logwin_info::logwin_info(debugger_windows_interface &debugger) : debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), nullptr) { if (!window()) return; m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_LOG))); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; } // compute a client rect RECT bounds; bounds.top = bounds.left = 0; bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH); bounds.bottom = 200; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); // clamp the min/max size set_maxwidth(bounds.right - bounds.left); // position the window at the bottom-right SetWindowPos(window(), HWND_TOP, 100, 100, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_SHOWWINDOW); // recompute the children debugwin_info::recompute_children(); }
pointswin_info::pointswin_info(debugger_windows_interface &debugger) : debugwin_info(debugger, false, std::string("All Breakpoints").c_str(), nullptr) { if (!window()) return; m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; } // create the options menu HMENU const optionsmenu = CreatePopupMenu(); AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_BREAKPOINTS, TEXT("Breakpoints\tCtrl+1")); AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_WATCHPOINTS, TEXT("Watchpoints\tCtrl+2")); AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options")); // compute a client rect RECT bounds; bounds.top = bounds.left = 0; bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH); bounds.bottom = 200; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); // clamp the min/max size set_maxwidth(bounds.right - bounds.left); // position the window at the bottom-right SetWindowPos(window(), HWND_TOP, 100, 100, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_SHOWWINDOW); // recompute the children debugwin_info::recompute_children(); }
void memorywin_info::recompute_children() { // compute a client rect RECT bounds; bounds.top = bounds.left = 0; bounds.right = m_views[0]->prefwidth() + (2 * EDGE_WIDTH); bounds.bottom = 200; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); // clamp the min/max size set_maxwidth(bounds.right - bounds.left); // get the parent's dimensions RECT parent; GetClientRect(window(), &parent); // edit box gets half of the width RECT editrect; editrect.top = parent.top + EDGE_WIDTH; editrect.bottom = editrect.top + metrics().debug_font_height() + 4; editrect.left = parent.left + EDGE_WIDTH; editrect.right = parent.left + ((parent.right - parent.left) / 2) - EDGE_WIDTH; // combo box gets the other half of the width RECT comborect; comborect.top = editrect.top; comborect.bottom = editrect.bottom; comborect.left = editrect.right + (2 * EDGE_WIDTH); comborect.right = parent.right - EDGE_WIDTH; // memory view gets the rest RECT memrect; memrect.top = editrect.bottom + (2 * EDGE_WIDTH); memrect.bottom = parent.bottom - EDGE_WIDTH; memrect.left = parent.left + EDGE_WIDTH; memrect.right = parent.right - EDGE_WIDTH; // set the bounds of things m_views[0]->set_bounds(memrect); set_editwnd_bounds(editrect); smart_set_window_bounds(m_combownd, window(), comborect); }
void debugwin_info::recompute_children() { if (m_views[0] != NULL) { // compute a client rect RECT bounds; bounds.top = bounds.left = 0; bounds.right = m_views[0]->prefwidth() + (2 * EDGE_WIDTH); bounds.bottom = 200; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); // clamp the min/max size set_maxwidth(bounds.right - bounds.left); // get the parent's dimensions RECT parent; GetClientRect(window(), &parent); // view gets the remaining space InflateRect(&parent, -EDGE_WIDTH, -EDGE_WIDTH); m_views[0]->set_bounds(parent); } }
consolewin_info::consolewin_info(debugger_windows_interface &debugger) : disasmbasewin_info(debugger, true, "Debug", nullptr), m_devices_menu(nullptr) { if ((window() == nullptr) || (m_views[0] == nullptr)) goto cleanup; // create the views m_views[1].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_STATE))); if (!m_views[1]->is_valid()) goto cleanup; m_views[2].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_CONSOLE))); if (!m_views[2]->is_valid()) goto cleanup; { // Add image menu only if image devices exist image_interface_iterator iter(machine().root_device()); if (iter.first() != nullptr) { m_devices_menu = CreatePopupMenu(); for (device_image_interface &img : iter) { 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("Images")); } // get the work bounds RECT work_bounds, bounds; SystemParametersInfo(SPI_GETWORKAREA, 0, &work_bounds, 0); // adjust the min/max sizes for the window style bounds.top = bounds.left = 0; bounds.right = bounds.bottom = EDGE_WIDTH + m_views[1]->maxwidth() + (2 * EDGE_WIDTH) + 100 + EDGE_WIDTH; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); set_minwidth(bounds.right - bounds.left); bounds.top = bounds.left = 0; bounds.right = bounds.bottom = EDGE_WIDTH + m_views[1]->maxwidth() + (2 * EDGE_WIDTH) + std::max(m_views[0]->maxwidth(), m_views[2]->maxwidth()) + EDGE_WIDTH; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); set_maxwidth(bounds.right - bounds.left); // position the window at the bottom-right int const bestwidth = (std::min<uint32_t>)(maxwidth(), work_bounds.right - work_bounds.left); int const bestheight = (std::min<uint32_t>)(500, work_bounds.bottom - work_bounds.top); SetWindowPos(window(), HWND_TOP, work_bounds.right - bestwidth, work_bounds.bottom - bestheight, bestwidth, bestheight, SWP_SHOWWINDOW); } // recompute the children set_cpu(*machine().debugger().cpu().get_visible_cpu()); // mark the edit box as the default focus and set it editwin_info::set_default_focus(); return; cleanup: m_views[2].reset(); m_views[1].reset(); m_views[0].reset(); }
consolewin_info::consolewin_info(debugger_windows_interface &debugger) : disasmbasewin_info(debugger, true, "Debug", NULL), m_devices_menu(NULL) { if ((window() == NULL) || (m_views[0] == NULL)) goto cleanup; // create the views m_views[1].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_STATE))); if (!m_views[1]->is_valid()) goto cleanup; m_views[2].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_CONSOLE))); if (!m_views[2]->is_valid()) goto cleanup; { // Add image menu only if image devices exist image_interface_iterator iter(machine().root_device()); device_image_interface *img = iter.first(); if (img != NULL) { m_devices_menu = CreatePopupMenu(); for ( ; img != NULL; img = iter.next()) { astring temp; temp.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[no image]"); TCHAR *tc_buf = tstring_from_utf8(temp.c_str()); if (tc_buf != NULL) { AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf); osd_free(tc_buf); } } AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)m_devices_menu, TEXT("Images")); } // get the work bounds RECT work_bounds, bounds; SystemParametersInfo(SPI_GETWORKAREA, 0, &work_bounds, 0); // adjust the min/max sizes for the window style bounds.top = bounds.left = 0; bounds.right = bounds.bottom = EDGE_WIDTH + m_views[1]->maxwidth() + (2 * EDGE_WIDTH) + 100 + EDGE_WIDTH; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); set_minwidth(bounds.right - bounds.left); bounds.top = bounds.left = 0; bounds.right = bounds.bottom = EDGE_WIDTH + m_views[1]->maxwidth() + (2 * EDGE_WIDTH) + MAX(m_views[0]->maxwidth(), m_views[2]->maxwidth()) + EDGE_WIDTH; AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); set_maxwidth(bounds.right - bounds.left); // position the window at the bottom-right int const bestwidth = MIN(maxwidth(), work_bounds.right - work_bounds.left); int const bestheight = MIN(500, work_bounds.bottom - work_bounds.top); SetWindowPos(window(), HWND_TOP, work_bounds.right - bestwidth, work_bounds.bottom - bestheight, bestwidth, bestheight, SWP_SHOWWINDOW); } // recompute the children set_cpu(*debug_cpu_get_visible_cpu(machine())); // mark the edit box as the default focus and set it set_default_focus(); return; cleanup: m_views[2].reset(); m_views[1].reset(); m_views[0].reset(); }