extern void LoadSettings(void) { HKEY hKey = NULL; int iItemIndex = -1; if (RegOpenKeyEx(HKEY_CURRENT_USER, g_szGeneralRegKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { TCHAR szBuffer[MAX_PATH]; DWORD dwAdvanChecked; unsigned long type = REG_DWORD, size = 1024; /* Restore last selected font */ if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS) { //Get combobox handle hWnd = GetDlgItem(hCharmapDlg, IDC_FONTCOMBO); //Search for match and return index if match found iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer); if(iItemIndex != CB_ERR) { ComboBox_SetCurSel(hWnd, iItemIndex); ChangeMapFont(hCharmapDlg); } } /* Restore last selected character set */ if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS) { //Get combobox handle hWnd = GetDlgItem(hCharmapDlg, IDC_COMBO_CHARSET); iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer); if(iItemIndex != CB_ERR) { ComboBox_SetCurSel(hWnd, iItemIndex); } } RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvanChecked, &size); if(dwAdvanChecked == TRUE) SendDlgItemMessage(hCharmapDlg, IDC_CHECK_ADVANCED, BM_CLICK, MF_CHECKED, 0); RegCloseKey(hKey); } else { /* Default font seems to be Arial */ hWnd = GetDlgItem(hCharmapDlg, IDC_FONTCOMBO); iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial")); if(iItemIndex != CB_ERR) { ComboBox_SetCurSel(hWnd, iItemIndex); ChangeMapFont(hCharmapDlg); } } }
//-------------------------------------------------------------- void FillSelect(HWND hWnd) { CBase base(ParametersBase().name()); if(base.IsOpen()) { ADODB::_RecordsetPtr rec; if(base.OpenTable(ParametersTable().name(), rec)) { while (!rec->EndOfFile) { wchar_t *c = _bstr_t(rec->Fields->GetItem(NameParam().name())->GetValue()); ComboBox_AddString(hWnd, c); rec->MoveNext(); } //CurrentParametersTable param; CurrentParametersTable ¶m = Singleton<CurrentParametersTable>::Instance(); Select<CurrentParametersTable>(base).ID(1).Execute(param); int id = param.items.get<CurrentID>().value; ParametersTable typeSizeParam; Select<ParametersTable>(base).ID(id).Execute(typeSizeParam); int num = ComboBox_FindStringExact(hWnd, 0, typeSizeParam.items.get<NameParam>().value); if(CB_ERR != num) ComboBox_SetCurSel(hWnd, num); } } }
/* This function handles the WM_INITDIALOG message. */ BOOL FASTCALL LocalTopic_OnInitDialog( HWND hwnd, HWND hwndFocus, LPARAM lParam ) { HWND hwndList; HWND hwndEdit; CURMSG curmsg; int index; /* Fill the listbox with the list of folders. */ hwndList = GetDlgItem( hwnd, IDD_LIST ); FillListWithFolders( hwnd, IDD_LIST ); /* Highlight the current folder or topic. */ Ameol2_GetCurrentTopic( &curmsg ); if( NULL != curmsg.pFolder ) { ASSERT( NULL != curmsg.pcat ); if( NULL == curmsg.pcl ) curmsg.pcl = Amdb_GetFirstFolder( curmsg.pcat ); if( CB_ERR != ( index = ComboBox_FindStringExact( hwndList, -1, curmsg.pcl ) ) ) ComboBox_SetCurSel( hwndList, index ); } /* Limit the input field. */ VERIFY( hwndEdit = GetDlgItem( hwnd, IDD_EDIT ) ); Edit_LimitText( hwndEdit, LEN_TOPICNAME ); EnableControl( hwnd, IDOK, FALSE ); SetFocus( hwndEdit ); return( FALSE ); }
/*------------------------------------------------ Initialization of "Font" combo box --------------------------------------------------*/ void InitComboFont(HWND hDlg) { HDC hdc; LOGFONT lf = {0}; HWND hcombo; wchar_t font[LF_FACESIZE]; int i; hdc = GetDC(NULL); // Enumerate fonts and set in the combo box hcombo = GetDlgItem(hDlg, IDC_FONT); lf.lfCharSet = DEFAULT_CHARSET; // fonts from any charset EnumFontFamiliesEx(hdc, &lf, EnumFontFamExProc, (LPARAM)hcombo, 0); ReleaseDC(NULL, hdc); api.GetStrEx(L"Clock", L"Font", font, _countof(font), L"Arial"); i = ComboBox_FindStringExact(hcombo, -1, font); if(i == LB_ERR) i = 0; ComboBox_SetCurSel(hcombo, i); }
//! 選択する値を設定 bool ComboBox_SelectItemByString(HWND hWnd, LPCTSTR value) { int idx = ComboBox_FindStringExact(hWnd, -1, value); if (idx == CB_ERR) return false; ComboBox_SetCurSel(hWnd, idx); return true; }
//////////////////////// // The change directory command : // manages the CB_DIR combo box int TftpDir_AddEntry (HWND hCBWnd, const char *szPath) { int Rc=-1; Rc = ComboBox_FindStringExact (hCBWnd, -1, szPath); if (Rc==CB_ERR) Rc = ComboBox_AddString (hCBWnd, szPath); ComboBox_SetCurSel (hCBWnd, Rc); return Rc; } // TftpDir_AddEntry
void CFixApp::PopulateDialog() { //Populate the GUI scale combobox for (size_t i = 1; i < 6; i++) { wchar_t szBuf[3]; swprintf_s(szBuf, L"x%Iu", i); ComboBox_AddString(m_hWndCBGUIScales, szBuf); } ComboBox_SetCurSel(m_hWndCBGUIScales, 0); //Populate the resolution combobox DEVMODE dm = {}; dm.dmSize = sizeof(dm); Resolution r= {}; for(DWORD iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != FALSE; iModeNum++) { if((dm.dmPelsWidth != r.iX || dm.dmPelsHeight != r.iY) && dm.dmBitsPerPel == 32) //Only add each res once, but don't actually check if it matches the current color depth/refresh rate { r.iX = dm.dmPelsWidth; r.iY = dm.dmPelsHeight; m_Resolutions.push_back(r); wchar_t szBuffer[20]; _snwprintf_s(szBuffer, _TRUNCATE, L"%Iux%Iu", r.iX, r.iY); int iIndex = ComboBox_AddString(m_hWndCBResolutions, szBuffer); ComboBox_SetItemData(m_hWndCBResolutions, iIndex, &(m_Resolutions.back())); } } ComboBox_SetCurSel(m_hWndCBResolutions, 0); //Renderers (based on UnEngineWin.h), requires appInit() to have been called TArray<FRegistryObjectInfo> Classes; Classes.Empty(); UObject::GetRegistryObjects( Classes, UClass::StaticClass(), URenderDevice::StaticClass(), 0 ); for( TArray<FRegistryObjectInfo>::TIterator It(Classes); It; ++It ) { FString Path = It->Object, Left, Right; if( Path.Split(L".",&Left,&Right) ) { const wchar_t* pszDesc = Localize(*Right,L"ClassCaption",*Left); assert(pszDesc); if(ComboBox_FindStringExact(m_hWndCBRenderers, -1, pszDesc) == CB_ERR) { ComboBox_AddString(m_hWndCBRenderers, pszDesc); m_Renderers.emplace_back(static_cast<wchar_t*>(Path.GetCharArray().GetData())); } } } }
/* This function handles the WM_INITDIALOG message. */ BOOL FASTCALL CmdSignatureDlg_OnInitDialog( HWND hwnd, HWND hwndFocus, LPARAM lParam ) { FINDDATA ft; HWND hwndList; HWND hwndEdit; register int n; LPSTR pDefSig; HFIND r; /* Get the default signature. */ pDefSig = (LPSTR)lParam; /* Fill the list box with all available signatures. */ hwndList = GetDlgItem( hwnd, IDD_LIST ); for( n = r = AmFindFirst( "*.sig", DSD_SIG, _A_NORMAL, &ft ); n != -1; n = Amuser_FindNext( r, &ft ) ) { register int c; for( c = 0; ft.name[ c ] && ft.name[ c ] != '.'; ++c ); ft.name[ c ] = '\0'; ComboBox_AddString( hwndList, ft.name ); } /* Select either the default signature or the first. */ if( ComboBox_GetCount( hwndList ) ) { int index; /* Show the default signature. */ index = 0; if( *pDefSig ) if( CB_ERR == ( index = ComboBox_FindStringExact( hwndList, -1, pDefSig ) ) ) index = 0; ComboBox_SetCurSel( hwndList, index ); CmdSignatureDlg_DisplaySig( hwnd, index ); } else { EnableControl( hwnd, IDD_DELETE, FALSE ); EnableControl( hwnd, IDOK, FALSE ); } Amuser_FindClose( r ); /* Set the font. */ hwndEdit = GetDlgItem( hwnd, IDD_EDIT ); SetWindowFont( hwndEdit, hEditFont, FALSE ); return( TRUE ); }
/*------------------------------------------------ --------------------------------------------------*/ void SetComboFontSize(HWND hDlg, BOOL bInit) { HDC hdc; wchar_t font[LF_FACESIZE]; DWORD size; LOGFONT lf = {0}; HWND size_cb = GetDlgItem(hDlg, IDC_FONTSIZE); HWND font_cb = GetDlgItem(hDlg, IDC_FONT); int pos; // remember old size if(bInit) { // on WM_INITDIALOG size = api.GetInt(L"Clock", L"FontSize", 9); if(!size || size>100) size = 9; } else { // when IDC_FONT has been changed ComboBox_GetText(size_cb, font, _countof(font)); size = _wtoi(font); } ComboBox_ResetContent(size_cb); hdc = GetDC(NULL); m_logpixelsy = GetDeviceCaps(hdc, LOGPIXELSY); ComboBox_GetLBText(font_cb, ComboBox_GetCurSel(font_cb), font); wcscpy(lf.lfFaceName, font); lf.lfCharSet = DEFAULT_CHARSET; EnumFontFamiliesEx(hdc, &lf, EnumSizeProcEx, (LPARAM)size_cb, 0); ReleaseDC(NULL, hdc); wsprintf(font, FMT("%d"), size); pos = ComboBox_FindStringExact(size_cb, -1, font); if(pos != LB_ERR) { ComboBox_SetCurSel(size_cb, pos); return; } ComboBox_SetText(size_cb, font); }
// copy a ComboBox and select a given string // Note : Since CB_IP has changed from text to a S_If structure // this is not exactly a Copy function... int CopyCBContent (HWND hFromCB, HWND hToCB, const char *lpszFind, int family) { int Rc=-1; int Ark, n; struct S_If { char *descr; char *addr; } // Struct S_If *pif; // erase content ComboBox_ResetContent (hToCB); // get n of source items n = ComboBox_GetCount (hFromCB); // copy original combo for (Ark=0 ; Ark<n ; Ark++) { pif = (struct S_If *) ComboBox_GetItemData (hFromCB, Ark); // if AF_INET specified do not copy IPv6 address (the ones with : in the address) if (! (family==AF_INET && strchr (pif->addr, ':')!=NULL)) ComboBox_AddString (hToCB, pif->addr); } // locate string and select if found if (lpszFind!=NULL && lpszFind[0]!=0) { Rc = ComboBox_FindStringExact (hToCB, 0, lpszFind); if (Rc==-1) { // DHCP bound address is not present into the interface list // (because tftpd32.ini has been edited or interface address has changed...) char sz[128]; sscanf (lpszFind, "%[0-9.:]", sz); lstrcat (sz, " [Bad Addr]"); Rc = ComboBox_InsertString (hToCB, 0, sz); } } ComboBox_SetCurSel (hToCB, Rc==-1 ? 0 : Rc); return Ark; } // CopyCBContent
INT PhSelectComboBoxString( _In_ HWND hwnd, _In_ PWSTR String, _In_ BOOLEAN Partial ) { if (Partial) { return ComboBox_SelectString(hwnd, -1, String); } else { INT index; index = ComboBox_FindStringExact(hwnd, -1, String); if (index == CB_ERR) return CB_ERR; ComboBox_SetCurSel(hwnd, index); return index; } }
/** * This method searches for an item which matches the given label. * * @param ptszItemLabel - The translated label of the desired item. * * @retval CB_ERR - item not found * @retval 0...n - index of the combobox item **/ int CCombo::Find(LPTSTR ptszItemLabel) const { return ComboBox_FindStringExact(_hwnd, 0, ptszItemLabel); }
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; }
/* This function handles the WM_COMMAND message. */ void FASTCALL CmdSignatureDlg_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify ) { switch( id ) { case IDD_LIST: if( codeNotify == CBN_SELCHANGE ) { HWND hwndList; HWND hwndEdit; int index; index = (int)GetWindowLong( hwnd, DWL_USER ); hwndEdit = GetDlgItem( hwnd, IDD_EDIT ); if( EditMap_GetModified( hwndEdit ) ) { if( !CmdSignatureDlg_SaveSig( hwnd, index ) ) break; fCancelToClose( hwnd, IDCANCEL ); } hwndList = GetDlgItem( hwnd, IDD_LIST ); index = ComboBox_GetCurSel( hwndList ); CmdSignatureDlg_DisplaySig( hwnd, index ); } break; case IDD_NEW: { char sz[ 9 ]; if( Adm_Dialog( hRscLib, hwnd, MAKEINTRESOURCE( IDDLG_NEWSIG ), NewSig, (LPARAM)(LPSTR)sz ) ) { HWND hwndList; HWND hwndEdit; int index; index = (int)GetWindowLong( hwnd, DWL_USER ); hwndEdit = GetDlgItem( hwnd, IDD_EDIT ); hwndList = GetDlgItem( hwnd, IDD_LIST ); if( EditMap_GetModified( hwndEdit ) && ComboBox_GetCount( hwndList ) > 0 ) if( !CmdSignatureDlg_SaveSig( hwnd, index ) ) break; AnsiUpper( sz ); if( ( index = ComboBox_FindStringExact( hwndList, -1, sz ) ) == LB_ERR ) index = ComboBox_AddString( hwndList, sz ); EnableControl( hwnd, IDOK, TRUE ); EnableControl( hwnd, IDD_DELETE, TRUE ); ComboBox_SetCurSel( hwndList, index ); CmdSignatureDlg_DisplaySig( hwnd, index ); fCancelToClose( hwnd, IDCANCEL ); SetFocus( hwndEdit ); } break; } case IDD_DELETE: { HWND hwndList; int index; hwndList = GetDlgItem( hwnd, IDD_LIST ); if( ( index = ComboBox_GetCurSel( hwndList ) ) != CB_ERR ) { char sz[ _MAX_FNAME ]; PCAT pcat; PCL pcl; PTL ptl; /* Get confirmation first. */ if( IDNO == fMessageBox( hwnd, 0, GS(IDS_STR975), MB_YESNO|MB_ICONINFORMATION ) ) break; /* Get the signature and delete the signature * file itself. */ ComboBox_GetLBText( hwndList, index, sz ); lstrcat( sz, ".sig" ); Ameol2_DeleteFile( sz, DSD_SIG ); /* Remove the signature from the listbox and display the * next one, if there is one. */ if( ComboBox_DeleteString( hwndList, index ) == index ) --index; if( index != CB_ERR ) { ComboBox_SetCurSel( hwndList, index ); CmdSignatureDlg_DisplaySig( hwnd, index ); } else { InvalidateRect( hwndList, NULL, FALSE ); UpdateWindow( hwndList ); EnableControl( hwnd, IDD_DELETE, FALSE ); EnableControl( hwnd, IDOK, FALSE ); Edit_SetText( GetDlgItem( hwnd, IDD_EDIT ), "" ); } /* For every topic which used the signature just deleted, * change it to the global signature. */ ComboBox_GetLBText( hwndList, index, sz ); for( pcat = Amdb_GetFirstCategory(); pcat; pcat = Amdb_GetNextCategory( pcat ) ) for( pcl = Amdb_GetFirstFolder( pcat ); pcl; pcl = Amdb_GetNextFolder( pcl ) ) for( ptl = Amdb_GetFirstTopic( pcl ); ptl; ptl = Amdb_GetNextTopic( ptl ) ) { TOPICINFO topicinfo; Amdb_GetTopicInfo( ptl, &topicinfo ); if( lstrcmp( topicinfo.szSigFile, sz ) == 0 ) Amdb_SetTopicSignature( ptl, szGlobalSig ); } fCancelToClose( hwnd, IDCANCEL ); } break; } case IDOK: { HWND hwndEdit; int index; index = (int)GetWindowLong( hwnd, DWL_USER ); hwndEdit = GetDlgItem( hwnd, IDD_EDIT ); if( EditMap_GetModified( hwndEdit ) ) if( !CmdSignatureDlg_SaveSig( hwnd, index ) ) break; EndDialog( hwnd, TRUE ); break; } case IDCANCEL: { HWND hwndEdit; hwndEdit = GetDlgItem( hwnd, IDD_EDIT ); if( EditMap_GetModified( hwndEdit ) ) { register int r; r = fMessageBox( hwnd, 0, GS(IDS_STR516), MB_YESNOCANCEL|MB_ICONINFORMATION ); if( r == IDCANCEL ) break; if( r == IDYES ) { int index; index = (int)GetWindowLong( hwnd, DWL_USER ); if( !CmdSignatureDlg_SaveSig( hwnd, index ) ) break; } } EndDialog( hwnd, FALSE ); break; } } }
void CFixApp::ReadSettings() { assert(GConfig); //Full-screen UBOOL bBorderless = TRUE; GConfig->GetBool(PROJECTNAME, L"BorderlessFullscreenWindow", bBorderless); UBOOL bFullscreen = FALSE; if (!bBorderless) { GConfig->GetBool(L"WinDrv.WindowsClient", L"StartupFullscreen", bFullscreen); } CheckRadioButton(m_hWnd, RADIO_VPWINDOWED, RADIO_VPBORDERLESS, bBorderless ? RADIO_VPBORDERLESS : bFullscreen ? RADIO_VPFULLSCREEN : RADIO_VPWINDOWED); EnableWindow(GetDlgItem(m_hWnd, CHK_BORDERLESSALLMONITORS), bBorderless); UBOOL bBorderlessAllMonitors = FALSE; GConfig->GetBool(PROJECTNAME, L"BorderlessFullscreenWindowAllMonitors", bBorderlessAllMonitors); CheckDlgButton(m_hWnd, CHK_BORDERLESSALLMONITORS, bBorderlessAllMonitors); //Resolution int iResX = 1024; GConfig->GetInt(L"WinDrv.WindowsClient", bFullscreen ? L"FullscreenViewportX" : L"WindowedViewportX", iResX); int iResY = 768; GConfig->GetInt(L"WinDrv.WindowsClient", bFullscreen ? L"FullscreenViewportY" : L"WindowedViewportY", iResY); wchar_t szBuffer[20]; _snwprintf_s(szBuffer, _TRUNCATE, L"%dx%d", iResX, iResY); const int iComboRes = ComboBox_FindStringExact(m_hWndCBResolutions, -1, szBuffer); const bool bStandardRes = iComboRes != CB_ERR; if(bStandardRes) //Can fail if res not supported { ComboBox_SetCurSel(m_hWndCBResolutions, iComboRes); CheckRadioButton(m_hWnd, RADIO_RESCOMMON, RADIO_RESCUSTOM, RADIO_RESCOMMON); } else { CheckRadioButton(m_hWnd,RADIO_RESCOMMON,RADIO_RESCUSTOM,RADIO_RESCUSTOM); } SetDlgItemInt(m_hWnd, TXT_RESX, iResX, FALSE); SetDlgItemInt(m_hWnd, TXT_RESY, iResY, FALSE); EnableDisableResSettings(!bBorderless, bStandardRes); //Bit depth int iBitDepth = sm_iBPP_32; GConfig->GetInt(L"WinDrv.WindowsClient", L"FullscreenColorBits", iBitDepth); if(iBitDepth == sm_iBPP_16) { CheckRadioButton(m_hWnd,RADIO_16BIT,RADIO_32BIT,RADIO_16BIT); } else { CheckRadioButton(m_hWnd,RADIO_16BIT,RADIO_32BIT,RADIO_32BIT); } //FOV const float fDefaultFOV = Misc::GetDefaultFOV(); float fFOV = fDefaultFOV; GConfig->GetFloat(L"Engine.PlayerPawn", L"DefaultFOV", fFOV, *static_cast<FConfigCacheIni*>(GConfig)->UserIni); UBOOL bUseAutoFOV = TRUE; GConfig->GetBool(PROJECTNAME, L"UseAutoFOV", bUseAutoFOV); if(bUseAutoFOV) { CheckRadioButton(m_hWnd, RADIO_FOVDEFAULT, RADIO_FOVCUSTOM, RADIO_FOVAUTO); EnableWindow(m_hWndTxtFOV, FALSE); } else if (fFOV == fDefaultFOV) { CheckRadioButton(m_hWnd, RADIO_FOVDEFAULT, RADIO_FOVCUSTOM, RADIO_FOVDEFAULT); EnableWindow(m_hWndTxtFOV, FALSE); } else { CheckRadioButton(m_hWnd, RADIO_FOVDEFAULT, RADIO_FOVCUSTOM, RADIO_FOVCUSTOM); EnableWindow(m_hWndTxtFOV, TRUE); } SetDlgItemInt(m_hWnd, TXT_FOV, static_cast<UINT>(fFOV), FALSE); //GUI scaling fix int iGuiScale = 0; GConfig->GetInt(PROJECTNAME, CGUIScalingFix::sm_pszConfigString, iGuiScale); CheckDlgButton(m_hWnd, CHK_GUIFIX, iGuiScale!=0); if (iGuiScale > 0) { ComboBox_SetCurSel(m_hWndCBGUIScales, iGuiScale - 1); EnableWindow(m_hWndCBGUIScales, TRUE); } else { EnableWindow(m_hWndCBGUIScales, FALSE); } //Subtitle fix BOOL bSubtitleFix = TRUE; GConfig->GetBool(PROJECTNAME, L"SubtitleFix", bSubtitleFix); CheckDlgButton(m_hWnd, CHK_SUBTITLEFIX, bSubtitleFix); //Renderer const wchar_t* pszRenderer = GConfig->GetStr(L"Engine.Engine", L"GameRenderDevice"); if(pszRenderer[0]=='\0') { pszRenderer = L"SoftDrv.SoftwareRenderDevice"; } const auto renderIt = std::find(m_Renderers.cbegin(), m_Renderers.cend(), pszRenderer); if(renderIt != m_Renderers.cend()) { ComboBox_SetCurSel(m_hWndCBRenderers, renderIt - m_Renderers.begin()); } //Detail textures BOOL bDetailTextures = TRUE; GConfig->GetBool(pszRenderer, L"DetailTextures", bDetailTextures); CheckDlgButton(m_hWnd,CHK_DETAILTEX, bDetailTextures); //Mouse acceleration BOOL bNoMouseAccel = TRUE; GConfig->GetBool(PROJECTNAME, L"RawInput", bNoMouseAccel); CheckDlgButton(m_hWnd,CHK_NOMOUSEACCEL, bNoMouseAccel); //DirectSound BOOL bDirectSound = TRUE; GConfig->GetBool(L"Galaxy.GalaxyAudioSubsystem", L"UseDirectSound", bDirectSound); CheckDlgButton(m_hWnd,CHK_DIRECTSOUND, bDirectSound); //Audio latency int iSndLatency = 40; GConfig->GetInt(L"Galaxy.GalaxyAudioSubsystem", L"Latency", iSndLatency); SetDlgItemInt(m_hWnd,TXT_LATENCY,iSndLatency,FALSE); //FPS limit int iFPSLimit = sm_iDefaultFPSLimit; GConfig->GetInt(PROJECTNAME, L"FPSLimit", iFPSLimit); SetDlgItemInt(m_hWnd, TXT_FPSLIMIT, iFPSLimit, FALSE); //Single CPU BOOL bUseSingleCPU = FALSE; GConfig->GetBool(PROJECTNAME, L"UseSingleCPU", bUseSingleCPU); CheckDlgButton(m_hWnd, CHK_USESINGLECPU, bUseSingleCPU); }
/*------------------------------------------------ Dialog procedure --------------------------------------------------*/ INT_PTR CALLBACK Page_Color(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: OnInit(hDlg); return TRUE; case WM_DESTROY:{ HFONT hfontb=(HFONT)SendDlgItemMessage(hDlg,IDC_BOLD,WM_GETFONT,0,0); HFONT hfonti=(HFONT)SendDlgItemMessage(hDlg,IDC_ITALIC,WM_GETFONT,0,0); SendDlgItemMessage(hDlg,IDC_BOLD,WM_SETFONT,0,0); SendDlgItemMessage(hDlg,IDC_ITALIC,WM_SETFONT,0,0); DeleteObject(hfontb); DeleteObject(hfonti); break;} case WM_MEASUREITEM: return ColorBox_OnMeasureItem(wParam, lParam); case WM_DRAWITEM: return ColorBox_OnDrawItem(wParam, lParam); case WM_COMMAND: { WORD id=LOWORD(wParam); switch(HIWORD(wParam)){ case CBN_SELCHANGE: if(id==IDC_COLFORE || id==IDC_COLBACK || id==IDC_FONT || id==IDC_FONTQUAL || id==IDC_FONTSIZE){ if(id==IDC_FONT) SetComboFontSize(hDlg, FALSE); SendPSChanged(hDlg); } break; case CBN_EDITCHANGE: if(id==IDC_FONTSIZE) SendPSChanged(hDlg); break; case EN_CHANGE: if(id==IDC_CLOCKHEIGHT || id==IDC_CLOCKWIDTH || id==IDC_ALPHATB || id==IDC_VERTPOS || id==IDC_LINEHEIGHT || id==IDC_HORIZPOS || id==IDC_ANGLE){ SendPSChanged(hDlg); } break; default: if(id==IDC_COLFORE_BTN || id==IDC_COLBACK_BTN){ ColorBox_ChooseColor((HWND)lParam); }else if(id==IDC_CHOOSEFONT){ HWND hwndCombo; HDC hdc; wchar_t size[8]; LOGFONT lf = {0}; CHOOSEFONT chosenfont = {sizeof(CHOOSEFONT)}; chosenfont.hwndOwner = hDlg; chosenfont.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_PRINTERFONTS | CF_SCREENFONTS; chosenfont.lpLogFont = &lf; hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE); ComboBox_GetText(hwndCombo, size, _countof(size)); hdc = GetDC(NULL); lf.lfWeight = IsDlgButtonChecked(hDlg, IDC_BOLD) ? FW_BOLD : FW_REGULAR; lf.lfItalic = (BYTE)IsDlgButtonChecked(hDlg, IDC_ITALIC); lf.lfHeight = -MulDiv(_wtoi(size), GetDeviceCaps(hdc,LOGPIXELSY), 72); ReleaseDC(NULL, hdc); hwndCombo = GetDlgItem(hDlg,IDC_FONT); ComboBox_GetText(hwndCombo, lf.lfFaceName, _countof(lf.lfFaceName)); if(ChooseFont(&chosenfont)){ int sel; CheckDlgButton(hDlg, IDC_BOLD, (chosenfont.lpLogFont->lfWeight >= FW_SEMIBOLD)); CheckDlgButton(hDlg, IDC_ITALIC, chosenfont.lpLogFont->lfItalic); ComboBox_SelectString(hwndCombo, -1, chosenfont.lpLogFont->lfFaceName); hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE); wsprintf(size, FMT("%d"), chosenfont.iPointSize/10); sel = ComboBox_FindStringExact(hwndCombo, -1, size); if(sel != CB_ERR) ComboBox_SetCurSel(hwndCombo, sel); else ComboBox_SetText(hwndCombo, size); SendPSChanged(hDlg); } }else if(id==IDC_BOLD || id==IDC_ITALIC) SendPSChanged(hDlg); } return TRUE;} case WM_NOTIFY:{ PSHNOTIFY* notify=(PSHNOTIFY*)lParam; switch(notify->hdr.code) { case PSN_APPLY: OnApply(hDlg,0); if(notify->lParam) m_transition=-1; break; case PSN_RESET: if(m_transition==1){ SendMessage(g_hwndClock, CLOCKM_REFRESHCLOCK, 0, 0); SendMessage(g_hwndClock, CLOCKM_REFRESHTASKBAR, 0, 0); api.DelKey(L"Preview"); } m_transition=-1; break; } return TRUE;} } return FALSE; }