blob: 9300701c4ef62c229abfe60bcaf545819c328076 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/***************************************************************************
* Copyright (C) 2005-2007 Nicolas Hadacek <hadacek@kde.org> *
* Copyright (C) 2003 Alain Gibaud <alain.gibaud@free.fr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef HEX_EDITOR_H
#define HEX_EDITOR_H
#include <tdeparts/part.h>
#include "device_editor.h"
#include "devices/base/hex_buffer.h"
#include "devices/base/generic_memory.h"
//-----------------------------------------------------------------------------
class HexEditor;
class HexEditorPart : public KParts::ReadWritePart
{
TQ_OBJECT
public:
HexEditorPart(HexEditor *editor);
virtual void setReadWrite(bool readWrite);
private:
virtual bool openFile() { return true; }
virtual bool saveFile() { return true; }
};
//-----------------------------------------------------------------------------
class HexEditor : public DeviceEditor
{
TQ_OBJECT
public:
HexEditor(const TQString &name, TQWidget *parent);
HexEditor(TQWidget *parent);
virtual bool isModified() const { return _modified; }
virtual bool isReadOnly() const { return !_part->isReadWrite(); }
virtual ~HexEditor() { clear(); }
virtual PURL::FileType fileType() const { return PURL::Hex; }
virtual PURL::Url url() const { return _url; }
virtual bool save(const PURL::Url &url);
virtual bool open(const PURL::Url &url);
Device::Memory *memory() { return _memory; }
const Device::Memory *memory() const { return _memory; }
const Device::Memory *originalMemory() const { return _originalMemory; }
void memoryRead();
virtual void addGui();
virtual void removeGui();
virtual void setFocus() {}
virtual TQValueList<uint> bookmarkLines() const { return TQValueList<uint>(); }
virtual void setBookmarkLines(const TQValueList<uint> &) {}
public slots:
virtual void statusChanged();
private slots:
void slotModified();
bool simpleLoad();
private:
Device::Memory *_originalMemory, *_memory;
HexBuffer _hexBuffer;
bool _modified, _dirty;
HexEditorPart *_part;
PURL::Url _url;
virtual void dropEvent(TQDropEvent *e) { emit dropEventPass(e); }
bool save(const PURL::Url &url, const TQString &fileErrorString);
bool verifyDeviceType();
virtual TQWidget *createView(const Device::Data *data, TQWidget *parent);
virtual void setModifiedInternal(bool modified) { _modified = modified; }
virtual void setReadOnlyInternal(bool readOnly);
void display();
void init();
void clear();
};
#endif
|