1 /////////////////////////////////////////////////////////////////////////////
2 // WinMerge: an interactive diff/merge utility
3 // Copyright (C) 1997-2000 Thingamahoochie Software
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /////////////////////////////////////////////////////////////////////////////
24 * @brief Implementation file for PropGeneral propertyheet
27 // ID line follows -- this is updated by SVN
31 #include "PropGeneral.h"
33 #include "OptionsDef.h"
34 #include "OptionsMgr.h"
35 #include "OptionsPanel.h"
40 static char THIS_FILE[] = __FILE__;
44 * @brief Constructor initialising members.
46 PropGeneral::PropGeneral(COptionsMgr *optionsMgr)
47 : OptionsPanel(optionsMgr, PropGeneral::IDD)
49 , m_bSingleInstance(FALSE)
50 , m_bVerifyPaths(FALSE)
51 , m_bCloseWindowWithEsc(TRUE)
52 , m_bAskMultiWindowClose(FALSE)
53 , m_bMultipleFileCmp(FALSE)
54 , m_bMultipleDirCmp(FALSE)
55 , m_nAutoCompleteSource(0)
56 , m_bPreserveFiletime(FALSE)
57 , m_bShowSelectFolderOnStartup(FALSE)
58 , m_bCloseWithOK(TRUE)
62 PropGeneral::~PropGeneral()
66 BOOL PropGeneral::OnInitDialog()
68 theApp.TranslateDialog(m_hWnd);
69 CPropertyPage::OnInitDialog();
71 CComboBox *pWnd = (CComboBox*)GetDlgItem(IDC_AUTO_COMPLETE_SOURCE);
74 pWnd->AddString(theApp.LoadString(IDS_AUTOCOMPLETE_DISABLED).c_str());
75 pWnd->AddString(theApp.LoadString(IDS_AUTOCOMPLETE_FILE_SYS).c_str());
76 pWnd->AddString(theApp.LoadString(IDS_AUTOCOMPLETE_MRU).c_str());
78 pWnd->SetCurSel(m_nAutoCompleteSource);
80 return TRUE; // return TRUE unless you set the focus to a control
83 void PropGeneral::DoDataExchange(CDataExchange* pDX)
85 CPropertyPage::DoDataExchange(pDX);
86 //{{AFX_DATA_MAP(PropGeneral)
87 DDX_Check(pDX, IDC_SCROLL_CHECK, m_bScroll);
88 DDX_Check(pDX, IDC_SINGLE_INSTANCE, m_bSingleInstance);
89 DDX_Check(pDX, IDC_VERIFY_OPEN_PATHS, m_bVerifyPaths);
90 DDX_Check(pDX, IDC_ESC_CLOSES_WINDOW, m_bCloseWindowWithEsc);
91 DDX_Check(pDX, IDC_ASK_MULTIWINDOW_CLOSE, m_bAskMultiWindowClose);
92 DDX_Check(pDX, IDC_MULTIDOC_FILECMP, m_bMultipleFileCmp);
93 DDX_Check(pDX, IDC_MULTIDOC_DIRCMP, m_bMultipleDirCmp);
94 DDX_CBIndex(pDX, IDC_AUTO_COMPLETE_SOURCE, m_nAutoCompleteSource);
95 DDX_Check(pDX, IDC_PRESERVE_FILETIME, m_bPreserveFiletime);
96 DDX_Check(pDX, IDC_STARTUP_FOLDER_SELECT, m_bShowSelectFolderOnStartup);
97 DDX_Check(pDX, IDC_CLOSE_WITH_OK, m_bCloseWithOK);
102 BEGIN_MESSAGE_MAP(PropGeneral, CPropertyPage)
103 //{{AFX_MSG_MAP(PropGeneral)
104 ON_BN_CLICKED(IDC_RESET_ALL_MESSAGE_BOXES, OnResetAllMessageBoxes)
109 * @brief Reads options values from storage to UI.
111 void PropGeneral::ReadOptions()
113 m_bScroll = GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST);
114 m_bSingleInstance = GetOptionsMgr()->GetBool(OPT_SINGLE_INSTANCE);
115 m_bVerifyPaths = GetOptionsMgr()->GetBool(OPT_VERIFY_OPEN_PATHS);
116 m_bCloseWindowWithEsc = GetOptionsMgr()->GetBool(OPT_CLOSE_WITH_ESC);
117 m_bAskMultiWindowClose = GetOptionsMgr()->GetBool(OPT_ASK_MULTIWINDOW_CLOSE);
118 m_bMultipleFileCmp = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
119 m_bMultipleDirCmp = GetOptionsMgr()->GetBool(OPT_MULTIDOC_DIRDOCS);
120 m_nAutoCompleteSource = GetOptionsMgr()->GetInt(OPT_AUTO_COMPLETE_SOURCE);
121 m_bPreserveFiletime = GetOptionsMgr()->GetBool(OPT_PRESERVE_FILETIMES);
122 m_bShowSelectFolderOnStartup = GetOptionsMgr()->GetBool(OPT_SHOW_SELECT_FILES_AT_STARTUP);
123 m_bCloseWithOK = GetOptionsMgr()->GetBool(OPT_CLOSE_WITH_OK);
127 * @brief Writes options values from UI to storage.
129 void PropGeneral::WriteOptions()
131 GetOptionsMgr()->SaveOption(OPT_SCROLL_TO_FIRST, m_bScroll == TRUE);
132 GetOptionsMgr()->SaveOption(OPT_SINGLE_INSTANCE, m_bSingleInstance == TRUE);
133 GetOptionsMgr()->SaveOption(OPT_VERIFY_OPEN_PATHS, m_bVerifyPaths == TRUE);
134 GetOptionsMgr()->SaveOption(OPT_CLOSE_WITH_ESC, m_bCloseWindowWithEsc == TRUE);
135 GetOptionsMgr()->SaveOption(OPT_ASK_MULTIWINDOW_CLOSE, m_bAskMultiWindowClose == TRUE);
136 GetOptionsMgr()->SaveOption(OPT_MULTIDOC_MERGEDOCS, m_bMultipleFileCmp == TRUE);
137 GetOptionsMgr()->SaveOption(OPT_MULTIDOC_DIRDOCS, m_bMultipleDirCmp == TRUE);
138 GetOptionsMgr()->SaveOption(OPT_AUTO_COMPLETE_SOURCE, m_nAutoCompleteSource);
139 GetOptionsMgr()->SaveOption(OPT_PRESERVE_FILETIMES, m_bPreserveFiletime);
140 GetOptionsMgr()->SaveOption(OPT_SHOW_SELECT_FILES_AT_STARTUP, m_bShowSelectFolderOnStartup);
141 GetOptionsMgr()->SaveOption(OPT_CLOSE_WITH_OK, m_bCloseWithOK);
145 * @brief Called when user wants to see all messageboxes again.
147 void PropGeneral::OnResetAllMessageBoxes()
149 CMessageBoxDialog::ResetMessageBoxes();
150 LangMessageBox(IDS_MESSAGE_BOX_ARE_RESET, MB_ICONINFORMATION);