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 "../taskbar/traynotify.h"
37 void ExplorerPropertySheet(HWND hparent
)
39 PropertySheetDialog
ps(hparent
);
41 ps
.dwFlags
|= PSH_USEICONID
| PSH_PROPTITLE
;
42 ps
.pszIcon
= MAKEINTRESOURCE(IDI_REACTOS
);
43 ps
.pszCaption
= TEXT("Explorer");
45 PropSheetPage
psp1(IDD_DESKBAR_DESKTOP
, WINDOW_CREATOR(DesktopSettingsDlg
));
46 psp1
.dwFlags
|= PSP_USETITLE
;
47 psp1
.pszTitle
= MAKEINTRESOURCE(IDS_DESKTOP
);
50 PropSheetPage
psp2(IDD_DESKBAR_TASKBAR
, WINDOW_CREATOR(TaskbarSettingsDlg
));
51 psp2
.dwFlags
|= PSP_USETITLE
;
52 psp2
.pszTitle
= MAKEINTRESOURCE(IDS_TASKBAR
);
55 PropSheetPage
psp3(IDD_DESKBAR_STARTMENU
, WINDOW_CREATOR(StartmenuSettingsDlg
));
56 psp3
.dwFlags
|= PSP_USETITLE
;
57 psp3
.pszTitle
= MAKEINTRESOURCE(IDS_STARTMENU
);
64 DesktopSettingsDlg::DesktopSettingsDlg(HWND 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
)
78 new PictureButton(_hwnd
, IDC_ICON_ALIGN_0
, _bmp0
);
79 new PictureButton(_hwnd
, IDC_ICON_ALIGN_1
, _bmp1
);
80 new PictureButton(_hwnd
, IDC_ICON_ALIGN_2
, _bmp2
);
81 new PictureButton(_hwnd
, IDC_ICON_ALIGN_3
, _bmp3
);
82 new PictureButton(_hwnd
, IDC_ICON_ALIGN_4
, _bmp4
);
83 new PictureButton(_hwnd
, IDC_ICON_ALIGN_5
, _bmp5
);
84 new PictureButton(_hwnd
, IDC_ICON_ALIGN_6
, _bmp6
);
85 new PictureButton(_hwnd
, IDC_ICON_ALIGN_7
, _bmp7
);
86 new PictureButton(_hwnd
, IDC_ICON_ALIGN_8
, _bmp8
);
87 new PictureButton(_hwnd
, IDC_ICON_ALIGN_9
, _bmp9
);
88 new PictureButton(_hwnd
, IDC_ICON_ALIGN_10
, _bmp10
);
90 _alignment_cur
= SendMessage(g_Globals
._hwndShellView
, PM_GET_ICON_ALGORITHM
, 0, 0);
91 _alignment_tmp
= _alignment_cur
;
93 _display_version_org
= SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,0));
94 CheckDlgButton(hwnd
, ID_DESKTOP_VERSION
, _display_version_org
? BST_CHECKED
: BST_UNCHECKED
);
97 #ifndef PSN_QUERYINITIALFOCUS // currently (as of 18.01.2004) missing in MinGW headers
98 #define PSN_QUERYINITIALFOCUS (-213)
101 int DesktopSettingsDlg::Notify(int id
, NMHDR
* pnmh
)
104 case PSN_QUERYINITIALFOCUS
:
105 SetWindowLongPtr(_hwnd
, DWLP_MSGRESULT
, (LPARAM
)GetDlgItem(_hwnd
, IDC_ICON_ALIGN_0
+_alignment_cur
));
109 _alignment_cur
= _alignment_tmp
;
110 _display_version_org
= SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,0));
114 if (_alignment_tmp
!= _alignment_cur
)
115 SendMessage(g_Globals
._hwndShellView
, PM_SET_ICON_ALGORITHM
, _alignment_cur
, 0);
116 SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, _display_version_org
, MAKELONG(1,0));
120 return super::Notify(id
, pnmh
);
126 int DesktopSettingsDlg::Command(int id
, int code
)
128 if (id
>=IDC_ICON_ALIGN_0
&& id
<=IDC_ICON_ALIGN_10
) {
129 int alignment
= id
- IDC_ICON_ALIGN_0
;
131 if (alignment
!= _alignment_tmp
) {
132 _alignment_tmp
= alignment
;
134 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
136 SendMessage(g_Globals
._hwndShellView
, PM_SET_ICON_ALGORITHM
, alignment
, 0);
143 case ID_DESKTOP_VERSION
:
144 SendMessage(g_Globals
._hwndShellView
, PM_DISPLAY_VERSION
, 0, MAKELONG(0,1)); // toggle version display flag
145 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
156 TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd
)
158 _cfg_org(g_Globals
._cfg
)
160 XMLPos options
= g_Globals
.get_cfg("desktopbar/options");
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
);
166 int TaskbarSettingsDlg::Notify(int id
, NMHDR
* pnmh
)
170 _cfg_org
= g_Globals
._cfg
;
174 g_Globals
._cfg
= _cfg_org
;
175 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
179 return super::Notify(id
, pnmh
);
185 int TaskbarSettingsDlg::Command(int id
, int code
)
188 case ID_CONFIG_NOTIFYAREA
:
189 Dialog::DoModal(IDD_NOTIFYAREA
, WINDOW_CREATOR(TrayNotifyDlg
), _hwnd
);
192 case ID_SHOW_CLOCK
: {
193 XMLBoolRef
boolRef1(XMLPos(g_Globals
.get_cfg("desktopbar/options")), "show-clock", true);
195 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
196 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
199 case ID_HIDE_INACTIVE_ICONS
: {
200 XMLBoolRef
boolRef2(XMLPos(g_Globals
.get_cfg("notify-icons/options")), "hide-inactive", true);
202 SendMessage(g_Globals
._hwndDesktopBar
, PM_REFRESH_CONFIG
, 0, 0);
203 PropSheet_Changed(GetParent(_hwnd
), _hwnd
);
214 StartmenuSettingsDlg::StartmenuSettingsDlg(HWND hwnd
)
219 int StartmenuSettingsDlg::Command(int id
, int code
)
223 case ID_CONFIG_NOTIFYAREA:
224 Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
232 MdiSdiDlg::MdiSdiDlg(HWND hwnd
)
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);
241 int id
= mdi
? IDC_MDI
: IDC_SDI
;
242 CheckDlgButton(hwnd
, id
, BST_CHECKED
);
243 SetFocus(GetDlgItem(hwnd
, id
));
245 CheckDlgButton(hwnd
, IDC_SEPARATE_SUBFOLDERS
, separateFolders
?BST_CHECKED
:BST_UNCHECKED
);
248 int MdiSdiDlg::Command(int id
, int code
)
250 if (code
== BN_CLICKED
) {
253 bool mdi
= IsDlgButtonChecked(_hwnd
, IDC_MDI
)==BST_CHECKED
;
254 bool separateFolders
= IsDlgButtonChecked(_hwnd
, IDC_SEPARATE_SUBFOLDERS
)==BST_CHECKED
;
256 XMLPos explorer_options
= g_Globals
.get_cfg("general/explorer");
258 XMLBoolRef(explorer_options
, "mdi") = mdi
;
259 XMLBoolRef(explorer_options
, "separate-folders") = separateFolders
;
263 EndDialog(_hwnd
, id
);