Cast time_t to long for printing.
[wine] / programs / winecfg / winecfg.h
1 /*
2  * WineCfg configuration management
3  *
4  * Copyright 2002 Jaco Greeff
5  * Copyright 2003 Dimitrie O. Paun
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef WINE_CFG_H
24 #define WINE_CFG_H
25
26 #include <stdarg.h>
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winnls.h"
33 #include "properties.h"
34
35 #define IS_OPTION_TRUE(ch) \
36     ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
37 #define IS_OPTION_FALSE(ch) \
38     ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
39
40 #define return_if_fail(try) \
41     if (!(try)) { \
42         WINE_ERR("check (" #try ") at %s:%d failed, returning\n", __FILE__,  __LINE__ - 1); \
43         return; \
44     }
45
46 #define WRITEME(owner) MessageBox(owner, "Write me!", "", MB_OK | MB_ICONEXCLAMATION);
47   
48
49 /* Transaction management */
50 enum transaction_action {
51     ACTION_SET,
52     ACTION_REMOVE
53 };
54
55 struct transaction {
56     char *section;
57     char *key;
58     char *newValue;
59     enum transaction_action action;
60     struct transaction *next, *prev;
61 };
62 extern struct transaction *tqhead, *tqtail;
63
64 extern int instantApply; /* non-zero means apply all changes instantly */
65
66 #define EDITING_GLOBAL 0
67 #define EDITING_APP    1
68 extern int appSettings;  /* non-zero means we are editing appdefault settings */
69
70 /* returns a string of the form AppDefaults\\appname.exe\\section */
71 /* no explicit free is needed of the string returned by this function */
72 char *getSectionForApp(char *section); 
73
74 /* Commits a transaction to the registry */
75 void processTransaction(struct transaction *trans);
76
77 /* Processes every pending transaction in the queue, removing them as it works from head to tail */
78 void processTransQueue();
79
80 /* Adds a transaction to the head of the queue. If we're using instant apply, this calls processTransaction
81  * action can be either:
82  *   ACTION_SET -> this transaction will change a registry key, newValue is the replacement value
83  *   ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored.
84  */
85 void addTransaction(char *section, char *key, enum transaction_action action, char *newValue);
86
87 /* frees the transaction structure, all fields, and removes it from the queue if in it */
88 void destroyTransaction(struct transaction *trans);
89
90 /* Initializes the transaction system */
91 int initialize(void);
92 extern HKEY configKey;
93
94 int setConfigValue (char *subkey, char *valueName, const char *value);
95 char *getConfigValue (char *subkey, char *valueName, char *defaultResult);
96 HRESULT doesConfigValueExist (char *subkey, char *valueName);
97 HRESULT removeConfigValue (char *subkey, char *valueName);
98
99 /* X11DRV */
100
101 void initX11DrvDlg (HWND hDlg);
102 void saveX11DrvDlgSettings (HWND hDlg);
103 INT_PTR CALLBACK X11DrvDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
104
105 /* Drive management */
106 void initDriveDlg (HWND hDlg);
107 void saveDriveSettings (HWND hDlg);
108
109 INT_PTR CALLBACK DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
110 INT_PTR CALLBACK DriveEditDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
111 INT_PTR CALLBACK AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
112
113 /* some basic utilities to make win32 suck less */
114 char *getDialogItemText(HWND hDlg, WORD controlID);
115 #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
116 #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
117
118
119 #define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config"
120
121 #endif