DXGL r818 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r817‎ | r818 | r819 >
Date:17:43, 1 June 2018
Author:admin
Status:new
Tags:
Comment:
Use Windows default position for DXGL Config dialog box.
Add dialog box for Save INI file.
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -1951,6 +1951,36 @@
19521952 return TRUE;
19531953 }
19541954
 1955+LRESULT CALLBACK SaveINICallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 1956+{
 1957+ switch(Msg)
 1958+ {
 1959+ case WM_INITDIALOG:
 1960+ SendDlgItemMessage(hWnd, IDC_NOWRITEREGISTRY, BM_SETCHECK, BST_CHECKED, 0);
 1961+ SendDlgItemMessage(hWnd, IDC_OVERRIDEREGISTRY, BM_SETCHECK, BST_UNCHECKED, 0);
 1962+ SendDlgItemMessage(hWnd, IDC_NOOVERWRITE, BM_SETCHECK, BST_UNCHECKED, 0);
 1963+ SendDlgItemMessage(hWnd, IDC_SAVESHA256, BM_SETCHECK, BST_CHECKED, 0);
 1964+ SendDlgItemMessage(hWnd, IDC_NOUNINSTALL, BM_SETCHECK, BST_CHECKED, 0);
 1965+ return TRUE;
 1966+ case WM_COMMAND:
 1967+ switch (LOWORD(wParam))
 1968+ {
 1969+ case IDOK:
 1970+ EndDialog(hWnd, IDOK);
 1971+ return TRUE;
 1972+ case IDCANCEL:
 1973+ EndDialog(hWnd, IDCANCEL);
 1974+ return TRUE;
 1975+ default:
 1976+ break;
 1977+ }
 1978+ return FALSE;
 1979+ default:
 1980+ return FALSE;
 1981+ }
 1982+ return TRUE;
 1983+}
 1984+
19551985 LRESULT CALLBACK AdvancedTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
19561986 {
19571987 switch (Msg)
@@ -2061,6 +2091,9 @@
20622092 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
20632093 *dirty = TRUE;
20642094 break;
 2095+ case IDC_WRITEINI:
 2096+ DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVEINI), hWnd, (DLGPROC)SaveINICallback);
 2097+ break;
20652098 default:
20662099 break;
20672100 }
@@ -2612,6 +2645,8 @@
26132646 DWORD dpisupport;
26142647 TCITEM tab;
26152648 HWND hProgressWnd;
 2649+ WNDCLASSEX wndclass;
 2650+ HWND hTempWnd;
