REGSettings(settings::settings_core *core, std::string context) : settings::settings_interface_impl(core, context), root(reg_key::from_context(context)) { std::list<std::string> list; reg_key path = get_reg_key("/includes"); getValues_(path, list); get_core()->register_path(999, "/includes", "INCLUDED FILES", "Files to be included in the configuration", false, false); BOOST_FOREACH(const std::string &s, list) { op_string child = getString_(path, s); if (child) { get_core()->register_key(999, "/includes", s, settings::settings_core::key_string, "INCLUDED FILE", *child, *child, false, false); add_child_unsafe(*child); } }
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; }
static void load_library_settings(HWND dialog) { char **overrides = enumerate_values(config_key, keypath("DllOverrides")); char **p; int sel, count = 0; sel = SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0); WINE_TRACE("sel=%d\n", sel); clear_settings(dialog); if (!overrides || *overrides == NULL) { set_controls_from_selection(dialog); disable(IDC_DLLS_EDITDLL); disable(IDC_DLLS_REMOVEDLL); HeapFree(GetProcessHeap(), 0, overrides); return; } enable(IDC_DLLS_EDITDLL); enable(IDC_DLLS_REMOVEDLL); for (p = overrides; *p != NULL; p++) { int index; char *str, *value; const char *label; struct dll *dll; value = get_reg_key(config_key, keypath("DllOverrides"), *p, NULL); label = mode_to_label(string_to_mode(value)); str = HeapAlloc(GetProcessHeap(), 0, strlen(*p) + 2 + strlen(label) + 2); strcpy(str, *p); strcat(str, " ("); strcat(str, label); strcat(str, ")"); dll = HeapAlloc(GetProcessHeap(), 0, sizeof(struct dll)); dll->name = *p; dll->mode = string_to_mode(value); index = SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_ADDSTRING, (WPARAM) -1, (LPARAM) str); SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETITEMDATA, index, (LPARAM) dll); HeapFree(GetProcessHeap(), 0, str); count++; } HeapFree(GetProcessHeap(), 0, overrides); /* restore the previous selection, if possible */ if (sel >= count - 1) sel = count - 1; else if (sel == -1) sel = 0; SendDlgItemMessageW(dialog, IDC_DLLS_LIST, LB_SETCURSEL, sel, 0); set_controls_from_selection(dialog); }
static void initAudioDlg (HWND hDlg) { int i, j, found; char* buf = NULL; WINE_TRACE("\n"); /* make a list of all drivers that can be loaded */ findAudioDrivers(); /* get current registry setting if available */ buf = get_reg_key(config_key, "Drivers", "Audio", NULL); /* check for first time install and set a default driver * select first available driver, and if that fails: none */ if (buf == NULL) { /* select first available driver */ if (*loadedAudioDrv->szDriver) selectDriver(hDlg, loadedAudioDrv->szDriver); } else /* make a local copy of the current registry setting */ strcpy(curAudioDriver, buf); WINE_TRACE("curAudioDriver = %s\n", curAudioDriver); /* check for drivers that can't be loaded */ checkRegistrySetting(hDlg); initAudioDeviceTree(hDlg); SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_RESETCONTENT, 0, 0); buf = get_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", "Full"); j = found = 0; for (i = 0; 0 != DSound_HW_Accels[i].displayID; ++i) { WCHAR accelStr[64]; int match; match = (strcmp(buf, DSound_HW_Accels[i].settingStr) == 0); if (match) { DSound_HW_Accels[i].visible = 1; found = 1; } if (DSound_HW_Accels[i].visible) { LoadStringW (GetModuleHandle (NULL), DSound_HW_Accels[i].displayID, accelStr, sizeof(accelStr)/sizeof(accelStr[0])); SendDlgItemMessageW (hDlg, IDC_DSOUND_HW_ACCEL, CB_ADDSTRING, 0, (LPARAM)accelStr); if (match) SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_SETCURSEL, j, 0); j++; } } if (!found) { WINE_ERR("Invalid Direct Sound HW Accel read from registry (%s)\n", buf); } HeapFree(GetProcessHeap(), 0, buf); SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_RESETCONTENT, 0, 0); for (i = 0; NULL != DSound_Rates[i]; ++i) { SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_ADDSTRING, 0, (LPARAM) DSound_Rates[i]); } buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", "44100"); for (i = 0; NULL != DSound_Rates[i]; ++i) { if (strcmp(buf, DSound_Rates[i]) == 0) { SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_SETCURSEL, i, 0); break ; } } SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_RESETCONTENT, 0, 0); for (i = 0; NULL != DSound_Bits[i]; ++i) { SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_ADDSTRING, 0, (LPARAM) DSound_Bits[i]); } buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", "16"); for (i = 0; NULL != DSound_Bits[i]; ++i) { if (strcmp(buf, DSound_Bits[i]) == 0) { SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_SETCURSEL, i, 0); break ; } } HeapFree(GetProcessHeap(), 0, buf); }