trunk/src/osd/sdl/debugqt.c
| r22536 | r22537 | |
| 19 | 19 | #include "config.h" |
| 20 | 20 | #include "debugger.h" |
| 21 | 21 | |
| 22 | #include "debugqtlogwindow.h" |
| 22 | 23 | #include "debugqtmainwindow.h" |
| 23 | | #include "debugqtmemorywindow.h" |
| 24 | 24 | #include "debugqtdasmwindow.h" |
| 25 | | #include "debugqtlogwindow.h" |
| 25 | #include "debugqtmemorywindow.h" |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | //============================================================ |
| r22536 | r22537 | |
| 41 | 41 | //============================================================ |
| 42 | 42 | |
| 43 | 43 | // Global variable used to feed the xml configuration callbacks |
| 44 | | std::vector<WindowQtConfig> xmlConfigurations; |
| 44 | simple_list<WindowQtConfig> xmlConfigurations; |
| 45 | 45 | |
| 46 | |
| 46 | 47 | static void xml_configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode) |
| 47 | 48 | { |
| 48 | 49 | xml_data_node *wnode; |
| r22536 | r22537 | |
| 55 | 56 | if (parentnode == NULL) |
| 56 | 57 | return; |
| 57 | 58 | |
| 58 | | xmlConfigurations.clear(); |
| 59 | xmlConfigurations.reset(); |
| 59 | 60 | |
| 60 | 61 | // Configuration load |
| 61 | 62 | for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window")) |
| 62 | 63 | { |
| 63 | | WindowQtConfig config; |
| 64 | WindowQtConfig& config = xmlConfigurations.append(*global_alloc(WindowQtConfig)); |
| 64 | 65 | config.m_size.setX(xml_get_attribute_int(wnode, "size_x", config.m_size.x())); |
| 65 | 66 | config.m_size.setY(xml_get_attribute_int(wnode, "size_y", config.m_size.y())); |
| 66 | 67 | config.m_position.setX(xml_get_attribute_int(wnode, "position_x", config.m_position.x())); |
| 67 | 68 | config.m_position.setY(xml_get_attribute_int(wnode, "position_y", config.m_position.y())); |
| 68 | 69 | config.m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", config.m_type); |
| 69 | | xmlConfigurations.push_back(config); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| r22536 | r22537 | |
| 77 | 77 | if (config_type != CONFIG_TYPE_GAME) |
| 78 | 78 | return; |
| 79 | 79 | |
| 80 | | for (int i = 0; i < xmlConfigurations.size(); i++) |
| 80 | for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next()) |
| 81 | 81 | { |
| 82 | 82 | // Create an xml node |
| 83 | 83 | xml_data_node *debugger_node; |
| r22536 | r22537 | |
| 85 | 85 | if (debugger_node == NULL) |
| 86 | 86 | continue; |
| 87 | 87 | |
| 88 | | xml_set_attribute_int(debugger_node, "type", xmlConfigurations[i].m_type); |
| 89 | | xml_set_attribute_int(debugger_node, "position_x", xmlConfigurations[i].m_position.x()); |
| 90 | | xml_set_attribute_int(debugger_node, "position_y", xmlConfigurations[i].m_position.y()); |
| 91 | | xml_set_attribute_int(debugger_node, "size_x", xmlConfigurations[i].m_size.x()); |
| 92 | | xml_set_attribute_int(debugger_node, "size_y", xmlConfigurations[i].m_size.y()); |
| 88 | xml_set_attribute_int(debugger_node, "type", config->m_type); |
| 89 | xml_set_attribute_int(debugger_node, "position_x", config->m_position.x()); |
| 90 | xml_set_attribute_int(debugger_node, "position_y", config->m_position.y()); |
| 91 | xml_set_attribute_int(debugger_node, "size_x", config->m_size.x()); |
| 92 | xml_set_attribute_int(debugger_node, "size_y", config->m_size.y()); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | static void gather_save_configurations() |
| 98 | 98 | { |
| 99 | | xmlConfigurations.clear(); |
| 99 | xmlConfigurations.reset(); |
| 100 | 100 | |
| 101 | 101 | // Loop over all the open windows |
| 102 | 102 | foreach (QWidget* widget, QApplication::topLevelWidgets()) |
| r22536 | r22537 | |
| 118 | 118 | else if (dynamic_cast<LogWindow*>(widget)) |
| 119 | 119 | type = WindowQtConfig::WIN_TYPE_LOG; |
| 120 | 120 | |
| 121 | | WindowQtConfig config; |
| 121 | WindowQtConfig& config = xmlConfigurations.append(*global_alloc(WindowQtConfig)); |
| 122 | 122 | config.m_type = type; |
| 123 | 123 | config.m_position.setX(widget->geometry().topLeft().x()); |
| 124 | 124 | config.m_position.setY(widget->geometry().topLeft().y()); |
| 125 | 125 | config.m_size.setX(widget->size().width()); |
| 126 | 126 | config.m_size.setY(widget->size().height()); |
| 127 | | xmlConfigurations.push_back(config); |
| 128 | 127 | } |
| 129 | 128 | } |
| 130 | 129 | |
| r22536 | r22537 | |
| 133 | 132 | // Utilities |
| 134 | 133 | //============================================================ |
| 135 | 134 | |
| 136 | | static void load_and_clear_main_window_config(std::vector<WindowQtConfig>& configs) |
| 135 | static void load_and_clear_main_window_config(simple_list<WindowQtConfig>& configList) |
| 137 | 136 | { |
| 138 | | if (configs.size() == 0) |
| 139 | | return; |
| 140 | | |
| 141 | | int i = 0; |
| 142 | | for (i = 0; i < configs.size(); i++) |
| 137 | for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next()) |
| 143 | 138 | { |
| 144 | | if (configs[i].m_type == WindowQtConfig::WIN_TYPE_MAIN) |
| 139 | if (config->m_type == WindowQtConfig::WIN_TYPE_MAIN) |
| 145 | 140 | { |
| 146 | | mainQtWindow->setGeometry(configs[i].m_position.x(), configs[i].m_position.y(), |
| 147 | | configs[i].m_size.x(), configs[i].m_size.y()); |
| 141 | mainQtWindow->setGeometry(config->m_position.x(), config->m_position.y(), |
| 142 | config->m_size.x(), config->m_size.y()); |
| 143 | configList.remove(*config); |
| 148 | 144 | break; |
| 149 | 145 | } |
| 150 | 146 | } |
| 151 | | configs.erase(configs.begin()+i); |
| 152 | 147 | } |
| 153 | 148 | |
| 154 | 149 | |
| 155 | | static void setup_additional_startup_windows(running_machine& machine, std::vector<WindowQtConfig>& configs) |
| 150 | static void setup_additional_startup_windows(running_machine& machine, simple_list<WindowQtConfig>& configList) |
| 156 | 151 | { |
| 157 | | for (int i = 0; i < configs.size(); i++) |
| 152 | for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next()) |
| 158 | 153 | { |
| 159 | 154 | WindowQt* foo = NULL; |
| 160 | | switch (configs[i].m_type) |
| 155 | switch (config->m_type) |
| 161 | 156 | { |
| 162 | 157 | case WindowQtConfig::WIN_TYPE_MEMORY: |
| 163 | 158 | foo = new MemoryWindow(&machine); break; |
| r22536 | r22537 | |
| 167 | 162 | foo = new LogWindow(&machine); break; |
| 168 | 163 | default: break; |
| 169 | 164 | } |
| 170 | | foo->setGeometry(configs[i].m_position.x(), configs[i].m_position.y(), |
| 171 | | configs[i].m_size.x(), configs[i].m_size.y()); |
| 165 | foo->setGeometry(config->m_position.x(), config->m_position.y(), |
| 166 | config->m_size.x(), config->m_size.y()); |
| 172 | 167 | foo->show(); |
| 173 | 168 | } |
| 174 | 169 | } |
| r22536 | r22537 | |
| 199 | 194 | } |
| 200 | 195 | else |
| 201 | 196 | { |
| 202 | | // If you're doing a hard reset, clear out existing widgets & get ready for re-init |
| 197 | // If you've done a hard reset, clear out existing widgets & get ready for re-init |
| 203 | 198 | foreach (QWidget* widget, QApplication::topLevelWidgets()) |
| 204 | 199 | { |
| 205 | 200 | if (!widget->isWindow() || widget->windowType() != Qt::Window) |
| r22536 | r22537 | |
| 298 | 293 | #else |
| 299 | 294 | |
| 300 | 295 | |
| 296 | |
| 301 | 297 | #include "sdlinc.h" |
| 302 | 298 | |
| 303 | 299 | #include "emu.h" |