ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

settings.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2004 Martin Fuchs
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 
00020  //
00021  // Explorer clone
00022  //
00023  // dialogs/settings.cpp
00024  //
00025  // Explorer dialogs
00026  //
00027  // Martin Fuchs, 18.01.2004
00028  //
00029 
00030 
00031 #include <precomp.h>
00032 
00033 #include "../resource.h"
00034 
00035 #include "../taskbar/traynotify.h"
00036 #include "settings.h"
00037 
00038 
00039 void ExplorerPropertySheet(HWND hparent)
00040 {
00041     PropertySheetDialog ps(hparent);
00042 
00043     ps.dwFlags |= PSH_USEICONID | PSH_PROPTITLE;
00044     ps.pszIcon = MAKEINTRESOURCE(IDI_REACTOS);
00045     ps.pszCaption = TEXT("Explorer");
00046 
00047     PropSheetPage psp1(IDD_DESKBAR_DESKTOP, WINDOW_CREATOR(DesktopSettingsDlg));
00048     psp1.dwFlags |= PSP_USETITLE;
00049     psp1.pszTitle = MAKEINTRESOURCE(IDS_DESKTOP);
00050     ps.add(psp1);
00051 
00052     PropSheetPage psp2(IDD_DESKBAR_TASKBAR, WINDOW_CREATOR(TaskbarSettingsDlg));
00053     psp2.dwFlags |= PSP_USETITLE;
00054     psp2.pszTitle = MAKEINTRESOURCE(IDS_TASKBAR);
00055     ps.add(psp2);
00056 
00057     PropSheetPage psp3(IDD_DESKBAR_STARTMENU, WINDOW_CREATOR(StartmenuSettingsDlg));
00058     psp3.dwFlags |= PSP_USETITLE;
00059     psp3.pszTitle = MAKEINTRESOURCE(IDS_STARTMENU);
00060     ps.add(psp3);
00061 
00062     ps.DoModal();
00063 }
00064 
00065 
00066 DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd)
00067  :  super(hwnd),
00068     _bmp0(IDB_ICON_ALIGN_0),
00069     _bmp1(IDB_ICON_ALIGN_1),
00070     _bmp2(IDB_ICON_ALIGN_2),
00071     _bmp3(IDB_ICON_ALIGN_3),
00072     _bmp4(IDB_ICON_ALIGN_4),
00073     _bmp5(IDB_ICON_ALIGN_5),
00074     _bmp6(IDB_ICON_ALIGN_6),
00075     _bmp7(IDB_ICON_ALIGN_7),
00076     _bmp8(IDB_ICON_ALIGN_8),
00077     _bmp9(IDB_ICON_ALIGN_9),
00078     _bmp10(IDB_ICON_ALIGN_10)
00079 {
00080     new PictureButton(_hwnd, IDC_ICON_ALIGN_0, _bmp0);
00081     new PictureButton(_hwnd, IDC_ICON_ALIGN_1, _bmp1);
00082     new PictureButton(_hwnd, IDC_ICON_ALIGN_2, _bmp2);
00083     new PictureButton(_hwnd, IDC_ICON_ALIGN_3, _bmp3);
00084     new PictureButton(_hwnd, IDC_ICON_ALIGN_4, _bmp4);
00085     new PictureButton(_hwnd, IDC_ICON_ALIGN_5, _bmp5);
00086     new PictureButton(_hwnd, IDC_ICON_ALIGN_6, _bmp6);
00087     new PictureButton(_hwnd, IDC_ICON_ALIGN_7, _bmp7);
00088     new PictureButton(_hwnd, IDC_ICON_ALIGN_8, _bmp8);
00089     new PictureButton(_hwnd, IDC_ICON_ALIGN_9, _bmp9);
00090     new PictureButton(_hwnd, IDC_ICON_ALIGN_10, _bmp10);
00091 
00092     _alignment_cur = SendMessage(g_Globals._hwndShellView, PM_GET_ICON_ALGORITHM, 0, 0);
00093     _alignment_tmp = _alignment_cur;
00094 
00095     _display_version_org = SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,0));
00096     CheckDlgButton(hwnd, ID_DESKTOP_VERSION, _display_version_org? BST_CHECKED: BST_UNCHECKED);
00097 }
00098 
00099 #ifndef PSN_QUERYINITIALFOCUS   // currently (as of 18.01.2004) missing in MinGW headers
00100 #define PSN_QUERYINITIALFOCUS (-213)
00101 #endif
00102 
00103 int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh)
00104 {
00105     switch(pnmh->code) {
00106       case PSN_QUERYINITIALFOCUS:
00107         SetWindowLongPtr(_hwnd, DWL_MSGRESULT, (LPARAM)GetDlgItem(_hwnd, IDC_ICON_ALIGN_0+_alignment_cur));
00108         break;
00109 
00110       case PSN_APPLY:
00111         _alignment_cur = _alignment_tmp;
00112         _display_version_org = SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,0));
00113         break;
00114 
00115       case PSN_RESET:
00116         if (_alignment_tmp != _alignment_cur)
00117             SendMessage(g_Globals._hwndShellView, PM_SET_ICON_ALGORITHM, _alignment_cur, 0);
00118         SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, _display_version_org, MAKELONG(1,0));
00119         break;
00120 
00121       default:
00122         return super::Notify(id, pnmh);
00123     }
00124 
00125     return 0;
00126 }
00127 
00128 int DesktopSettingsDlg::Command(int id, int code)
00129 {
00130     if (id>=IDC_ICON_ALIGN_0 && id<=IDC_ICON_ALIGN_10) {
00131         int alignment = id - IDC_ICON_ALIGN_0;
00132 
00133         if (alignment != _alignment_tmp) {
00134             _alignment_tmp = alignment;
00135 
00136             PropSheet_Changed(GetParent(_hwnd), _hwnd);
00137 
00138             SendMessage(g_Globals._hwndShellView, PM_SET_ICON_ALGORITHM, alignment, 0);
00139         }
00140 
00141         return 0;
00142     }
00143 
00144     switch(id) {
00145       case ID_DESKTOP_VERSION:
00146         SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,1));    // toggle version display flag
00147         PropSheet_Changed(GetParent(_hwnd), _hwnd);
00148         break;
00149 
00150       default:
00151         return 1;
00152     }
00153 
00154     return 0;
00155 }
00156 
00157 
00158 TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd)
00159  :  super(hwnd),
00160     _cfg_org(g_Globals._cfg)
00161 {
00162     XMLPos options = g_Globals.get_cfg("desktopbar/options");
00163 
00164     CheckDlgButton(hwnd, ID_SHOW_CLOCK, XMLBool(options, "show-clock", true)? BST_CHECKED: BST_UNCHECKED);
00165     CheckDlgButton(hwnd, ID_HIDE_INACTIVE_ICONS, XMLBool(options, "hide-inactive", true)? BST_CHECKED: BST_UNCHECKED);
00166 }
00167 
00168 int TaskbarSettingsDlg::Notify(int id, NMHDR* pnmh)
00169 {
00170     switch(pnmh->code) {
00171       case PSN_APPLY:
00172         _cfg_org = g_Globals._cfg;
00173         break;
00174 
00175       case PSN_RESET:
00176         g_Globals._cfg = _cfg_org;
00177         SendMessage(g_Globals._hwndDesktopBar, PM_REFRESH_CONFIG, 0, 0);
00178         break;
00179 
00180       default:
00181         return super::Notify(id, pnmh);
00182     }
00183 
00184     return 0;
00185 }
00186 
00187 int TaskbarSettingsDlg::Command(int id, int code)
00188 {
00189     switch(id) {
00190       case ID_CONFIG_NOTIFYAREA:
00191         Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
00192         break;
00193 
00194       case ID_SHOW_CLOCK: {
00195         XMLBoolRef boolRef1(XMLPos(g_Globals.get_cfg("desktopbar/options")), "show-clock", true);
00196         boolRef1.toggle();
00197         SendMessage(g_Globals._hwndDesktopBar, PM_REFRESH_CONFIG, 0, 0);
00198         PropSheet_Changed(GetParent(_hwnd), _hwnd);
00199         break;}
00200 
00201       case ID_HIDE_INACTIVE_ICONS: {
00202         XMLBoolRef boolRef2(XMLPos(g_Globals.get_cfg("notify-icons/options")), "hide-inactive", true);
00203         boolRef2.toggle();
00204         SendMessage(g_Globals._hwndDesktopBar, PM_REFRESH_CONFIG, 0, 0);
00205         PropSheet_Changed(GetParent(_hwnd), _hwnd);
00206         break;}
00207 
00208       default:
00209         return 1;
00210     }
00211 
00212     return 0;
00213 }
00214 
00215 
00216 StartmenuSettingsDlg::StartmenuSettingsDlg(HWND hwnd)
00217  :  super(hwnd)
00218 {
00219 }
00220 
00221 int StartmenuSettingsDlg::Command(int id, int code)
00222 {
00223 /*
00224     switch(id) {
00225       case ID_CONFIG_NOTIFYAREA:
00226         Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
00227         return 0;
00228     }
00229 */
00230     return 1;
00231 }
00232 
00233 
00234 MdiSdiDlg::MdiSdiDlg(HWND hwnd)
00235  :  super(hwnd)
00236 {
00237     CenterWindow(hwnd);
00238 
00239     XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
00240     bool mdi = XMLBool(explorer_options, "mdi", true);
00241     bool separateFolders = XMLBool(explorer_options, "separate-folders", true);
00242 
00243     int id = mdi? IDC_MDI: IDC_SDI;
00244     CheckDlgButton(hwnd, id, BST_CHECKED);
00245     SetFocus(GetDlgItem(hwnd, id));
00246 
00247     CheckDlgButton(hwnd, IDC_SEPARATE_SUBFOLDERS, separateFolders?BST_CHECKED:BST_UNCHECKED);
00248 }
00249 
00250 int MdiSdiDlg::Command(int id, int code)
00251 {
00252     if (code == BN_CLICKED) {
00253         switch(id) {
00254           case IDOK: {
00255             bool mdi = IsDlgButtonChecked(_hwnd, IDC_MDI)==BST_CHECKED;
00256             bool separateFolders = IsDlgButtonChecked(_hwnd, IDC_SEPARATE_SUBFOLDERS)==BST_CHECKED;
00257 
00258             XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
00259 
00260             XMLBoolRef(explorer_options, "mdi") = mdi;
00261             XMLBoolRef(explorer_options, "separate-folders") = separateFolders;
00262           } // fall through
00263 
00264           case IDCANCEL:
00265             EndDialog(_hwnd, id);
00266             break;
00267         }
00268 
00269         return 0;
00270     }
00271 
00272     return 1;
00273 }

Generated on Sun May 27 2012 04:18:29 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.