diff options
Diffstat (limited to 'src/osd/modules/debugger/win/consolewininfo.cpp')
-rw-r--r-- | src/osd/modules/debugger/win/consolewininfo.cpp | 127 |
1 files changed, 78 insertions, 49 deletions
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); } |