2 * WineCfg main entry point
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2003 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
31 #include <wine/debug.h>
33 #include "properties.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
40 PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
45 * hWnd = NULL, lParam == dialog resource
50 case PSCB_INITIALIZED:
59 initGeneralDlg (HWND hDlg)
62 const VERSION_DESC *pVer = NULL;
63 char *curWinVer = getConfigValue("Version", "Windows", "win98");
64 char *curDOSVer = getConfigValue("Version", "DOS", "6.22");
65 char *curWineLook = getConfigValue("Tweak.Layout", "WineLook", "win95");
67 /* normalize the version strings */
68 if (!strcmp(curWinVer, "win2000") || !strcmp(curWinVer, "nt2k") || !strcmp(curWinVer, "nt2000")) {
70 curWinVer = strdup("win2k");
73 if (!strcmp(curWinVer, "win2k3")) {
75 curWinVer = strdup("win2003");
78 if ((pVer = getWinVersions ()))
80 for (i = 0; *pVer->szVersion; i++, pVer++)
82 SendDlgItemMessage (hDlg, IDC_WINVER, CB_ADDSTRING,
83 0, (LPARAM) pVer->szDescription);
84 if (!strcmp (pVer->szVersion, curWinVer))
85 SendDlgItemMessage (hDlg, IDC_WINVER, CB_SETCURSEL,
89 if ((pVer = getDOSVersions ()))
91 for (i = 0; *pVer->szVersion; i++, pVer++)
93 SendDlgItemMessage (hDlg, IDC_DOSVER, CB_ADDSTRING,
94 0, (LPARAM) pVer->szDescription);
95 if (!strcmp (pVer->szVersion, curDOSVer))
96 SendDlgItemMessage (hDlg, IDC_DOSVER, CB_SETCURSEL,
100 if ((pVer = getWinelook ()))
102 for (i = 0; *pVer->szVersion; i++, pVer++)
104 SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_ADDSTRING,
105 0, (LPARAM) pVer->szDescription);
106 if (!strcmp (pVer->szVersion, curWineLook))
107 SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_SETCURSEL,
118 GeneralDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
123 initGeneralDlg (hDlg);
127 switch (LOWORD(wParam)) {
128 case IDC_WINVER: if (HIWORD(wParam) == CBN_SELCHANGE) {
129 /* user changed the wine version combobox */
130 int selection = SendDlgItemMessage( hDlg, IDC_WINVER, CB_GETCURSEL, 0, 0);
131 VERSION_DESC *desc = getWinVersions();
133 while (selection > 0) {
136 addTransaction("Version", "Windows", ACTION_SET, desc->szVersion);
151 DllDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
165 #define NUM_PROPERTY_PAGES 5
167 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
169 PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
173 * Fill out the (General) PROPSHEETPAGE data structure
174 * for the property sheet
176 psp[0].dwSize = sizeof (PROPSHEETPAGE);
177 psp[0].dwFlags = PSP_USETITLE;
178 psp[0].hInstance = hInstance;
179 psp[0].u.pszTemplate = MAKEINTRESOURCE (IDD_GENERALCFG);
180 psp[0].u2.pszIcon = NULL;
181 psp[0].pfnDlgProc = GeneralDlgProc;
182 psp[0].pszTitle = "General";
186 * Fill out the (Applications) PROPSHEETPAGE data structure
187 * for the property sheet
189 psp[1].dwSize = sizeof (PROPSHEETPAGE);
190 psp[1].dwFlags = PSP_USETITLE;
191 psp[1].hInstance = hInstance;
192 psp[1].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
193 psp[1].u2.pszIcon = NULL;
194 psp[1].pfnDlgProc = AppDlgProc;
195 psp[1].pszTitle = "Applications";
199 * Fill out the (Libraries) PROPSHEETPAGE data structure
200 * for the property sheet
202 psp[2].dwSize = sizeof (PROPSHEETPAGE);
203 psp[2].dwFlags = PSP_USETITLE;
204 psp[2].hInstance = hInstance;
205 psp[2].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
206 psp[2].u2.pszIcon = NULL;
207 psp[2].pfnDlgProc = DllDlgProc;
208 psp[2].pszTitle = "Libraries";
212 * Fill out the (X11Drv) PROPSHEETPAGE data structure
213 * for the property sheet
215 psp[3].dwSize = sizeof (PROPSHEETPAGE);
216 psp[3].dwFlags = PSP_USETITLE;
217 psp[3].hInstance = hInstance;
218 psp[3].u.pszTemplate = MAKEINTRESOURCE (IDD_X11DRVCFG);
219 psp[3].u2.pszIcon = NULL;
220 psp[3].pfnDlgProc = X11DrvDlgProc;
221 psp[3].pszTitle = "X11 Driver";
224 psp[4].dwSize = sizeof (PROPSHEETPAGE);
225 psp[4].dwFlags = PSP_USETITLE;
226 psp[4].hInstance = hInstance;
227 psp[4].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
228 psp[4].u2.pszIcon = NULL;
229 psp[4].pfnDlgProc = DriveDlgProc;
230 psp[4].pszTitle = "Drives";
234 * Fill out the PROPSHEETHEADER
236 psh.dwSize = sizeof (PROPSHEETHEADER);
237 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
238 psh.hwndParent = hOwner;
239 psh.hInstance = hInstance;
240 psh.u.pszIcon = NULL;
241 psh.pszCaption = "Wine Configuration";
242 psh.nPages = NUM_PROPERTY_PAGES;
243 psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
244 psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
245 psh.u2.nStartPage = 0;
248 * Display the modal property sheet
250 return PropertySheet (&psh);
254 /*****************************************************************************
256 * Description: Main windows entry point
257 * Parameters : hInstance
261 * Returns : Program exit code
264 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
267 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
268 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
269 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
271 if (initialize() != 0) {
272 WINE_ERR("initialization failed, aborting\n");
277 * The next 3 lines should be all that is needed
278 * for the Wine Configuration property sheet
280 InitCommonControls ();
281 if (doPropertySheet (hInstance, NULL) > 0) {
284 WINE_TRACE("Cancel\n");