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 #define versionSection (appSettings == EDITING_GLOBAL ? "Version" : (getSectionForApp("Version")))
41 #define tweakSection (appSettings == EDITING_GLOBAL ? "Tweak.Layout" : (getSectionForApp("Tweak.Layout")))
44 PropSheetCallback (HWND hWnd
, UINT uMsg
, LPARAM lParam
)
49 * hWnd = NULL, lParam == dialog resource
54 case PSCB_INITIALIZED
:
63 initGeneralDlg (HWND hDlg
)
66 const VERSION_DESC
*pVer
= NULL
;
67 char *curWinVer
= getConfigValue(versionSection
, "Windows", "win98");
68 char *curDOSVer
= getConfigValue(versionSection
, "DOS", "6.22");
69 char *curWineLook
= getConfigValue(tweakSection
, "WineLook", "win95");
71 /* normalize the version strings */
72 if (!strcmp(curWinVer
, "win2000") || !strcmp(curWinVer
, "nt2k") || !strcmp(curWinVer
, "nt2000")) {
74 curWinVer
= strdup("win2k");
77 if (!strcmp(curWinVer
, "win2k3")) {
79 curWinVer
= strdup("win2003");
82 if ((pVer
= getWinVersions ()))
84 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
86 SendDlgItemMessage (hDlg
, IDC_WINVER
, CB_ADDSTRING
,
87 0, (LPARAM
) pVer
->szDescription
);
88 if (!strcmp (pVer
->szVersion
, curWinVer
))
89 SendDlgItemMessage (hDlg
, IDC_WINVER
, CB_SETCURSEL
,
93 if ((pVer
= getDOSVersions ()))
95 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
97 SendDlgItemMessage (hDlg
, IDC_DOSVER
, CB_ADDSTRING
,
98 0, (LPARAM
) pVer
->szDescription
);
99 if (!strcmp (pVer
->szVersion
, curDOSVer
))
100 SendDlgItemMessage (hDlg
, IDC_DOSVER
, CB_SETCURSEL
,
104 if ((pVer
= getWinelook ()))
106 for (i
= 0; *pVer
->szVersion
; i
++, pVer
++)
108 SendDlgItemMessage (hDlg
, IDC_WINELOOK
, CB_ADDSTRING
,
109 0, (LPARAM
) pVer
->szDescription
);
110 if (!strcmp (pVer
->szVersion
, curWineLook
))
111 SendDlgItemMessage (hDlg
, IDC_WINELOOK
, CB_SETCURSEL
,
122 GeneralDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
127 if (((LPNMHDR
)lParam
)->code
!= PSN_SETACTIVE
) break;
128 /* otherwise fall through, we want to refresh the page as well */
130 initGeneralDlg (hDlg
);
134 switch (LOWORD(wParam
)) {
135 case IDC_WINVER
: if (HIWORD(wParam
) == CBN_SELCHANGE
) {
136 /* user changed the wine version combobox */
137 int selection
= SendDlgItemMessage( hDlg
, IDC_WINVER
, CB_GETCURSEL
, 0, 0);
138 VERSION_DESC
*desc
= getWinVersions();
140 while (selection
> 0) {
143 addTransaction(versionSection
, "Windows", ACTION_SET
, desc
->szVersion
);
147 case IDC_WINELOOK
: if (HIWORD(wParam
) == CBN_SELCHANGE
) {
148 /* user changed the wine look combo box */
149 int selection
= SendDlgItemMessage( hDlg
, IDC_WINELOOK
, CB_GETCURSEL
, 0, 0);
150 VERSION_DESC
*desc
= getWinelook();
152 while (selection
> 0) {
155 addTransaction(tweakSection
, "WineLook", ACTION_SET
, desc
->szVersion
);
159 case IDC_DOSVER
: if (HIWORD(wParam
) == CBN_SELCHANGE
) {
160 /* user changed the dos version combo box */
161 int selection
= SendDlgItemMessage( hDlg
, IDC_WINELOOK
, CB_GETCURSEL
, 0, 0);
162 VERSION_DESC
*desc
= getDOSVersions();
164 while (selection
> 0) {
167 addTransaction(versionSection
, "DOS", ACTION_SET
, desc
->szVersion
);
180 #define NUM_PROPERTY_PAGES 5
182 doPropertySheet (HINSTANCE hInstance
, HWND hOwner
)
184 PROPSHEETPAGE psp
[NUM_PROPERTY_PAGES
];
188 * Fill out the (General) PROPSHEETPAGE data structure
189 * for the property sheet
191 psp
[0].dwSize
= sizeof (PROPSHEETPAGE
);
192 psp
[0].dwFlags
= PSP_USETITLE
;
193 psp
[0].hInstance
= hInstance
;
194 psp
[0].u
.pszTemplate
= MAKEINTRESOURCE (IDD_GENERALCFG
);
195 psp
[0].u2
.pszIcon
= NULL
;
196 psp
[0].pfnDlgProc
= GeneralDlgProc
;
197 psp
[0].pszTitle
= "General";
201 * Fill out the (Applications) PROPSHEETPAGE data structure
202 * for the property sheet
204 psp
[1].dwSize
= sizeof (PROPSHEETPAGE
);
205 psp
[1].dwFlags
= PSP_USETITLE
;
206 psp
[1].hInstance
= hInstance
;
207 psp
[1].u
.pszTemplate
= MAKEINTRESOURCE (IDD_APPCFG
);
208 psp
[1].u2
.pszIcon
= NULL
;
209 psp
[1].pfnDlgProc
= AppDlgProc
;
210 psp
[1].pszTitle
= "Applications";
214 * Fill out the (Libraries) PROPSHEETPAGE data structure
215 * for the property sheet
217 psp
[2].dwSize
= sizeof (PROPSHEETPAGE
);
218 psp
[2].dwFlags
= PSP_USETITLE
;
219 psp
[2].hInstance
= hInstance
;
220 psp
[2].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DLLCFG
);
221 psp
[2].u2
.pszIcon
= NULL
;
222 psp
[2].pfnDlgProc
= LibrariesDlgProc
;
223 psp
[2].pszTitle
= "Libraries";
227 * Fill out the (X11Drv) PROPSHEETPAGE data structure
228 * for the property sheet
230 psp
[3].dwSize
= sizeof (PROPSHEETPAGE
);
231 psp
[3].dwFlags
= PSP_USETITLE
;
232 psp
[3].hInstance
= hInstance
;
233 psp
[3].u
.pszTemplate
= MAKEINTRESOURCE (IDD_X11DRVCFG
);
234 psp
[3].u2
.pszIcon
= NULL
;
235 psp
[3].pfnDlgProc
= X11DrvDlgProc
;
236 psp
[3].pszTitle
= "X11 Driver";
239 psp
[4].dwSize
= sizeof (PROPSHEETPAGE
);
240 psp
[4].dwFlags
= PSP_USETITLE
;
241 psp
[4].hInstance
= hInstance
;
242 psp
[4].u
.pszTemplate
= MAKEINTRESOURCE (IDD_DRIVECFG
);
243 psp
[4].u2
.pszIcon
= NULL
;
244 psp
[4].pfnDlgProc
= DriveDlgProc
;
245 psp
[4].pszTitle
= "Drives";
249 * Fill out the PROPSHEETHEADER
251 psh
.dwSize
= sizeof (PROPSHEETHEADER
);
252 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_USEICONID
| PSH_USECALLBACK
;
253 psh
.hwndParent
= hOwner
;
254 psh
.hInstance
= hInstance
;
255 psh
.u
.pszIcon
= NULL
;
256 psh
.pszCaption
= "Wine Configuration";
257 psh
.nPages
= NUM_PROPERTY_PAGES
;
258 psh
.u3
.ppsp
= (LPCPROPSHEETPAGE
) & psp
;
259 psh
.pfnCallback
= (PFNPROPSHEETCALLBACK
) PropSheetCallback
;
260 psh
.u2
.nStartPage
= 0;
263 * Display the modal property sheet
265 return PropertySheet (&psh
);
269 /*****************************************************************************
271 * Description: Main windows entry point
272 * Parameters : hInstance
276 * Returns : Program exit code
279 WinMain (HINSTANCE hInstance
, HINSTANCE hPrev
, LPSTR szCmdLine
, int nShow
)
282 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
283 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
284 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
286 if (initialize() != 0) {
287 WINE_ERR("initialization failed, aborting\n");
292 * The next 3 lines should be all that is needed
293 * for the Wine Configuration property sheet
295 InitCommonControls ();
296 if (doPropertySheet (hInstance
, NULL
) > 0) {
299 WINE_TRACE("Cancel\n");