3e9c23429e4c47284a8abb1e558a38797c149223
2 * Copyright 2004 Martin Fuchs
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.
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.
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
23 // dialogs/settings.cpp
27 // Martin Fuchs, 18.01.2004
33 #include "../resource.h"
35 #include "../taskbar/traynotify.h"
39 void ExplorerPropertySheet(HWND hparent
)
41 PropertySheetDialog
ps(hparent
);
43 ps
.dwFlags
|= PSH_USEICONID
| PSH_PROPTITLE
;
44 ps
.pszIcon
= MAKEINTRESOURCE(IDI_REACTOS
);
45 ps
.pszCaption
= TEXT("Explorer");
47 PropSheetPage
psp1(IDD_DESKBAR_DESKTOP
, WINDOW_CREATOR(DesktopSettingsDlg
));
48 psp1
.dwFlags
|= PSP_USETITLE
;
49 psp1
.pszTitle
= MAKEINTRESOURCE(IDS_DESKTOP
);
52 PropSheetPage
psp2(IDD_DESKBAR_TASKBAR
, WINDOW_CREATOR(TaskbarSettingsDlg
));
53 psp2
.dwFlags
|= PSP_USETITLE
;
54 psp2
.pszTitle
= MAKEINTRESOURCE(IDS_TASKBAR
);
57 PropSheetPage
psp3(IDD_DESKBAR_STARTMENU
, WINDOW_CREATOR(StartmenuSettingsDlg
));
58 psp3
.dwFlags
|= PSP_USETITLE
;
59 psp3
.pszTitle
= MAKEINTRESOURCE(IDS_STARTMENU
);
66 DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd
)
68 _bmp0(IDB_ICON_ALIGN_0
),
69 _bmp1(IDB_ICON_ALIGN_1
),
70 _bmp2(IDB_ICON_ALIGN_2
),
71 _bmp3(IDB_ICON_ALIGN_3
),
72 _bmp4(IDB_ICON_ALIGN_4
),
73 _bmp5(IDB_ICON_ALIGN_5
),
74 _bmp6(IDB_ICON_ALIGN_6
),
75 _bmp7(IDB_ICON_ALIGN_7
),
76 _bmp8(IDB_ICON_ALIGN_8
),
77 _bmp9(IDB_ICON_ALIGN_9
),
78 _bmp10(IDB_ICON_ALIGN_10
)
80 new PictureButton(_hwnd
, IDC_ICON_ALIGN_0
, _bmp0
);
81 new PictureButton(_hwnd
, IDC_ICON_ALIGN_1
, _bmp1
);
82 new PictureButton(_hwnd
, IDC_ICON_ALIGN_2
, _bmp2
);
83 new PictureButton(_hwnd
, IDC_ICON_ALIGN_3
, _bmp3
);
84 new PictureButton(_hwnd
, IDC_ICON_ALIGN_4
, _bmp4
);
85 new PictureButton(_hwnd
, IDC_ICON_ALIGN_5
, _bmp5
);
86 new PictureButton(_hwnd
, IDC_ICON_ALIGN_6
, _bmp6
);
87 new PictureButton(_hwnd
, IDC_ICON_ALIGN_7
, _bmp7
);
88 new PictureButton(_hwnd
, IDC_ICON_ALIGN_8
, _bmp8
);
89 new PictureButton(_hwnd
, IDC_ICON_ALIGN_9
, _bmp9
);
90 new PictureButton(_hwnd
, IDC_ICON_ALIGN_10
, _bmp10
);
92 _alignment_cur
= SendMessage(g_Globals
._hwndShellView
, PM_GET_ICON_ALGORITHM
, 0, 0);
93 _alignment_tmp
= _alignment_cur
;
95 _display_version_org
= SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,0));
96 CheckDlgButton(hwnd
, ID_DESKTOP_VERSION
, _display_version_org
? BST_CHECKED
: BST_UNCHECKED
);
99 #ifndef PSN_QUERYINITIALFOCUS // currently (as of 18.01.2004) missing in MinGW headers
100 #define PSN_QUERYINITIALFOCUS (-213)
103 int DesktopSettingsDlg::Notify(int id
, NMHDR
* pnmh
)
106 case PSN_QUERYINITIALFOCUS
:
107 SetWindowLongPtr(_hwnd
, DWL_MSGRESULT
, (LPARAM
)GetDlgItem(_hwnd
, IDC_ICON_ALIGN_0
+_alignment_cur
));
111 _alignment_cur
= _alignment_tmp
;
112 _display_version_org
= SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,0));
116 if (_alignment_tmp
!= _alignment_cur
)
117 SendMessage(g_Globals
._hwndShellView
, PM_SET_ICON_ALGORITHM
, _alignment_cur
, 0);
118 SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, _display_version_org
, MAKELONG(1,0));
122 return super::Notify(id
, pnmh
);
128 int DesktopSettingsDlg::Command(int id
, int code
)
130 if (id
>=IDC_ICON_ALIGN_0
&& id
<=IDC_ICON_ALIGN_10
) {
131 int alignment
= id
- IDC_ICON_ALIGN_0
;
133 if (alignment
!= _alignment_tmp
) {
134 _alignment_tmp
= alignment
;
136 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
138 SendMessage(g_Globals
._hwndShellView
, PM_SET_ICON_ALGORITHM
, alignment
, 0);
145 case ID_DESKTOP_VERSION
:
146 SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,1)); // toggle version display flag
147 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
158 TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd
)
160 _cfg_org(g_Globals
._cfg
)
162 XMLPos options
= g_Globals
.get_cfg("desktopbar/options");
164 CheckDlgButton(hwnd
, ID_SHOW_CLOCK
, XMLBool(options
, "show-clock", true)? BST_CHECKED
: BST_UNCHECKED
);
165 CheckDlgButton(hwnd
, ID_HIDE_INACTIVE_ICONS
, XMLBool(options
, "hide-inactive", true)? BST_CHECKED
: BST_UNCHECKED
);
168 int TaskbarSettingsDlg::Notify(int id
, NMHDR
* pnmh
)
172 _cfg_org
= g_Globals
._cfg
;
176 g_Globals
._cfg
= _cfg_org
;
177 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
181 return super::Notify(id
, pnmh
);
187 int TaskbarSettingsDlg::Command(int id
, int code
)
190 case ID_CONFIG_NOTIFYAREA
:
191 Dialog::DoModal(IDD_NOTIFYAREA
, WINDOW_CREATOR(TrayNotifyDlg
), _hwnd
);
194 case ID_SHOW_CLOCK
: {
195 XMLBoolRef
boolRef1(XMLPos(g_Globals
.get_cfg("desktopbar/options")), "show-clock", true);
197 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
198 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
201 case ID_HIDE_INACTIVE_ICONS
: {
202 XMLBoolRef
boolRef2(XMLPos(g_Globals
.get_cfg("notify-icons/options")), "hide-inactive", true);
204 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
205 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
216 StartmenuSettingsDlg::StartmenuSettingsDlg(HWND hwnd
)
221 int StartmenuSettingsDlg::Command(int id
, int code
)
225 case ID_CONFIG_NOTIFYAREA:
226 Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
234 MdiSdiDlg::MdiSdiDlg(HWND hwnd
)
239 XMLPos explorer_options
= g_Globals
.get_cfg("general/explorer");
240 bool mdi
= XMLBool(explorer_options
, "mdi", true);
241 bool separateFolders
= XMLBool(explorer_options
, "separate-folders", true);
243 int id
= mdi
? IDC_MDI
: IDC_SDI
;
244 CheckDlgButton(hwnd
, id
, BST_CHECKED
);
245 SetFocus(GetDlgItem(hwnd
, id
));
247 CheckDlgButton(hwnd
, IDC_SEPARATE_SUBFOLDERS
, separateFolders
?BST_CHECKED
:BST_UNCHECKED
);
250 int MdiSdiDlg::Command(int id
, int code
)
252 if (code
== BN_CLICKED
) {
255 bool mdi
= IsDlgButtonChecked(_hwnd
, IDC_MDI
)==BST_CHECKED
;
256 bool separateFolders
= IsDlgButtonChecked(_hwnd
, IDC_SEPARATE_SUBFOLDERS
)==BST_CHECKED
;
258 XMLPos explorer_options
= g_Globals
.get_cfg("general/explorer");
260 XMLBoolRef(explorer_options
, "mdi") = mdi
;
261 XMLBoolRef(explorer_options
, "separate-folders") = separateFolders
;
265 EndDialog(_hwnd
, id
);