static void on_options_click(HWND dialog) { if (IsDlgButtonChecked(dialog, IDC_SHOW_DOT_FILES) == BST_CHECKED) set_reg_key(config_key, "", "ShowDotFiles", "Y"); else set_reg_key(config_key, "", "ShowDotFiles", "N"); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); }
static void on_remove_click(HWND dialog) { int sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); struct dll *dll; if (sel == LB_ERR) return; dll = (struct dll *) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_DELETESTRING, sel, 0); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), dll->name, NULL); HeapFree(GetProcessHeap(), 0, dll->name); HeapFree(GetProcessHeap(), 0, dll); if (SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0) > 0) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETCURSEL, max(sel - 1, 0), 0); else { disable(IDC_DLLS_EDITDLL); disable(IDC_DLLS_REMOVEDLL); } set_controls_from_selection(dialog); }
static void save_sys_color(int idx, COLORREF clr) { char buffer[13]; sprintf(buffer, "%d %d %d", GetRValue (clr), GetGValue (clr), GetBValue (clr)); set_reg_key(HKEY_CURRENT_USER, "Control Panel\\Colors", metrics[idx].color_reg, buffer); }
static void on_add_click(HWND dialog) { static const char dotDll[] = ".dll"; char buffer[1024], *ptr; ZeroMemory(buffer, sizeof(buffer)); SendDlgItemMessageA(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); if (lstrlenA(buffer) >= sizeof(dotDll)) { ptr = buffer + lstrlenA(buffer) - sizeof(dotDll) + 1; if (!lstrcmpiA(ptr, dotDll)) { WINE_TRACE("Stripping dll extension\n"); *ptr = '\0'; } } /* check if dll is in the builtin-only list */ if (!(ptr = strrchr( buffer, '\\' ))) { ptr = buffer; if (*ptr == '*') ptr++; } else ptr++; if (is_builtin_only( ptr )) { MSGBOXPARAMSA params; params.cbSize = sizeof(params); params.hwndOwner = dialog; params.hInstance = GetModuleHandleA( NULL ); params.lpszText = MAKEINTRESOURCEA( IDS_DLL_WARNING ); params.lpszCaption = MAKEINTRESOURCEA( IDS_DLL_WARNING_CAPTION ); params.dwStyle = MB_ICONWARNING | MB_YESNO; params.lpszIcon = NULL; params.dwContextHelpId = 0; params.lpfnMsgBoxCallback = NULL; params.dwLanguageId = 0; if (MessageBoxIndirectA( ¶ms ) != IDYES) return; } SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM)emptyW); disable(IDC_DLLS_ADDDLL); SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0); WINE_TRACE("Adding %s as native, builtin\n", buffer); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), buffer, "native,builtin"); load_library_settings(dialog); SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer); set_controls_from_selection(dialog); }
static void selectDriver(HWND hDlg, const char * driver) { WCHAR text[1024]; WCHAR caption[64]; strcpy(curAudioDriver, driver); set_reg_key(config_key, "Drivers", "Audio", curAudioDriver); if (LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_MISSING, text, sizeof(text)/sizeof(text[0]))) { if (LoadStringW(GetModuleHandle(NULL), IDS_WINECFG_TITLE, caption, sizeof(caption)/sizeof(caption[0]))) MessageBoxW(hDlg, text, caption, MB_OK | MB_ICONINFORMATION); } SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */ }
static void set_dllmode(HWND dialog, DWORD id) { enum dllmode mode; struct dll *dll; int sel; const char *str; mode = id_to_mode(id); sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); if (sel == -1) return; dll = (struct dll *) SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, sel, 0); str = mode_to_string(mode); WINE_TRACE("Setting %s to %s\n", dll->name, str); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), dll->name, str); load_library_settings(dialog); /* ... and refresh */ }
INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hWnd; HDC hDC; RECT rcClient, rcRect; char *owner, *org; switch (uMsg) { case WM_NOTIFY: switch(((LPNMHDR)lParam)->code) { case PSN_APPLY: /*save registration info to registry */ owner = get_text(hDlg, IDC_ABT_OWNER); org = get_text(hDlg, IDC_ABT_ORG); set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", "RegisteredOwner", owner ? owner : ""); set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", "RegisteredOrganization", org ? org : ""); set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOwner", owner ? owner : ""); set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOrganization", org ? org : ""); apply(); HeapFree(GetProcessHeap(), 0, owner); HeapFree(GetProcessHeap(), 0, org); break; case NM_CLICK: case NM_RETURN: if(wParam == IDC_ABT_WEB_LINK) ShellExecuteA(NULL, "open", PACKAGE_URL, NULL, NULL, SW_SHOW); break; } break; case WM_INITDIALOG: hDC = GetDC(hDlg); /* read owner and organization info from registry, load it into text box */ owner = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOwner", ""); org = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOrganization", ""); SetDlgItemText(hDlg, IDC_ABT_OWNER, owner); SetDlgItemText(hDlg, IDC_ABT_ORG, org); SendMessage(GetParent(hDlg), PSM_UNCHANGED, 0, 0); HeapFree(GetProcessHeap(), 0, owner); HeapFree(GetProcessHeap(), 0, org); /* prepare the panel */ hWnd = GetDlgItem(hDlg, IDC_ABT_PANEL); if(hWnd) { GetClientRect(hDlg, &rcClient); GetClientRect(hWnd, &rcRect); MoveWindow(hWnd, 0, 0, rcClient.right, rcRect.bottom, FALSE); logo = LoadImageW((HINSTANCE)GetWindowLongPtrW(hDlg, GWLP_HINSTANCE), MAKEINTRESOURCEW(IDI_LOGO), IMAGE_ICON, 0, 0, LR_SHARED); } /* prepare the title text */ hWnd = GetDlgItem(hDlg, IDC_ABT_TITLE_TEXT); if(hWnd) { titleFont = CreateFont( -MulDiv(24, GetDeviceCaps(hDC, LOGPIXELSY), 72), 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, "Tahoma"); SendMessage(hWnd, WM_SETFONT, (WPARAM)titleFont, TRUE); } /* prepare the web link */ hWnd = GetDlgItem(hDlg, IDC_ABT_WEB_LINK); if(hWnd) SetWindowTextA(hWnd, "<a href=\"" PACKAGE_URL "\">" PACKAGE_URL "</a>"); ReleaseDC(hDlg, hDC); break; case WM_DESTROY: if(logo) { DestroyIcon(logo); logo = NULL; } if(titleFont) { DeleteObject(titleFont); titleFont = NULL; } break; case WM_COMMAND: switch(HIWORD(wParam)) { case EN_CHANGE: /* enable apply button */ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); break; } break; case WM_DRAWITEM: if(wParam == IDC_ABT_PANEL) { LPDRAWITEMSTRUCT pDIS = (LPDRAWITEMSTRUCT)lParam; FillRect(pDIS->hDC, &pDIS->rcItem, (HBRUSH) (COLOR_WINDOW+1)); DrawIconEx(pDIS->hDC, 0, 0, logo, 0, 0, 0, 0, DI_IMAGE); DrawEdge(pDIS->hDC, &pDIS->rcItem, EDGE_SUNKEN, BF_BOTTOM); } break; case WM_CTLCOLORSTATIC: switch(GetDlgCtrlID((HWND)lParam)) { case IDC_ABT_TITLE_TEXT: /* set the title to a wine color */ SetTextColor((HDC)wParam, 0x0000007F); case IDC_ABT_PANEL_TEXT: case IDC_ABT_LICENSE_TEXT: case IDC_ABT_WEB_LINK: return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_WINDOW)); } break; } return FALSE; }
INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_AUDIO_CONFIGURE: configureAudioDriver(hDlg); break; case IDC_AUDIO_TEST: if(!PlaySound(MAKEINTRESOURCE(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_SYNC)) MessageBox(NULL, "Audio test failed!", "Error", MB_OK | MB_ICONERROR); break; case IDC_AUDIO_CONTROL_PANEL: MessageBox(NULL, "Launching audio control panel not implemented yet!", "Fixme", MB_OK | MB_ICONERROR); break; case IDC_DSOUND_HW_ACCEL: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_accel; int i, j = 0; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_accel = SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_GETCURSEL, 0, 0); for (i = 0; DSound_HW_Accels[i].settingStr; ++i) { if (DSound_HW_Accels[i].visible) { if (j == selected_dsound_accel) { set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", DSound_HW_Accels[i].settingStr); break; } j++; } } } break; case IDC_DSOUND_RATES: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_rate; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_rate = SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_GETCURSEL, 0, 0); set_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", DSound_Rates[selected_dsound_rate]); } break; case IDC_DSOUND_BITS: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_bits; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_bits = SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_GETCURSEL, 0, 0); set_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", DSound_Bits[selected_dsound_bits]); } break; } break; case WM_SHOWWINDOW: set_window_title(hDlg); break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->code) { case PSN_KILLACTIVE: SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); break; case PSN_APPLY: set_reg_key(config_key, "Drivers", "Audio", curAudioDriver); apply(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; case PSN_SETACTIVE: break; case NM_CLICK: if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE) { TVHITTESTINFO ht; DWORD dwPos = GetMessagePos(); HWND tree = ((LPNMHDR)lParam)->hwndFrom; ZeroMemory(&ht, sizeof(ht)); ht.pt.x = (short)LOWORD(dwPos); ht.pt.y = (short)HIWORD(dwPos); MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1); SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht ); if (TVHT_ONITEMSTATEICON & ht.flags) { TVITEM tvItem; int index; ZeroMemory(&tvItem, sizeof(tvItem)); tvItem.hItem = ht.hItem; SendMessageW( tree, TVM_GETITEMW, 0, (LPARAM) &tvItem ); index = TreeView_GetItemState(tree, ht.hItem, TVIS_STATEIMAGEMASK); if (index == INDEXTOSTATEIMAGEMASK(1)) { TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(2), TVIS_STATEIMAGEMASK); addDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver); SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */ } else if (index == INDEXTOSTATEIMAGEMASK(2)) { TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK); removeDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver); SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */ } } } break; case NM_RCLICK: if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE) { TVHITTESTINFO ht; DWORD dwPos = GetMessagePos(); HWND tree = ((LPNMHDR)lParam)->hwndFrom; POINT pt; ZeroMemory(&ht, sizeof(ht)); pt.x = (short)LOWORD(dwPos); pt.y = (short)HIWORD(dwPos); ht.pt = pt; MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1); SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht ); if (TVHT_ONITEMLABEL & ht.flags) { TVITEM tvItem; ZeroMemory(&tvItem, sizeof(tvItem)); tvItem.hItem = ht.hItem; tvItem.mask = TVIF_PARAM; tvItem.lParam = -1; if (TreeView_GetItem(tree, &tvItem)) { if (tvItem.lParam & DRIVER_MASK) { if (hPopupMenus) { TrackPopupMenu(GetSubMenu(hPopupMenus, 0), TPM_RIGHTBUTTON, pt.x, pt.y, 0, tree, NULL); toConfigure = tvItem.lParam & ~DRIVER_MASK; } } else if (tvItem.lParam & DEVICE_MASK) { /* FIXME TBD */ } } } } } break; case WM_INITDIALOG: initAudioDlg(hDlg); break; } return FALSE; }