debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler) : debugbase_info(debugger), m_is_main_console(is_main_console), m_next(NULL), m_wnd(NULL), m_handler(handler), m_minwidth(200), m_maxwidth(0), m_minheight(200), m_maxheight(0), m_ignore_char_lparam(0) { register_window_class(); m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE, 0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandleUni(), this); if (m_wnd == NULL) return; RECT work_bounds; SystemParametersInfo(SPI_GETWORKAREA, 0, &work_bounds, 0); m_maxwidth = work_bounds.right - work_bounds.left; m_maxheight = work_bounds.bottom - work_bounds.top; }
BOOL DevView_SetDriver(HWND hwndDevView, const software_config *config) { struct DevViewInfo *pDevViewInfo; const device_image_interface *dev = NULL; struct DevViewEntry *pEnt; int i; int y, nHeight, nDevCount; int nStaticPos, nStaticWidth, nEditPos, nEditWidth, nButtonPos, nButtonWidth; HDC hDc; LPTSTR *ppszDevices; LPTSTR t_s; SIZE sz; LONG_PTR l; pDevViewInfo = GetDevViewInfo(hwndDevView); // clear out DevView_Clear(hwndDevView); // copy the config pDevViewInfo->config = config; // count total amount of devices nDevCount = 0; { for (bool gotone = pDevViewInfo->config->mconfig->devicelist().first(dev); gotone; gotone = dev->next(dev)) { nDevCount++; } } if (nDevCount > 0) { // get the names of all of the devices ppszDevices = (LPTSTR *) alloca(nDevCount * sizeof(*ppszDevices)); i = 0; for (bool gotone = pDevViewInfo->config->mconfig->devicelist().first(dev); gotone; gotone = dev->next(dev)) { t_s = tstring_from_utf8(dev->device().name()); ppszDevices[i] = (TCHAR*)alloca((_tcslen(t_s) + 1) * sizeof(TCHAR)); _tcscpy(ppszDevices[i], t_s); osd_free(t_s); i++; } // Calculate the requisite size for the device column pDevViewInfo->nWidth = 0; if (nDevCount > 0) { hDc = GetDC(hwndDevView); for (i = 0; i < nDevCount; i++) { GetTextExtentPoint32(hDc, ppszDevices[i], _tcslen(ppszDevices[i]), &sz); if (sz.cx > pDevViewInfo->nWidth) pDevViewInfo->nWidth = sz.cx; } ReleaseDC(hwndDevView, hDc); } pEnt = (struct DevViewEntry *) malloc(sizeof(struct DevViewEntry) * (nDevCount + 1)); if (!pEnt) return FALSE; memset(pEnt, 0, sizeof(struct DevViewEntry) * (nDevCount + 1)); pDevViewInfo->pEntries = pEnt; y = 10; nHeight = 21; DevView_GetColumns(hwndDevView, &nStaticPos, &nStaticWidth, &nEditPos, &nEditWidth, &nButtonPos, &nButtonWidth); for (bool gotone = pDevViewInfo->config->mconfig->devicelist().first(dev); gotone; gotone = dev->next(dev)) { pEnt->dev = dev; pEnt->hwndStatic = win_create_window_ex_utf8(0, "STATIC", dev->device().name(), WS_VISIBLE | WS_CHILD, nStaticPos, y, nStaticWidth, nHeight, hwndDevView, NULL, NULL, NULL); pEnt->hwndEdit = win_create_window_ex_utf8(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, nEditPos, y, nEditWidth, nHeight, hwndDevView, NULL, NULL, NULL); pEnt->hwndBrowseButton = win_create_window_ex_utf8(0, "BUTTON", "...", WS_VISIBLE | WS_CHILD, nButtonPos, y, nButtonWidth, nHeight, hwndDevView, NULL, NULL, NULL); if (pEnt->hwndStatic) { SendMessage(pEnt->hwndStatic, WM_SETFONT, (WPARAM) pDevViewInfo->hFont, TRUE); } if (pEnt->hwndEdit) { SendMessage(pEnt->hwndEdit, WM_SETFONT, (WPARAM) pDevViewInfo->hFont, TRUE); l = (LONG_PTR) DevView_EditWndProc; l = SetWindowLongPtr(pEnt->hwndEdit, GWLP_WNDPROC, l); pEnt->pfnEditWndProc = (WNDPROC) l; SetWindowLongPtr(pEnt->hwndEdit, GWLP_USERDATA, (LONG_PTR) pEnt); } if (pEnt->hwndBrowseButton) { SetWindowLongPtr(pEnt->hwndBrowseButton, GWLP_USERDATA, (LONG_PTR) pEnt); } y += nHeight; pEnt++; } } DevView_Refresh(hwndDevView); return TRUE; }