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
|
/***************************************************************************
* Copyright (C) 2005 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. *
***************************************************************************/
#include "pic_config_editor.h"
#include <tqlayout.h>
#include <tqvgroupbox.h>
#include <tqapplication.h>
#include "pic_config_word_editor.h"
#include "common/common/misc.h"
#include "common/gui/misc_gui.h"
//----------------------------------------------------------------------------
Pic::MemoryConfigEditorWidget::MemoryConfigEditorWidget(Memory &memory, bool withWordEditor, TQWidget *tqparent)
: Device::MemoryEditorGroup(&memory, tqparent, "pic_config_editor_widget"),
MemoryCaster(MemoryRangeType::Config, memory)
{
TQHBoxLayout *hb = new TQHBoxLayout(_top);
TabWidget *tabw = 0;
uint nbWords = device().nbWords(MemoryRangeType::Config);
if ( nbWords>1 ) {
tabw = new TabWidget(this);
tabw->setIgnoreWheelEvent(true);
hb->addWidget(tabw);
}
for(uint i=0; i<nbWords; ++i) {
//qDebug("BinWordsEditor for config word #%i", i);
//uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i;
//qDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).tqmasks.count());
if ( device().config()._words[i].tqmasks.count()==0 ) continue;
TQWidget *page = 0;
if ( nbWords>1 ) {
page = new TQWidget(tabw);
tabw->addTab(page, device().config()._words[i].name);
} else {
page = new TQGroupBox(this);
hb->addWidget(page);
}
TQVBoxLayout *vbox = new TQVBoxLayout(page, 10, 10);
TQHBoxLayout *hbox = new TQHBoxLayout(vbox);
ConfigWordEditor *we = new ConfigWordEditor(memory, i, withWordEditor, page);
addEditor(we);
hbox->addWidget(we);
hbox->addStretch(1);
vbox->addStretch(1);
}
}
//----------------------------------------------------------------------------
Pic::MemoryConfigEditor::MemoryConfigEditor(const HexView *hexview, Memory &memory, TQWidget *tqparent)
: MemoryTypeEditor(hexview, MemoryRangeType::Config, memory, tqparent, "pic_config_editor")
{}
void Pic::MemoryConfigEditor::init(bool first)
{
MemoryTypeEditor::init(first);
MemoryConfigEditorWidget *w = new MemoryConfigEditorWidget(memory(), true, this);
addEditor(w);
_top->addWidget(w);
}
|