ReactOS 0.4.15-dev-7788-g1ad9096
settings.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2004 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // dialogs/settings.cpp
24 //
25 // Explorer dialogs
26 //
27 // Martin Fuchs, 18.01.2004
28 //
29
30
31#include <precomp.h>
32
33#include "../taskbar/traynotify.h"
34#include "settings.h"
35
36
38{
39 PropertySheetDialog ps(hparent);
40
41 ps.dwFlags |= PSH_USEICONID | PSH_PROPTITLE;
42 ps.pszIcon = MAKEINTRESOURCE(IDI_REACTOS);
43 ps.pszCaption = TEXT("Explorer");
44
46 psp1.dwFlags |= PSP_USETITLE;
47 psp1.pszTitle = MAKEINTRESOURCE(IDS_DESKTOP);
48 ps.add(psp1);
49
51 psp2.dwFlags |= PSP_USETITLE;
52 psp2.pszTitle = MAKEINTRESOURCE(IDS_TASKBAR);
53 ps.add(psp2);
54
56 psp3.dwFlags |= PSP_USETITLE;
57 psp3.pszTitle = MAKEINTRESOURCE(IDS_STARTMENU);
58 ps.add(psp3);
59
60 ps.DoModal();
61}
62
63
65 : super(hwnd),
66 _bmp0(IDB_ICON_ALIGN_0),
67 _bmp1(IDB_ICON_ALIGN_1),
68 _bmp2(IDB_ICON_ALIGN_2),
69 _bmp3(IDB_ICON_ALIGN_3),
70 _bmp4(IDB_ICON_ALIGN_4),
71 _bmp5(IDB_ICON_ALIGN_5),
72 _bmp6(IDB_ICON_ALIGN_6),
73 _bmp7(IDB_ICON_ALIGN_7),
74 _bmp8(IDB_ICON_ALIGN_8),
75 _bmp9(IDB_ICON_ALIGN_9),
76 _bmp10(IDB_ICON_ALIGN_10)
77{
89
92
95}
96
97#ifndef PSN_QUERYINITIALFOCUS // currently (as of 18.01.2004) missing in MinGW headers
98#define PSN_QUERYINITIALFOCUS (-213)
99#endif
100
102{
103 switch(pnmh->code) {
106 break;
107
108 case PSN_APPLY:
111 break;
112
113 case PSN_RESET:
117 break;
118
119 default:
120 return super::Notify(id, pnmh);
121 }
122
123 return 0;
124}
125
127{
128 if (id>=IDC_ICON_ALIGN_0 && id<=IDC_ICON_ALIGN_10) {
129 int alignment = id - IDC_ICON_ALIGN_0;
130
131 if (alignment != _alignment_tmp) {
132 _alignment_tmp = alignment;
133
134 PropSheet_Changed(GetParent(_hwnd), _hwnd);
135
137 }
138
139 return 0;
140 }
141
142 switch(id) {
144 SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,1)); // toggle version display flag
145 PropSheet_Changed(GetParent(_hwnd), _hwnd);
146 break;
147
148 default:
149 return 1;
150 }
151
152 return 0;
153}
154
155
157 : super(hwnd),
158 _cfg_org(g_Globals._cfg)
159{
160 XMLPos options = g_Globals.get_cfg("desktopbar/options");
161
162 CheckDlgButton(hwnd, ID_SHOW_CLOCK, XMLBool(options, "show-clock", true)? BST_CHECKED: BST_UNCHECKED);
163 CheckDlgButton(hwnd, ID_HIDE_INACTIVE_ICONS, XMLBool(options, "hide-inactive", true)? BST_CHECKED: BST_UNCHECKED);
164}
165
167{
168 switch(pnmh->code) {
169 case PSN_APPLY:
171 break;
172
173 case PSN_RESET:
176 break;
177
178 default:
179 return super::Notify(id, pnmh);
180 }
181
182 return 0;
183}
184
186{
187 switch(id) {
190 break;
191
192 case ID_SHOW_CLOCK: {
193 XMLBoolRef boolRef1(XMLPos(g_Globals.get_cfg("desktopbar/options")), "show-clock", true);
194 boolRef1.toggle();
196 PropSheet_Changed(GetParent(_hwnd), _hwnd);
197 break;}
198
200 XMLBoolRef boolRef2(XMLPos(g_Globals.get_cfg("notify-icons/options")), "hide-inactive", true);
201 boolRef2.toggle();
203 PropSheet_Changed(GetParent(_hwnd), _hwnd);
204 break;}
205
206 default:
207 return 1;
208 }
209
210 return 0;
211}
212
213
215 : super(hwnd)
216{
217}
218
220{
221/*
222 switch(id) {
223 case ID_CONFIG_NOTIFYAREA:
224 Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
225 return 0;
226 }
227*/
228 return 1;
229}
230
231
233 : super(hwnd)
234{
236
237 XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
238 bool mdi = XMLBool(explorer_options, "mdi", true);
239 bool separateFolders = XMLBool(explorer_options, "separate-folders", true);
240
241 int id = mdi? IDC_MDI: IDC_SDI;
244
246}
247
248int MdiSdiDlg::Command(int id, int code)
249{
250 if (code == BN_CLICKED) {
251 switch(id) {
252 case IDOK: {
253 bool mdi = IsDlgButtonChecked(_hwnd, IDC_MDI)==BST_CHECKED;
254 bool separateFolders = IsDlgButtonChecked(_hwnd, IDC_SEPARATE_SUBFOLDERS)==BST_CHECKED;
255
256 XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
257
258 XMLBoolRef(explorer_options, "mdi") = mdi;
259 XMLBoolRef(explorer_options, "separate-folders") = separateFolders;
260 } // fall through
261
262 case IDCANCEL:
263 EndDialog(_hwnd, id);
264 break;
265 }
266
267 return 0;
268 }
269
270 return 1;
271}
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:48
#define PM_REFRESH_CONFIG
Definition: explorer.h:70
#define TEXT(s)
Definition: k32.h:26
#define PM_DISPLAY_VERSION
Definition: desktop.h:31
#define PM_SET_ICON_ALGORITHM
Definition: desktop.h:29
#define PM_GET_ICON_ALGORITHM
Definition: desktop.h:30
void ExplorerPropertySheet(HWND hparent)
Definition: settings.cpp:37
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define IDC_ICON_ALIGN_10
Definition: resource.h:160
#define IDD_DESKBAR_STARTMENU
Definition: resource.h:100
#define ID_SHOW_CLOCK
Definition: resource.h:173
#define IDC_MDI
Definition: resource.h:179
#define IDC_ICON_ALIGN_4
Definition: resource.h:148
#define IDC_ICON_ALIGN_8
Definition: resource.h:156
#define IDC_ICON_ALIGN_1
Definition: resource.h:144
#define IDD_DESKBAR_DESKTOP
Definition: resource.h:63
#define IDB_ICON_ALIGN_8
Definition: resource.h:110
#define IDB_ICON_ALIGN_5
Definition: resource.h:107
#define IDD_DESKBAR_TASKBAR
Definition: resource.h:98
#define IDC_ICON_ALIGN_5
Definition: resource.h:150
#define IDB_ICON_ALIGN_4
Definition: resource.h:106
#define IDC_ICON_ALIGN_6
Definition: resource.h:152
#define IDB_ICON_ALIGN_6
Definition: resource.h:108
#define IDB_ICON_ALIGN_0
Definition: resource.h:99
#define IDC_ICON_ALIGN_7
Definition: resource.h:154
#define IDB_ICON_ALIGN_3
Definition: resource.h:104
#define IDB_ICON_ALIGN_7
Definition: resource.h:109
#define IDS_TASKBAR
Definition: resource.h:35
#define IDB_ICON_ALIGN_9
Definition: resource.h:111
#define IDB_ICON_ALIGN_2
Definition: resource.h:102
#define IDC_SDI
Definition: resource.h:180
#define IDB_ICON_ALIGN_10
Definition: resource.h:113
#define IDC_ICON_ALIGN_0
Definition: resource.h:143
#define ID_CONFIG_NOTIFYAREA
Definition: resource.h:218
#define IDC_ICON_ALIGN_9
Definition: resource.h:158
#define IDD_NOTIFYAREA
Definition: resource.h:103
#define IDB_ICON_ALIGN_1
Definition: resource.h:101
#define IDC_ICON_ALIGN_3
Definition: resource.h:147
#define IDC_SEPARATE_SUBFOLDERS
Definition: resource.h:181
#define ID_DESKTOP_VERSION
Definition: resource.h:174
#define IDC_ICON_ALIGN_2
Definition: resource.h:146
#define ID_HIDE_INACTIVE_ICONS
Definition: resource.h:172
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
#define IDI_REACTOS
Definition: osk_res.h:21
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSP_USETITLE
Definition: prsht.h:26
#define PSN_APPLY
Definition: prsht.h:117
#define PSH_USEICONID
Definition: prsht.h:42
#define PSN_RESET
Definition: prsht.h:118
#define IDS_DESKTOP
Definition: shresdef.h:73
#define IDS_STARTMENU
Definition: shresdef.h:92
"Desktopbar Settings" Property Sheet Dialog
Definition: settings.h:36
ResBitmap _bmp4
Definition: settings.h:46
ResBitmap _bmp3
Definition: settings.h:45
ResBitmap _bmp7
Definition: settings.h:49
ResBitmap _bmp6
Definition: settings.h:48
int _display_version_org
Definition: settings.h:57
virtual int Command(int id, int code)
Definition: settings.cpp:126
ResBitmap _bmp1
Definition: settings.h:43
ResBitmap _bmp10
Definition: settings.h:52
ResBitmap _bmp8
Definition: settings.h:50
DesktopSettingsDlg(HWND hwnd)
Definition: settings.cpp:64
ResBitmap _bmp9
Definition: settings.h:51
ResBitmap _bmp5
Definition: settings.h:47
virtual int Notify(int id, NMHDR *pnmh)
Definition: settings.cpp:101
ResBitmap _bmp2
Definition: settings.h:44
ResBitmap _bmp0
Definition: settings.h:42
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
HWND _hwndDesktopBar
Definition: globals.h:287
XMLDoc _cfg
Definition: globals.h:293
HWND _hwndShellView
Definition: globals.h:288
XMLPos get_cfg()
Definition: explorer.cpp:119
MdiSdiDlg(HWND hwnd)
Definition: settings.cpp:232
virtual int Command(int id, int code)
Definition: settings.cpp:248
Property Sheet Page (inner dialog)
Definition: window.h:426
Property Sheet dialog.
Definition: window.h:409
int DoModal(int start_page=0)
Definition: window.cpp:1338
void add(PropSheetPage &psp)
Definition: window.cpp:1333
"Startmenu Settings" Property Sheet Dialog
Definition: settings.h:81
virtual int Command(int id, int code)
Definition: settings.cpp:219
StartmenuSettingsDlg(HWND hwnd)
Definition: settings.cpp:214
"Taskbar Settings" Property Sheet Dialog
Definition: settings.h:66
virtual int Command(int id, int code)
Definition: settings.cpp:185
TaskbarSettingsDlg(HWND hwnd)
Definition: settings.cpp:156
virtual int Notify(int id, NMHDR *pnmh)
Definition: settings.cpp:166
configuration dialog for notification icons
Definition: traynotify.h:199
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
Definition: inflate.c:139
UINT code
Definition: winuser.h:3159
#define SetWindowLongPtr
Definition: treelist.c:70
#define MAKELONG(a, b)
Definition: typedefs.h:249
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:831
#define BST_UNCHECKED
Definition: winuser.h:199
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendMessage
Definition: winuser.h:5843
HWND WINAPI GetParent(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define BN_CLICKED
Definition: winuser.h:1925
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)