DXGL r794 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r793‎ | r794 | r795 >
Date:22:59, 13 March 2018
Author:admin
Status:new
Tags:
Comment:
Reset display mode list in DXGL Test after applying certain settings in DXGL Config.
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxgltest.cpp (modified) (history)
  • /dxglcfg/dxgltest.h (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -95,6 +95,7 @@
9696 HWND hTab;
9797 HWND hTabs[8];
9898 static int tabopen;
 99+BOOL modelistdirty = FALSE;
99100
100101 static const TCHAR *colormodes[32] = {
101102 _T("None"),
@@ -1562,6 +1563,7 @@
15631564 }
15641565 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
15651566 *dirty = TRUE;
 1567+ modelistdirty = TRUE;
15661568 }
15671569 }
15681570 if (HIWORD(wParam) == CBN_DROPDOWN)
@@ -1593,6 +1595,7 @@
15941596 }
15951597 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
15961598 *dirty = TRUE;
 1599+ modelistdirty = TRUE;
15971600 }
15981601 }
15991602 if (HIWORD(wParam) == CBN_DROPDOWN)
@@ -1608,6 +1611,7 @@
16091612 cfg->scaler = GetCombo(hWnd, IDC_VIDMODE, &cfgmask->scaler);
16101613 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
16111614 *dirty = TRUE;
 1615+ modelistdirty = TRUE;
16121616 if (cfg->scaler == 8)
16131617 {
16141618 EnableWindow(GetDlgItem(hWnd, IDC_FIXEDSCALELABEL), TRUE);
@@ -1711,6 +1715,7 @@
17121716 cfg->SortModes = GetCombo(hWnd, IDC_SORTMODES, &cfgmask->SortModes);
17131717 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
17141718 *dirty = TRUE;
 1719+ modelistdirty = TRUE;
17151720 break;
17161721 case IDC_DPISCALE:
17171722 cfg->DPIScale = GetCombo(hWnd, IDC_DPISCALE, &cfgmask->DPIScale);
@@ -1771,6 +1776,7 @@
17721777 cfgmask->postsizex, cfgmask->postsizey, tristate);
17731778 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
17741779 *dirty = TRUE;
 1780+ modelistdirty = TRUE;
17751781 }
17761782 else if (HIWORD(wParam) == CBN_SELCHANGE)
17771783 {
@@ -1778,6 +1784,7 @@
17791785 &cfgmask->postsizex, &cfgmask->postsizey);
17801786 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
17811787 *dirty = TRUE;
 1788+ modelistdirty = TRUE;
17821789 }
17831790 break;
17841791 case IDC_PRIMARYSCALE:
@@ -2375,6 +2382,7 @@
23762383 RedrawWindow(GetDlgItem(hWnd, IDC_HACKSLIST), NULL, NULL, RDW_INVALIDATE);
23772384 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
23782385 *dirty = TRUE;
 2386+ if(item == 2) modelistdirty = TRUE;
23792387 }
23802388 break;
23812389 default:
@@ -3349,6 +3357,7 @@
33503358 return TRUE;
33513359 case IDC_APPLY:
33523360 SaveChanges(hWnd);
 3361+ if(modelistdirty) ResetModeList(hTabs[6]);
33533362 return TRUE;
33543363 case IDC_APPS:
33553364 if(HIWORD(wParam) == CBN_SELCHANGE)
Index: dxglcfg/dxgltest.cpp
@@ -23,6 +23,7 @@
2424 static HINSTANCE hinstance;
2525 bool gradientavailable;
2626 BOOL (WINAPI *_GradientFill)(HDC hdc, TRIVERTEX* pVertices, ULONG nVertices, void* pMesh, ULONG nMeshElements, DWORD dwMode) = NULL;
 27+extern BOOL modelistdirty;
2728
2829 void GetFileVersion(tstring &version, LPCTSTR filename)
2930 {
@@ -242,6 +243,20 @@
243244
244245 TCHAR tmpstring[33];
245246
 247+void ResetModeList(HWND hWnd)
 248+{
 249+ LPDIRECTDRAW lpdd;
 250+ HRESULT error;
 251+ SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_RESETCONTENT, 0, 0);
 252+ error = DirectDrawCreate(NULL, &lpdd, NULL);
 253+ if (error == DD_OK)
 254+ {
 255+ error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, GetDlgItem(hWnd, IDC_VIDMODES), EnumModesCallback8);
 256+ IDirectDraw_Release(lpdd);
 257+ }
 258+ SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_SETCURSEL, modenum, 0);
 259+}
 260+
246261 INT_PTR CALLBACK TestTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
247262 {
248263 int i;
@@ -261,7 +276,7 @@
262277 if(error == DD_OK)
263278 {
264279 error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,GetDlgItem(hWnd,IDC_VIDMODES),EnumModesCallback8);
265 - lpdd->Release();
 280+ IDirectDraw_Release(lpdd);
266281 }
267282 SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_SETCURSEL,modenum,0);
268283 break;
@@ -335,6 +350,7 @@
336351 Do you want to apply them before running this test?"),
337352 _T("Notice"), MB_YESNO | MB_ICONQUESTION) == IDYES)
338353 SaveChanges(hDialog);
 354+ if (modelistdirty) ResetModeList(hWnd);
339355 }
340356 if (SendDlgItemMessage(hWnd, IDC_RESIZABLE, BM_GETCHECK, 0, 0)) resizable = true;
341357 else resizable = false;
Index: dxglcfg/dxgltest.h
@@ -19,5 +19,6 @@
2020
2121 #include "resource.h"
2222
 23+void ResetModeList(HWND hWnd);
2324 INT_PTR CALLBACK TestTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
2425 INT_PTR CALLBACK AboutTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);