26162651 switch (Msg)
26172652 {
26182653 case WM_INITDIALOG:
@@ -2619,6 +2654,24 @@
26202655 CreateThread(NULL, 0, ProgressThread, &hProgressWnd, 0, NULL);
26212656 while (hProgressWnd == NULL) Sleep(10);
26222657 hDialog = hWnd;
 2658+ ZeroMemory(&wndclass, sizeof(WNDCLASSEX));
 2659+ wndclass.cbSize = sizeof(WNDCLASSEX);
 2660+ wndclass.lpfnWndProc = DefWindowProc;
 2661+ wndclass.hInstance = GetModuleHandle(NULL);
 2662+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 2663+ wndclass.hbrBackground = (HBRUSH)COLOR_WINDOW;
 2664+ wndclass.lpszClassName = _T("DXGLConfigDlgPosition");
 2665+ RegisterClassEx(&wndclass);
 2666+ GetWindowRect(hWnd, &r);
 2667+ hTempWnd = CreateWindow(_T("DXGLConfigDlgPosition"), _T("DXGL Config"),
 2668+ DS_3DLOOK | DS_CONTEXTHELP | DS_SHELLFONT | WS_CAPTION | WS_SYSMENU,
 2669+ CW_USEDEFAULT, CW_USEDEFAULT, r.right-r.left,r.bottom-r.top,NULL,NULL,
 2670+ GetModuleHandle(NULL), NULL);
 2671+ error = GetLastError();
 2672+ GetWindowRect(hTempWnd, &r);
 2673+ SetWindowPos(hWnd, HWND_TOP,r.left,r.top,0,0, SWP_NOSIZE);
 2674+ DestroyWindow(hTempWnd);
 2675+ UnregisterClass(_T("DXGLConfigDlgPosition"), GetModuleHandle(NULL));
26232676 tristate = FALSE;
26242677 maxapps = 128;
26252678 apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
Index: dxglcfg/dxglcfg.rc
@@ -133,8 +133,7 @@
134134 AUTOCHECKBOX "Capture mouse in window mode (Press Ctrl+Alt to release)", IDC_CAPTUREMOUSE, 7, 114, 196, 8, 0, WS_EX_LEFT
135135 LTEXT "Installation path", IDC_PATHLABEL, 7, 124, 51, 9, SS_LEFT, WS_EX_LEFT
136136 EDITTEXT IDC_PROFILEPATH, 7, 135, 331, 14, NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY, WS_EX_LEFT
137 - // Removed for DXGL 0.5.13 release
138 - // PUSHBUTTON "Write INI file...", IDC_WRITEINI, 262, 150, 73, 14, 0, WS_EX_LEFT
 137+ PUSHBUTTON "Write INI file...", IDC_WRITEINI, 262, 150, 73, 14, 0, WS_EX_LEFT
139138 }
140139
141140
@@ -259,6 +258,24 @@
260259
261260
262261 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 262+IDD_SAVEINI DIALOG 0, 0, 186, 95
 263+STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
 264+CAPTION "Save .ini File"
 265+FONT 8, "Ms Shell Dlg"
 266+{
 267+ AUTOCHECKBOX "Don't write application profile to registry", IDC_NOWRITEREGISTRY, 11, 16, 138, 8, 0, WS_EX_LEFT
 268+ AUTOCHECKBOX "Override global registry settings", IDC_OVERRIDEREGISTRY, 11, 26, 113, 8, 0, WS_EX_LEFT
 269+ AUTOCHECKBOX "Prevent DXGL Config from overwriting ddraw.dll", IDC_NOOVERWRITE, 11, 36, 165, 8, 0, WS_EX_LEFT
 270+ GROUPBOX ".ini file options", 0, 5, 5, 172, 69, 0, WS_EX_LEFT
 271+ AUTOCHECKBOX "Save SHA-256 signature of existing ddraw.dll", IDC_SAVESHA256, 11, 46, 157, 8, 0, WS_EX_LEFT
 272+ AUTOCHECKBOX "Prevent DXGL Config from deleting ddraw.dll", IDC_NOUNINSTALL, 11, 56, 156, 8, 0, WS_EX_LEFT
 273+ PUSHBUTTON "Cancel", IDCANCEL, 131, 76, 50, 14, 0, WS_EX_LEFT
 274+ DEFPUSHBUTTON "&Save...", IDOK, 76, 76, 50, 14, 0, WS_EX_LEFT
 275+}
 276+
 277+
 278+
 279+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
263280 IDD_TEXSHADER DIALOG 0, 0, 487, 317
264281 STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
265282 CAPTION "Texture Shader Demo"
Index: dxglcfg/resource.h
@@ -25,6 +25,7 @@
2626 #define IDD_TEXSHADER 103
2727 #define IDD_VERTEXSHADER 104
2828 #define IDD_MODELIST 105
 29+#define IDD_SAVEINI 106
2930
3031 // Tabs
3132 #define IDD_DISPLAY 201
@@ -260,3 +261,10 @@
261262
262263 // Controls - Mode list dialog
263264 #define IDC_MODELIST 3101
 265+
 266+// Controls - Save .ini file dialog
 267+#define IDC_NOWRITEREGISTRY 3201
 268+#define IDC_OVERRIDEREGISTRY 3202
 269+#define IDC_NOOVERWRITE 3203
 270+#define IDC_SAVESHA256 3204
 271+#define IDC_NOUNINSTALL 3205