Rename X11 Driver tab of winecfg to Graphics.
[wine/hacks.git] / programs / winecfg / main.c
blobb3d1f823c099e2aa87649c61a077be1786861bbc
1 /*
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 #include "config.h"
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <stdarg.h>
29 #ifdef HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
36 #include <windef.h>
37 #include <winbase.h>
38 #include <winuser.h>
39 #include <commctrl.h>
40 #include <wine/debug.h>
42 #include "properties.h"
43 #include "resource.h"
44 #include "winecfg.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
48 void CALLBACK
49 PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
51 switch (uMsg)
54 * hWnd = NULL, lParam == dialog resource
56 case PSCB_PRECREATE:
57 break;
59 case PSCB_INITIALIZED:
60 break;
62 default:
63 break;
67 INT_PTR CALLBACK
68 AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
70 switch (uMsg) {
72 case WM_NOTIFY:
73 if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
74 /* otherwise fall through, we want to refresh the page as well */
75 case WM_INITDIALOG:
76 break;
78 case WM_COMMAND:
79 break;
81 default:
82 break;
85 return FALSE;
88 #define NUM_PROPERTY_PAGES 6
90 INT_PTR
91 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
93 PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
94 PROPSHEETHEADER psh;
95 int pg = 0; /* start with page 0 */
98 * Fill out the (Applications) PROPSHEETPAGE data structure
99 * for the property sheet
101 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
102 psp[pg].dwFlags = PSP_USETITLE;
103 psp[pg].hInstance = hInstance;
104 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
105 psp[pg].u2.pszIcon = NULL;
106 psp[pg].pfnDlgProc = AppDlgProc;
107 psp[pg].pszTitle = "Applications";
108 psp[pg].lParam = 0;
109 pg++;
112 * Fill out the (Libraries) PROPSHEETPAGE data structure
113 * for the property sheet
115 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
116 psp[pg].dwFlags = PSP_USETITLE;
117 psp[pg].hInstance = hInstance;
118 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
119 psp[pg].u2.pszIcon = NULL;
120 psp[pg].pfnDlgProc = LibrariesDlgProc;
121 psp[pg].pszTitle = "Libraries";
122 psp[pg].lParam = 0;
123 pg++;
126 * Fill out the (X11Drv) PROPSHEETPAGE data structure
127 * for the property sheet
129 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
130 psp[pg].dwFlags = PSP_USETITLE;
131 psp[pg].hInstance = hInstance;
132 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_GRAPHCFG);
133 psp[pg].u2.pszIcon = NULL;
134 psp[pg].pfnDlgProc = GraphDlgProc;
135 psp[pg].pszTitle = "Graphics";
136 psp[pg].lParam = 0;
137 pg++;
139 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
140 psp[pg].dwFlags = PSP_USETITLE;
141 psp[pg].hInstance = hInstance;
142 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
143 psp[pg].u2.pszIcon = NULL;
144 psp[pg].pfnDlgProc = DriveDlgProc;
145 psp[pg].pszTitle = "Drives";
146 psp[pg].lParam = 0;
147 pg++;
149 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
150 psp[pg].dwFlags = PSP_USETITLE;
151 psp[pg].hInstance = hInstance;
152 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_AUDIOCFG);
153 psp[pg].u2.pszIcon = NULL;
154 psp[pg].pfnDlgProc = AudioDlgProc;
155 psp[pg].pszTitle = "Audio";
156 psp[pg].lParam = 0;
157 pg++;
160 * Fill out the (General) PROPSHEETPAGE data structure
161 * for the property sheet
163 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
164 psp[pg].dwFlags = PSP_USETITLE;
165 psp[pg].hInstance = hInstance;
166 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_ABOUTCFG);
167 psp[pg].u2.pszIcon = NULL;
168 psp[pg].pfnDlgProc = AboutDlgProc;
169 psp[pg].pszTitle = "About";
170 psp[pg].lParam = 0;
171 pg++;
174 * Fill out the PROPSHEETHEADER
176 psh.dwSize = sizeof (PROPSHEETHEADER);
177 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
178 psh.hwndParent = hOwner;
179 psh.hInstance = hInstance;
180 psh.u.pszIcon = NULL;
181 psh.pszCaption = "Wine Configuration";
182 psh.nPages = NUM_PROPERTY_PAGES;
183 psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
184 psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
185 psh.u2.nStartPage = 0;
188 * Display the modal property sheet
190 return PropertySheet (&psh);
194 /*****************************************************************************
195 * Name : WinMain
196 * Description: Main windows entry point
197 * Parameters : hInstance
198 * hPrev
199 * szCmdLine
200 * nShow
201 * Returns : Program exit code
203 int WINAPI
204 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
207 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
208 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
209 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
211 if (initialize() != 0) {
212 WINE_ERR("initialization failed, aborting\n");
213 ExitProcess(1);
216 /* is the user running as root? */
217 if(getuid() == 0)
218 MessageBox(NULL, "It is not advisable to run wine as root. Doing so may compromise the security of your computer. Please run wine as a normal user.", "Warning", MB_OK);
221 * The next 3 lines should be all that is needed
222 * for the Wine Configuration property sheet
224 InitCommonControls ();
225 if (doPropertySheet (hInstance, NULL) > 0) {
226 WINE_TRACE("OK\n");
227 } else {
228 WINE_TRACE("Cancel\n");
231 ExitProcess (0);
233 return 0;