summaryrefslogtreecommitdiffstats
path: root/src/devices/mem24/gui/mem24_memory_editor.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
commitf508189682b6fba62e08feeb1596f682bad5fff9 (patch)
tree28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/devices/mem24/gui/mem24_memory_editor.h
downloadpiklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz
piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/devices/mem24/gui/mem24_memory_editor.h')
-rw-r--r--src/devices/mem24/gui/mem24_memory_editor.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/devices/mem24/gui/mem24_memory_editor.h b/src/devices/mem24/gui/mem24_memory_editor.h
new file mode 100644
index 0000000..eb99e97
--- /dev/null
+++ b/src/devices/mem24/gui/mem24_memory_editor.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (C) 2006 Nicolas Hadacek <[email protected]> *
+ * *
+ * 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 MEM24_MEMORY_EDITOR_H
+#define MEM24_MEMORY_EDITOR_H
+
+#include "devices/gui/memory_editor.h"
+#include "devices/gui/hex_word_editor.h"
+#include "devices/mem24/mem24/mem24_memory.h"
+
+namespace Mem24
+{
+class HexView;
+
+//-----------------------------------------------------------------------------
+class MemoryCaster
+{
+public:
+ MemoryCaster(Memory &memory) : _memory(memory) {}
+ const Data &device() const { return static_cast<const Data &>(_memory.device()); }
+ const Memory &memory() const { return static_cast<Memory &>(_memory); }
+ Memory &memory() { return static_cast<Memory &>(_memory); }
+
+private:
+ Memory &_memory;
+};
+
+//-----------------------------------------------------------------------------
+class HexWordEditor : public Device::HexWordEditor, public MemoryCaster
+{
+Q_OBJECT
+public:
+ HexWordEditor(Memory &memory, QWidget *parent)
+ : Device::HexWordEditor(memory, 2, parent), MemoryCaster(memory) {}
+
+private:
+ virtual BitValue mask() const { return 0xFF; }
+ virtual BitValue normalizeWord(BitValue value) const { return value; }
+ virtual BitValue word() const { return memory().byte(_offset); }
+ virtual void setWord(BitValue value) { memory().setByte(_offset, value); }
+};
+
+//-----------------------------------------------------------------------------
+class MemoryRangeEditor : public Device::MemoryRangeEditor, public MemoryCaster
+{
+Q_OBJECT
+public:
+ MemoryRangeEditor(Memory &memory, QWidget *parent);
+
+private:
+ virtual uint nbWords() const { return device().nbBytes(); }
+ virtual uint addressIncrement() const { return 1; }
+ virtual Address startAddress() const { return 0x0; }
+ virtual Device::HexWordEditor *createHexWordEditor(QWidget *parent);
+ virtual bool isRangeReadOnly() const { return false; }
+};
+
+//-----------------------------------------------------------------------------
+class MemoryTypeEditor : public Device::MemoryTypeEditor, public MemoryCaster
+{
+Q_OBJECT
+public:
+ MemoryTypeEditor(const HexView *hexview, Memory &memory, QWidget *parent);
+ virtual void init(bool first);
+
+private:
+ virtual bool internalDoAction(Device::Action action);
+};
+
+} // namespace
+
+#endif