summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-09-17 06:28:25 +1000
committer Vas Crabb <vas@vastheman.com>2022-09-17 06:31:07 +1000
commitc25428f519d401634d2e7555cc5cc0908efb5b0d (patch)
tree870decebdc57c8c742a8059629225aa923034e53 /src/osd
parentb64b4ef8bbae5c5745740d0861393a2b37b0fd32 (diff)
Added a crude dark theme for the Win32 debugger.
Also made a start on weaning the Qt debugger off its weird configuation objects. It can now save more view state with less string comparisons on memory labels, but it can't restore all of it yet.
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/debugger/debugqt.cpp126
-rw-r--r--src/osd/modules/debugger/debugwin.cpp34
-rw-r--r--src/osd/modules/debugger/qt/breakpointswindow.cpp47
-rw-r--r--src/osd/modules/debugger/qt/breakpointswindow.h7
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.cpp49
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.h9
-rw-r--r--src/osd/modules/debugger/qt/debuggerview.cpp13
-rw-r--r--src/osd/modules/debugger/qt/debuggerview.h4
-rw-r--r--src/osd/modules/debugger/qt/deviceinformationwindow.cpp30
-rw-r--r--src/osd/modules/debugger/qt/deviceinformationwindow.h10
-rw-r--r--src/osd/modules/debugger/qt/deviceswindow.cpp20
-rw-r--r--src/osd/modules/debugger/qt/deviceswindow.h7
-rw-r--r--src/osd/modules/debugger/qt/logwindow.cpp19
-rw-r--r--src/osd/modules/debugger/qt/logwindow.h9
-rw-r--r--src/osd/modules/debugger/qt/mainwindow.cpp52
-rw-r--r--src/osd/modules/debugger/qt/mainwindow.h9
-rw-r--r--src/osd/modules/debugger/qt/memorywindow.cpp95
-rw-r--r--src/osd/modules/debugger/qt/memorywindow.h9
-rw-r--r--src/osd/modules/debugger/qt/windowqt.cpp33
-rw-r--r--src/osd/modules/debugger/qt/windowqt.h23
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.cpp127
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.h2
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.cpp22
-rw-r--r--src/osd/modules/debugger/win/debugwin.h3
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.cpp6
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.h5
-rw-r--r--src/osd/modules/debugger/win/uimetrics.cpp87
-rw-r--r--src/osd/modules/debugger/win/uimetrics.h35
-rw-r--r--src/osd/modules/debugger/xmlconfig.cpp5
-rw-r--r--src/osd/modules/debugger/xmlconfig.h5
30 files changed, 509 insertions, 393 deletions
diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp
index dbc638d354a..cb09b08f0dc 100644
--- a/src/osd/modules/debugger/debugqt.cpp
+++ b/src/osd/modules/debugger/debugqt.cpp
@@ -56,8 +56,13 @@ public:
#if defined(_WIN32) && !defined(SDLMAME_WIN32)
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE;
#endif
+
private:
+ void configuration_save(config_type which_type, util::xml::data_node *parentnode);
+ void gather_save_configurations();
+
running_machine *m_machine;
+ util::xml::file::ptr m_config;
};
@@ -94,16 +99,15 @@ void xml_configuration_load(running_machine &machine, config_type cfg_type, conf
util::xml::data_node const *wnode = nullptr;
for (wnode = parentnode->get_child(osd::debugger::NODE_WINDOW); wnode; wnode = wnode->get_next_sibling(osd::debugger::NODE_WINDOW))
{
- WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)wnode->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, WindowQtConfig::WIN_TYPE_UNKNOWN);
- switch (type)
+ switch (wnode->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, -1))
{
- case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(std::make_unique<MainWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(std::make_unique<MemoryWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(std::make_unique<DasmWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(std::make_unique<LogWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(std::make_unique<BreakpointsWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_DEVICES: xmlConfigurations.push_back(std::make_unique<DevicesWindowQtConfig>()); break;
- case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION: xmlConfigurations.push_back(std::make_unique<DeviceInformationWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_CONSOLE: xmlConfigurations.push_back(std::make_unique<MainWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_MEMORY_VIEWER: xmlConfigurations.push_back(std::make_unique<MemoryWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER: xmlConfigurations.push_back(std::make_unique<DasmWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER: xmlConfigurations.push_back(std::make_unique<LogWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_POINTS_VIEWER: xmlConfigurations.push_back(std::make_unique<BreakpointsWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_DEVICES_VIEWER: xmlConfigurations.push_back(std::make_unique<DevicesWindowQtConfig>()); break;
+ case osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER: xmlConfigurations.push_back(std::make_unique<DeviceInformationWindowQtConfig>()); break;
default: continue;
}
xmlConfigurations.back()->recoverFromXmlNode(*wnode);
@@ -111,60 +115,6 @@ void xml_configuration_load(running_machine &machine, config_type cfg_type, conf
}
-void xml_configuration_save(running_machine &machine, config_type cfg_type, util::xml::data_node *parentnode)
-{
- // We only save system configuration
- if (cfg_type != config_type::SYSTEM)
- return;
-
- for (int i = 0; i < xmlConfigurations.size(); i++)
- {
- WindowQtConfig &config = *xmlConfigurations[i];
-
- // Create an xml node
- util::xml::data_node *const debugger_node = parentnode->add_child(osd::debugger::NODE_WINDOW, nullptr);
-
- // Insert the appropriate information
- if (debugger_node)
- config.addToXmlDataNode(*debugger_node);
- }
-}
-
-
-void gather_save_configurations()
-{
- xmlConfigurations.clear();
-
- // Loop over all the open windows
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- {
- if (!widget->isVisible())
- continue;
-
- if (!widget->isWindow() || widget->windowType() != Qt::Window)
- continue;
-
- // Figure out its type
- if (dynamic_cast<MainWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<MainWindowQtConfig>());
- else if (dynamic_cast<MemoryWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<MemoryWindowQtConfig>());
- else if (dynamic_cast<DasmWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<DasmWindowQtConfig>());
- else if (dynamic_cast<LogWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<LogWindowQtConfig>());
- else if (dynamic_cast<BreakpointsWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<BreakpointsWindowQtConfig>());
- else if (dynamic_cast<DevicesWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<DevicesWindowQtConfig>());
- else if (dynamic_cast<DeviceInformationWindow *>(widget))
- xmlConfigurations.push_back(std::make_unique<DeviceInformationWindowQtConfig>());
-
- xmlConfigurations.back()->buildFromQWidget(widget);
- }
-}
-
-
//============================================================
// Utilities
//============================================================
@@ -174,7 +124,7 @@ void load_and_clear_main_window_config(std::vector<std::unique_ptr<WindowQtConfi
for (int i = 0; i < configList.size(); i++)
{
WindowQtConfig &config = *configList[i];
- if (config.m_type == WindowQtConfig::WIN_TYPE_MAIN)
+ if (config.m_type == osd::debugger::WINDOW_TYPE_CONSOLE)
{
config.applyToQWidget(mainQtWindow);
configList.erase(configList.begin() + i);
@@ -193,17 +143,17 @@ void setup_additional_startup_windows(running_machine &machine, std::vector<std:
WindowQt *foo = nullptr;
switch (config.m_type)
{
- case WindowQtConfig::WIN_TYPE_MEMORY:
+ case osd::debugger::WINDOW_TYPE_MEMORY_VIEWER:
foo = new MemoryWindow(machine); break;
- case WindowQtConfig::WIN_TYPE_DASM:
+ case osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER:
foo = new DasmWindow(machine); break;
- case WindowQtConfig::WIN_TYPE_LOG:
+ case osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER:
foo = new LogWindow(machine); break;
- case WindowQtConfig::WIN_TYPE_BREAK_POINTS:
+ case osd::debugger::WINDOW_TYPE_POINTS_VIEWER:
foo = new BreakpointsWindow(machine); break;
- case WindowQtConfig::WIN_TYPE_DEVICES:
+ case osd::debugger::WINDOW_TYPE_DEVICES_VIEWER:
foo = new DevicesWindow(machine); break;
- case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION:
+ case osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER:
foo = new DeviceInformationWindow(machine); break;
default:
break;
@@ -266,10 +216,11 @@ void debug_qt::init_debugger(running_machine &machine)
}
m_machine = &machine;
+
// Setup the configuration XML saving and loading
machine.configuration().config_register("debugger",
configuration_manager::load_delegate(&xml_configuration_load, &machine),
- configuration_manager::save_delegate(&xml_configuration_save, &machine));
+ configuration_manager::save_delegate(&debug_qt::configuration_save, this));
}
@@ -346,6 +297,7 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
// all the QT windows are already gone.
gather_save_configurations();
}
+
#if defined(_WIN32) && !defined(SDLMAME_WIN32)
winwindow_update_cursor_state(*m_machine); // make sure the cursor isn't hidden while in debugger
#endif
@@ -361,6 +313,38 @@ void debug_qt::debugger_update()
qApp->processEvents(QEventLoop::AllEvents, 1);
}
+
+void debug_qt::configuration_save(config_type which_type, util::xml::data_node *parentnode)
+{
+ // We only save system configuration for now
+ if ((config_type::SYSTEM == which_type) && parentnode && m_config)
+ {
+ for (util::xml::data_node const *node = m_config->get_first_child(); node; node = node->get_next_sibling())
+ node->copy_into(*parentnode);
+ m_config.reset();
+ }
+}
+
+
+void debug_qt::gather_save_configurations()
+{
+ m_config = util::xml::file::create();
+
+ // Loop over all the open windows
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ {
+ if (!widget->isVisible())
+ continue;
+
+ if (!widget->isWindow() || widget->windowType() != Qt::Window)
+ continue;
+
+ WindowQt *const win = dynamic_cast<WindowQt *>(widget);
+ if (win)
+ win->saveConfiguration(*m_config);
+ }
+}
+
#else // USE_QTDEBUG
MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt")
diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp
index 19e95b0313e..d5a8d291658 100644
--- a/src/osd/modules/debugger/debugwin.cpp
+++ b/src/osd/modules/debugger/debugwin.cpp
@@ -43,7 +43,9 @@ public:
m_metrics(),
m_waiting_for_debugger(false),
m_window_list(),
- m_main_console(nullptr)
+ m_main_console(nullptr),
+ m_config(),
+ m_save_windows(true)
{
}
@@ -60,6 +62,9 @@ protected:
virtual running_machine &machine() const override { return *m_machine; }
virtual ui_metrics &metrics() const override { return *m_metrics; }
+ virtual void set_color_theme(int index) override;
+ virtual bool get_save_window_arrangement() const override { return m_save_windows; }
+ virtual void set_save_window_arrangement(bool save) override { m_save_windows = save; }
virtual bool const &waiting_for_debugger() const override { return m_waiting_for_debugger; }
virtual bool seq_pressed() const override;
@@ -88,6 +93,7 @@ private:
consolewin_info *m_main_console;
util::xml::file::ptr m_config;
+ bool m_save_windows;
};
@@ -191,6 +197,14 @@ void debugger_windows::debugger_update()
}
+void debugger_windows::set_color_theme(int index)
+{
+ m_metrics->set_color_theme(index);
+ for (auto const &window : m_window_list)
+ window->redraw();
+}
+
+
bool debugger_windows::seq_pressed() const
{
input_seq const &seq = m_machine->ioport().type_seq(IPT_UI_DEBUG_BREAK);
@@ -286,7 +300,14 @@ void debugger_windows::config_load(config_type cfgtype, config_level cfglevel, u
{
if (parentnode)
{
- if (config_type::SYSTEM == cfgtype)
+ if (config_type::DEFAULT == cfgtype)
+ {
+ m_save_windows = 0 != parentnode->get_attribute_int(osd::debugger::ATTR_DEBUGGER_SAVE_WINDOWS, m_save_windows ? 1 : 0);
+ util::xml::data_node const *const colors = parentnode->get_child(osd::debugger::NODE_COLORS);
+ if (colors)
+ m_metrics->set_color_theme(colors->get_attribute_int(osd::debugger::ATTR_COLORS_THEME, m_metrics->get_color_theme()));
+ }
+ else if (config_type::SYSTEM == cfgtype)
{
if (m_main_console)
{
@@ -305,7 +326,14 @@ void debugger_windows::config_load(config_type cfgtype, config_level cfglevel, u
void debugger_windows::config_save(config_type cfgtype, util::xml::data_node *parentnode)
{
- if (config_type::SYSTEM == cfgtype)
+ if (config_type::DEFAULT == cfgtype)
+ {
+ parentnode->set_attribute_int(osd::debugger::ATTR_DEBUGGER_SAVE_WINDOWS, m_save_windows ? 1 : 0);
+ util::xml::data_node *const colors = parentnode->add_child(osd::debugger::NODE_COLORS, nullptr);
+ if (colors)
+ colors->set_attribute_int(osd::debugger::ATTR_COLORS_THEME, m_metrics->get_color_theme());
+ }
+ else if (m_save_windows && (config_type::SYSTEM == cfgtype))
{
for (auto &info : m_window_list)
info->save_configuration(*parentnode);
diff --git a/src/osd/modules/debugger/qt/breakpointswindow.cpp b/src/osd/modules/debugger/qt/breakpointswindow.cpp
index 3b71e22690d..5af92edb917 100644
--- a/src/osd/modules/debugger/qt/breakpointswindow.cpp
+++ b/src/osd/modules/debugger/qt/breakpointswindow.cpp
@@ -81,6 +81,31 @@ BreakpointsWindow::~BreakpointsWindow()
}
+void BreakpointsWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_POINTS_VIEWER);
+ if (m_breakpointsView)
+ {
+ switch (m_breakpointsView->view()->type())
+ {
+ case DVT_BREAK_POINTS:
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 0);
+ break;
+ case DVT_WATCH_POINTS:
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 1);
+ break;
+ case DVT_REGISTER_POINTS:
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 2);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
void BreakpointsWindow::typeChanged(QAction* changedTo)
{
// Clean
@@ -114,21 +139,6 @@ void BreakpointsWindow::typeChanged(QAction* changedTo)
//=========================================================================
// BreakpointsWindowQtConfig
//=========================================================================
-void BreakpointsWindowQtConfig::buildFromQWidget(QWidget *widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- BreakpointsWindow *window = dynamic_cast<BreakpointsWindow *>(widget);
-
- QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
- if (typeGroup->checkedAction()->text() == "Breakpoints")
- m_bwType = 0;
- else if (typeGroup->checkedAction()->text() == "Watchpoints")
- m_bwType = 1;
- else if (typeGroup->checkedAction()->text() == "Registerpoints")
- m_bwType = 2;
-}
-
-
void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
{
WindowQtConfig::applyToQWidget(widget);
@@ -139,13 +149,6 @@ void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
}
-void BreakpointsWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, m_bwType);
-}
-
-
void BreakpointsWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/breakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h
index fab5ea149e9..a66389a1a5a 100644
--- a/src/osd/modules/debugger/qt/breakpointswindow.h
+++ b/src/osd/modules/debugger/qt/breakpointswindow.h
@@ -18,6 +18,9 @@ public:
BreakpointsWindow(running_machine &machine, QWidget *parent = nullptr);
virtual ~BreakpointsWindow();
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
private slots:
void typeChanged(QAction *changedTo);
@@ -34,7 +37,7 @@ class BreakpointsWindowQtConfig : public WindowQtConfig
{
public:
BreakpointsWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_BREAK_POINTS),
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_POINTS_VIEWER),
m_bwType(0)
{
}
@@ -44,9 +47,7 @@ public:
// Settings
int m_bwType;
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp
index d46ceb2d767..79167169c1b 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.cpp
+++ b/src/osd/modules/debugger/qt/dasmwindow.cpp
@@ -51,7 +51,7 @@ DasmWindow::DasmWindow(running_machine &machine, QWidget *parent) :
connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated);
// Force a recompute of the disassembly region
- downcast<debug_view_disasm *>(m_dasmView->view())->set_expression("curpc");
+ m_dasmView->view<debug_view_disasm>()->set_expression("curpc");
// Populate the combo box & set the proper CPU
populateComboBox();
@@ -119,6 +119,19 @@ DasmWindow::~DasmWindow()
}
+void DasmWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER);
+
+ debug_view_disasm &dasmview = *m_dasmView->view<debug_view_disasm>();
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_dasmView->sourceIndex());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column());
+ node.add_child(osd::debugger::NODE_WINDOW_EXPRESSION, dasmview.expression());
+}
+
+
void DasmWindow::cpuChanged(int index)
{
if (index < m_dasmView->view()->source_count())
@@ -132,7 +145,7 @@ void DasmWindow::cpuChanged(int index)
void DasmWindow::expressionSubmitted()
{
const QString expression = m_inputEdit->text();
- downcast<debug_view_disasm *>(m_dasmView->view())->set_expression(expression.toLocal8Bit().data());
+ m_dasmView->view<debug_view_disasm>()->set_expression(expression.toLocal8Bit().data());
m_dasmView->viewport()->update();
}
@@ -141,7 +154,7 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
{
if (m_dasmView->view()->cursor_visible())
{
- offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
+ offs_t const address = m_dasmView->view<debug_view_disasm>()->selected_address();
device_t *const device = m_dasmView->view()->source()->device();
device_debug *const cpuinfo = device->debug();
@@ -172,7 +185,7 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo)
{
if (m_dasmView->view()->cursor_visible())
{
- offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
+ offs_t const address = m_dasmView->view<debug_view_disasm>()->selected_address();
device_t *const device = m_dasmView->view()->source()->device();
device_debug *const cpuinfo = device->debug();
@@ -196,7 +209,7 @@ void DasmWindow::runToCursor(bool changedTo)
{
if (m_dasmView->view()->cursor_visible())
{
- offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
+ offs_t const address = m_dasmView->view<debug_view_disasm>()->selected_address();
m_dasmView->view()->source()->device()->debug()->go(address);
}
}
@@ -204,7 +217,7 @@ void DasmWindow::runToCursor(bool changedTo)
void DasmWindow::rightBarChanged(QAction* changedTo)
{
- debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmView->view());
+ debug_view_disasm* dasmView = m_dasmView->view<debug_view_disasm>();
if (changedTo->text() == "Raw Opcodes")
{
dasmView->set_right_column(DASM_RIGHTCOL_RAW);
@@ -228,7 +241,7 @@ void DasmWindow::dasmViewUpdated()
bool breakpointEnabled = false;
if (haveCursor)
{
- offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
+ offs_t const address = m_dasmView->view<debug_view_disasm>()->selected_address();
device_t *const device = m_dasmView->view()->source()->device();
device_debug *const cpuinfo = device->debug();
@@ -281,21 +294,6 @@ void DasmWindow::setToCurrentCpu()
//=========================================================================
// DasmWindowQtConfig
//=========================================================================
-void DasmWindowQtConfig::buildFromQWidget(QWidget *widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- DasmWindow *window = dynamic_cast<DasmWindow *>(widget);
- QComboBox *cpu = window->findChild<QComboBox *>("cpu");
- m_cpu = cpu->currentIndex();
-
- QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup");
- if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
- m_rightBar = DASM_RIGHTCOL_RAW;
- else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
- m_rightBar = DASM_RIGHTCOL_ENCRYPTED;
- else if (rightBarGroup->checkedAction()->text() == "Comments")
- m_rightBar = DASM_RIGHTCOL_COMMENTS;
-}
void DasmWindowQtConfig::applyToQWidget(QWidget *widget)
{
@@ -311,13 +309,6 @@ void DasmWindowQtConfig::applyToQWidget(QWidget *widget)
}
}
-void DasmWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_cpu);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
-}
-
void DasmWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h
index fc4ce11d731..c746fd42df7 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.h
+++ b/src/osd/modules/debugger/qt/dasmwindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_DASMWINDOW_H
#define MAME_DEBUGGER_QT_DASMWINDOW_H
+#pragma once
+
#include "debuggerview.h"
#include "windowqt.h"
@@ -21,6 +23,9 @@ public:
DasmWindow(running_machine &machine, QWidget *parent = nullptr);
virtual ~DasmWindow();
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
private slots:
void cpuChanged(int index);
void expressionSubmitted();
@@ -55,7 +60,7 @@ class DasmWindowQtConfig : public WindowQtConfig
{
public:
DasmWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_DASM),
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER),
m_cpu(0),
m_rightBar(0)
{
@@ -67,9 +72,7 @@ public:
int m_cpu;
int m_rightBar;
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp
index a1c8bcf2aec..454b0552795 100644
--- a/src/osd/modules/debugger/qt/debuggerview.cpp
+++ b/src/osd/modules/debugger/qt/debuggerview.cpp
@@ -51,6 +51,19 @@ DebuggerView::~DebuggerView()
m_machine.debug_view().free_view(*m_view);
}
+
+int DebuggerView::sourceIndex() const
+{
+ if (m_view)
+ {
+ debug_view_source const *const source = m_view->source();
+ if (source)
+ return m_view->source_index(*source);
+ }
+ return -1;
+}
+
+
void DebuggerView::paintEvent(QPaintEvent *event)
{
// Tell the MAME debug view how much real estate is available
diff --git a/src/osd/modules/debugger/qt/debuggerview.h b/src/osd/modules/debugger/qt/debuggerview.h
index a38b3b11152..46a3328841f 100644
--- a/src/osd/modules/debugger/qt/debuggerview.h
+++ b/src/osd/modules/debugger/qt/debuggerview.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_DEBUGGERVIEW_H
#define MAME_DEBUGGER_QT_DEBUGGERVIEW_H
+#pragma once
+
#include "debug/debugvw.h"
#include <QtWidgets/QAbstractScrollArea>
@@ -22,6 +24,8 @@ public:
// Setters and accessors
void setPreferBottom(bool pb) { m_preferBottom = pb; }
debug_view *view() { return m_view; }
+ template <typename T> T *view() { return downcast<T *>(m_view); }
+ int sourceIndex() const;
signals:
void updated();
diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp
index 29b30f927d4..f50ae801dd1 100644
--- a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp
+++ b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp
@@ -29,6 +29,17 @@ DeviceInformationWindow::~DeviceInformationWindow()
{
}
+
+void DeviceInformationWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER);
+
+ node.set_attribute(osd::debugger::ATTR_WINDOW_DEVICE_TAG, m_device->tag());
+}
+
+
void DeviceInformationWindow::fill_device_information()
{
setWindowTitle(util::string_format("Debug: Device %s", m_device->tag()).c_str());
@@ -101,22 +112,10 @@ void DeviceInformationWindow::set_device(const char *tag)
fill_device_information();
}
-const char *DeviceInformationWindow::device_tag() const
-{
- return m_device->tag();
-}
-
//=========================================================================
// DeviceInformationWindowQtConfig
//=========================================================================
-void DeviceInformationWindowQtConfig::buildFromQWidget(QWidget *widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- DeviceInformationWindow *window = dynamic_cast<DeviceInformationWindow *>(widget);
- m_device_tag = window->device_tag();
-}
-
void DeviceInformationWindowQtConfig::applyToQWidget(QWidget *widget)
{
@@ -126,13 +125,6 @@ void DeviceInformationWindowQtConfig::applyToQWidget(QWidget *widget)
}
-void DeviceInformationWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute(osd::debugger::ATTR_WINDOW_DEVICE_TAG, m_device_tag.c_str());
-}
-
-
void DeviceInformationWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h
index c7bfa68527d..a8ae4c07c02 100644
--- a/src/osd/modules/debugger/qt/deviceinformationwindow.h
+++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_DEVICEINFORMATIONWINDOW_H
#define MAME_DEBUGGER_QT_DEVICEINFORMATIONWINDOW_H
+#pragma once
+
#include "windowqt.h"
//============================================================
@@ -17,7 +19,9 @@ public:
virtual ~DeviceInformationWindow();
void set_device(const char *tag);
- const char *device_tag() const;
+
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
private:
device_t *m_device;
@@ -37,15 +41,13 @@ public:
std::string m_device_tag;
DeviceInformationWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION)
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER)
{
}
~DeviceInformationWindowQtConfig() {}
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/deviceswindow.cpp b/src/osd/modules/debugger/qt/deviceswindow.cpp
index 51ad0ecc8c2..c74a7408249 100644
--- a/src/osd/modules/debugger/qt/deviceswindow.cpp
+++ b/src/osd/modules/debugger/qt/deviceswindow.cpp
@@ -156,16 +156,18 @@ void DevicesWindow::activated(const QModelIndex &index)
}
+void DevicesWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DEVICES_VIEWER);
+}
+
+
//=========================================================================
// DevicesWindowQtConfig
//=========================================================================
-void DevicesWindowQtConfig::buildFromQWidget(QWidget *widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- // DevicesWindow *window = dynamic_cast<DevicesWindow *>(widget);
-}
-
void DevicesWindowQtConfig::applyToQWidget(QWidget *widget)
{
@@ -174,12 +176,6 @@ void DevicesWindowQtConfig::applyToQWidget(QWidget *widget)
}
-void DevicesWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
-}
-
-
void DevicesWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/deviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h
index 884ad87d421..0ad457fbb61 100644
--- a/src/osd/modules/debugger/qt/deviceswindow.h
+++ b/src/osd/modules/debugger/qt/deviceswindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_DEVICESWINDOW_H
#define MAME_DEBUGGER_QT_DEVICESWINDOW_H
+#pragma once
+
#include "windowqt.h"
#include <QtWidgets/QTreeView>
@@ -47,6 +49,9 @@ public slots:
void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void activated(const QModelIndex &index);
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
private:
QTreeView *m_devices_view;
DevicesWindowModel m_devices_model;
@@ -63,7 +68,7 @@ class DevicesWindowQtConfig : public WindowQtConfig
{
public:
DevicesWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_DEVICES)
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_DEVICES_VIEWER)
{
}
diff --git a/src/osd/modules/debugger/qt/logwindow.cpp b/src/osd/modules/debugger/qt/logwindow.cpp
index 838ae29de02..b6cd65f7a4b 100644
--- a/src/osd/modules/debugger/qt/logwindow.cpp
+++ b/src/osd/modules/debugger/qt/logwindow.cpp
@@ -46,27 +46,24 @@ LogWindow::~LogWindow()
}
-//=========================================================================
-// LogWindowQtConfig
-//=========================================================================
-void LogWindowQtConfig::buildFromQWidget(QWidget *widget)
+void LogWindow::saveConfigurationToNode(util::xml::data_node &node)
{
- WindowQtConfig::buildFromQWidget(widget);
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER);
}
+//=========================================================================
+// LogWindowQtConfig
+//=========================================================================
+
void LogWindowQtConfig::applyToQWidget(QWidget *widget)
{
WindowQtConfig::applyToQWidget(widget);
}
-void LogWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
-}
-
-
void LogWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/logwindow.h b/src/osd/modules/debugger/qt/logwindow.h
index 05d4d15514f..02509d2d95d 100644
--- a/src/osd/modules/debugger/qt/logwindow.h
+++ b/src/osd/modules/debugger/qt/logwindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_LOGWINDOW_H
#define MAME_DEBUGGER_QT_LOGWINDOW_H
+#pragma once
+
#include "debuggerview.h"
#include "windowqt.h"
@@ -18,6 +20,9 @@ public:
LogWindow(running_machine &machine, QWidget *parent = nullptr);
virtual ~LogWindow();
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
private:
// Widgets
DebuggerView *m_logView;
@@ -31,15 +36,13 @@ class LogWindowQtConfig : public WindowQtConfig
{
public:
LogWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_LOG)
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER)
{
}
~LogWindowQtConfig() {}
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp
index ec7bafee33c..974d3632ffc 100644
--- a/src/osd/modules/debugger/qt/mainwindow.cpp
+++ b/src/osd/modules/debugger/qt/mainwindow.cpp
@@ -148,6 +148,18 @@ void MainWindow::setProcessor(device_t *processor)
}
+void MainWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_CONSOLE);
+
+ debug_view_disasm &dasmview = *m_dasmFrame->view()->view<debug_view_disasm>();
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column());
+ node.set_attribute("qtwindowstate", saveState().toPercentEncoding().data());
+}
+
+
// Used to intercept the user clicking 'X' in the upper corner
void MainWindow::closeEvent(QCloseEvent *event)
{
@@ -207,10 +219,10 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
void MainWindow::toggleBreakpointAtCursor(bool changedTo)
{
- debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
+ debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>();
if (dasmView->cursor_visible() && (m_machine.debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
- offs_t const address = downcast<debug_view_disasm *>(dasmView)->selected_address();
+ offs_t const address = dasmView->selected_address();
device_debug *const cpuinfo = dasmView->source()->device()->debug();
// Find an existing breakpoint at this address
@@ -231,7 +243,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo)
void MainWindow::enableBreakpointAtCursor(bool changedTo)
{
- debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
+ debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>();
if (dasmView->cursor_visible() && (m_machine.debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
offs_t const address = dasmView->selected_address();
@@ -254,10 +266,10 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo)
void MainWindow::runToCursor(bool changedTo)
{
- debug_view_disasm *dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
+ debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>();
if (dasmView->cursor_visible() && (m_machine.debugger().console().get_visible_cpu() == dasmView->source()->device()))
{
- offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
+ offs_t address = dasmView->selected_address();
std::string command = string_format("go 0x%X", address);
m_machine.debugger().console().execute_command(command, true);
}
@@ -266,7 +278,7 @@ void MainWindow::runToCursor(bool changedTo)
void MainWindow::rightBarChanged(QAction *changedTo)
{
- debug_view_disasm *dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
+ debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>();
if (changedTo->text() == "Raw Opcodes")
dasmView->set_right_column(DASM_RIGHTCOL_RAW);
@@ -382,7 +394,7 @@ void MainWindow::unmountImage(bool changedTo)
void MainWindow::dasmViewUpdated()
{
- debug_view_disasm *const dasmView = downcast<debug_view_disasm *>(m_dasmFrame->view()->view());
+ debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>();
bool const haveCursor = dasmView->cursor_visible() && (m_machine.debugger().console().get_visible_cpu() == dasmView->source()->device());
bool haveBreakpoint = false;
bool breakpointEnabled = false;
@@ -471,22 +483,6 @@ void MainWindow::createImagesMenu()
//=========================================================================
// MainWindowQtConfig
//=========================================================================
-void MainWindowQtConfig::buildFromQWidget(QWidget* widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- MainWindow *window = dynamic_cast<MainWindow *>(widget);
- m_windowState = window->saveState();
-
- QActionGroup *rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
- if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
- m_rightBar = 0;
- else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
- m_rightBar = 1;
- else if (rightBarGroup->checkedAction()->text() == "Comments")
- m_rightBar = 2;
-}
-
-
void MainWindowQtConfig::applyToQWidget(QWidget *widget)
{
WindowQtConfig::applyToQWidget(widget);
@@ -494,15 +490,7 @@ void MainWindowQtConfig::applyToQWidget(QWidget *widget)
window->restoreState(m_windowState);
QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
- rightBarGroup->actions()[m_rightBar]->trigger();
-}
-
-
-void MainWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
- node.set_attribute("qtwindowstate", m_windowState.toPercentEncoding().data());
+ rightBarGroup->actions()[m_rightBar - 1]->trigger();
}
diff --git a/src/osd/modules/debugger/qt/mainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h
index 6c1e9baefcb..74f7b84b208 100644
--- a/src/osd/modules/debugger/qt/mainwindow.h
+++ b/src/osd/modules/debugger/qt/mainwindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_MAINWINDOW_H
#define MAME_DEBUGGER_QT_MAINWINDOW_H
+#pragma once
+
#include "debuggerview.h"
#include "windowqt.h"
@@ -32,8 +34,9 @@ public:
void setProcessor(device_t *processor);
-
protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
// Used to intercept the user clicking 'X' in the upper corner
void closeEvent(QCloseEvent *event);
@@ -157,7 +160,7 @@ class MainWindowQtConfig : public WindowQtConfig
{
public:
MainWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_MAIN),
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_CONSOLE),
m_rightBar(0),
m_windowState()
{}
@@ -168,9 +171,7 @@ public:
int m_rightBar;
QByteArray m_windowState;
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp
index 8373a56ec3f..2360cda0458 100644
--- a/src/osd/modules/debugger/qt/memorywindow.cpp
+++ b/src/osd/modules/debugger/qt/memorywindow.cpp
@@ -214,6 +214,23 @@ MemoryWindow::~MemoryWindow()
}
+void MemoryWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_MEMORY_VIEWER);
+
+ debug_view_memory &memView = *m_memTable->view<debug_view_memory>();
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_memTable->sourceIndex());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, memView.reverse() ? 1 : 0);
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, memView.physical() ? 1 : 0);
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, memView.address_radix());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, int(memView.get_data_format()));
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ROW_CHUNKS, memView.chunks_per_row());
+ node.add_child(osd::debugger::NODE_WINDOW_EXPRESSION, memView.expression());
+}
+
+
void MemoryWindow::memoryRegionChanged(int index)
{
if (index < m_memTable->view()->source_count())
@@ -222,7 +239,7 @@ void MemoryWindow::memoryRegionChanged(int index)
m_memTable->viewport()->update();
// Update the data format radio buttons to the memory region's default
- debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view());
+ debug_view_memory *memView = m_memTable->view<debug_view_memory>();
switch (memView->get_data_format())
{
case debug_view_memory::data_format::HEX_8BIT: dataFormatMenuItem("formatActOne")->setChecked(true); break;
@@ -252,7 +269,7 @@ void MemoryWindow::memoryRegionChanged(int index)
void MemoryWindow::expressionSubmitted()
{
const QString expression = m_inputEdit->text();
- downcast<debug_view_memory *>(m_memTable->view())->set_expression(expression.toLocal8Bit().data());
+ m_memTable->view<debug_view_memory>()->set_expression(expression.toLocal8Bit().data());
// Make the cursor pop
m_memTable->view()->set_cursor_visible(true);
@@ -269,7 +286,7 @@ void MemoryWindow::expressionSubmitted()
void MemoryWindow::formatChanged(QAction* changedTo)
{
- debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
if (changedTo->text() == "1-byte hexadecimal")
memView->set_data_format(debug_view_memory::data_format::HEX_8BIT);
@@ -300,7 +317,7 @@ void MemoryWindow::formatChanged(QAction* changedTo)
void MemoryWindow::addressChanged(QAction* changedTo)
{
- debug_view_memory *memView = downcast<debug_view_memory *>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
if (changedTo->text() == "Logical Addresses")
memView->set_physical(false);
@@ -313,7 +330,7 @@ void MemoryWindow::addressChanged(QAction* changedTo)
void MemoryWindow::radixChanged(QAction* changedTo)
{
- debug_view_memory *memView = downcast<debug_view_memory *>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
if (changedTo->text() == "Hexadecimal Addresses")
memView->set_address_radix(16);
@@ -328,7 +345,7 @@ void MemoryWindow::radixChanged(QAction* changedTo)
void MemoryWindow::reverseChanged(bool changedTo)
{
- debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
memView->set_reverse(changedTo);
m_memTable->viewport()->update();
}
@@ -336,7 +353,7 @@ void MemoryWindow::reverseChanged(bool changedTo)
void MemoryWindow::increaseBytesPerLine(bool changedTo)
{
- debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
memView->set_chunks_per_row(memView->chunks_per_row() + 1);
m_memTable->viewport()->update();
}
@@ -344,7 +361,7 @@ void MemoryWindow::increaseBytesPerLine(bool changedTo)
void MemoryWindow::decreaseBytesPerLine(bool checked)
{
- debug_view_memory *memView = downcast<debug_view_memory *>(m_memTable->view());
+ debug_view_memory *const memView = m_memTable->view<debug_view_memory>();
memView->set_chunks_per_row(memView->chunks_per_row() - 1);
m_memTable->viewport()->update();
}
@@ -404,7 +421,7 @@ void DebuggerMemView::addItemsToContextMenu(QMenu *menu)
if (view()->cursor_visible())
{
- debug_view_memory &memView = downcast<debug_view_memory &>(*view());
+ debug_view_memory &memView = *view<debug_view_memory>();
debug_view_memory_source const &source = downcast<debug_view_memory_source const &>(*memView.source());
address_space *const addressSpace = source.space();
if (addressSpace)
@@ -468,55 +485,6 @@ void DebuggerMemView::copyLastPc()
//=========================================================================
// MemoryWindowQtConfig
//=========================================================================
-void MemoryWindowQtConfig::buildFromQWidget(QWidget *widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- MemoryWindow *window = dynamic_cast<MemoryWindow *>(widget);
- QComboBox *memoryRegion = window->findChild<QComboBox*>("memoryregion");
- m_memoryRegion = memoryRegion->currentIndex();
-
- QAction *reverse = window->findChild<QAction *>("reverse");
- m_reverse = reverse->isChecked();
-
- QActionGroup *addressGroup = window->findChild<QActionGroup*>("addressgroup");
- if (addressGroup->checkedAction()->text() == "Logical Addresses")
- m_addressMode = 0;
- else if (addressGroup->checkedAction()->text() == "Physical Addresses")
- m_addressMode = 1;
-
- QActionGroup *radixGroup = window->findChild<QActionGroup*>("radixgroup");
- if (radixGroup->checkedAction()->text() == "Hexadecimal Addresses")
- m_addressRadix = 16;
- else if (radixGroup->checkedAction()->text() == "Decimal Addresses")
- m_addressRadix = 10;
- else if (radixGroup->checkedAction()->text() == "Octal Addresses")
- m_addressRadix = 8;
-
- QActionGroup *dataFormat = window->findChild<QActionGroup*>("dataformat");
- if (dataFormat->checkedAction()->text() == "1-byte Chunks (Hex)")
- m_dataFormat = int(debug_view_memory::data_format::HEX_8BIT);
- else if (dataFormat->checkedAction()->text() == "2-byte Chunks (Hex)")
- m_dataFormat = int(debug_view_memory::data_format::HEX_16BIT);
- else if (dataFormat->checkedAction()->text() == "4-byte Chunks (Hex)")
- m_dataFormat = int(debug_view_memory::data_format::HEX_32BIT);
- else if (dataFormat->checkedAction()->text() == "8-byte Chunks (Hex)")
- m_dataFormat = int(debug_view_memory::data_format::HEX_64BIT);
- else if (dataFormat->checkedAction()->text() == "1-byte Chunks (Octal)")
- m_dataFormat = int(debug_view_memory::data_format::OCTAL_8BIT);
- else if (dataFormat->checkedAction()->text() == "2-byte Chunks (Octal)")
- m_dataFormat = int(debug_view_memory::data_format::OCTAL_16BIT);
- else if (dataFormat->checkedAction()->text() == "4-byte Chunks (Octal)")
- m_dataFormat = int(debug_view_memory::data_format::OCTAL_32BIT);
- else if (dataFormat->checkedAction()->text() == "8-byte Chunks (Octal)")
- m_dataFormat = int(debug_view_memory::data_format::OCTAL_64BIT);
- else if (dataFormat->checkedAction()->text() == "32-bit floating point")
- m_dataFormat = int(debug_view_memory::data_format::FLOAT_32BIT);
- else if (dataFormat->checkedAction()->text() == "64-bit Floating Point")
- m_dataFormat = int(debug_view_memory::data_format::FLOAT_64BIT);
- else if (dataFormat->checkedAction()->text() == "80-bit Floating Point")
- m_dataFormat = int(debug_view_memory::data_format::FLOAT_80BIT);
-}
-
void MemoryWindowQtConfig::applyToQWidget(QWidget *widget)
{
@@ -560,17 +528,6 @@ void MemoryWindowQtConfig::applyToQWidget(QWidget *widget)
}
-void MemoryWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_memoryRegion);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, m_reverse);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, m_addressMode);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, m_addressRadix);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, m_dataFormat);
-}
-
-
void MemoryWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
diff --git a/src/osd/modules/debugger/qt/memorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h
index 86193cc3edc..50b06879ac2 100644
--- a/src/osd/modules/debugger/qt/memorywindow.h
+++ b/src/osd/modules/debugger/qt/memorywindow.h
@@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_MEMORYWINDOW_H
#define MAME_DEBUGGER_QT_MEMORYWINDOW_H
+#pragma once
+
#include "debuggerview.h"
#include "windowqt.h"
@@ -23,6 +25,9 @@ public:
MemoryWindow(running_machine &machine, QWidget *parent = nullptr);
virtual ~MemoryWindow();
+protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node) override;
+
private slots:
void memoryRegionChanged(int index);
void expressionSubmitted();
@@ -77,7 +82,7 @@ class MemoryWindowQtConfig : public WindowQtConfig
{
public:
MemoryWindowQtConfig() :
- WindowQtConfig(WIN_TYPE_MEMORY),
+ WindowQtConfig(osd::debugger::WINDOW_TYPE_MEMORY_VIEWER),
m_reverse(0),
m_addressMode(0),
m_addressRadix(0),
@@ -95,9 +100,7 @@ public:
int m_dataFormat;
int m_memoryRegion;
- void buildFromQWidget(QWidget *widget);
void applyToQWidget(QWidget *widget);
- void addToXmlDataNode(util::xml::data_node &node) const;
void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp
index 1d7ba70b5a6..ce198332619 100644
--- a/src/osd/modules/debugger/qt/windowqt.cpp
+++ b/src/osd/modules/debugger/qt/windowqt.cpp
@@ -243,31 +243,30 @@ void WindowQt::debugActQuit()
}
-//=========================================================================
-// WindowQtConfig
-//=========================================================================
-void WindowQtConfig::buildFromQWidget(QWidget *widget)
+void WindowQt::saveConfiguration(util::xml::data_node &parentnode)
{
- m_position.setX(widget->geometry().topLeft().x());
- m_position.setY(widget->geometry().topLeft().y());
- m_size.setX(widget->size().width());
- m_size.setY(widget->size().height());
+ util::xml::data_node *const node = parentnode.add_child(osd::debugger::NODE_WINDOW, nullptr);
+ if (node)
+ saveConfigurationToNode(*node);
}
-void WindowQtConfig::applyToQWidget(QWidget *widget)
+void WindowQt::saveConfigurationToNode(util::xml::data_node &node)
{
- widget->setGeometry(m_position.x(), m_position.y(), m_size.x(), m_size.y());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, geometry().topLeft().x());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, geometry().topLeft().y());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, size().width());
+ node.set_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, size().height());
}
-void WindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
+//=========================================================================
+// WindowQtConfig
+//=========================================================================
+
+void WindowQtConfig::applyToQWidget(QWidget *widget)
{
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, m_type);
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, m_position.x());
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, m_position.y());
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, m_size.x());
- node.set_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, m_size.y());
+ widget->setGeometry(m_position.x(), m_position.y(), m_size.x(), m_size.y());
}
@@ -277,5 +276,5 @@ void WindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
m_size.setY(node.get_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, m_size.y()));
m_position.setX(node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, m_position.x()));
m_position.setY(node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, m_position.y()));
- m_type = (WindowQtConfig::WindowType)node.get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, m_type);
+ m_type = node.get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, m_type);
}
diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h
index cb1d28342a9..3aaae3e3489 100644
--- a/src/osd/modules/debugger/qt/windowqt.h
+++ b/src/osd/modules/debugger/qt/windowqt.h
@@ -5,7 +5,6 @@
#include "../xmlconfig.h"
-#include "config.h"
#include "debugger.h"
#include <QtWidgets/QMainWindow>
@@ -31,6 +30,7 @@ public:
bool wantsHide() { return s_hideAll; }
void clearHideFlag() { s_hideAll = false; }
+ void saveConfiguration(util::xml::data_node &parentnode);
protected slots:
void debugActOpenMemory();
@@ -53,6 +53,8 @@ protected slots:
protected:
+ virtual void saveConfigurationToNode(util::xml::data_node &node);
+
running_machine &m_machine;
static bool s_refreshAll;
@@ -66,20 +68,7 @@ protected:
class WindowQtConfig
{
public:
- enum WindowType
- {
- WIN_TYPE_UNKNOWN,
- WIN_TYPE_MAIN,
- WIN_TYPE_MEMORY,
- WIN_TYPE_DASM,
- WIN_TYPE_LOG,
- WIN_TYPE_BREAK_POINTS,
- WIN_TYPE_DEVICES,
- WIN_TYPE_DEVICE_INFORMATION
- };
-
-public:
- WindowQtConfig(const WindowType& type=WIN_TYPE_UNKNOWN) :
+ WindowQtConfig(int type) :
m_type(type),
m_size(800, 600),
m_position(120, 120)
@@ -87,13 +76,11 @@ public:
virtual ~WindowQtConfig() {}
// Settings
- WindowType m_type;
+ int m_type;
QPoint m_size;
QPoint m_position;
- virtual void buildFromQWidget(QWidget *widget);
virtual void applyToQWidget(QWidget *widget);
- virtual void addToXmlDataNode(util::xml::data_node &node) const;
virtual void recoverFromXmlNode(util::xml::data_node const &node);
};
diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp
index 83eba523f74..9057b9c0e0e 100644
--- a/src/osd/modules/debugger/win/consolewininfo.cpp
+++ b/src/osd/modules/debugger/win/consolewininfo.cpp
@@ -212,7 +212,7 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) :
m_current_cpu(nullptr),
m_devices_menu(nullptr)
{
- if ((window() == nullptr) || (m_views[0] == nullptr))
+ if (!window() || !m_views[0])
goto cleanup;
// create the views
@@ -224,21 +224,30 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) :
goto cleanup;
{
- // Add image menu only if image devices exist
+ // add image menu only if image devices exist
image_interface_enumerator iter(machine().root_device());
if (iter.first() != nullptr)
{
m_devices_menu = CreatePopupMenu();
for (device_image_interface &img : iter)
{
- if (!img.user_loadable())
- continue;
- osd::text::tstring tc_buf = osd::text::to_tstring(string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[no image]"));
- AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf.c_str());
+ if (img.user_loadable())
+ {
+ osd::text::tstring tc_buf = osd::text::to_tstring(string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[no image]"));
+ AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf.c_str());
+ }
}
AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)m_devices_menu, TEXT("Media"));
}
+ // add the settings menu
+ HMENU const settingsmenu = CreatePopupMenu();
+ AppendMenu(settingsmenu, MF_ENABLED, ID_SAVE_WINDOWS, TEXT("Save Window Arrangement"));
+ AppendMenu(settingsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
+ AppendMenu(settingsmenu, MF_ENABLED, ID_LIGHT_BACKGROUND, TEXT("Light Background"));
+ AppendMenu(settingsmenu, MF_ENABLED, ID_DARK_BACKGROUND, TEXT("Dark Background"));
+ AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)settingsmenu, TEXT("Settings"));
+
// get the work bounds
RECT work_bounds, bounds;
SystemParametersInfo(SPI_GETWORKAREA, 0, &work_bounds, 0);
@@ -349,7 +358,7 @@ void consolewin_info::update_menu()
{
disasmbasewin_info::update_menu();
- if (m_devices_menu != nullptr)
+ if (m_devices_menu)
{
// create the image menu
uint32_t cnt = 0;
@@ -435,65 +444,85 @@ void consolewin_info::update_menu()
cnt++;
}
}
+
+ HMENU const menu = GetMenu(window());
+ CheckMenuItem(menu, ID_SAVE_WINDOWS, MF_BYCOMMAND | (debugger().get_save_window_arrangement() ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(menu, ID_LIGHT_BACKGROUND, MF_BYCOMMAND | ((ui_metrics::THEME_LIGHT_BACKGROUND == metrics().get_color_theme()) ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(menu, ID_DARK_BACKGROUND, MF_BYCOMMAND | ((ui_metrics::THEME_DARK_BACKGROUND == metrics().get_color_theme()) ? MF_CHECKED : MF_UNCHECKED));
}
bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
- if ((HIWORD(wparam) == 0) && (LOWORD(wparam) >= ID_DEVICE_OPTIONS))
+ if (HIWORD(wparam) == 0)
{
- uint32_t const devid = (LOWORD(wparam) - ID_DEVICE_OPTIONS) / DEVOPTION_MAX;
- image_interface_enumerator iter(machine().root_device());
- device_image_interface *const img = iter.byindex(devid);
- if (img != nullptr)
+ if (LOWORD(wparam) >= ID_DEVICE_OPTIONS)
{
- switch ((LOWORD(wparam) - ID_DEVICE_OPTIONS) % DEVOPTION_MAX)
- {
- case DEVOPTION_ITEM:
- // TODO: this is supposed to show a software list item picker - it never worked properly
- return true;
- case DEVOPTION_OPEN :
- open_image_file(*img);
- return true;
- case DEVOPTION_CREATE:
- create_image_file(*img);
- return true;
- case DEVOPTION_CLOSE:
- img->unload();
- return true;
- }
- if (img->device().type() == CASSETTE)
+ uint32_t const devid = (LOWORD(wparam) - ID_DEVICE_OPTIONS) / DEVOPTION_MAX;
+ image_interface_enumerator iter(machine().root_device());
+ device_image_interface *const img = iter.byindex(devid);
+ if (img != nullptr)
{
- auto *const cassette = downcast<cassette_image_device *>(&img->device());
- bool s;
switch ((LOWORD(wparam) - ID_DEVICE_OPTIONS) % DEVOPTION_MAX)
{
- case DEVOPTION_CASSETTE_STOPPAUSE:
- cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
+ case DEVOPTION_ITEM:
+ // TODO: this is supposed to show a software list item picker - it never worked properly
return true;
- case DEVOPTION_CASSETTE_PLAY:
- cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
+ case DEVOPTION_OPEN :
+ open_image_file(*img);
return true;
- case DEVOPTION_CASSETTE_RECORD:
- cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
+ case DEVOPTION_CREATE:
+ create_image_file(*img);
return true;
- case DEVOPTION_CASSETTE_REWIND:
- cassette->seek(0.0, SEEK_SET); // to start
+ case DEVOPTION_CLOSE:
+ img->unload();
return true;
- case DEVOPTION_CASSETTE_FASTFORWARD:
- cassette->seek(+300.0, SEEK_CUR); // 5 minutes forward or end, whichever comes first
- break;
- case DEVOPTION_CASSETTE_MOTOR:
- s =((cassette->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED);
- cassette->change_state(s ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
- break;
- case DEVOPTION_CASSETTE_SOUND:
- s =((cassette->get_state() & CASSETTE_MASK_SPEAKER) == CASSETTE_SPEAKER_MUTED);
- cassette->change_state(s ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
- break;
+ }
+ if (img->device().type() == CASSETTE)
+ {
+ auto *const cassette = downcast<cassette_image_device *>(&img->device());
+ bool s;
+ switch ((LOWORD(wparam) - ID_DEVICE_OPTIONS) % DEVOPTION_MAX)
+ {
+ case DEVOPTION_CASSETTE_STOPPAUSE:
+ cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
+ return true;
+ case DEVOPTION_CASSETTE_PLAY:
+ cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
+ return true;
+ case DEVOPTION_CASSETTE_RECORD:
+ cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
+ return true;
+ case DEVOPTION_CASSETTE_REWIND:
+ cassette->seek(0.0, SEEK_SET); // to start
+ return true;
+ case DEVOPTION_CASSETTE_FASTFORWARD:
+ cassette->seek(+300.0, SEEK_CUR); // 5 minutes forward or end, whichever comes first
+ return true;
+ case DEVOPTION_CASSETTE_MOTOR:
+ s = ((cassette->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED);
+ cassette->change_state(s ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
+ return true;
+ case DEVOPTION_CASSETTE_SOUND:
+ s = ((cassette->get_state() & CASSETTE_MASK_SPEAKER) == CASSETTE_SPEAKER_MUTED);
+ cassette->change_state(s ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
+ return true;
+ }
}
}
}
+ else switch (LOWORD(wparam))
+ {
+ case ID_SAVE_WINDOWS:
+ debugger().set_save_window_arrangement(!debugger().get_save_window_arrangement());
+ return true;
+ case ID_LIGHT_BACKGROUND:
+ debugger().set_color_theme(ui_metrics::THEME_LIGHT_BACKGROUND);
+ return true;
+ case ID_DARK_BACKGROUND:
+ debugger().set_color_theme(ui_metrics::THEME_DARK_BACKGROUND);
+ return true;
+ }
}
return disasmbasewin_info::handle_command(wparam, lparam);
}
diff --git a/src/osd/modules/debugger/win/consolewininfo.h b/src/osd/modules/debugger/win/consolewininfo.h
index a5b79832578..851cbe6b45b 100644
--- a/src/osd/modules/debugger/win/consolewininfo.h
+++ b/src/osd/modules/debugger/win/consolewininfo.h
@@ -53,7 +53,7 @@ private:
bool get_softlist_info(device_image_interface &img);
device_t *m_current_cpu;
- HMENU m_devices_menu;
+ HMENU m_devices_menu;
std::map<std::string,std::string> slmap;
};
diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp
index faed31e74bc..744121cbe77 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.cpp
+++ b/src/osd/modules/debugger/win/debugviewinfo.cpp
@@ -498,7 +498,7 @@ void debugview_info::draw_contents(HDC windc)
for (int iter = 0; iter < 2; iter++)
{
COLORREF fgcolor;
- COLORREF bgcolor = RGB(0xff,0xff,0xff);
+ COLORREF bgcolor = metrics().view_colors(DCA_NORMAL).second;
HBRUSH bgbrush = nullptr;
int last_attrib = -1;
TCHAR buffer[256];
@@ -522,20 +522,8 @@ void debugview_info::draw_contents(HDC windc)
{
COLORREF oldbg = bgcolor;
- // pick new background color
- bgcolor = RGB(0xff,0xff,0xff);
- if (viewdata[col].attrib & DCA_VISITED) bgcolor = RGB(0xc6, 0xe2, 0xff);
- if (viewdata[col].attrib & DCA_ANCILLARY) bgcolor = RGB(0xe0,0xe0,0xe0);
- if (viewdata[col].attrib & DCA_SELECTED) bgcolor = RGB(0xff,0x80,0x80);
- if (viewdata[col].attrib & DCA_CURRENT) bgcolor = RGB(0xff,0xff,0x00);
- if ((viewdata[col].attrib & DCA_SELECTED) && (viewdata[col].attrib & DCA_CURRENT)) bgcolor = RGB(0xff,0xc0,0x80);
-
- // pick new foreground color
- fgcolor = RGB(0x00,0x00,0x00);
- if (viewdata[col].attrib & DCA_CHANGED) fgcolor = RGB(0xff,0x00,0x00);
- if (viewdata[col].attrib & DCA_INVALID) fgcolor = RGB(0x00,0x00,0xff);
- if (viewdata[col].attrib & DCA_DISABLED) fgcolor = RGB((GetRValue(fgcolor) + GetRValue(bgcolor)) / 2, (GetGValue(fgcolor) + GetGValue(bgcolor)) / 2, (GetBValue(fgcolor) + GetBValue(bgcolor)) / 2);
- if (viewdata[col].attrib & DCA_COMMENT) fgcolor = RGB(0x00,0x80,0x00);
+ // pick new colors
+ std::tie(fgcolor, bgcolor) = metrics().view_colors(viewdata[col].attrib);
// flush any pending drawing
if (count > 0)
@@ -546,7 +534,7 @@ void debugview_info::draw_contents(HDC windc)
FillRect(dc, &bounds, bgbrush);
if (do_filldown)
{
- COLORREF const filldown = (last_attrib & DCA_ANCILLARY) ? RGB(0xe0,0xe0,0xe0) : RGB(0xff,0xff,0xff);
+ COLORREF const filldown = metrics().view_colors(last_attrib & DCA_ANCILLARY).second;
if (oldbg != filldown)
{
DeleteObject(bgbrush);
@@ -593,7 +581,7 @@ void debugview_info::draw_contents(HDC windc)
FillRect(dc, &bounds, bgbrush);
if (do_filldown)
{
- COLORREF const filldown = (last_attrib & DCA_ANCILLARY) ? RGB(0xe0,0xe0,0xe0) : RGB(0xff,0xff,0xff);
+ COLORREF const filldown = metrics().view_colors(last_attrib & DCA_ANCILLARY).second;
if (bgcolor != filldown)
{
DeleteObject(bgbrush);
diff --git a/src/osd/modules/debugger/win/debugwin.h b/src/osd/modules/debugger/win/debugwin.h
index aeaf7252eec..37d21136699 100644
--- a/src/osd/modules/debugger/win/debugwin.h
+++ b/src/osd/modules/debugger/win/debugwin.h
@@ -35,6 +35,9 @@ public:
virtual running_machine &machine() const = 0;
virtual ui_metrics &metrics() const = 0;
+ virtual void set_color_theme(int index) = 0;
+ virtual bool get_save_window_arrangement() const = 0;
+ virtual void set_save_window_arrangement(bool save) = 0;
virtual bool const &waiting_for_debugger() const = 0;
virtual bool seq_pressed() const = 0;
diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp
index f449d39dbf8..f2f29fc9838 100644
--- a/src/osd/modules/debugger/win/debugwininfo.cpp
+++ b/src/osd/modules/debugger/win/debugwininfo.cpp
@@ -59,6 +59,12 @@ debugwin_info::~debugwin_info()
}
+void debugwin_info::redraw()
+{
+ RedrawWindow(m_wnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN);
+}
+
+
void debugwin_info::destroy()
{
for (int curview = 0; curview < MAX_VIEWS; curview++)
diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h
index f311d40ad2f..899fd4b755d 100644
--- a/src/osd/modules/debugger/win/debugwininfo.h
+++ b/src/osd/modules/debugger/win/debugwininfo.h
@@ -40,6 +40,7 @@ public:
void show() const { smart_show_window(m_wnd, true); }
void hide() const { smart_show_window(m_wnd, false); }
void set_foreground() const { SetForegroundWindow(m_wnd); }
+ void redraw();
void destroy();
virtual bool set_default_focus();
@@ -111,6 +112,10 @@ protected:
ID_CLEAR_LOG,
+ ID_SAVE_WINDOWS,
+ ID_LIGHT_BACKGROUND,
+ ID_DARK_BACKGROUND,
+
ID_DEVICE_OPTIONS // always keep this at the end
};
diff --git a/src/osd/modules/debugger/win/uimetrics.cpp b/src/osd/modules/debugger/win/uimetrics.cpp
index 67eb045c619..6bd3bc8284d 100644
--- a/src/osd/modules/debugger/win/uimetrics.cpp
+++ b/src/osd/modules/debugger/win/uimetrics.cpp
@@ -9,8 +9,39 @@
#include "emu.h"
#include "uimetrics.h"
+#include "debug/debugvw.h"
+
#include "strconv.h"
+#include <algorithm>
+
+
+COLORREF const ui_metrics::s_themes[][COLOR_COUNT] = {
+ {
+ RGB(0x00, 0x00, 0x00), // foreground normal
+ RGB(0xff, 0x00, 0x00), // foreground changed
+ RGB(0x00, 0x00, 0xff), // foreground invalid
+ RGB(0x00, 0x80, 0x00), // foreground comment
+ RGB(0xff, 0xff, 0xff), // background normal
+ RGB(0xff, 0x80, 0x80), // background selected
+ RGB(0xe0, 0xe0, 0xe0), // background ancillary
+ RGB(0xff, 0xff, 0x00), // background current
+ RGB(0xff, 0xc0, 0x80), // background current selected
+ RGB(0xc0, 0xe0, 0xff) // background visited
+ },
+ {
+ RGB(0xe0, 0xe0, 0xe0), // foreground normal
+ RGB(0xff, 0x60, 0xff), // foreground changed
+ RGB(0x00, 0xc0, 0xe0), // foreground invalid
+ RGB(0x00, 0xe0, 0x00), // foreground comment
+ RGB(0x00, 0x00, 0x00), // background normal
+ RGB(0xe0, 0x00, 0x00), // background selected
+ RGB(0x40, 0x40, 0x40), // background ancillary
+ RGB(0x00, 0x00, 0xc0), // background current
+ RGB(0xb0, 0x60, 0x00), // background current selected
+ RGB(0x00, 0x40, 0x80) // background visited
+ } };
+
ui_metrics::ui_metrics(osd_options const &options) :
m_debug_font(nullptr),
@@ -22,7 +53,7 @@ ui_metrics::ui_metrics(osd_options const &options) :
{
// create a temporary DC
HDC const temp_dc = GetDC(nullptr);
- if (temp_dc != nullptr)
+ if (temp_dc)
{
float const size = options.debugger_font_size();
char const *const face = options.debugger_font();
@@ -47,6 +78,9 @@ ui_metrics::ui_metrics(osd_options const &options) :
SelectObject(temp_dc, old_font);
ReleaseDC(nullptr, temp_dc);
}
+
+ // set default color theme
+ set_color_theme(THEME_LIGHT_BACKGROUND);
}
@@ -69,3 +103,54 @@ ui_metrics::~ui_metrics()
if (m_debug_font)
DeleteObject(m_debug_font);
}
+
+
+std::pair<COLORREF, COLORREF> ui_metrics::view_colors(u8 attrib) const
+{
+ std::pair<COLORREF, COLORREF> result;
+
+ if (attrib & DCA_SELECTED)
+ result.second = (attrib & DCA_CURRENT) ? m_colors[COLOR_BG_CURRENT_SELECTED] : m_colors[COLOR_BG_SELECTED];
+ else if (attrib & DCA_CURRENT)
+ result.second = m_colors[COLOR_BG_CURRENT];
+ else if (attrib & DCA_ANCILLARY)
+ result.second = m_colors[COLOR_BG_ANCILLARY];
+ else if (attrib & DCA_VISITED)
+ result.second = m_colors[COLOR_BG_VISITED];
+ else
+ result.second = m_colors[COLOR_BG_NORMAL];
+
+ if (DCA_COMMENT & attrib)
+ {
+ result.first = m_colors[COLOR_FG_COMMENT];
+ }
+ else
+ {
+ if (attrib & DCA_INVALID)
+ result.first = m_colors[COLOR_FG_INVALID];
+ else if (attrib & DCA_CHANGED)
+ result.first = m_colors[COLOR_FG_CHANGED];
+ else
+ result.first = m_colors[COLOR_FG_NORMAL];
+
+ if (attrib & DCA_DISABLED)
+ {
+ result.first = RGB(
+ (GetRValue(result.first) + GetRValue(result.second) + 1) >> 1,
+ (GetGValue(result.first) + GetGValue(result.second) + 1) >> 1,
+ (GetBValue(result.first) + GetBValue(result.second) + 1) >> 1);
+ }
+ }
+
+ return result;
+}
+
+
+void ui_metrics::set_color_theme(int index)
+{
+ if ((0 <= index) && (std::size(s_themes) > index))
+ {
+ std::copy(std::begin(s_themes[index]), std::end(s_themes[index]), m_colors);
+ m_color_theme = index;
+ }
+}
diff --git a/src/osd/modules/debugger/win/uimetrics.h b/src/osd/modules/debugger/win/uimetrics.h
index a87e04bafee..2621fc602d3 100644
--- a/src/osd/modules/debugger/win/uimetrics.h
+++ b/src/osd/modules/debugger/win/uimetrics.h
@@ -12,13 +12,20 @@
#include "debugwin.h"
-
#include "modules/lib/osdobj_common.h"
+#include <utility>
+
class ui_metrics
{
public:
+ enum
+ {
+ THEME_LIGHT_BACKGROUND,
+ THEME_DARK_BACKGROUND
+ };
+
ui_metrics(osd_options const &options);
ui_metrics(ui_metrics const &that);
~ui_metrics();
@@ -31,7 +38,28 @@ public:
uint32_t hscroll_height() const { return m_hscroll_height; }
uint32_t vscroll_width() const { return m_vscroll_width; }
+ std::pair<COLORREF, COLORREF> view_colors(u8 attrib) const;
+ int get_color_theme() const { return m_color_theme; }
+ void set_color_theme(int index);
+
private:
+ enum
+ {
+ COLOR_FG_NORMAL,
+ COLOR_FG_CHANGED,
+ COLOR_FG_INVALID,
+ COLOR_FG_COMMENT,
+
+ COLOR_BG_NORMAL,
+ COLOR_BG_SELECTED,
+ COLOR_BG_ANCILLARY,
+ COLOR_BG_CURRENT,
+ COLOR_BG_CURRENT_SELECTED,
+ COLOR_BG_VISITED,
+
+ COLOR_COUNT
+ };
+
HFONT m_debug_font;
uint32_t m_debug_font_height;
uint32_t m_debug_font_width;
@@ -39,6 +67,11 @@ private:
uint32_t const m_hscroll_height;
uint32_t const m_vscroll_width;
+
+ COLORREF m_colors[COLOR_COUNT];
+ int m_color_theme;
+
+ static COLORREF const s_themes[][COLOR_COUNT];
};
#endif // MAME_DEBUGGER_WIN_UIMETRICS_H
diff --git a/src/osd/modules/debugger/xmlconfig.cpp b/src/osd/modules/debugger/xmlconfig.cpp
index a2a29d668a2..9cdd34fc5da 100644
--- a/src/osd/modules/debugger/xmlconfig.cpp
+++ b/src/osd/modules/debugger/xmlconfig.cpp
@@ -6,12 +6,15 @@
namespace osd::debugger {
char const *const NODE_WINDOW = "window";
+char const *const NODE_COLORS = "colors";
char const *const NODE_WINDOW_SPLITS = "splits";
char const *const NODE_WINDOW_SELECTION = "selection";
char const *const NODE_WINDOW_SCROLL = "scroll";
char const *const NODE_WINDOW_EXPRESSION = "expression";
+char const *const ATTR_DEBUGGER_SAVE_WINDOWS = "savewindows";
+
char const *const ATTR_WINDOW_TYPE = "type";
char const *const ATTR_WINDOW_POSITION_X = "position_x";
char const *const ATTR_WINDOW_POSITION_Y = "position_y";
@@ -32,6 +35,8 @@ char const *const ATTR_WINDOW_POINTS_TYPE = "bwtype";
char const *const ATTR_WINDOW_DEVICE_TAG = "device-tag";
+char const *const ATTR_COLORS_THEME = "theme";
+
char const *const ATTR_SPLITS_CONSOLE_STATE = "state";
char const *const ATTR_SPLITS_CONSOLE_DISASSEMBLY = "disassembly";
diff --git a/src/osd/modules/debugger/xmlconfig.h b/src/osd/modules/debugger/xmlconfig.h
index 5696e412304..a83f6ae960a 100644
--- a/src/osd/modules/debugger/xmlconfig.h
+++ b/src/osd/modules/debugger/xmlconfig.h
@@ -22,12 +22,15 @@ WINDOW_TYPE_DEVICE_INFO_VIEWER
};
extern char const *const NODE_WINDOW;
+extern char const *const NODE_COLORS;
extern char const *const NODE_WINDOW_SPLITS;
extern char const *const NODE_WINDOW_SELECTION;
extern char const *const NODE_WINDOW_SCROLL;
extern char const *const NODE_WINDOW_EXPRESSION;
+extern char const *const ATTR_DEBUGGER_SAVE_WINDOWS;
+
extern char const *const ATTR_WINDOW_TYPE;
extern char const *const ATTR_WINDOW_POSITION_X;
extern char const *const ATTR_WINDOW_POSITION_Y;
@@ -48,6 +51,8 @@ extern char const *const ATTR_WINDOW_POINTS_TYPE;
extern char const *const ATTR_WINDOW_DEVICE_TAG;
+extern char const *const ATTR_COLORS_THEME;
+
extern char const *const ATTR_SPLITS_CONSOLE_STATE;
extern char const *const ATTR_SPLITS_CONSOLE_DISASSEMBLY;