UINT CALLBACK File_OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static LPINT lpnLineFeedType; switch (uMsg) { case WM_INITDIALOG: { OPENFILENAME *lpofn = (OPENFILENAME *)lParam; HWND hwndCbo = GetDlgItem(hwnd, IDC_COMBO_LINEFEED); int nSelectedIndex = 0; int i; struct tagLINEFEEDCOMBOITEM { TCHAR szText[32]; int nType; } ts[4] = { { _T("Automatic"), CRLF_STYLE_AUTOMATIC }, { _T("DOS"), CRLF_STYLE_DOS }, { _T("UNiX"), CRLF_STYLE_UNIX }, { _T("Mac"), CRLF_STYLE_MAC } }; // Set a pointer to the passed on int) lpnLineFeedType = (int *)lpofn->lCustData; for (i = 0; i < DIMOF(ts); i++) { int nIndex = ComboBox_AddString(hwndCbo, ts[i].szText); if (nIndex != CB_ERR) { if (ts[i].nType == *lpnLineFeedType) nSelectedIndex = nIndex; ComboBox_SetItemData(hwndCbo, nIndex, ts[i].nType); } } ComboBox_SetCurSel(hwndCbo, nSelectedIndex); } return (FALSE); case WM_NOTIFY: { LPNMHDR lpnmh = (LPNMHDR)lParam; switch (lpnmh->code) { case CDN_SHAREVIOLATION: SetWindowLong(hwnd, DWL_MSGRESULT, TRUE); return (TRUE); case CDN_FILEOK: { HWND hwndCbo = GetDlgItem(hwnd, IDC_COMBO_LINEFEED); int nIndex = ComboBox_GetCurSel(hwndCbo); if (nIndex != CB_ERR) *lpnLineFeedType = (int)ComboBox_GetItemData(hwndCbo, nIndex); else *lpnLineFeedType = CRLF_STYLE_AUTOMATIC; SetWindowLong(hwnd, DWL_MSGRESULT, TRUE); } return (TRUE); } } break; } return (FALSE); }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_TIMER: { int iPage = TabCtrl_GetCurSel (GetDlgItem(m_hDlg, IDC_LEFTTABS)); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: { HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS); NMHDR* pNotifyMessage = NULL; pNotifyMessage = (LPNMHDR)lParam; if (pNotifyMessage->hwndFrom == tabs) { int iPage = TabCtrl_GetCurSel (tabs); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } } break; case IDC_BREAKPOINTLIST: breakpointList->handleNotify(lParam); break; case IDC_THREADLIST: threadList->handleNotify(lParam); break; case IDC_STACKFRAMES: stackTraceView->handleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case ID_TOGGLE_PAUSE: SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0); break; case ID_DEBUG_DISPLAYMEMVIEW: changeSubWindow(SUBWIN_MEM); break; case ID_DEBUG_DISPLAYBREAKPOINTLIST: changeSubWindow(SUBWIN_BREAKPOINT); break; case ID_DEBUG_DISPLAYTHREADLIST: changeSubWindow(SUBWIN_THREADS); break; case ID_DEBUG_DISPLAYSTACKFRAMELIST: changeSubWindow(SUBWIN_STACKFRAMES); break; case ID_DEBUG_ADDBREAKPOINT: { bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false); Core_EnableStepping(false); } } break; case ID_DEBUG_STEPOVER: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver(); break; case ID_DEBUG_STEPINTO: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto(); break; case ID_DEBUG_RUNTOLINE: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; case ID_DEBUG_STEPOUT: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); break; case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_STOPGO: { if (!Core_IsStepping()) // stop { ptr->setDontRedraw(false); SetDebugMode(true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } else { // go lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false); Core_EnableStepping(false); } } break; case IDC_STEP: stepInto(); break; case IDC_STEPOVER: stepOver(); break; case IDC_STEPOUT: stepOut(); break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_MEMCHECK: SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0); break; case IDC_UPDATECALLSTACK: { HWND hDlg = m_hDlg; HWND list = GetDlgItem(hDlg,IDC_CALLSTACK); ComboBox_ResetContent(list); u32 pc = currentMIPS->pc; u32 ra = currentMIPS->r[MIPS_REG_RA]; DWORD addr = Memory::ReadUnchecked_U32(pc); int count=1; ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(pc)),pc); if (symbolMap.GetDescription(pc) != symbolMap.GetDescription(ra)) { ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(ra)),ra); count++; } //walk the stack chain while (addr != 0xFFFFFFFF && addr!=0 && count++<20) { DWORD fun = Memory::ReadUnchecked_U32(addr+4); const char *str = symbolMap.GetDescription(fun); if (strlen(str)==0) str = "(unknown)"; ComboBox_SetItemData(list, ComboBox_AddString(list,str), fun); addr = Memory::ReadUnchecked_U32(addr); } ComboBox_SetCurSel(list,0); } break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_BACKWARDLINKS: { HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box))); if (funcnum!=-1) symbolMap.FillListBoxBLinks(box,funcnum); break; } case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { char szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(szBuffer,cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: changeSubWindow(SUBWIN_NEXT); break; case WM_DEB_SETSTATUSBARTEXT: SendMessage(statusBarWnd,WM_SETTEXT,0,lParam); break; case WM_DEB_GOTOHEXEDIT: { CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); memory->gotoAddr(wParam); // display the memory viewer too HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST); HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW); HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST); ShowWindow(bp,SW_HIDE); ShowWindow(mem,SW_NORMAL); ShowWindow(threads,SW_HIDE); } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SendMessage(statusBarWnd,WM_SIZE,0,10); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = defaultRect.right - defaultRect.left - 100; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = defaultRect.bottom - defaultRect.top - 200; } return TRUE; case WM_CLOSE: Show(false); return TRUE; case WM_ACTIVATE: if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) { g_debuggerActive = true; } else { g_debuggerActive = false; } break; } return FALSE; }
//************************************************************************************ // UpdateDialogControls() // Builds the list of devices and modes for the combo boxes in the device // select dialog box. //************************************************************************************ static VOID UpdateDialogControls(HWND hDlg, D3DEnum_DeviceInfo * pCurrentDevice, DWORD dwCurrentMode, BOOL bWindowed, BOOL bStereo) { // Get access to the enumerated device list D3DEnum_DeviceInfo * pDeviceList; DWORD dwNumDevices; D3DEnum_GetDevices(&pDeviceList, &dwNumDevices); // Access to UI controls HWND hwndDevice = GetDlgItem(hDlg, IDC_DEVICE_COMBO); HWND hwndMode = GetDlgItem(hDlg, IDC_MODE_COMBO); HWND hwndWindowed = GetDlgItem(hDlg, IDC_WINDOWED_CHECKBOX); HWND hwndStereo = GetDlgItem(hDlg, IDC_STEREO_CHECKBOX); HWND hwndFullscreenText = GetDlgItem(hDlg, IDC_FULLSCREEN_TEXT); // Reset the content in each of the combo boxes ComboBox_ResetContent(hwndDevice); ComboBox_ResetContent(hwndMode); // Don't let non-GDI devices be windowed if (FALSE == pCurrentDevice->bDesktopCompatible) bWindowed = FALSE; // Add a list of devices to the device combo box for (DWORD device = 0; device < dwNumDevices; device++) { D3DEnum_DeviceInfo * pDevice = &pDeviceList[device]; // Add device name to the combo box DWORD dwItem = ComboBox_AddString(hwndDevice, pDevice->strDesc); // Set the remaining UI states for the current device if (pDevice == pCurrentDevice) { // Set the combobox selection on the current device ComboBox_SetCurSel(hwndDevice, dwItem); // Enable/set the fullscreen checkbox, as appropriate if (hwndWindowed) { EnableWindow(hwndWindowed, pDevice->bDesktopCompatible); Button_SetCheck(hwndWindowed, bWindowed); } // Enable/set the stereo checkbox, as appropriate if (hwndStereo) { EnableWindow(hwndStereo, pDevice->bStereoCompatible && !bWindowed); Button_SetCheck(hwndStereo, bStereo); } // Enable/set the fullscreen modes combo, as appropriate EnableWindow(hwndMode, !bWindowed); EnableWindow(hwndFullscreenText, !bWindowed); // Build the list of fullscreen modes for (DWORD mode = 0; mode < pDevice->dwNumModes; mode++) { DDSURFACEDESC2 * pddsdMode = &pDevice->pddsdModes[mode]; // Skip non-stereo modes, if the device is in stereo mode if (0 == (pddsdMode->ddsCaps.dwCaps2 & DDSCAPS2_STEREOSURFACELEFT)) if (bStereo) continue; TCHAR strMode[80]; wsprintf(strMode, _T("%ld x %ld x %ld"), pddsdMode->dwWidth, pddsdMode->dwHeight, pddsdMode->ddpfPixelFormat.dwRGBBitCount); // Add mode desc to the combo box DWORD dwItem = ComboBox_AddString(hwndMode, strMode); // Set the item data to identify this mode ComboBox_SetItemData(hwndMode, dwItem, mode); // Set the combobox selection on the current mode if (mode == dwCurrentMode) ComboBox_SetCurSel(hwndMode, dwItem); // Since not all modes support stereo, select a default mode in // case none was chosen yet. if (bStereo && (CB_ERR == ComboBox_GetCurSel(hwndMode))) ComboBox_SetCurSel(hwndMode, dwItem); } } } }
INT_PTR CALLBACK InputPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { // Mouse actions struct { int control; wchar_t *option; } mouse_buttons[] = { { IDC_LMB, L"LMB" }, { IDC_MMB, L"MMB" }, { IDC_RMB, L"RMB" }, { IDC_MB4, L"MB4" }, { IDC_MB5, L"MB5" }, }; struct action { wchar_t *action; wchar_t *l10n; }; struct action mouse_actions[] = { { L"Move", l10n->input_actions_move }, { L"Resize", l10n->input_actions_resize }, { L"Close", l10n->input_actions_close }, { L"Minimize", l10n->input_actions_minimize }, { L"Lower", l10n->input_actions_lower }, { L"AlwaysOnTop", l10n->input_actions_alwaysontop }, { L"Center", l10n->input_actions_center }, { L"Nothing", l10n->input_actions_nothing }, }; // Scroll struct action scroll_actions[] = { { L"AltTab", l10n->input_actions_alttab }, { L"Volume", l10n->input_actions_volume }, { L"Transparency", l10n->input_actions_transparency }, { L"Lower", l10n->input_actions_lower }, { L"Nothing", l10n->input_actions_nothing }, }; // Hotkeys struct { int control; int vkey; } hotkeys[] = { { IDC_LEFTALT, VK_LMENU }, { IDC_RIGHTALT, VK_RMENU }, { IDC_LEFTWINKEY, VK_LWIN }, { IDC_RIGHTWINKEY, VK_RWIN }, { IDC_LEFTCTRL, VK_LCONTROL }, { IDC_RIGHTCTRL, VK_RCONTROL }, }; if (msg == WM_INITDIALOG) { wchar_t txt[50]; int i; // Hotkeys unsigned int temp; int numread; GetPrivateProfileString(L"Input", L"Hotkeys", L"A4 A5", txt, ARRAY_SIZE(txt), inipath); wchar_t *pos = txt; while (*pos != '\0' && swscanf(pos,L"%02X%n",&temp,&numread) != EOF) { pos += numread; // What key was that? for (i=0; i < ARRAY_SIZE(hotkeys); i++) { if (temp == hotkeys[i].vkey) { Button_SetCheck(GetDlgItem(hwnd,hotkeys[i].control), BST_CHECKED); break; } } } } else if (msg == WM_COMMAND) { int id = LOWORD(wParam); int event = HIWORD(wParam); wchar_t txt[50] = L""; int i; if (event == CBN_SELCHANGE) { HWND control = GetDlgItem(hwnd, id); // Mouse actions for (i=0; i < ARRAY_SIZE(mouse_buttons); i++) { if (id == mouse_buttons[i].control) { int j = ComboBox_GetCurSel(control); WritePrivateProfileString(L"Input", mouse_buttons[i].option, mouse_actions[j].action, inipath); break; } } // Scroll if (id == IDC_SCROLL) { int j = ComboBox_GetCurSel(control); if (!vista && !wcscmp(scroll_actions[j].action,L"Volume")) { MessageBox(NULL, L"The Volume action only works on Vista and later. Sorry!", APP_NAME, MB_ICONINFORMATION|MB_OK|MB_TASKMODAL); GetPrivateProfileString(L"Input", L"Scroll", L"Nothing", txt, ARRAY_SIZE(txt), inipath); for (i=0; wcscmp(txt,scroll_actions[i].action) && i < ARRAY_SIZE(scroll_actions)-1; i++) {} ComboBox_SetCurSel(control, i); } else { WritePrivateProfileString(L"Input", L"Scroll", scroll_actions[j].action, inipath); } } } else if (LOWORD(wParam) == IDC_LOWERWITHMMB) { int val = Button_GetCheck(GetDlgItem(hwnd, IDC_LOWERWITHMMB)); WritePrivateProfileString(L"Input", L"LowerWithMMB", _itow(val,txt,10), inipath); } else { // Hotkeys int vkey = 0; for (i=0; i < ARRAY_SIZE(hotkeys); i++) { if (wParam == hotkeys[i].control) { vkey = hotkeys[i].vkey; break; } } if (!vkey) return FALSE; wchar_t keys[50]; GetPrivateProfileString(L"Input", L"Hotkeys", L"", keys, ARRAY_SIZE(keys), inipath); int add = Button_GetCheck(GetDlgItem(hwnd,wParam)); if (add) { if (*keys != '\0') { wcscat(keys, L" "); } swprintf(txt, L"%s%02X", keys, vkey); } else { unsigned int temp; int numread; wchar_t *pos = keys; while (*pos != '\0' && swscanf(pos,L"%02X%n",&temp,&numread) != EOF) { if (temp == vkey) { wcsncpy(txt, keys, pos-keys); wcscat(txt, pos+numread); break; } pos += numread; } } WritePrivateProfileString(L"Input", L"Hotkeys", txt, inipath); } UpdateSettings(); } else if (msg == WM_NOTIFY) { LPNMHDR pnmh = (LPNMHDR)lParam; if (pnmh->code == PSN_SETACTIVE) { wchar_t txt[50]; int i, j, sel; // Mouse actions for (i=0; i < ARRAY_SIZE(mouse_buttons); i++) { HWND control = GetDlgItem(hwnd, mouse_buttons[i].control); ComboBox_ResetContent(control); GetPrivateProfileString(L"Input", mouse_buttons[i].option, L"Nothing", txt, ARRAY_SIZE(txt), inipath); sel = ARRAY_SIZE(mouse_actions)-1; for (j=0; j < ARRAY_SIZE(mouse_actions); j++) { ComboBox_AddString(control, mouse_actions[j].l10n); if (!wcscmp(txt,mouse_actions[j].action)) { sel = j; } } ComboBox_SetCurSel(control, sel); } // Scroll HWND control = GetDlgItem(hwnd, IDC_SCROLL); ComboBox_ResetContent(control); GetPrivateProfileString(L"Input", L"Scroll", L"Nothing", txt, ARRAY_SIZE(txt), inipath); sel = ARRAY_SIZE(scroll_actions)-1; for (j=0; j < ARRAY_SIZE(scroll_actions); j++) { ComboBox_AddString(control, scroll_actions[j].l10n); if (!wcscmp(txt,scroll_actions[j].action)) { sel = j; } } ComboBox_SetCurSel(control, sel); // Update text SetDlgItemText(hwnd, IDC_MOUSE_BOX, l10n->input_mouse_box); SetDlgItemText(hwnd, IDC_LMB_HEADER, l10n->input_mouse_lmb); SetDlgItemText(hwnd, IDC_MMB_HEADER, l10n->input_mouse_mmb); SetDlgItemText(hwnd, IDC_RMB_HEADER, l10n->input_mouse_rmb); SetDlgItemText(hwnd, IDC_MB4_HEADER, l10n->input_mouse_mb4); SetDlgItemText(hwnd, IDC_MB5_HEADER, l10n->input_mouse_mb5); SetDlgItemText(hwnd, IDC_SCROLL_HEADER, l10n->input_mouse_scroll); SetDlgItemText(hwnd, IDC_LOWERWITHMMB, l10n->input_mouse_lowerwithmmb); SetDlgItemText(hwnd, IDC_HOTKEYS_BOX, l10n->input_hotkeys_box); SetDlgItemText(hwnd, IDC_LEFTALT, l10n->input_hotkeys_leftalt); SetDlgItemText(hwnd, IDC_RIGHTALT, l10n->input_hotkeys_rightalt); SetDlgItemText(hwnd, IDC_LEFTWINKEY, l10n->input_hotkeys_leftwinkey); SetDlgItemText(hwnd, IDC_RIGHTWINKEY, l10n->input_hotkeys_rightwinkey); SetDlgItemText(hwnd, IDC_LEFTCTRL, l10n->input_hotkeys_leftctrl); SetDlgItemText(hwnd, IDC_RIGHTCTRL, l10n->input_hotkeys_rightctrl); SetDlgItemText(hwnd, IDC_HOTKEYS_MORE, l10n->input_hotkeys_more); } } LinkProc(hwnd, msg, wParam, lParam); return FALSE; }
INT_PTR CALLBACK PhpOptionsGeneralDlgProc( _In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ) { switch (uMsg) { case WM_INITDIALOG: { HWND comboBoxHandle; ULONG i; LOGFONT font; PhpPageInit(hwndDlg); comboBoxHandle = GetDlgItem(hwndDlg, IDC_MAXSIZEUNIT); for (i = 0; i < sizeof(PhSizeUnitNames) / sizeof(PWSTR); i++) ComboBox_AddString(comboBoxHandle, PhSizeUnitNames[i]); SetDlgItemText(hwndDlg, IDC_SEARCHENGINE, PhaGetStringSetting(L"SearchEngine")->Buffer); SetDlgItemText(hwndDlg, IDC_PEVIEWER, PhaGetStringSetting(L"ProgramInspectExecutables")->Buffer); if (PhMaxSizeUnit != -1) ComboBox_SetCurSel(comboBoxHandle, PhMaxSizeUnit); else ComboBox_SetCurSel(comboBoxHandle, sizeof(PhSizeUnitNames) / sizeof(PWSTR) - 1); SetDlgItemInt(hwndDlg, IDC_ICONPROCESSES, PhGetIntegerSetting(L"IconProcesses"), FALSE); SetDlgItemCheckForSetting(hwndDlg, IDC_ALLOWONLYONEINSTANCE, L"AllowOnlyOneInstance"); SetDlgItemCheckForSetting(hwndDlg, IDC_HIDEONCLOSE, L"HideOnClose"); SetDlgItemCheckForSetting(hwndDlg, IDC_HIDEONMINIMIZE, L"HideOnMinimize"); SetDlgItemCheckForSetting(hwndDlg, IDC_COLLAPSESERVICES, L"CollapseServicesOnStart"); SetDlgItemCheckForSetting(hwndDlg, IDC_ICONSINGLECLICK, L"IconSingleClick"); SetDlgItemCheckForSetting(hwndDlg, IDC_ICONTOGGLESVISIBILITY, L"IconTogglesVisibility"); SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLEPLUGINS, L"EnablePlugins"); ReadCurrentUserRun(); if (CurrentUserRunPresent) { Button_SetCheck(GetDlgItem(hwndDlg, IDC_STARTATLOGON), BST_CHECKED); if (CurrentUserRunStartHidden) Button_SetCheck(GetDlgItem(hwndDlg, IDC_STARTHIDDEN), BST_CHECKED); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_STARTHIDDEN), FALSE); } // Set the font of the button for a nice preview. if (GetCurrentFont(&font)) { CurrentFontInstance = CreateFontIndirect(&font); if (CurrentFontInstance) SendMessage(GetDlgItem(hwndDlg, IDC_FONT), WM_SETFONT, (WPARAM)CurrentFontInstance, TRUE); } } break; case WM_DESTROY: { if (CurrentFontInstance) DeleteObject(CurrentFontInstance); PhClearReference(&NewFontSelection); } break; case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_STARTATLOGON: { EnableWindow(GetDlgItem(hwndDlg, IDC_STARTHIDDEN), Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTATLOGON)) == BST_CHECKED); } break; case IDC_FONT: { LOGFONT font; CHOOSEFONT chooseFont; if (!GetCurrentFont(&font)) { // Can't get LOGFONT from the existing setting, probably // because the user hasn't ever chosen a font before. // Set the font to something familiar. GetObject((HFONT)SendMessage(PhMainWndHandle, WM_PH_GET_FONT, 0, 0), sizeof(LOGFONT), &font); } memset(&chooseFont, 0, sizeof(CHOOSEFONT)); chooseFont.lStructSize = sizeof(CHOOSEFONT); chooseFont.hwndOwner = hwndDlg; chooseFont.lpLogFont = &font; chooseFont.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; if (ChooseFont(&chooseFont)) { PhMoveReference(&NewFontSelection, PhBufferToHexString((PUCHAR)&font, sizeof(LOGFONT))); // Update the button's font. if (CurrentFontInstance) DeleteObject(CurrentFontInstance); CurrentFontInstance = CreateFontIndirect(&font); SendMessage(GetDlgItem(hwndDlg, IDC_FONT), WM_SETFONT, (WPARAM)CurrentFontInstance, TRUE); } } break; } } break; case WM_NOTIFY: { LPNMHDR header = (LPNMHDR)lParam; switch (header->code) { case PSN_APPLY: { BOOLEAN startAtLogon; BOOLEAN startHidden; PhSetStringSetting2(L"SearchEngine", &(PhaGetDlgItemText(hwndDlg, IDC_SEARCHENGINE)->sr)); PhSetStringSetting2(L"ProgramInspectExecutables", &(PhaGetDlgItemText(hwndDlg, IDC_PEVIEWER)->sr)); PhSetIntegerSetting(L"MaxSizeUnit", PhMaxSizeUnit = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_MAXSIZEUNIT))); PhSetIntegerSetting(L"IconProcesses", GetDlgItemInt(hwndDlg, IDC_ICONPROCESSES, NULL, FALSE)); SetSettingForDlgItemCheck(hwndDlg, IDC_ALLOWONLYONEINSTANCE, L"AllowOnlyOneInstance"); SetSettingForDlgItemCheck(hwndDlg, IDC_HIDEONCLOSE, L"HideOnClose"); SetSettingForDlgItemCheck(hwndDlg, IDC_HIDEONMINIMIZE, L"HideOnMinimize"); SetSettingForDlgItemCheck(hwndDlg, IDC_COLLAPSESERVICES, L"CollapseServicesOnStart"); SetSettingForDlgItemCheck(hwndDlg, IDC_ICONSINGLECLICK, L"IconSingleClick"); SetSettingForDlgItemCheck(hwndDlg, IDC_ICONTOGGLESVISIBILITY, L"IconTogglesVisibility"); SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLEPLUGINS, L"EnablePlugins"); startAtLogon = Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTATLOGON)) == BST_CHECKED; startHidden = Button_GetCheck(GetDlgItem(hwndDlg, IDC_STARTHIDDEN)) == BST_CHECKED; WriteCurrentUserRun(startAtLogon, startHidden); if (NewFontSelection) { PhSetStringSetting2(L"Font", &NewFontSelection->sr); PostMessage(PhMainWndHandle, WM_PH_UPDATE_FONT, 0, 0); } SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); } return TRUE; } } break; } return FALSE; }
/** * This is the dialog procedure for the advanced contact information propertysheetpage. * * @param hDlg - handle to the dialog window * @param uMsg - the message to handle * @param wParam - parameter * @param lParam - parameter * * @return different values **/ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); if (pCtrlList) { LPIDSTRLIST pList; UINT nList; HFONT hBoldFont; PSGetBoldFont(hDlg, hBoldFont); SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0); TranslateDialogDefault(hDlg); SetTimer(hDlg, 1, 5000, NULL); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_TCHAR)); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_TCHAR)); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_ORIGIN_CITY, DBVT_TCHAR)); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_ORIGIN_STATE, DBVT_TCHAR)); GetCountryList(&nList, &pList); pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList)); pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL)); } } break; case WM_NOTIFY: { switch (((LPNMHDR) lParam)->idFrom) { case 0: { MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; switch (((LPNMHDR) lParam)->code) { case PSN_INFOCHANGED: { if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; if (hContact) { MTime mt; if (mt.DBGetStamp(hContact, USERINFO, SET_CONTACT_ADDEDTIME) && strstr(pszProto, "ICQ")) { DWORD dwStamp; dwStamp = DB::Contact::WhenAdded(db_get_dw(hContact, pszProto, "UIN", 0), pszProto); if (dwStamp > 0) mt.FromStampAsUTC(dwStamp); } if (mt.IsValid()) { TCHAR szTime[MAX_PATH]; LPTSTR ptr; mt.UTCToLocal(); mt.DateFormatLong(szTime, _countof(szTime)); mir_tstrcat(szTime, _T(" - ")); ptr = szTime + mir_tstrlen(szTime); mt.TimeFormat(ptr, _countof(szTime) - (ptr - szTime)); SetDlgItemText(hDlg, TXT_DATEADDED, szTime); } } SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); } break; case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { { ICO_COMMON_ADDRESS, STM_SETIMAGE, ICO_ADDRESS }, { ICO_COMMON_CLOCK, STM_SETIMAGE, ICO_CLOCK }, }; IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon)); } } } } /* switch (((LPNMHDR)lParam)->idFrom) */ } break; case WM_COMMAND: { switch (LOWORD(wParam)) { case EDIT_COUNTRY: if (HIWORD(wParam) == CBN_SELCHANGE) { LPIDSTRLIST pd = (LPIDSTRLIST)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); UpDate_CountryIcon(GetDlgItem(hDlg, ICO_COUNTRY), pd->nID); } break; } } break; case WM_TIMER: { TCHAR szTime[32]; CTzCombo::GetObj(hDlg, EDIT_TIMEZONE)->GetTime(szTime, _countof(szTime)); SetDlgItemText(hDlg, TXT_TIME, szTime); break; } case WM_DESTROY: KillTimer(hDlg, 1); } return PSPBaseProc(hDlg, uMsg, wParam, lParam); }
static BOOL CALLBACK SpectrumPopupProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) { switch(msg) { case WM_INITDIALOG: SetWindowLongPtr(wnd,DWLP_USER,lp); { spec_param * ptr = reinterpret_cast<spec_param*>(lp); ptr->m_scope.initialize(FindOwningPopup(wnd)); uSendDlgItemMessage(wnd, IDC_BARS, BM_SETCHECK, ptr->ptr->mode == MODE_BARS, 0); HWND wnd_combo = GetDlgItem(wnd, IDC_FRAME_COMBO); EnableWindow(wnd_combo, ptr->b_show_frame); if (ptr->b_show_frame) { ComboBox_AddString(wnd_combo, _T("None")); ComboBox_AddString(wnd_combo, _T("Sunken")); ComboBox_AddString(wnd_combo, _T("Grey")); ComboBox_SetCurSel(wnd_combo, ptr->frame); } wnd_combo = GetDlgItem(wnd, IDC_SCALE); ComboBox_AddString(wnd_combo, _T("Linear")); ComboBox_AddString(wnd_combo, _T("Logarithmic")); ComboBox_SetCurSel(wnd_combo, ptr->m_scale); wnd_combo = GetDlgItem(wnd, IDC_VERTICAL_SCALE); ComboBox_AddString(wnd_combo, _T("Linear")); ComboBox_AddString(wnd_combo, _T("Logarithmic")); ComboBox_SetCurSel(wnd_combo, ptr->m_vertical_scale); } return TRUE; case WM_ERASEBKGND: SetWindowLongPtr(wnd, DWLP_MSGRESULT, TRUE); return TRUE; case WM_PAINT: uih::HandleModernBackgroundPaint(wnd, GetDlgItem(wnd, IDOK)); return TRUE; case WM_CTLCOLORSTATIC: { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); if (GetDlgItem(wnd, IDC_PATCH_FORE) == (HWND)lp) { HDC dc =(HDC)wp; if (!ptr->br_fore) { ptr->br_fore = CreateSolidBrush(ptr->cr_fore); } return (BOOL)ptr->br_fore; } else if (GetDlgItem(wnd, IDC_PATCH_BACK) == (HWND)lp) { HDC dc =(HDC)wp; if (!ptr->br_back) { ptr->br_back = CreateSolidBrush(ptr->cr_back); } return (BOOL)ptr->br_back; } else return (BOOL)GetSysColorBrush(COLOR_3DHIGHLIGHT); } break; case WM_COMMAND: switch(wp) { case IDCANCEL: EndDialog(wnd,0); return TRUE; case IDC_CHANGE_BACK: { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); COLORREF COLOR = ptr->cr_back; COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_BACK),GetSysColor(COLOR_3DFACE),0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (uChooseColor(&COLOR, wnd, &COLORS[0])) { ptr->cr_back = COLOR; ptr->flush_back(); RedrawWindow(GetDlgItem(wnd, IDC_PATCH_BACK), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW); } } break; case IDC_CHANGE_FORE: { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); COLORREF COLOR = ptr->cr_fore; COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_TEXT),GetSysColor(COLOR_3DSHADOW),0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (uChooseColor(&COLOR, wnd, &COLORS[0])) { ptr->cr_fore = COLOR; ptr->flush_fore(); RedrawWindow(GetDlgItem(wnd, IDC_PATCH_FORE), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW); } } break; case IDC_BARS: { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); ptr->mode = (uSendMessage((HWND)lp, BM_GETCHECK, 0, 0) != TRUE ? MODE_STANDARD : MODE_BARS); } break; case IDC_FRAME_COMBO|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); ptr->frame = ComboBox_GetCurSel(HWND(lp)); } break; case IDC_SCALE|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); ptr->m_scale = ComboBox_GetCurSel(HWND(lp)); } break; case IDC_VERTICAL_SCALE|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); ptr->m_vertical_scale = ComboBox_GetCurSel(HWND(lp)); } break; case IDOK: { spec_param * ptr = reinterpret_cast<spec_param*>(GetWindowLongPtr(wnd,DWLP_USER)); EndDialog(wnd,1); } return TRUE; default: return FALSE; } default: return FALSE; } }
//----------------------------------------------------------------------------- // Checks if a valid entry in the combo box is selected. //----------------------------------------------------------------------------- bool DeviceEnumeration::ComboBoxSomethingSelected( HWND dialog, int id ) { HWND control = GetDlgItem( dialog, id ); int index = ComboBox_GetCurSel( control ); return ( index >= 0 ); }
//----------------------------------------------------------------------------- // Handles window messages for the graphics settings dialog. //----------------------------------------------------------------------------- INT_PTR DeviceEnumeration::SettingsDialogProc( HWND dialog, UINT msg, WPARAM wparam, LPARAM lparam ) { switch( msg ) { case WM_INITDIALOG: { // Display the adapter details and its driver version. char version[16]; sprintf( version, "%d", LOWORD( m_adapter.DriverVersion.LowPart ) ); Edit_SetText( GetDlgItem( dialog, IDC_DISPLAY_ADAPTER ), m_adapter.Description ); Edit_SetText( GetDlgItem( dialog, IDC_DRIVER_VERSION ), version ); // Check if the settings script has anything in it. if( m_settingsScript->GetBoolData( "windowed" ) == NULL ) { // The settings script is empty, so default to windowed mode. CheckDlgButton( dialog, IDC_WINDOWED, m_windowed = true ); } else { // Load the window mode state. CheckDlgButton( dialog, IDC_WINDOWED, m_windowed = *m_settingsScript->GetBoolData( "windowed" ) ); CheckDlgButton( dialog, IDC_FULLSCREEN, !m_windowed ); // Check if running in fullscreen mode. if( m_windowed == false ) { // Enable all the fullscreen controls. EnableWindow( GetDlgItem( dialog, IDC_VSYNC ), true ); EnableWindow( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ), true ); EnableWindow( GetDlgItem( dialog, IDC_RESOLUTION ), true ); EnableWindow( GetDlgItem( dialog, IDC_REFRESH_RATE ), true ); // Load the vsync state. CheckDlgButton( dialog, IDC_VSYNC, m_vsync = *m_settingsScript->GetBoolData( "vsync" ) ); // Fill in the display formats combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) if( !ComboBoxContainsText( dialog, IDC_DISPLAY_FORMAT, m_displayModes->GetCurrent()->bpp ) ) ComboBoxAdd( dialog, IDC_DISPLAY_FORMAT, (void*)m_displayModes->GetCurrent()->mode.Format, m_displayModes->GetCurrent()->bpp ); ComboBoxSelect( dialog, IDC_DISPLAY_FORMAT, *m_settingsScript->GetNumberData( "bpp" ) ); char text[16]; // Fill in the resolutions combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_RESOLUTION ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) { if( m_displayModes->GetCurrent()->mode.Format == (D3DFORMAT)PtrToUlong( ComboBoxSelected( dialog, IDC_COLOUR_DEPTH ) ) ) { sprintf( text, "%d x %d", m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ); if (!ComboBoxContainsText( dialog, IDC_RESOLUTION, text ) ) ComboBoxAdd( dialog, IDC_RESOLUTION, (void*)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ), text ); } } ComboBoxSelect( dialog, IDC_RESOLUTION, *m_settingsScript->GetNumberData( "resolution" ) ); // Fill in the refresh rates combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_REFRESH_RATE ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) { if( (DWORD)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ) == (DWORD)PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) ) { sprintf( text, "%d Hz", m_displayModes->GetCurrent()->mode.RefreshRate ); if (!ComboBoxContainsText( dialog, IDC_REFRESH_RATE, text ) ) ComboBoxAdd( dialog, IDC_REFRESH_RATE, (void*)m_displayModes->GetCurrent()->mode.RefreshRate, text ); } } ComboBoxSelect( dialog, IDC_REFRESH_RATE, *m_settingsScript->GetNumberData( "refresh" ) ); } } return true; } case WM_COMMAND: { switch( LOWORD(wparam) ) { case IDOK: { // Store the details of the selected display mode. m_selectedDisplayMode.Width = LOWORD( PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) ); m_selectedDisplayMode.Height = HIWORD( PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) ); m_selectedDisplayMode.RefreshRate = PtrToUlong( ComboBoxSelected( dialog, IDC_REFRESH_RATE ) ); m_selectedDisplayMode.Format = (D3DFORMAT)PtrToUlong( ComboBoxSelected( dialog, IDC_DISPLAY_FORMAT ) ); m_windowed = IsDlgButtonChecked( dialog, IDC_WINDOWED ) ? true : false; m_vsync = IsDlgButtonChecked( dialog, IDC_VSYNC ) ? true : false; // Destroy the display modes list. SAFE_DELETE( m_displayModes ); // Get the selected index from each combo box. long bpp = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ) ); long resolution = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_RESOLUTION ) ); long refresh = ComboBox_GetCurSel( GetDlgItem( dialog, IDC_REFRESH_RATE ) ); // Check if the settings script has anything in it. if( m_settingsScript->GetBoolData( "windowed" ) == NULL ) { // Add all the settings to the script. m_settingsScript->AddVariable( "windowed", VARIABLE_BOOL, &m_windowed ); m_settingsScript->AddVariable( "vsync", VARIABLE_BOOL, &m_vsync ); m_settingsScript->AddVariable( "bpp", VARIABLE_NUMBER, &bpp ); m_settingsScript->AddVariable( "resolution", VARIABLE_NUMBER, &resolution ); m_settingsScript->AddVariable( "refresh", VARIABLE_NUMBER, &refresh ); } else { // Set all the settings. m_settingsScript->SetVariable( "windowed", &m_windowed ); m_settingsScript->SetVariable( "vsync", &m_vsync ); m_settingsScript->SetVariable( "bpp", &bpp ); m_settingsScript->SetVariable( "resolution", &resolution ); m_settingsScript->SetVariable( "refresh", &refresh ); } // Save all the settings out to the settings script. m_settingsScript->SaveScript(); // Destroy the settings script. SAFE_DELETE( m_settingsScript ); // Close the dialog. EndDialog( dialog, IDOK ); return true; } case IDCANCEL: { // Destroy the display modes list. SAFE_DELETE( m_displayModes ); // Destroy the settings script. SAFE_DELETE( m_settingsScript ); EndDialog( dialog, IDCANCEL ); return true; } case IDC_COLOUR_DEPTH: { if( CBN_SELCHANGE == HIWORD(wparam) ) { char res[16]; DWORD selectedRes = (DWORD)PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ); // Update the resolution combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_RESOLUTION ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) { if( m_displayModes->GetCurrent()->mode.Format == (D3DFORMAT)PtrToUlong( ComboBoxSelected( dialog, IDC_COLOUR_DEPTH ) ) ) { sprintf( res, "%d x %d", m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ); if( !ComboBoxContainsText( dialog, IDC_RESOLUTION, res ) ) { ComboBoxAdd( dialog, IDC_RESOLUTION, (void*)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ), res ); if( selectedRes == (DWORD)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ) ) ComboBoxSelect( dialog, IDC_RESOLUTION, (void*)selectedRes ); } } } if( ComboBoxSelected( dialog, IDC_RESOLUTION ) == NULL ) ComboBoxSelect( dialog, IDC_RESOLUTION, 0 ); } return true; } case IDC_RESOLUTION: { if( CBN_SELCHANGE == HIWORD(wparam) ) { char refresh[16]; DWORD selectedRefresh = (DWORD)PtrToUlong( ComboBoxSelected( dialog, IDC_REFRESH_RATE ) ); // Update the refresh rate combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_REFRESH_RATE ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) { if( (DWORD)MAKELONG( m_displayModes->GetCurrent()->mode.Width, m_displayModes->GetCurrent()->mode.Height ) == (DWORD)PtrToUlong( ComboBoxSelected( dialog, IDC_RESOLUTION ) ) ) { sprintf( refresh, "%d Hz", m_displayModes->GetCurrent()->mode.RefreshRate ); if( !ComboBoxContainsText( dialog, IDC_REFRESH_RATE, refresh ) ) { ComboBoxAdd( dialog, IDC_REFRESH_RATE, (void*)m_displayModes->GetCurrent()->mode.RefreshRate, refresh ); if( selectedRefresh == m_displayModes->GetCurrent()->mode.RefreshRate ) ComboBoxSelect( dialog, IDC_REFRESH_RATE, (void*)selectedRefresh ); } } } if( ComboBoxSelected( dialog, IDC_REFRESH_RATE ) == NULL ) ComboBoxSelect( dialog, IDC_REFRESH_RATE, 0 ); } return true; } case IDC_WINDOWED: case IDC_FULLSCREEN: { // Check if the user has change to windowed or fullscreen mode. if( IsDlgButtonChecked( dialog, IDC_WINDOWED ) ) { // Clear and disable all the fullscreen controls. ComboBox_ResetContent( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ) ); ComboBox_ResetContent( GetDlgItem( dialog, IDC_RESOLUTION ) ); ComboBox_ResetContent( GetDlgItem( dialog, IDC_REFRESH_RATE ) ); CheckDlgButton( dialog, IDC_VSYNC, false ); EnableWindow( GetDlgItem( dialog, IDC_VSYNC ), false ); EnableWindow( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ), false ); EnableWindow( GetDlgItem( dialog, IDC_RESOLUTION ), false ); EnableWindow( GetDlgItem( dialog, IDC_REFRESH_RATE ), false ); } else { // Enable all the fullscreen controls. EnableWindow( GetDlgItem( dialog, IDC_VSYNC ), true ); EnableWindow( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ), true ); EnableWindow( GetDlgItem( dialog, IDC_RESOLUTION ), true ); EnableWindow( GetDlgItem( dialog, IDC_REFRESH_RATE ), true ); // Fill in the display formats combo box. ComboBox_ResetContent( GetDlgItem( dialog, IDC_DISPLAY_FORMAT ) ); m_displayModes->Iterate( true ); while( m_displayModes->Iterate() ) { if( !ComboBoxContainsText( dialog, IDC_DISPLAY_FORMAT, m_displayModes->GetCurrent()->bpp ) ) ComboBoxAdd( dialog, IDC_DISPLAY_FORMAT, (void*)m_displayModes->GetCurrent()->mode.Format, m_displayModes->GetCurrent()->bpp ); } ComboBoxSelect( dialog, IDC_DISPLAY_FORMAT, 0 ); } return true; } } } } return false; }
BOOL CALLBACK AnchorDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, AnchorObject *th) { TCHAR text[MAX_PATH]; int c, camIndex, i, type; HWND cb; Tab<INode *> cameras; switch (message) { case WM_INITDIALOG: th->ParentPickButton = GetICustButton(GetDlgItem(hDlg, IDC_PICK_PARENT)); th->ParentPickButton->SetType(CBT_CHECK); th->ParentPickButton->SetButtonDownNotify(TRUE); th->ParentPickButton->SetHighlightColor(GREEN_WASH); th->ParentPickButton->SetCheck(FALSE); th->dlgPrevSel = -1; th->hRollup = hDlg; if (th->triggerObject) Static_SetText(GetDlgItem(hDlg, IDC_TRIGGER_OBJ), th->triggerObject->GetName()); th->pblock->GetValue(PB_AN_TYPE, th->iObjParams->GetTime(), type, FOREVER); th->isJump = type == 0; EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump); GetCameras(th->iObjParams->GetRootNode(), &cameras); c = cameras.Count(); cb = GetDlgItem(hDlg, IDC_CAMERA); camIndex = -1; for (i = 0; i < c; i++) { // add the name to the list TSTR name = cameras[i]->GetName(); int ind = ComboBox_AddString(cb, name.data()); ComboBox_SetItemData(cb, ind, cameras[i]); if (cameras[i] == th->cameraObject) camIndex = i; } if (camIndex != -1) ComboBox_SelectString(cb, 0, cameras[camIndex]->GetName()); Edit_SetText(GetDlgItem(hDlg, IDC_DESC), th->description.data()); Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->URL.data()); Edit_SetText(GetDlgItem(hDlg, IDC_PARAMETER), th->parameter.data()); if (pickMode) SetPickMode(th); return TRUE; case WM_DESTROY: if (pickMode) SetPickMode(th); //th->iObjParams->ClearPickMode(); //th->previousMode = NULL; ReleaseICustButton(th->ParentPickButton); return FALSE; case WM_MOUSEACTIVATE: return FALSE; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BOOKMARKS: { // do bookmarks TSTR url, cam, desc; if (GetBookmarkURL(th->iObjParams, &url, &cam, &desc)) { // get the new URL information; Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), url.data()); Edit_SetText(GetDlgItem(hDlg, IDC_DESC), desc.data()); } } break; case IDC_CAMERA: if (HIWORD(wParam) == CBN_SELCHANGE) { cb = GetDlgItem(hDlg, IDC_CAMERA); int sel = ComboBox_GetCurSel(cb); INode *rtarg; rtarg = (INode *)ComboBox_GetItemData(cb, sel); th->ReplaceReference(2, rtarg); } break; case IDC_HYPERLINK: th->isJump = IsDlgButtonChecked(hDlg, IDC_HYPERLINK); EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump); break; case IDC_SET_CAMERA: th->isJump = !IsDlgButtonChecked(hDlg, IDC_SET_CAMERA); EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump); EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump); break; case IDC_PICK_PARENT: // Pick an object from the scene // Set the pickmode... switch (HIWORD(wParam)) { case BN_BUTTONDOWN: SetPickMode(th); /* if (th->previousMode) { // reset the command mode th->iObjParams->SetCommandMode(th->previousMode); th->previousMode = NULL; } else { th->previousMode = th->iObjParams->GetCommandMode(); theParentPick.SetAnchor(th); th->iObjParams->SetPickMode(&theParentPick); } */ break; } return TRUE; case IDC_ANCHOR_URL: switch (HIWORD(wParam)) { case EN_SETFOCUS: DisableAccelerators(); break; case EN_KILLFOCUS: EnableAccelerators(); break; case EN_CHANGE: Edit_GetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), text, MAX_PATH); th->URL = text; } break; case IDC_DESC: switch (HIWORD(wParam)) { case EN_SETFOCUS: DisableAccelerators(); break; case EN_KILLFOCUS: EnableAccelerators(); break; case EN_CHANGE: Edit_GetText(GetDlgItem(hDlg, IDC_DESC), text, MAX_PATH); th->description = text; } break; case IDC_PARAMETER: switch (HIWORD(wParam)) { case EN_SETFOCUS: DisableAccelerators(); break; case EN_KILLFOCUS: EnableAccelerators(); break; case EN_CHANGE: Edit_GetText(GetDlgItem(hDlg, IDC_PARAMETER), text, MAX_PATH); th->parameter = text; } break; default: return FALSE; } } return FALSE; }
void CConfigDialog::OnOK(void) { char szTemp[2048]; int nMaxChar = 2048; Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_LINUS), szTemp, nMaxChar); TestConfig::i().m_sLinusUrl = szTemp; Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_WSADDR), szTemp, nMaxChar); TestConfig::i().m_sWSUrl = szTemp; TestConfig::i().m_bCalliope = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_CALLIOPE)); TestConfig::i().m_bLoopback = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_LOOPBACK)); TestConfig::i().m_bEnableCVO = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_CVO)); TestConfig::i().m_bAppshare = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_AS)); TestConfig::i().m_bSharer = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ISSHARER)); TestConfig::i().m_bMultiStreamEnable = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_MULTI)); TestConfig::i().m_bQoSEnable = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_QOS)); TestConfig::i().m_audioParam["enableQos"] = TestConfig::i().m_bQoSEnable; TestConfig::i().m_videoParam["enableQos"] = TestConfig::i().m_bQoSEnable; bool enableFec = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_FEC)); if (enableFec) { TestConfig::i().m_videoParam["fecParams"]["bEnableFec"] = true; TestConfig::i().m_videoParam["fecParams"]["uClockRate"] = 8000; TestConfig::i().m_videoParam["fecParams"]["uPayloadType"] = 111; } bool enableDtlsSrtp = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_DTLS_SRTP)); if (enableDtlsSrtp) { TestConfig::i().m_bEnableDtlsSrtp = true; } else { TestConfig::i().m_bEnableDtlsSrtp = false; } TestConfig::i().m_bASPreview = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ASPREVIEW)); HWND hCheckFilterSelf = GetDlgItem(m_hWindow, ID_CHECK_FILTER_SELF); if ( hCheckFilterSelf ) TestConfig::i().m_bShareFilterSelf = Button_GetCheck(hCheckFilterSelf); if (TestConfig::i().m_bAppshare){ HWND hScreenSource = GetDlgItem(m_hWindow, IDC_COMBO_AS_SOURCE); int nIndex = ComboBox_GetCurSel(hScreenSource); // char szSelectSource[MAX_PATH] = { 0 }; WCHAR szSelectSource[MAX_PATH] = { 0 }; // ComboBox_GetLBText(hScreenSource, nIndex, szSelectSource); //TestConfig::i().m_strScreenSharingAutoLaunchSourceName = "DISPLAY"; SendMessageW(hScreenSource, CB_GETLBTEXT, nIndex, (LPARAM)szSelectSource); char szUtf8SelectSource[MAX_PATH] = { 0 }; WideCharToMultiByte(CP_UTF8, 0, szSelectSource, wcslen(szSelectSource), szUtf8SelectSource, MAX_PATH, NULL, NULL); std::string strSourceName = szUtf8SelectSource; strSourceName = strSourceName.substr(0, strSourceName.find(":")); TestConfig::i().m_strScreenSharingAutoLaunchSourceName = strSourceName.c_str(); if (TestConfig::i().m_bCalliope){ // TestConfig::i().m_bFakeVideoByShare = false; TestConfig::i().m_bHasVideo = true; } TestConfig::i().m_bAutoStart = true; } if (!TestConfig::i().m_bLoopback) { TestConfig::i().m_bSharer = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ISSHARER)); } TestConfig::i().m_audioDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE)); TestConfig::i().m_videoDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE)); TestConfig::i().m_shareDebugOption["enableICE"] = !!Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_ICE)); HWND hVideoSize = GetDlgItem(m_hWindow, ID_COMBO_VIDEOSIZE); HWND hActiveVideo = GetDlgItem(m_hWindow, ID_COMBO_ACTIVEVIDEO_COUNT); TestConfig::i().m_nVideoSize = ComboBox_GetItemData(hVideoSize, ComboBox_GetCurSel(hVideoSize)); TestConfig::i().m_uMaxVideoStreams = ComboBox_GetItemData(hActiveVideo, ComboBox_GetCurSel(hActiveVideo)); TestConfig::i().m_bNoSignal = Button_GetCheck(GetDlgItem(m_hWindow, ID_CHECK_NOSIGNAL));; Edit_GetText(GetDlgItem(m_hWindow, ID_EDIT_VENUEURL), szTemp, nMaxChar); TestConfig::i().m_sVenuUrl = szTemp; EndDialog(m_hWindow, IDOK); }
//----------------------------------------------------------------------------- // Name: ComboBoxSomethingSelected // Desc: Returns whether any entry in the combo box is selected. This is // more useful than ComboBoxSelected() when you need to distinguish // between having no item selected vs. having an item selected whose // itemData is NULL. //----------------------------------------------------------------------------- bool CD3DSettingsDialog::ComboBoxSomethingSelected( int id ) { HWND hwndCtrl = GetDlgItem( m_hDlg, id ); int index = ComboBox_GetCurSel( hwndCtrl ); return ( index >= 0 ); }
/* This function handles the WM_COMMAND message. */ void FASTCALL SortMailFrom_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify ) { switch( id ) { case IDD_EXISTING: EnableControl( hwnd, IDD_LIST, TRUE ); EnableControl( hwnd, IDD_PAD2, FALSE ); EnableControl( hwnd, IDD_EDIT, FALSE ); break; case IDD_NEW: EnableControl( hwnd, IDD_LIST, FALSE ); EnableControl( hwnd, IDD_PAD2, TRUE ); EnableControl( hwnd, IDD_EDIT, TRUE ); SetFocus( GetDlgItem( hwnd, IDD_EDIT ) ); break; case IDOK: /* Get the destination folder. */ if( IsDlgButtonChecked( hwnd, IDD_EXISTING ) ) { HWND hwndList; int index; VERIFY( hwndList = GetDlgItem( hwnd, IDD_LIST ) ); index = ComboBox_GetCurSel( hwndList ); ASSERT( CB_ERR != index ); ptlDest = (PTL)ComboBox_GetItemData( hwndList, index ); ASSERT( NULL != ptlDest ); } else { char szMailBox[ LEN_MAILBOX ]; PCL pcl; /* Get the destination folder name. */ GetDlgItemText( hwnd, IDD_EDIT, szMailBox, sizeof( szMailBox ) ); StripLeadingTrailingSpaces( szMailBox ); if( !IsValidFolderName( hwnd, szMailBox ) ) break; if( strchr( szMailBox, ' ' ) != NULL ) { wsprintf( lpTmpBuf, GS(IDS_STR1154), ' ' ); fMessageBox( hwnd, 0, lpTmpBuf, MB_OK|MB_ICONINFORMATION ); break; } if( NULL == ( pcl = Amdb_OpenFolder( NULL, "Mail" ) ) ) pcl = Amdb_CreateFolder( Amdb_GetFirstCategory(), "Mail", CFF_SORT ); ptlDest = NULL; if( pcl ) { if( Amdb_OpenTopic( pcl, szMailBox ) ) { fMessageBox( hwnd, 0, GS(IDS_STR832), MB_OK|MB_ICONEXCLAMATION ); break; } ptlDest = Amdb_CreateTopic( pcl, szMailBox, FTYPE_MAIL ); Amdb_CommitDatabase( FALSE ); } /* Error if we couldn't create the folder (out of memory?) */ if( NULL == ptlDest ) { wsprintf( lpTmpBuf, GS(IDS_STR845), szMailBox ); fMessageBox( hwndFrame, 0, lpTmpBuf, MB_OK|MB_ICONINFORMATION ); break; } } /* Get the address, reject if there isn't one. */ Edit_GetText( GetDlgItem( hwnd, IDD_NAME ), szRuleAuthor, LEN_INTERNETNAME+1 ); if( strlen( szRuleAuthor ) == 0 ) { fMessageBox( hwnd, 0, GS(IDS_STR783), MB_OK|MB_ICONINFORMATION ); HighlightField( hwnd, IDD_NAME); break; } /* Set a flag if all messages are moved to the * destination folder. */ fMoveExisting = IsDlgButtonChecked( hwnd, IDD_FILEALL ); EndDialog( hwnd, TRUE ); break; case IDCANCEL: EndDialog( hwnd, FALSE ); break; } }
INT_PTR CALLBACK GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam) { LPPSHNOTIFY psn; langProcData langData = { .languages = GetDlgItem(hwndDlg, ID_CMB_LANGUAGE), .language = GetGUILanguage() }; switch(msg) { case WM_INITDIALOG: /* Populate UI language selection combo box */ EnumResourceLanguages( NULL, RT_STRING, MAKEINTRESOURCE(IDS_LANGUAGE_NAME / 16 + 1), (ENUMRESLANGPROC) FillLangListProc, (LONG_PTR) &langData ); /* If none of the available languages matched, select the fallback */ if (ComboBox_GetCurSel(langData.languages) == CB_ERR) ComboBox_SelectString(langData.languages, -1, LangListEntry(IDS_LANGUAGE_NAME, fallbackLangId)); /* Clear language id data for the selected item */ ComboBox_SetItemData(langData.languages, ComboBox_GetCurSel(langData.languages), 0); if (GetLaunchOnStartup()) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP), BST_CHECKED); if (o.log_append) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_LOG_APPEND), BST_CHECKED); if (o.silent_connection) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_SILENT), BST_CHECKED); if (o.show_balloon == 0) CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON0); else if (o.show_balloon == 1) CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON1); else if (o.show_balloon == 2) CheckRadioButton (hwndDlg, ID_RB_BALLOON0, ID_RB_BALLOON2, ID_RB_BALLOON2); if (o.show_script_window) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN), BST_CHECKED); break; case WM_NOTIFY: psn = (LPPSHNOTIFY) lParam; if (psn->hdr.code == (UINT) PSN_APPLY) { LANGID langId = (LANGID) ComboBox_GetItemData(langData.languages, ComboBox_GetCurSel(langData.languages)); if (langId != 0) SetGUILanguage(langId); SetLaunchOnStartup(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP)) == BST_CHECKED); o.log_append = (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_LOG_APPEND)) == BST_CHECKED); o.silent_connection = (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SILENT)) == BST_CHECKED); if (IsDlgButtonChecked(hwndDlg, ID_RB_BALLOON0)) o.show_balloon = 0; else if (IsDlgButtonChecked(hwndDlg, ID_RB_BALLOON2)) o.show_balloon = 2; else o.show_balloon = 1; o.show_script_window = (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN)) == BST_CHECKED); SaveRegistryKeys(); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); return TRUE; } break; } return FALSE; }
INT_PTR CALLBACK DialogPackage::SelectFolderDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB); c_Dialog->SetDialogFont(hWnd); std::wstring* existingPath = (std::wstring*)lParam; SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam); *existingPath += L'*'; WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoBasic, &fd, FindExSearchNameMatch, nullptr, 0); existingPath->pop_back(); if (hFind != INVALID_HANDLE_VALUE) { const WCHAR* folder = PathFindFileName(existingPath->c_str()); HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_RADIO); std::wstring text = L"Add folder from "; text.append(folder, wcslen(folder) - 1); text += L':'; SetWindowText(item, text.c_str()); Button_SetCheck(item, BST_CHECKED); item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO); do { if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && !(fd.cFileName[0] == L'.' && (!fd.cFileName[1] || fd.cFileName[1] == L'.' && !fd.cFileName[2])) && wcscmp(fd.cFileName, L"Backup") != 0 && wcscmp(fd.cFileName, L"@Backup") != 0 && wcscmp(fd.cFileName, L"@Vault") != 0) { ComboBox_InsertString(item, -1, fd.cFileName); } } while (FindNextFile(hFind, &fd)); ComboBox_SetCurSel(item, 0); FindClose(hFind); } } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_PACKAGESELECTFOLDER_EXISTING_RADIO: { HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO); EnableWindow(item, TRUE); int sel = ComboBox_GetCurSel(item); item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT); EnableWindow(item, FALSE); item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON); EnableWindow(item, FALSE); item = GetDlgItem(hWnd, IDOK); EnableWindow(item, sel != -1); } break; case IDC_PACKAGESELECTFOLDER_CUSTOM_RADIO: { HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO); EnableWindow(item, FALSE); item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT); EnableWindow(item, TRUE); item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON); EnableWindow(item, TRUE); SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT, EN_CHANGE), 0); } break; case IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT: if (HIWORD(wParam) == EN_CHANGE) { WCHAR buffer[MAX_PATH]; int len = Edit_GetText((HWND)lParam, buffer, MAX_PATH); // Disable Add button if invalid directory DWORD attributes = GetFileAttributes(buffer); BOOL state = (attributes != INVALID_FILE_ATTRIBUTES && attributes & FILE_ATTRIBUTE_DIRECTORY); EnableWindow(GetDlgItem(hWnd, IDOK), state); } break; case IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON: { WCHAR buffer[MAX_PATH]; BROWSEINFO bi = {0}; bi.hwndOwner = hWnd; bi.ulFlags = BIF_USENEWUI | BIF_NONEWFOLDERBUTTON | BIF_RETURNONLYFSDIRS; PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&bi); if (pidl && SHGetPathFromIDList(pidl, buffer)) { HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT); SetWindowText(item, buffer); CoTaskMemFree(pidl); } } break; case IDOK: { WCHAR buffer[MAX_PATH]; HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_RADIO); bool existing = Button_GetCheck(item) == BST_CHECKED; item = GetDlgItem(hWnd, existing ? IDC_PACKAGESELECTFOLDER_EXISTING_COMBO : IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT); GetWindowText(item, buffer, _countof(buffer)); std::wstring* result = (std::wstring*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (existing) { *result += buffer; } else { *result = buffer; } *result += L'\\'; EndDialog(hWnd, 1); } } break; case WM_CLOSE: EndDialog(hWnd, 0); break; default: return FALSE; } return TRUE; }
BOOL CALLBACK DeviceDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { HWND hWC;int i; DoDevEnum(hW); hWC=GetDlgItem(hW,IDC_DEVICE); i=ComboBox_FindStringExact(hWC,-1,szDevName); if(i==CB_ERR) i=0; ComboBox_SetCurSel(hWC,i); hWC=GetDlgItem(hW,IDC_GAMMA); ScrollBar_SetRange(hWC,0,1024,FALSE); if(iUseGammaVal==2048) ScrollBar_SetPos(hWC,512,FALSE); else { ScrollBar_SetPos(hWC,iUseGammaVal,FALSE); CheckDlgButton(hW,IDC_USEGAMMA,TRUE); } } case WM_HSCROLL: { HWND hWC=GetDlgItem(hW,IDC_GAMMA); int pos=ScrollBar_GetPos(hWC); switch(LOWORD(wParam)) { case SB_THUMBPOSITION: pos=HIWORD(wParam);break; case SB_LEFT: pos=0;break; case SB_RIGHT: pos=1024;break; case SB_LINELEFT: pos-=16;break; case SB_LINERIGHT: pos+=16;break; case SB_PAGELEFT: pos-=128;break; case SB_PAGERIGHT: pos+=128;break; } ScrollBar_SetPos(hWC,pos,TRUE); return TRUE; } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDCANCEL: FreeGui(hW); EndDialog(hW,FALSE);return TRUE; case IDOK: { HWND hWC=GetDlgItem(hW,IDC_DEVICE); int i=ComboBox_GetCurSel(hWC); if(i==CB_ERR) return TRUE; guiDev=*((GUID *)ComboBox_GetItemData(hWC,i)); ComboBox_GetLBText(hWC,i,szDevName); FreeGui(hW); if(!IsDlgButtonChecked(hW,IDC_USEGAMMA)) iUseGammaVal=2048; else iUseGammaVal=ScrollBar_GetPos(GetDlgItem(hW,IDC_GAMMA)); EndDialog(hW,TRUE); return TRUE; } } } } return FALSE; }
INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { TCHAR tstr[64]; static bool bDlgInit = false; //some controls send WM_COMMAND before or during WM_INITDIALOG UINT idCtrl; switch (msg) { case WM_INITDIALOG: //Create preview box: { hwndBox = CreateWindowEx( WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx _T(BOXPREVIEW_WNDCLASS), // Class name NULL, // Title DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle CW_USEDEFAULT, // x CW_USEDEFAULT, // y CW_USEDEFAULT, // Width CW_USEDEFAULT, // Height HWND_DESKTOP, // Parent NULL, // menu handle hInst, // Instance (LPVOID)0); ShowWindow(hwndBox, SW_HIDE); } //Group: History { CheckDlgButton(hwnd, IDC_ENABLE_HISTORY, PopupOptions.EnableHistory); SetDlgItemInt (hwnd, IDC_HISTORYSIZE, PopupOptions.HistorySize, FALSE); CheckDlgButton(hwnd, IDC_HPPLOG, PopupOptions.UseHppHistoryLog); HWND hCtrl = GetDlgItem(hwnd, IDC_SHOWHISTORY); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)Translate("Popup History"), 0); SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopupOptions.EnableHistory && gbHppInstalled); } //Group: Avatars { //Borders CheckDlgButton(hwnd, IDC_AVT_BORDER, PopupOptions.avatarBorders); CheckDlgButton(hwnd, IDC_AVT_PNGBORDER, PopupOptions.avatarPNGBorders); EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopupOptions.avatarBorders); //Radius SetDlgItemInt(hwnd, IDC_AVT_RADIUS, PopupOptions.avatarRadius, FALSE); SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2),0)); //Size mir_subclassWindow(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), AvatarTrackBarWndProc); SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETRANGE,FALSE, MAKELONG(SETTING_AVTSIZE_MIN, SETTING_AVTSIZE_MAX)); SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETPOS, TRUE, max(PopupOptions.avatarSize, SETTING_AVTSIZE_MIN)); SetDlgItemInt(hwnd, IDC_AVT_SIZE, PopupOptions.avatarSize, FALSE); //Request avatars CheckDlgButton(hwnd, IDC_AVT_REQUEST, PopupOptions.EnableAvatarUpdates); } //Group: Monitor { BOOL bMonitor = 0; bMonitor = GetSystemMetrics(SM_CMONITORS)>1; CheckDlgButton(hwnd, IDC_MIRANDAWND, bMonitor ? (PopupOptions.Monitor == MN_MIRANDA) : TRUE); CheckDlgButton(hwnd, IDC_ACTIVEWND, bMonitor ? (PopupOptions.Monitor == MN_ACTIVE) : FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GRP_MULTIMONITOR), bMonitor); EnableWindow(GetDlgItem(hwnd, IDC_MULTIMONITOR_DESC), bMonitor); EnableWindow(GetDlgItem(hwnd, IDC_MIRANDAWND), bMonitor); EnableWindow(GetDlgItem(hwnd, IDC_ACTIVEWND), bMonitor); } //Group: Transparency { //win2k+ CheckDlgButton(hwnd, IDC_TRANS, PopupOptions.UseTransparency); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1,255)); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha); mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc); mir_sntprintf(tstr, SIZEOF(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopupOptions.OpaqueOnHover); { BOOL how = TRUE; EnableWindow(GetDlgItem(hwnd, IDC_TRANS), how); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1), how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT), how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER), how && PopupOptions.UseTransparency); } ShowWindow(GetDlgItem(hwnd, IDC_TRANS), SW_SHOW); } //Group: Effects { //Use Animations CheckDlgButton(hwnd, IDC_USEANIMATIONS, PopupOptions.UseAnimations); //Fade SetDlgItemInt (hwnd, IDC_FADEIN, PopupOptions.FadeIn, FALSE); SetDlgItemInt (hwnd, IDC_FADEOUT,PopupOptions.FadeOut,FALSE); UDACCEL aAccels[] = {{0,50},{1,100},{3,500}}; SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEINTIME_MAX, SETTING_FADEINTIME_MIN)); SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEOUTTIME_MAX,SETTING_FADEOUTTIME_MIN)); SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN,UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); BOOL how = PopupOptions.UseAnimations || PopupOptions.UseEffect; EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), how); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), how); //effects drop down { DWORD dwItem, dwActiveItem = 0; BOOL how = TRUE; EnableWindow(GetDlgItem(hwnd, IDC_EFFECT), how); EnableWindow(GetDlgItem(hwnd, IDC_EFFECT_TXT), how); HWND hCtrl = GetDlgItem(hwnd, IDC_EFFECT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("No effect")) ,-2); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Fade in/out")) ,-1); dwActiveItem = (DWORD)PopupOptions.UseEffect; for (int i=0; i < g_lstPopupVfx.getCount(); ++i) { dwItem = ComboBox_AddString(hCtrl, TranslateTS(g_lstPopupVfx[i])); ComboBox_SetItemData(hCtrl, dwItem, i); if (PopupOptions.UseEffect && !lstrcmp(g_lstPopupVfx[i], PopupOptions.Effect)) dwActiveItem = dwItem; } SendDlgItemMessage(hwnd, IDC_EFFECT, CB_SETCURSEL, dwActiveItem, 0); } } //later check stuff SetDlgItemInt(hwnd, IDC_MAXPOPUPS, PopupOptions.MaxPopups, FALSE); TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG bDlgInit = true; return TRUE; case WM_HSCROLL: switch (idCtrl = GetDlgCtrlID((HWND)lParam)) { case IDC_AVT_SIZE_SLIDE: PopupOptions.avatarSize = SendDlgItemMessage(hwnd,IDC_AVT_SIZE_SLIDE, TBM_GETPOS,0,0); SetDlgItemInt(hwnd, IDC_AVT_SIZE ,PopupOptions.avatarSize,FALSE); SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2),0)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_TRANS_SLIDER: PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd,IDC_TRANS_SLIDER, TBM_GETPOS, 0,0); mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; } break; case WM_COMMAND: idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { case BN_CLICKED: //Button controls switch(idCtrl) { case IDC_ENABLE_HISTORY: PopupOptions.EnableHistory = !PopupOptions.EnableHistory; EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopupOptions.EnableHistory && gbHppInstalled); SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_SHOWHISTORY: PopupHistoryShow(); break; case IDC_HPPLOG: PopupOptions.UseHppHistoryLog = !PopupOptions.UseHppHistoryLog; SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_AVT_BORDER: PopupOptions.avatarBorders = !PopupOptions.avatarBorders; EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopupOptions.avatarBorders); SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_AVT_PNGBORDER: PopupOptions.avatarPNGBorders = !PopupOptions.avatarPNGBorders; SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_AVT_REQUEST: PopupOptions.EnableAvatarUpdates = !PopupOptions.EnableAvatarUpdates; SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_MIRANDAWND: PopupOptions.Monitor = MN_MIRANDA; SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_ACTIVEWND: PopupOptions.Monitor = MN_ACTIVE; SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); break; case IDC_TRANS: PopupOptions.UseTransparency = !PopupOptions.UseTransparency; { BOOL how = TRUE; EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopupOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER) ,how && PopupOptions.UseTransparency); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; case IDC_TRANS_OPAQUEONHOVER: PopupOptions.OpaqueOnHover = !PopupOptions.OpaqueOnHover; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_USEANIMATIONS: PopupOptions.UseAnimations = !PopupOptions.UseAnimations; { BOOL enable = PopupOptions.UseAnimations || PopupOptions.UseEffect; EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; case IDC_PREVIEW: PopupPreview(); break; } break; case CBN_SELCHANGE: //lParam = Handle to the control switch(idCtrl) { case IDC_EFFECT: { int iEffect = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); PopupOptions.UseEffect = (iEffect != -2) ? TRUE : FALSE; mir_free(PopupOptions.Effect); PopupOptions.Effect = mir_tstrdup((iEffect >= 0) ? g_lstPopupVfx[iEffect] : _T("")); BOOL enable = PopupOptions.UseAnimations || PopupOptions.UseEffect; EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable); EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; } break; case EN_CHANGE: //Edit controls change if (!bDlgInit) break; //lParam = Handle to the control switch(idCtrl) { case IDC_MAXPOPUPS: { int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (maxPop > 0){ PopupOptions.MaxPopups = maxPop; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_HISTORYSIZE: { int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if ( histSize > 0 && histSize <= SETTING_HISTORYSIZE_MAX){ PopupOptions.HistorySize = histSize; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_AVT_RADIUS: { int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if ( avtRadius <= SETTING_AVTSIZE_MAX / 2 ) { PopupOptions.avatarRadius = avtRadius; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_FADEIN: { int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if ( fadeIn >= SETTING_FADEINTIME_MIN && fadeIn <= SETTING_FADEINTIME_MAX ) { PopupOptions.FadeIn = fadeIn; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_FADEOUT: { int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if ( fadeOut >= SETTING_FADEOUTTIME_MIN && fadeOut <= SETTING_FADEOUTTIME_MAX){ PopupOptions.FadeOut = fadeOut; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; } break; case EN_KILLFOCUS: //Edit controls lost fokus //lParam = Handle to the control switch(idCtrl) { case IDC_MAXPOPUPS: { int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (maxPop <= 0) PopupOptions.MaxPopups = 20; if (maxPop != PopupOptions.MaxPopups) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.MaxPopups, FALSE); //ErrorMSG(1); SetFocus((HWND)lParam); } } break; case IDC_HISTORYSIZE: { int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (histSize <= 0) PopupOptions.HistorySize = SETTING_HISTORYSIZE_DEFAULT; else if (histSize > SETTING_HISTORYSIZE_MAX) PopupOptions.HistorySize = SETTING_HISTORYSIZE_MAX; if (histSize != PopupOptions.HistorySize) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.HistorySize, FALSE); ErrorMSG(1, SETTING_HISTORYSIZE_MAX); SetFocus((HWND)lParam); } } break; case IDC_AVT_RADIUS: { int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (avtRadius > SETTING_AVTSIZE_MAX / 2) PopupOptions.avatarRadius = SETTING_AVTSIZE_MAX / 2; if (avtRadius != PopupOptions.avatarRadius) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.avatarRadius, FALSE); ErrorMSG(0, SETTING_AVTSIZE_MAX / 2); SetFocus((HWND)lParam); } } break; case IDC_FADEIN: { int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (fade < SETTING_FADEINTIME_MIN) PopupOptions.FadeIn = SETTING_FADEINTIME_MIN; else if (fade > SETTING_FADEINTIME_MAX) PopupOptions.FadeIn = SETTING_FADEINTIME_MAX; if (fade != PopupOptions.FadeIn) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.FadeIn, FALSE); ErrorMSG(SETTING_FADEINTIME_MIN, SETTING_FADEINTIME_MAX); SetFocus((HWND)lParam); } } break; case IDC_FADEOUT: { int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (fade < SETTING_FADEOUTTIME_MIN) PopupOptions.FadeOut = SETTING_FADEOUTTIME_MIN; else if (fade > SETTING_FADEOUTTIME_MAX) PopupOptions.FadeOut = SETTING_FADEOUTTIME_MAX; if (fade != PopupOptions.FadeOut) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.FadeOut, FALSE); ErrorMSG(SETTING_FADEOUTTIME_MIN, SETTING_FADEOUTTIME_MAX); SetFocus((HWND)lParam); } } } } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: LoadOption_AdvOpts(); return TRUE; case PSN_APPLY: //History db_set_b(NULL, MODULNAME, "EnableHistory", (BYTE)PopupOptions.EnableHistory); db_set_w(NULL, MODULNAME, "HistorySize", PopupOptions.HistorySize); PopupHistoryResize(); db_set_b(NULL, MODULNAME, "UseHppHistoryLog", PopupOptions.UseHppHistoryLog); //Avatars db_set_b(NULL, MODULNAME, "AvatarBorders", PopupOptions.avatarBorders); db_set_b(NULL, MODULNAME, "AvatarPNGBorders", PopupOptions.avatarPNGBorders); db_set_b(NULL, MODULNAME, "AvatarRadius", PopupOptions.avatarRadius); db_set_w(NULL, MODULNAME, "AvatarSize", PopupOptions.avatarSize); db_set_b(NULL, MODULNAME, "EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates); //Monitor db_set_b(NULL, MODULNAME, "Monitor", PopupOptions.Monitor); //Transparency db_set_b(NULL, MODULNAME, "UseTransparency", PopupOptions.UseTransparency); db_set_b(NULL, MODULNAME, "Alpha", PopupOptions.Alpha); db_set_b(NULL, MODULNAME, "OpaqueOnHover", PopupOptions.OpaqueOnHover); //Effects db_set_b(NULL, MODULNAME, "UseAnimations", PopupOptions.UseAnimations); db_set_b(NULL, MODULNAME, "Fade", PopupOptions.UseEffect); db_set_ts(NULL, MODULNAME, "Effect", PopupOptions.Effect); db_set_dw(NULL, MODULNAME, "FadeInTime", PopupOptions.FadeIn); db_set_dw(NULL, MODULNAME, "FadeOutTime", PopupOptions.FadeOut); //other old stuff db_set_w(NULL, MODULNAME, "MaxPopups", (BYTE)PopupOptions.MaxPopups); } return TRUE; } break; case WM_DESTROY: bDlgInit = false; break; } return FALSE; }
BOOL CALLBACK KeyDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { int i,j,k;char szB[2];HWND hWC; for(i=IDC_KEY1;i<=IDC_KEY10;i++) { hWC=GetDlgItem(hW,i); for(j=0;tMKeys[j].cCode!=0;j++) { k=ComboBox_AddString(hWC,tMKeys[j].szName); ComboBox_SetItemData(hWC,k,tMKeys[j].cCode); } for(j=0x30;j<=0x39;j++) { wsprintf(szB,"%c",j); k=ComboBox_AddString(hWC,szB); ComboBox_SetItemData(hWC,k,j); } for(j=0x41;j<=0x5a;j++) { wsprintf(szB,"%c",j); k=ComboBox_AddString(hWC,szB); ComboBox_SetItemData(hWC,k,j); } SetGPUKey(GetDlgItem(hW,i),szGPUKeys[i-IDC_KEY1]); } }return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_DEFAULT: { int i; for(i=IDC_KEY1;i<=IDC_KEY10;i++) SetGPUKey(GetDlgItem(hW,i),szKeyDefaults[i-IDC_KEY1]); }break; case IDCANCEL: EndDialog(hW,FALSE); return TRUE; case IDOK: { HWND hWC;int i; for(i=IDC_KEY1;i<=IDC_KEY10;i++) { hWC=GetDlgItem(hW,i); szGPUKeys[i-IDC_KEY1]=(char)ComboBox_GetItemData(hWC,ComboBox_GetCurSel(hWC)); if(szGPUKeys[i-IDC_KEY1]<0x20) szGPUKeys[i-IDC_KEY1]=0x20; } EndDialog(hW,TRUE); return TRUE; } } } } return FALSE; }
LRESULT CALLBACK InputSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static helpballoon_struct hb[26]; switch (uMsg) { case WM_INITDIALOG: { int i; u32 j; for (i = 0; i < 2; i++) { SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB+i, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("None")); SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Direct")); SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("6-port Multitap")); } for (i = 0; i < 6; i++) { SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("None")); SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Standard Pad")); /* SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Analog Pad")); SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Stunner")); */ SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Mouse")); /* SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Keyboard")); */ SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("None")); SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Standard Pad")); /* SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Analog Pad")); SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Stunner")); */ SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Mouse")); /* SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_ADDSTRING, 0, (LPARAM)_16("Keyboard")); */ SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+i, CB_SETCURSEL, 0, 0); EnableWindow(GetDlgItem(hDlg, IDC_PORT1ATYPECB+i), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_PORT1ACFGPB+i), FALSE); SendDlgItemMessage(hDlg, IDC_PORT2ATYPECB+i, CB_SETCURSEL, 0, 0); EnableWindow(GetDlgItem(hDlg, IDC_PORT2ATYPECB+i), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_PORT2ACFGPB+i), FALSE); } SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB, CB_SETCURSEL, porttype[0], 0); PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_PORT1CONNTYPECB, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg, IDC_PORT1CONNTYPECB)); SendDlgItemMessage(hDlg, IDC_PORT2CONNTYPECB, CB_SETCURSEL, porttype[1], 0); PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_PORT2CONNTYPECB, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg, IDC_PORT2CONNTYPECB)); EnableWindow(GetDlgItem(hDlg, IDC_PORT1ATYPECB), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_PORT2ATYPECB), TRUE); if (!PERCore) { SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB, CB_SETCURSEL, 1, 0); EnableWindow(GetDlgItem(hDlg, IDC_PORT1ACFGPB), TRUE); } // Go through previous settings and figure out which controls to // enable, etc. for (j = 0; j < numpads; j++) { if (paddevice[j].emulatetype != 0) { int id=0; switch (pad[j]->perid) { case PERPAD: id = 1; break; case PERMOUSE: id = 2; break; default: break; } SendDlgItemMessage(hDlg, IDC_PORT1ATYPECB+j, CB_SETCURSEL, id, 0); EnableWindow(GetDlgItem(hDlg, IDC_PORT1ACFGPB+j), TRUE); } } // Setup Tooltips hb[0].string = "Use this to select whether to use a multi-tap or direct connection"; hb[0].hParent = GetDlgItem(hDlg, IDC_PORT1CONNTYPECB); hb[1].string = hb[0].string; hb[1].hParent = GetDlgItem(hDlg, IDC_PORT2CONNTYPECB); for (i = 0; i < 6; i++) { hb[2+i].string = "Use this to select what kind of peripheral to emulate"; hb[2+i].hParent = GetDlgItem(hDlg, IDC_PORT1ATYPECB+i); hb[8+i].string = hb[2+i].string; hb[8+i].hParent = GetDlgItem(hDlg, IDC_PORT2ATYPECB+i); hb[14+i].string = "Press this to change the button configuration, etc."; hb[14+i].hParent = GetDlgItem(hDlg, IDC_PORT1ACFGPB+i); hb[20+i].string = hb[14+i].string; hb[20+i].hParent = GetDlgItem(hDlg, IDC_PORT2ACFGPB+i); } hb[26].string = NULL; CreateHelpBalloons(hb); return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_PORT1CONNTYPECB: case IDC_PORT2CONNTYPECB: { int i, id, id2; switch(HIWORD(wParam)) { case CBN_SELCHANGE: switch(ComboBox_GetCurSel((HWND)lParam)) { case 0: // None if (LOWORD(wParam) == IDC_PORT1CONNTYPECB) { id = IDC_PORT1ATYPECB; id2 = IDC_PORT1ACFGPB; } else { id = IDC_PORT2ATYPECB; id2 = IDC_PORT2ACFGPB; } for (i = 0; i < 6; i++) { EnableWindow(GetDlgItem(hDlg, id+i), FALSE); EnableWindow(GetDlgItem(hDlg, id2+i), FALSE); } break; case 1: // Direct if (LOWORD(wParam) == IDC_PORT1CONNTYPECB) { id = IDC_PORT1ATYPECB; id2 = IDC_PORT1ACFGPB; } else { id = IDC_PORT2ATYPECB; id2 = IDC_PORT2ACFGPB; } EnableWindow(GetDlgItem(hDlg, id), TRUE); PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(id, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg, id)); for (i = 1; i < 6; i++) { EnableWindow(GetDlgItem(hDlg, id+i), FALSE); EnableWindow(GetDlgItem(hDlg, id2+i), FALSE); } break; case 2: // Multi-tap id = (LOWORD(wParam) == IDC_PORT1CONNTYPECB ? IDC_PORT1ATYPECB : IDC_PORT2ATYPECB); for (i = 0; i < 6; i++) { EnableWindow(GetDlgItem(hDlg, id+i), TRUE); PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(id+i, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg, id+i)); } break; default: break; } break; default: break; } break; } case IDC_PORT1ATYPECB: case IDC_PORT1BTYPECB: case IDC_PORT1CTYPECB: case IDC_PORT1DTYPECB: case IDC_PORT1ETYPECB: case IDC_PORT1FTYPECB: case IDC_PORT2ATYPECB: case IDC_PORT2BTYPECB: case IDC_PORT2CTYPECB: case IDC_PORT2DTYPECB: case IDC_PORT2ETYPECB: case IDC_PORT2FTYPECB: { switch(HIWORD(wParam)) { case CBN_SELCHANGE: // If emulated peripheral is set to none, we don't want // the config button enabled if (ComboBox_GetCurSel((HWND)lParam) != 0) Button_Enable(GetDlgItem(hDlg, IDC_PORT1ACFGPB+(int)LOWORD(wParam)-IDC_PORT1ATYPECB), TRUE); else Button_Enable(GetDlgItem(hDlg, IDC_PORT1ACFGPB+(int)LOWORD(wParam)-IDC_PORT1ATYPECB), FALSE); break; default: break; } break; } case IDC_PORT1ACFGPB: case IDC_PORT1BCFGPB: case IDC_PORT1CCFGPB: case IDC_PORT1DCFGPB: case IDC_PORT1ECFGPB: case IDC_PORT1FCFGPB: case IDC_PORT2ACFGPB: case IDC_PORT2BCFGPB: case IDC_PORT2CCFGPB: case IDC_PORT2DCFGPB: case IDC_PORT2ECFGPB: case IDC_PORT2FCFGPB: switch (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PORT1ATYPECB+LOWORD(wParam)-IDC_PORT1ACFGPB))) { case 1: // Standard Pad DialogBoxParam(y_hInstance, MAKEINTRESOURCE(IDD_PADCONFIG), hDlg, (DLGPROC)PadConfigDlgProc, (LPARAM)LOWORD(wParam)-IDC_PORT1ACFGPB); break; case 2: // Mouse DialogBoxParam(y_hInstance, MAKEINTRESOURCE(IDD_MOUSECONFIG), hDlg, (DLGPROC)MouseConfigDlgProc, (LPARAM)LOWORD(wParam)-IDC_PORT1ACFGPB); break; default: break; } return TRUE; default: break; } break; } case WM_NOTIFY: switch (((NMHDR *) lParam)->code) { case PSN_SETACTIVE: break; case PSN_APPLY: { u32 i, j; char string1[13], string2[32]; for (i = 0; i < 2; i++) { int cursel=(int)SendDlgItemMessage(hDlg, IDC_PORT1CONNTYPECB+i, CB_GETCURSEL, 0, 0); sprintf(string1, "Port%dType", (int)i+1); sprintf(string2, "%d", cursel); WritePrivateProfileStringA("Input", string1, string2, inifilename); for (j = 0; j < 6; j++) { sprintf(string1, "Peripheral%ld%C", i+1, 'A'+j); sprintf(string2, "%d", ConvertEmulateTypeSelStringToID(hDlg, IDC_PORT1ATYPECB+(i*6)+j)); WritePrivateProfileStringA(string1, "EmulateType", string2, inifilename); } } SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); break; } case PSN_KILLACTIVE: SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return 1; break; case PSN_RESET: break; } break; case WM_DESTROY: { // Reload device(s) PERDXLoadDevices(inifilename); DestroyHelpBalloons(hb); break; } default: break; } return FALSE; }
void GetSettings(HWND hW) { HWND hWC;char cs[256];int i,j;char * p; hWC=GetDlgItem(hW,IDC_RESOLUTION); // get resolution i=ComboBox_GetCurSel(hWC); ComboBox_GetLBText(hWC,i,cs); iResX=atol(cs); p=strchr(cs,'x'); iResY=atol(p+1); p=strchr(cs,','); // added by syo if(p) iRefreshRate=atol(p+1); // get refreshrate else iRefreshRate=0; hWC=GetDlgItem(hW,IDC_COLDEPTH); // get color depth i=ComboBox_GetCurSel(hWC); ComboBox_GetLBText(hWC,i,cs); iColDepth=atol(cs); hWC=GetDlgItem(hW,IDC_SCANLINES); // scanlines iUseScanLines=ComboBox_GetCurSel(hWC); i=GetDlgItemInt(hW,IDC_WINX,NULL,FALSE); // get win size if(i<50) i=50; if(i>20000) i=20000; j=GetDlgItemInt(hW,IDC_WINY,NULL,FALSE); if(j<50) j=50; if(j>20000) j=20000; iWinSize=MAKELONG(i,j); if(IsDlgButtonChecked(hW,IDC_DISPMODE2)) // win mode iWindowMode=1; else iWindowMode=0; if(IsDlgButtonChecked(hW,IDC_USELIMIT)) // fps limit UseFrameLimit=1; else UseFrameLimit=0; if(IsDlgButtonChecked(hW,IDC_USESKIPPING)) // fps skip UseFrameSkip=1; else UseFrameSkip=0; if(IsDlgButtonChecked(hW,IDC_GAMEFIX)) // game fix iUseFixes=1; else iUseFixes=0; if(IsDlgButtonChecked(hW,IDC_SYSMEMORY)) // use system memory iSysMemory=1; else iSysMemory=0; if(IsDlgButtonChecked(hW,IDC_STOPSAVER)) // stop screen saver iStopSaver=1; else iStopSaver=0; if(IsDlgButtonChecked(hW,IDC_VSYNC)) // wait VSYNC bVsync=bVsync_Key=TRUE; else bVsync=bVsync_Key=FALSE; if(IsDlgButtonChecked(hW,IDC_TRANSPARENT)) // transparent menu bTransparent=TRUE; else bTransparent=FALSE; if(IsDlgButtonChecked(hW,IDC_SHOWFPS)) // show fps iShowFPS=1; else iShowFPS=0; if(IsDlgButtonChecked(hW,IDC_DEBUGMODE)) // debug mode iDebugMode=1; else iDebugMode=0; hWC=GetDlgItem(hW,IDC_NOSTRETCH); iUseNoStretchBlt=ComboBox_GetCurSel(hWC); hWC=GetDlgItem(hW,IDC_DITHER); iUseDither=ComboBox_GetCurSel(hWC); if(IsDlgButtonChecked(hW,IDC_FRAMEAUTO)) // frame rate iFrameLimit=2; else iFrameLimit=1; GetDlgItemText(hW,IDC_FRAMELIM,cs,255); fFrameRate=(float)atof(cs); if(fFrameRate<10.0f) fFrameRate=10.0f; if(fFrameRate>200.0f) fFrameRate=200.0f; }
INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int updatestrings = 0; if (msg == WM_INITDIALOG) { wchar_t txt[20]; GetPrivateProfileString(L"General", L"AutoFocus", L"0", txt, ARRAY_SIZE(txt), inipath); Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOFOCUS), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED); GetPrivateProfileString(L"General", L"Aero", L"2", txt, ARRAY_SIZE(txt), inipath); Button_SetCheck(GetDlgItem(hwnd,IDC_AERO), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED); GetPrivateProfileString(L"General", L"InactiveScroll", L"1", txt, ARRAY_SIZE(txt), inipath); Button_SetCheck(GetDlgItem(hwnd,IDC_INACTIVESCROLL), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED); GetPrivateProfileString(L"General", L"MDI", L"0", txt, ARRAY_SIZE(txt), inipath); Button_SetCheck(GetDlgItem(hwnd,IDC_MDI), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED); HWND control = GetDlgItem(hwnd, IDC_LANGUAGE); ComboBox_ResetContent(control); if (l10n == &l10n_ini) { ComboBox_AddString(control, l10n->lang); ComboBox_SetCurSel(control, 0); ComboBox_Enable(control, FALSE); } else { ComboBox_Enable(control, TRUE); int i; for (i=0; i < ARRAY_SIZE(languages); i++) { ComboBox_AddString(control, languages[i]->lang); if (l10n == languages[i]) { ComboBox_SetCurSel(control, i); } } } Button_Enable(GetDlgItem(hwnd,IDC_ELEVATE), vista && !elevated); } else if (msg == WM_COMMAND) { int id = LOWORD(wParam); int event = HIWORD(wParam); HWND control = GetDlgItem(hwnd, id); int val = Button_GetCheck(control); wchar_t txt[10]; if (id == IDC_AUTOFOCUS) { WritePrivateProfileString(L"General", L"AutoFocus", _itow(val,txt,10), inipath); } else if (id == IDC_AUTOSNAP && event == CBN_SELCHANGE) { val = ComboBox_GetCurSel(control); WritePrivateProfileString(L"General", L"AutoSnap", _itow(val,txt,10), inipath); } else if (id == IDC_AERO) { WritePrivateProfileString(L"General", L"Aero", _itow(val,txt,10), inipath); } else if (id == IDC_INACTIVESCROLL) { WritePrivateProfileString(L"General", L"InactiveScroll", _itow(val,txt,10), inipath); } else if (id == IDC_MDI) { WritePrivateProfileString(L"General", L"MDI", _itow(val,txt,10), inipath); } else if (id == IDC_LANGUAGE && event == CBN_SELCHANGE) { int i = ComboBox_GetCurSel(control); if (i == ARRAY_SIZE(languages)) { OpenUrl(L"https://stefansundin.github.io/altdrag/doc/translate.html"); for (i=0; l10n != languages[i]; i++) {} ComboBox_SetCurSel(control, i); } else { l10n = languages[i]; WritePrivateProfileString(L"General", L"Language", l10n->code, inipath); updatestrings = 1; UpdateStrings(); } } else if (id == IDC_AUTOSTART) { SetAutostart(val, 0, 0); Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), val); Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), val && vista); if (!val) { Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), BST_UNCHECKED); Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), BST_UNCHECKED); } } else if (id == IDC_AUTOSTART_HIDE) { int elevate = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE)); SetAutostart(1, val, elevate); } else if (id == IDC_AUTOSTART_ELEVATE) { int hide = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE)); SetAutostart(1, hide, val); if (val) { // Don't nag if UAC is disabled, only check if elevated DWORD uac_enabled = 1; if (elevated) { DWORD len = sizeof(uac_enabled); HKEY key; RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &key); RegQueryValueEx(key, L"EnableLUA", NULL, NULL, (LPBYTE)&uac_enabled, &len); RegCloseKey(key); } if (uac_enabled) { MessageBox(NULL, l10n->general_autostart_elevate_tip, APP_NAME, MB_ICONINFORMATION|MB_OK); } } } else if (id == IDC_ELEVATE && MessageBox(NULL,l10n->general_elevate_tip,APP_NAME,MB_ICONINFORMATION|MB_OK)) { wchar_t path[MAX_PATH]; GetModuleFileName(NULL, path, ARRAY_SIZE(path)); if ((INT_PTR)ShellExecute(NULL,L"runas",path,L"-config -multi",NULL,SW_SHOWNORMAL) > 32) { PostMessage(g_hwnd, WM_CLOSE, 0, 0); } else { MessageBox(NULL, l10n->general_elevation_aborted, APP_NAME, MB_ICONINFORMATION|MB_OK); } return; } UpdateSettings(); } else if (msg == WM_NOTIFY) { LPNMHDR pnmh = (LPNMHDR) lParam; if (pnmh->code == PSN_SETACTIVE) { updatestrings = 1; // Autostart int autostart=0, hidden=0, elevated=0; CheckAutostart(&autostart, &hidden, &elevated); Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART), autostart?BST_CHECKED:BST_UNCHECKED); Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), hidden?BST_CHECKED:BST_UNCHECKED); Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), elevated?BST_CHECKED:BST_UNCHECKED); Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), autostart); Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), autostart && vista); } } if (updatestrings) { // Update text SetDlgItemText(hwnd, IDC_GENERAL_BOX, l10n->general_box); SetDlgItemText(hwnd, IDC_AUTOFOCUS, l10n->general_autofocus); SetDlgItemText(hwnd, IDC_AERO, l10n->general_aero); SetDlgItemText(hwnd, IDC_INACTIVESCROLL, l10n->general_inactivescroll); SetDlgItemText(hwnd, IDC_MDI, l10n->general_mdi); SetDlgItemText(hwnd, IDC_AUTOSNAP_HEADER, l10n->general_autosnap); SetDlgItemText(hwnd, IDC_LANGUAGE_HEADER, l10n->general_language); SetDlgItemText(hwnd, IDC_AUTOSTART_BOX, l10n->general_autostart_box); SetDlgItemText(hwnd, IDC_AUTOSTART, l10n->general_autostart); SetDlgItemText(hwnd, IDC_AUTOSTART_HIDE, l10n->general_autostart_hide); SetDlgItemText(hwnd, IDC_AUTOSTART_ELEVATE, l10n->general_autostart_elevate); SetDlgItemText(hwnd, IDC_ELEVATE, (elevated?l10n->general_elevated:l10n->general_elevate)); SetDlgItemText(hwnd, IDC_AUTOSAVE, l10n->general_autosave); // AutoSnap HWND control = GetDlgItem(hwnd, IDC_AUTOSNAP); ComboBox_ResetContent(control); ComboBox_AddString(control, l10n->general_autosnap0); ComboBox_AddString(control, l10n->general_autosnap1); ComboBox_AddString(control, l10n->general_autosnap2); ComboBox_AddString(control, l10n->general_autosnap3); wchar_t txt[10]; GetPrivateProfileString(L"General", L"AutoSnap", L"0", txt, ARRAY_SIZE(txt), inipath); ComboBox_SetCurSel(control, _wtoi(txt)); // Language control = GetDlgItem(hwnd, IDC_LANGUAGE); ComboBox_DeleteString(control, ARRAY_SIZE(languages)); if (l10n == &en_US) { ComboBox_AddString(control, L"How can I help translate?"); } } return FALSE; }
BOOL CALLBACK RecordingDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { HWND hWC; CheckDlgButton(hW,IDC_REC_MODE1,RECORD_RECORDING_MODE==0); CheckDlgButton(hW,IDC_REC_MODE2,RECORD_RECORDING_MODE==1); hWC = GetDlgItem(hW,IDC_VIDEO_SIZE); ComboBox_ResetContent(hWC); ComboBox_AddString(hWC,"Full"); ComboBox_AddString(hWC,"Half"); ComboBox_AddString(hWC,"Quarter"); ComboBox_SetCurSel(hWC,RECORD_VIDEO_SIZE); SetDlgItemInt(hW,IDC_REC_WIDTH,RECORD_RECORDING_WIDTH,FALSE); SetDlgItemInt(hW,IDC_REC_HEIGHT,RECORD_RECORDING_HEIGHT,FALSE); hWC = GetDlgItem(hW,IDC_FRAME_RATE); ComboBox_ResetContent(hWC); ComboBox_AddString(hWC,"1"); ComboBox_AddString(hWC,"2"); ComboBox_AddString(hWC,"3"); ComboBox_AddString(hWC,"4"); ComboBox_AddString(hWC,"5"); ComboBox_AddString(hWC,"6"); ComboBox_AddString(hWC,"7"); ComboBox_AddString(hWC,"8"); ComboBox_SetCurSel(hWC,RECORD_FRAME_RATE_SCALE); CheckDlgButton(hW,IDC_COMPRESSION1,RECORD_COMPRESSION_MODE==0); CheckDlgButton(hW,IDC_COMPRESSION2,RECORD_COMPRESSION_MODE==1); RefreshCodec(hW); } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_RECCFG: { if(IsDlgButtonChecked(hW,IDC_COMPRESSION1)) { BITMAPINFOHEADER bitmap = {40,640,480,1,16,0,640*480*2,2048,2048,0,0}; if(!ICCompressorChoose(hW,ICMF_CHOOSE_DATARATE|ICMF_CHOOSE_KEYFRAME,&bitmap,NULL,&RECORD_COMPRESSION1,"16 bit Compression")) return TRUE; if(RECORD_COMPRESSION1.cbState>sizeof(RECORD_COMPRESSION_STATE1)) { memset(&RECORD_COMPRESSION1,0,sizeof(RECORD_COMPRESSION1)); memset(&RECORD_COMPRESSION_STATE1,0,sizeof(RECORD_COMPRESSION_STATE1)); RECORD_COMPRESSION1.cbSize = sizeof(RECORD_COMPRESSION1); } else { if(RECORD_COMPRESSION1.lpState!=RECORD_COMPRESSION_STATE1) memcpy(RECORD_COMPRESSION_STATE1,RECORD_COMPRESSION1.lpState,RECORD_COMPRESSION1.cbState); } RECORD_COMPRESSION1.lpState = RECORD_COMPRESSION_STATE1; } else { BITMAPINFOHEADER bitmap = {40,640,480,1,24,0,640*480*3,2048,2048,0,0}; if(!ICCompressorChoose(hW,ICMF_CHOOSE_DATARATE|ICMF_CHOOSE_KEYFRAME,&bitmap,NULL,&RECORD_COMPRESSION2,"24 bit Compression")) return TRUE; if(RECORD_COMPRESSION2.cbState>sizeof(RECORD_COMPRESSION_STATE2)) { memset(&RECORD_COMPRESSION2,0,sizeof(RECORD_COMPRESSION2)); memset(&RECORD_COMPRESSION_STATE2,0,sizeof(RECORD_COMPRESSION_STATE2)); RECORD_COMPRESSION2.cbSize = sizeof(RECORD_COMPRESSION2); } else { if(RECORD_COMPRESSION2.lpState!=RECORD_COMPRESSION_STATE2) memcpy(RECORD_COMPRESSION_STATE2,RECORD_COMPRESSION2.lpState,RECORD_COMPRESSION2.cbState); } RECORD_COMPRESSION2.lpState = RECORD_COMPRESSION_STATE2; } RefreshCodec(hW); return TRUE; } case IDCANCEL: EndDialog(hW,FALSE);return TRUE; case IDOK: { HWND hWC; if(IsDlgButtonChecked(hW,IDC_REC_MODE1)) RECORD_RECORDING_MODE = 0; else RECORD_RECORDING_MODE = 1; hWC = GetDlgItem(hW,IDC_VIDEO_SIZE); RECORD_VIDEO_SIZE = ComboBox_GetCurSel(hWC); RECORD_RECORDING_WIDTH = GetDlgItemInt(hW,IDC_REC_WIDTH,NULL,FALSE); RECORD_RECORDING_HEIGHT = GetDlgItemInt(hW,IDC_REC_HEIGHT,NULL,FALSE); hWC = GetDlgItem(hW,IDC_FRAME_RATE); RECORD_FRAME_RATE_SCALE = ComboBox_GetCurSel(hWC); if(IsDlgButtonChecked(hW,IDC_COMPRESSION1)) RECORD_COMPRESSION_MODE = 0; else RECORD_COMPRESSION_MODE = 1; EndDialog(hW,TRUE); return TRUE; } } } } return FALSE; }
BOOL CALLBACK item_details_config_t::on_message(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { /*case DM_GETDEFID: SetWindowLongPtr(wnd, DWL_MSGRESULT, MAKELONG(m_modal ? IDOK : IDCANCEL, DC_HASDEFID)); return TRUE;*/ case WM_INITDIALOG: { m_wnd = wnd; if (!m_modal) { modeless_dialog_manager::g_add(wnd); m_this->set_config_wnd(wnd); ShowWindow(GetDlgItem(wnd, IDOK), SW_HIDE); SetWindowText(GetDlgItem(wnd, IDCANCEL), L"Close"); } uSetWindowText(GetDlgItem(wnd, IDC_SCRIPT), m_script); HWND wnd_combo = GetDlgItem(wnd, IDC_EDGESTYLE); ComboBox_AddString(wnd_combo, L"None"); ComboBox_AddString(wnd_combo, L"Sunken"); ComboBox_AddString(wnd_combo, L"Grey"); ComboBox_SetCurSel(wnd_combo, m_edge_style); wnd_combo = GetDlgItem(wnd, IDC_HALIGN); ComboBox_AddString(wnd_combo, L"Left"); ComboBox_AddString(wnd_combo, L"Centre"); ComboBox_AddString(wnd_combo, L"Right"); ComboBox_SetCurSel(wnd_combo, m_horizontal_alignment); wnd_combo = GetDlgItem(wnd, IDC_VALIGN); ComboBox_AddString(wnd_combo, L"Top"); ComboBox_AddString(wnd_combo, L"Centre"); ComboBox_AddString(wnd_combo, L"Bottom"); ComboBox_SetCurSel(wnd_combo, m_vertical_alignment); LOGFONT lf; static_api_ptr_t<cui::fonts::manager>()->get_font(g_guid_item_details_font_client, lf); m_font_code_generator.initialise(lf, wnd, IDC_FONT_CODE); colour_code_gen(wnd, IDC_COLOUR_CODE, false, true); if (!m_modal) { SendMessage(wnd, DM_SETDEFID, IDCANCEL, NULL); SetFocus(GetDlgItem(wnd, IDCANCEL)); return FALSE; } else return FALSE; } return FALSE;// m_modal ? FALSE : TRUE; case WM_DESTROY: if (m_timer_active) on_timer(); if (!m_modal) m_this->set_config_wnd(NULL); break; case WM_NCDESTROY: m_wnd = NULL; if (!m_modal) { modeless_dialog_manager::g_remove(wnd); SetWindowLongPtr(wnd, DWL_USER, NULL); delete this; } break; case WM_ERASEBKGND: SetWindowLongPtr(wnd, DWL_MSGRESULT, TRUE); return TRUE; case WM_PAINT: ui_helpers::innerWMPaintModernBackground(wnd, GetDlgItem(wnd, IDOK)); return TRUE; case WM_CTLCOLORSTATIC: SetBkColor((HDC)wp, GetSysColor(COLOR_WINDOW)); SetTextColor((HDC)wp, GetSysColor(COLOR_WINDOWTEXT)); return (BOOL)GetSysColorBrush(COLOR_WINDOW); case WM_CLOSE: if (m_modal) { SendMessage(wnd, WM_COMMAND, IDCANCEL, NULL); return TRUE; } break; case WM_TIMER: if (wp == timer_id) on_timer(); break; case WM_COMMAND: switch (LOWORD(wp)) { case IDOK: if (m_modal) EndDialog(wnd, 1); return TRUE; case IDCANCEL: if (m_modal) EndDialog(wnd, 0); else { DestroyWindow(wnd); } return TRUE; case IDC_GEN_COLOUR: colour_code_gen(wnd, IDC_COLOUR_CODE, false, false); break; case IDC_GEN_FONT: m_font_code_generator.run(wnd, IDC_FONT_CODE); break; case IDC_SCRIPT: switch (HIWORD(wp)) { case EN_CHANGE: m_script = string_utf8_from_window(HWND(lp)); if (!m_modal) start_timer(); break; } break; case IDC_EDGESTYLE: switch (HIWORD(wp)) { case CBN_SELCHANGE: m_edge_style = ComboBox_GetCurSel((HWND)lp); if (!m_modal) { m_this->set_edge_style(m_edge_style); cfg_item_details_edge_style = m_edge_style; } break; } break; case IDC_HALIGN: switch (HIWORD(wp)) { case CBN_SELCHANGE: m_horizontal_alignment = ComboBox_GetCurSel((HWND)lp); if (!m_modal) { m_this->set_horizontal_alignment(m_horizontal_alignment); cfg_item_details_horizontal_alignment = m_horizontal_alignment; } break; } break; case IDC_VALIGN: switch (HIWORD(wp)) { case CBN_SELCHANGE: m_vertical_alignment = ComboBox_GetCurSel((HWND)lp); if (!m_modal) { m_this->set_vertical_alignment(m_vertical_alignment); cfg_item_details_vertical_alignment = m_vertical_alignment; } break; } break; } break; } return FALSE; }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: leftTabs->HandleNotify(lParam); break; case IDC_BREAKPOINTLIST: breakpointList->HandleNotify(lParam); break; case IDC_THREADLIST: threadList->HandleNotify(lParam); break; case IDC_STACKFRAMES: stackTraceView->HandleNotify(lParam); break; case IDC_DEBUG_BOTTOMTABS: bottomTabs->HandleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case ID_TOGGLE_PAUSE: SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0); break; case ID_DEBUG_DISPLAYMEMVIEW: bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); break; case ID_DEBUG_DISPLAYBREAKPOINTLIST: bottomTabs->ShowTab(breakpointList->GetHandle()); break; case ID_DEBUG_DISPLAYTHREADLIST: bottomTabs->ShowTab(threadList->GetHandle()); break; case ID_DEBUG_DISPLAYSTACKFRAMELIST: bottomTabs->ShowTab(stackTraceView->GetHandle()); break; case ID_DEBUG_DSIPLAYREGISTERLIST: leftTabs->ShowTab(0); break; case ID_DEBUG_DSIPLAYFUNCTIONLIST: leftTabs->ShowTab(1); break; case ID_DEBUG_ADDBREAKPOINT: { keepStatusBarText = true; bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true, false); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false, false); Core_EnableStepping(false); } keepStatusBarText = false; } break; case ID_DEBUG_STEPOVER: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver(); break; case ID_DEBUG_STEPINTO: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto(); break; case ID_DEBUG_RUNTOLINE: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; case ID_DEBUG_STEPOUT: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); break; case ID_DEBUG_HIDEBOTTOMTABS: { RECT rect; hideBottomTabs = !hideBottomTabs; GetClientRect(m_hDlg,&rect); UpdateSize(rect.right-rect.left,rect.bottom-rect.top); } break; case ID_DEBUG_TOGGLEBOTTOMTABTITLES: bottomTabs->SetShowTabTitles(!bottomTabs->GetShowTabTitles()); break; case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_STOPGO: { if (!Core_IsStepping()) // stop { ptr->setDontRedraw(false); SetDebugMode(true, true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } else { // go lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false, true); Core_EnableStepping(false); } } break; case IDC_STEP: stepInto(); break; case IDC_STEPOVER: stepOver(); break; case IDC_STEPOUT: stepOut(); break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false, true); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_MEMCHECK: SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0); break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { wchar_t szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(ConvertWStringToUTF8(szBuffer).c_str(),cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0, true); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: bottomTabs->NextTab(true); SetFocus(bottomTabs->CurrentTabHandle()); break; case WM_DEB_SETSTATUSBARTEXT: if (!keepStatusBarText) SendMessage(statusBarWnd,WM_SETTEXT,0,(LPARAM)ConvertUTF8ToWString((const char *)lParam).c_str()); break; case WM_DEB_GOTOHEXEDIT: { CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); memory->gotoAddr(wParam); // display the memory viewer too bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SendMessage(statusBarWnd,WM_SIZE,0,10); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = minWidth; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = minHeight; } return TRUE; case WM_CLOSE: Show(false); return TRUE; case WM_ACTIVATE: if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) { g_activeWindow = WINDOW_CPUDEBUGGER; } break; } return FALSE; }
/* * Update policy and settings dialog callback */ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND hPolicy; static HWND hFrequency, hBeta; int32_t freq; char update_policy_text[4096]; switch (message) { case WM_INITDIALOG: set_title_bar_icon(hDlg); center_dialog(hDlg); hFrequency = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY); hBeta = GetDlgItem(hDlg, IDC_INCLUDE_BETAS); IGNORE_RETVAL(ComboBox_SetItemData(hFrequency, ComboBox_AddStringU(hFrequency, "Disabled"), -1)); IGNORE_RETVAL(ComboBox_SetItemData(hFrequency, ComboBox_AddStringU(hFrequency, "Daily (Default)"), 86400)); IGNORE_RETVAL(ComboBox_SetItemData(hFrequency, ComboBox_AddStringU(hFrequency, "Weekly"), 604800)); IGNORE_RETVAL(ComboBox_SetItemData(hFrequency, ComboBox_AddStringU(hFrequency, "Monthly"), 2629800)); freq = ReadRegistryKey32(REGKEY_HKCU, REGKEY_UPDATE_INTERVAL); EnableWindow(GetDlgItem(hDlg, IDC_CHECK_NOW), (freq != 0)); EnableWindow(hBeta, (freq >= 0)); switch(freq) { case -1: IGNORE_RETVAL(ComboBox_SetCurSel(hFrequency, 0)); break; case 0: case 86400: IGNORE_RETVAL(ComboBox_SetCurSel(hFrequency, 1)); break; case 604800: IGNORE_RETVAL(ComboBox_SetCurSel(hFrequency, 2)); break; case 2629800: IGNORE_RETVAL(ComboBox_SetCurSel(hFrequency, 3)); break; default: IGNORE_RETVAL(ComboBox_SetItemData(hFrequency, ComboBox_AddStringU(hFrequency, "Custom"), freq)); IGNORE_RETVAL(ComboBox_SetCurSel(hFrequency, 4)); break; } IGNORE_RETVAL(ComboBox_AddStringU(hBeta, "Yes")); IGNORE_RETVAL(ComboBox_AddStringU(hBeta, "No")); IGNORE_RETVAL(ComboBox_SetCurSel(hBeta, GetRegistryKeyBool(REGKEY_HKCU, REGKEY_INCLUDE_BETAS)?0:1)); hPolicy = GetDlgItem(hDlg, IDC_POLICY); SendMessage(hPolicy, EM_AUTOURLDETECT, 1, 0); safe_sprintf(update_policy_text, sizeof(update_policy_text), update_policy); SendMessageA(hPolicy, EM_SETTEXTEX, (WPARAM)&friggin_microsoft_unicode_amateurs, (LPARAM)update_policy_text); SendMessage(hPolicy, EM_SETSEL, -1, -1); SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK); SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE)); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; case IDC_CHECK_NOW: CheckForUpdates(TRUE); return (INT_PTR)TRUE; case IDC_UPDATE_FREQUENCY: if (HIWORD(wParam) != CBN_SELCHANGE) break; freq = (int32_t)ComboBox_GetItemData(hFrequency, ComboBox_GetCurSel(hFrequency)); WriteRegistryKey32(REGKEY_HKCU, REGKEY_UPDATE_INTERVAL, (DWORD)freq); EnableWindow(hBeta, (freq >= 0)); return (INT_PTR)TRUE; case IDC_INCLUDE_BETAS: if (HIWORD(wParam) != CBN_SELCHANGE) break; SetRegistryKeyBool(REGKEY_HKCU, REGKEY_INCLUDE_BETAS, ComboBox_GetCurSel(hBeta) == 0); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; }
// // CustomEntryDlgProc // // This function is the dialog procedure for the custom entry dialog and handles // the basic events that happen within that dialog // INT_PTR CALLBACK CustomEntryDlgProc( HWND hwndDlg, // handle to dialog box UINT uMsg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { HWND hEditBox = NULL; // handle to an edit box HWND hComboBox = NULL; // handle to the combo box LPRASENTRYDLG lpInfo = NULL; // pointer to the RASENTRYDLG structure static LPRASENTRY lpRasEntry = NULL; // pointer to the RASENTRY structure static PSAMPLE_CUSTOM_ENTRY_DATA pData = NULL; // pointer to the SAMPLE_CUSTOM_ENTRY_DATA structure switch (uMsg) { case WM_INITDIALOG: { // set up the dialog and the parameters pData = (PSAMPLE_CUSTOM_ENTRY_DATA) lParam; if (!pData) { return FALSE; } lpInfo = &(pData->tEntryDlg); lpRasEntry = pData->ptEntry; hComboBox = GetDlgItem(hwndDlg, IDC_LIST_MODEMS); hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_ENTRYNAME); if (hEditBox) { Edit_LimitText(hEditBox, RAS_MaxEntryName); // Count doesn't include NULL Edit_SetText(hEditBox, (LPTSTR)pData->szEntryName); } hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO); if (hEditBox) { Edit_LimitText(hEditBox, CELEMS(lpRasEntry->szLocalPhoneNumber) - 1); // Count doesn't include NULL Edit_SetText(hEditBox, lpRasEntry->szLocalPhoneNumber); } // // enumerate to get the device name to use - we'll just do modems // // first get the size of the buffer required LPRASDEVINFO lpRasDevInfo = NULL; // RASDEVINFO structure pointer DWORD dwNumEntries = 0; // number of entries returned DWORD dwSize = sizeof(RASDEVINFO); // size of buffer DWORD rc = 0; // return code // Allocate buffer with space for at least one structure lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize); if (NULL == lpRasDevInfo) { return FALSE; } lpRasDevInfo->dwSize = sizeof(RASDEVINFO); rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries); if (ERROR_BUFFER_TOO_SMALL == rc) { // If the buffer is too small, free the allocated memory and allocate a bigger buffer. if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo)) { lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize); if (NULL == lpRasDevInfo) { OutputTraceString(L"--- Error allocating memory (HeapAlloc) for RASDEVINFO structures for RasEnumDevices(): %d\n", GetLastError()); return FALSE; } lpRasDevInfo->dwSize = sizeof(RASDEVINFO); rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries); } else { // Couldn't free the memory return FALSE; } } // Check whether RasEnumDevices succeeded if (ERROR_SUCCESS == rc) { lpRasDevInfo = (LPRASDEVINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize); if (NULL != lpRasDevInfo) { lpRasDevInfo->dwSize = sizeof(RASDEVINFO); rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries); if (ERROR_SUCCESS == rc) { for (UINT i = 0; i < dwNumEntries; i++, lpRasDevInfo++) { if (lstrcmpi(lpRasDevInfo->szDeviceType, RASDT_Modem) == 0) { if (hComboBox) { // add to the list ComboBox_AddString(hComboBox, lpRasDevInfo->szDeviceName); } } } } HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo); lpRasDevInfo = NULL; } else { OutputTraceString(L"--- Error allocating memory (HeapAlloc) for RASDEVINFO structures for RasEnumDevices(): %d\n", GetLastError()); } } if (hComboBox) { // select the item we have in the entry ComboBox_SelectString(hComboBox, -1, lpRasEntry->szDeviceName); } // move dialog and position according to structure paramters // NOTE: we don't take into account multiple monitors or extreme // cases here as this is only a quick sample DWORD xPos = 0; // x coordinate position for centering DWORD yPos = 0; // y coordinate position for centering if (lpInfo->dwFlags & RASDDFLAG_PositionDlg) { xPos = lpInfo->xDlg; yPos = lpInfo->yDlg; } else { RECT rectTop; // parent rectangle used for centering RECT rectDlg; // dialog rectangle used for centering // center window within the owner or desktop GetWindowRect(lpInfo->hwndOwner != NULL ? lpInfo->hwndOwner : GetDesktopWindow(), &rectTop); GetWindowRect(hwndDlg, &rectDlg); xPos = ((rectTop.left + rectTop.right) / 2) - ((rectDlg.right - rectDlg.left) / 2); yPos = ((rectTop.top + rectTop.bottom) / 2) - ((rectDlg.bottom - rectDlg.top) / 2); } SetWindowPos(hwndDlg, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { TCHAR szEntryName[RAS_MaxEntryName + 1] = {0}; // Entry name TCHAR szPhoneBook[MAX_PATH + 1] = {0}; // Phonebook path TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1] = {0}; // copy back the phonenumber, entry name, & device name hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO); if (hEditBox) { Edit_GetText(hEditBox, lpRasEntry->szLocalPhoneNumber, CELEMS(lpRasEntry->szLocalPhoneNumber)); } hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_ENTRYNAME); if (hEditBox) { Edit_GetText(hEditBox, szEntryName, CELEMS(szEntryName)); } hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO); if (hEditBox) { Edit_GetText(hEditBox, szPhoneNumber, CELEMS(szPhoneNumber)); } hComboBox = GetDlgItem(hwndDlg, IDC_LIST_MODEMS); if (hComboBox) { ComboBox_GetLBText(hComboBox, ComboBox_GetCurSel(hComboBox), lpRasEntry->szDeviceName); } if (!pData) return FALSE; // Check entry name for validity StringCchCopy(szPhoneBook, CELEMS(szPhoneBook), (LPTSTR)pData->szPhoneBookPath); if (RasValidateEntryName(szPhoneBook, szEntryName) == ERROR_INVALID_NAME) { MessageBox(hwndDlg, L"The Entry Name is Invalid.", L"Entry name error", MB_OK); } else { StringCchCopy(pData->szEntryName, CELEMS(pData->szEntryName), szEntryName); StringCchCopy(lpRasEntry->szLocalPhoneNumber, CELEMS(lpRasEntry->szLocalPhoneNumber), szPhoneNumber); EndDialog(hwndDlg, TRUE); } return TRUE; } case IDCANCEL: EndDialog(hwndDlg, FALSE); return TRUE; } break; } return FALSE; }
void Dlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { static BOOL s_fProcesses = TRUE; switch (id) { case IDCANCEL: EndDialog(hwnd, id); break; /* Restart the application when we are not running * as Elevated Administrator. */ case IDC_BTN_SYSTEM_PROCESSES: { /* Hide ourself before trying to start the same application * but with elevated privileges. */ ShowWindow(hwnd, SW_HIDE); TCHAR szApplication[MAX_PATH]; DWORD cchLength = _countof(szApplication); /* Retrieves the full name of the executable * image for the specified process. * hProcess [in] * A handle to the process. * This handle must be created with the PROCESS_QUERY_INFORMATION * or PROCESS_QUERY_LIMITED_INFORMATION access right. * For more information, see Process Security and Access Rights. * dwFlags [in] * This parameter can be one of the following values. * 0 The name should use the Win32 path format. * The name should use the native system path format. * lpExeName [out] * The path to the executable image. * If the function succeeds, this string is null-terminated. * lpdwSize [in, out] * On input, specifies the size of the lpExeName buffer, in characters. * On success, receives the number of characters written to the buffer, * not including the null-terminating character. */ QueryFullProcessImageName( GetCurrentProcess(), 0, szApplication, &cchLength); DWORD dwStatus = StartElevatedProcess(szApplication, NULL); if (dwStatus == S_OK) { /* not need to keep on working under lower privileges. */ ExitProcess(0); } /* In case of error, show up again. */ ShowWindow(hwnd, SW_SHOWNORMAL); } break; case ID_PROCESSES: s_fProcesses = TRUE; EnableMenuItem(GetMenu(hwnd), ID_VMMAP, MF_BYCOMMAND | MF_ENABLED); DrawMenuBar(hwnd); Dlg_PopulateProcessList(hwnd); break; case ID_MODULES: EnableMenuItem(GetMenu(hwnd), ID_VMMAP, MF_BYCOMMAND | MF_GRAYED); DrawMenuBar(hwnd); s_fProcesses = FALSE; Dlg_PopulateModuleList(hwnd); break; case IDC_PROCESSMODULELIST: if (codeNotify == CBN_SELCHANGE) { DWORD dw = ComboBox_GetCurSel(hwndCtl); if (s_fProcesses) { dw = (DWORD) ComboBox_GetItemData(hwndCtl, dw); // Process ID ShowProcessInfo(GetDlgItem(hwnd, IDC_RESULTS), dw); } else { // Index in helper listbox of full path dw = (DWORD) ComboBox_GetItemData(hwndCtl, dw); TCHAR szModulePath[1024]; ListBox_GetText(GetDlgItem(hwnd, IDC_MODULEHELP), dw, szModulePath); ShowModuleInfo(GetDlgItem(hwnd, IDC_RESULTS), szModulePath); } } break; case ID_VMMAP: { TCHAR szCmdLine[32]; HWND hwndCB = GetDlgItem(hwnd, IDC_PROCESSMODULELIST); DWORD dwProcessId = (DWORD) ComboBox_GetItemData(hwndCB, ComboBox_GetCurSel(hwndCB)); StringCchPrintf(szCmdLine, _countof(szCmdLine), TEXT("%d"), dwProcessId); DWORD dwStatus = StartElevatedProcess(TEXT("\"14-VMMap.exe\""), szCmdLine); if (dwStatus == ERROR_CANCELLED) { chMB("Failed to run 14-VMMap.exe: you refused access."); } } break; } }
INT_PTR DialogPackage::TabOptions::OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDC_PACKAGEOPTIONS_FILEBROWSE_BUTTON: { WCHAR buffer[MAX_PATH]; HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_FILE_EDIT); GetWindowText(item, buffer, _countof(buffer)); OPENFILENAME ofn = { sizeof(OPENFILENAME) }; ofn.lpstrFilter = L"Rainmeter skin package (.rmskin)\0*.rmskin"; ofn.lpstrTitle = L"Select Rainmeter skin package"; ofn.lpstrDefExt = L"dll"; ofn.lpstrFile = buffer; ofn.nMaxFile = _countof(buffer); ofn.hwndOwner = c_Dialog->GetWindow(); if (GetOpenFileName(&ofn)) { c_Dialog->m_TargetFile = buffer; SetWindowText(item, buffer); } } break; case IDC_PACKAGEOPTIONS_DONOTHING_RADIO: { HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKIN_EDIT); ShowWindow(item, SW_HIDE); item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKINBROWSE_BUTTON); ShowWindow(item, SW_HIDE); item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_COMBO); ShowWindow(item, SW_HIDE); c_Dialog->m_Load.clear(); } break; case IDC_PACKAGEOPTIONS_LOADSKIN_RADIO: { HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKIN_EDIT); ShowWindow(item, SW_SHOWNORMAL); WCHAR buffer[MAX_PATH]; GetWindowText(item, buffer, _countof(buffer)); c_Dialog->m_Load = buffer; c_Dialog->m_LoadLayout = false; item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKINBROWSE_BUTTON); ShowWindow(item, SW_SHOWNORMAL); item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_COMBO); ShowWindow(item, SW_HIDE); } break; case IDC_PACKAGEOPTIONS_LOADTHEME_RADIO: { HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKIN_EDIT); ShowWindow(item, SW_HIDE); item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKINBROWSE_BUTTON); ShowWindow(item, SW_HIDE); item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_COMBO); ShowWindow(item, SW_SHOWNORMAL); WCHAR buffer[MAX_PATH]; GetWindowText(item, buffer, _countof(buffer)); c_Dialog->m_Load = buffer; c_Dialog->m_LoadLayout = true; } break; case IDC_PACKAGEOPTIONS_LOADTHEME_COMBO: if (HIWORD(wParam) == CBN_SELENDOK) { WCHAR buffer[MAX_PATH]; HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_COMBO); GetWindowText(item, buffer, _countof(buffer)); c_Dialog->m_Load = buffer; c_Dialog->m_LoadLayout = true; } break; case IDC_PACKAGEOPTIONS_LOADSKINBROWSE_BUTTON: { WCHAR buffer[MAX_PATH]; HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKIN_EDIT); GetWindowText(item, buffer, _countof(buffer)); OPENFILENAME ofn = { sizeof(OPENFILENAME) }; ofn.Flags = OFN_FILEMUSTEXIST; ofn.FlagsEx = OFN_EX_NOPLACESBAR; ofn.lpstrFilter = L"Rainmeter skin file (.ini)\0*.ini"; ofn.lpstrTitle = L"Select Rainmeter skin file"; ofn.lpstrDefExt = L"ini"; ofn.lpstrFile = buffer; ofn.nMaxFile = _countof(buffer); ofn.lpstrInitialDir = c_Dialog->m_SkinFolder.second.c_str(); ofn.hwndOwner = c_Dialog->GetWindow(); if (GetOpenFileName(&ofn)) { // Make sure user didn't browse to some random folder if (_wcsnicmp(ofn.lpstrInitialDir, buffer, c_Dialog->m_SkinFolder.second.length()) == 0) { // Skip everything before actual skin folder const WCHAR* folderPath = buffer + c_Dialog->m_SkinFolder.second.length() - c_Dialog->m_SkinFolder.first.length() - 1; SetWindowText(item, folderPath); c_Dialog->m_Load = folderPath; } } } break; case IDC_PACKAGEOPTIONS_RAINMETERVERSION_EDIT: if (HIWORD(wParam) == EN_CHANGE) { WCHAR buffer[32]; GetWindowText((HWND)lParam, buffer, _countof(buffer)); // Get caret position DWORD sel = Edit_GetSel((HWND)lParam); // Only allow numbers and period WCHAR* version = buffer; while (*version) { if (iswdigit(*version) || *version == L'.') { ++version; } else { *version = L'\0'; SetWindowText((HWND)lParam, buffer); // Reset caret position Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel)); break; } } c_Dialog->m_MinimumRainmeter = buffer; } break; case IDC_PACKAGEOPTIONS_WINDOWSVERSION_COMBO: if (HIWORD(wParam) == CBN_SELCHANGE) { int sel = ComboBox_GetCurSel((HWND)lParam); c_Dialog->m_MinimumWindows = g_OsNameVersions[sel].version; } break; default: return FALSE; } return TRUE; }
//************************************************************************************ // ChangeDeviceProc() // Windows message handling function for the device select dialog //************************************************************************************ static BOOL CALLBACK ChangeDeviceProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { static D3DEnum_DeviceInfo ** ppDeviceArg; static D3DEnum_DeviceInfo * pCurrentDevice; static DWORD dwCurrentMode; static BOOL bCurrentWindowed; static BOOL bCurrentStereo; // Get access to the enumerated device list D3DEnum_DeviceInfo * pDeviceList; DWORD dwNumDevices; D3DEnum_GetDevices(&pDeviceList, &dwNumDevices); // Handle the initialization message if (WM_INITDIALOG == uiMsg) { // Get the app's current device, passed in as an lParam argument ppDeviceArg = (D3DEnum_DeviceInfo **)lParam; if (NULL == ppDeviceArg) return FALSE; // Setup temp storage pointers for dialog pCurrentDevice = (*ppDeviceArg); dwCurrentMode = pCurrentDevice->dwCurrentMode; bCurrentWindowed = pCurrentDevice->bWindowed; bCurrentStereo = pCurrentDevice->bStereo; UpdateDialogControls(hDlg, pCurrentDevice, dwCurrentMode, bCurrentWindowed, bCurrentStereo); return TRUE; } else if (WM_COMMAND == uiMsg) { HWND hwndDevice = GetDlgItem(hDlg, IDC_DEVICE_COMBO); HWND hwndMode = GetDlgItem(hDlg, IDC_MODE_COMBO); HWND hwndWindowed = GetDlgItem(hDlg, IDC_WINDOWED_CHECKBOX); HWND hwndStereo = GetDlgItem(hDlg, IDC_STEREO_CHECKBOX); // Get current UI state DWORD dwDevice = ComboBox_GetCurSel(hwndDevice); DWORD dwModeItem = ComboBox_GetCurSel(hwndMode); DWORD dwMode = ComboBox_GetItemData(hwndMode, dwModeItem); BOOL bWindowed = hwndWindowed ? Button_GetCheck(hwndWindowed) : 0; BOOL bStereo = hwndStereo ? Button_GetCheck(hwndStereo) : 0; D3DEnum_DeviceInfo * pDevice = &pDeviceList[dwDevice]; if (IDOK == LOWORD(wParam)) { // Handle the case when the user hits the OK button. Check if any // of the options were changed if (pDevice != pCurrentDevice || dwMode != dwCurrentMode || bWindowed != bCurrentWindowed || bStereo != bCurrentStereo) { // Return the newly selected device and its new properties (*ppDeviceArg) = pDevice; pDevice->bWindowed = FALSE; pDevice->bStereo = FALSE; pDevice->dwCurrentMode = dwMode; pDevice->ddsdFullscreenMode = pDevice->pddsdModes[dwMode]; EndDialog(hDlg, IDOK); } else EndDialog(hDlg, IDCANCEL); return TRUE; } else if (IDCANCEL == LOWORD(wParam)) { // Handle the case when the user hits the Cancel button EndDialog(hDlg, IDCANCEL); return TRUE; } else if (CBN_SELENDOK == HIWORD(wParam)) { if (LOWORD(wParam) == IDC_DEVICE_COMBO) { // Handle the case when the user chooses the device combo dwMode = pDeviceList[dwDevice].dwCurrentMode; bWindowed = pDeviceList[dwDevice].bWindowed; bStereo = pDeviceList[dwDevice].bStereo; } } // Keep the UI current UpdateDialogControls(hDlg, &pDeviceList[dwDevice], dwMode, bWindowed, bStereo); return TRUE; } return FALSE; }
INT_PTR CALLBACK InterfaceDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { CHOOSECOLOR cc; COLORREF choice_colors[16]; TCHAR tmp[4]; int i = 0; BOOL bRedrawList = FALSE; int nCurSelection = 0; int nHistoryTab = 0; int nTabCount = 0; int nPatternCount = 0; int value = 0; const char* snapname = NULL; switch (Msg) { case WM_INITDIALOG: Button_SetCheck(GetDlgItem(hDlg,IDC_START_GAME_CHECK),GetGameCheck()); Button_SetCheck(GetDlgItem(hDlg,IDC_JOY_GUI),GetJoyGUI()); Button_SetCheck(GetDlgItem(hDlg,IDC_KEY_GUI),GetKeyGUI()); Button_SetCheck(GetDlgItem(hDlg,IDC_BROADCAST),GetBroadcast()); Button_SetCheck(GetDlgItem(hDlg,IDC_RANDOM_BG),GetRandomBackground()); Button_SetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE),GetHideMouseOnStartup()); // Get the current value of the control SendDlgItemMessage(hDlg, IDC_CYCLETIMESEC, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 60)); /* [0, 60] */ value = GetCycleScreenshot(); SendDlgItemMessage(hDlg,IDC_CYCLETIMESEC, TBM_SETPOS, TRUE, value); _itot(value,tmp,10); SendDlgItemMessage(hDlg,IDC_CYCLETIMESECTXT,WM_SETTEXT,0, (WPARAM)tmp); Button_SetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger()); Button_SetCheck(GetDlgItem(hDlg,IDC_FILTER_INHERIT), GetFilterInherit()); Button_SetCheck(GetDlgItem(hDlg,IDC_NOOFFSET_CLONES), GetOffsetClones()); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Snapshot")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_SCREENSHOT); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Flyer")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_FLYER); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Cabinet")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_CABINET); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Marquee")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_MARQUEE); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Title")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_TITLE); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Control Panel")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_CONTROL_PANEL); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("PCB")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_PCB); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("All")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_ALL); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("None")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_NONE); if (GetHistoryTab() < MAX_TAB_TYPES) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab()); } else { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab()-TAB_SUBTRACT); } (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename + Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g%i"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Gamename")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g/%g"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Gamename + Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g/%g%i"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount, "%g/%i"); //Default to this setting (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++); snapname = GetSnapName(); if (core_stricmp(snapname,"%g" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 0); } if (core_stricmp(snapname,"%g%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 1); } if (core_stricmp(snapname,"%g/%g" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 2); } if (core_stricmp(snapname,"%g/%g%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 3); } if (core_stricmp(snapname,"%g/%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 4); } SendDlgItemMessage(hDlg, IDC_SCREENSHOT_BORDERSIZE, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 100)); /* [0, 100] */ value = GetScreenshotBorderSize(); SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZE, TBM_SETPOS, TRUE, value); _itot(value,tmp,10); SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZETXT,WM_SETTEXT,0, (WPARAM)tmp); //return TRUE; break; case WM_HELP: /* User clicked the ? from the upper right on a control */ HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_HSCROLL: HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll); break; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_SCREENSHOT_BORDERCOLOR: { for (i=0;i<16;i++) choice_colors[i] = GetCustomColor(i); cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hDlg; cc.rgbResult = GetScreenshotBorderColor(); cc.lpCustColors = choice_colors; cc.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_SOLIDCOLOR; if (!ChooseColor(&cc)) return TRUE; for (i=0;i<16;i++) SetCustomColor(i,choice_colors[i]); SetScreenshotBorderColor(cc.rgbResult); UpdateScreenShot(); return TRUE; } case IDOK : { BOOL checked = FALSE; SetGameCheck(Button_GetCheck(GetDlgItem(hDlg, IDC_START_GAME_CHECK))); SetJoyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_JOY_GUI))); SetKeyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_KEY_GUI))); SetBroadcast(Button_GetCheck(GetDlgItem(hDlg, IDC_BROADCAST))); SetRandomBackground(Button_GetCheck(GetDlgItem(hDlg, IDC_RANDOM_BG))); SetHideMouseOnStartup(Button_GetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE))); if( Button_GetCheck(GetDlgItem(hDlg,IDC_RESET_PLAYCOUNT ) ) ) { ResetPlayCount( -1 ); bRedrawList = TRUE; } if( Button_GetCheck(GetDlgItem(hDlg,IDC_RESET_PLAYTIME ) ) ) { ResetPlayTime( -1 ); bRedrawList = TRUE; } value = SendDlgItemMessage(hDlg,IDC_CYCLETIMESEC, TBM_GETPOS, 0, 0); if( GetCycleScreenshot() != value ) { SetCycleScreenshot(value); } value = SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZE, TBM_GETPOS, 0, 0); if( GetScreenshotBorderSize() != value ) { SetScreenshotBorderSize(value); UpdateScreenShot(); } value = SendDlgItemMessage(hDlg,IDC_HIGH_PRIORITY, TBM_GETPOS, 0, 0); checked = Button_GetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER)); if (checked != GetStretchScreenShotLarger()) { SetStretchScreenShotLarger(checked); UpdateScreenShot(); } checked = Button_GetCheck(GetDlgItem(hDlg,IDC_FILTER_INHERIT)); if (checked != GetFilterInherit()) { SetFilterInherit(checked); // LineUpIcons does just a ResetListView(), which is what we want here PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, FALSE),(LPARAM)NULL); } checked = Button_GetCheck(GetDlgItem(hDlg,IDC_NOOFFSET_CLONES)); if (checked != GetOffsetClones()) { SetOffsetClones(checked); // LineUpIcons does just a ResetListView(), which is what we want here PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, FALSE),(LPARAM)NULL); } nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_SNAPNAME)); if (nCurSelection != CB_ERR) { const char* snapname_selection = (const char*)ComboBox_GetItemData(GetDlgItem(hDlg,IDC_SNAPNAME), nCurSelection); if (snapname_selection) { SetSnapName(snapname_selection); } } EndDialog(hDlg, 0); nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_HISTORY_TAB)); if (nCurSelection != CB_ERR) nHistoryTab = ComboBox_GetItemData(GetDlgItem(hDlg,IDC_HISTORY_TAB), nCurSelection); EndDialog(hDlg, 0); if( GetHistoryTab() != nHistoryTab ) { SetHistoryTab(nHistoryTab, TRUE); ResizePickerControls(GetMainWindow()); UpdateScreenShot(); } if( bRedrawList ) { UpdateListView(); } return TRUE; } case IDCANCEL : EndDialog(hDlg, 0); return TRUE; } break; } return 0; }