-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPrefsDlg.cpp
More file actions
136 lines (117 loc) · 3.48 KB
/
PrefsDlg.cpp
File metadata and controls
136 lines (117 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: PREFSDLG.CPP
** COMPONENT: The Application.
** DESCRIPTION: CPrefsDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "PrefsDlg.hpp"
#include "UTCMGRApp.hpp"
#include "HelpTopics.h"
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CPrefsDlg::CPrefsDlg()
: CDialog(IDD_PREFS)
{
DEFINE_CTRL_TABLE
CTRL(IDC_DEF_PROFILE, &m_cbProfiles )
CTRL(IDC_SCAN_ON_START, &m_ckScanStart )
CTRL(IDC_SCAN_ON_SWITCH, &m_ckScanSwitch )
CTRL(IDC_SCAN_TMP_FILES, &m_ckScanForTmp )
CTRL(IDC_SCAN_INDEX, &m_ckScanIndex )
CTRL(IDC_SHOW_ALL, &m_ckShowAll )
CTRL(IDC_LOG_EDITS, &m_ckLogEdits )
CTRL(IDC_IGNORE_DATES, &m_ckIgnoreDates)
END_CTRL_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CPrefsDlg::OnInitDialog()
{
// Load the default profile combo.
for (uint i = 0; i < App.m_aoProfiles.size(); ++i)
{
CProfile* pProfile = App.m_aoProfiles[i];
size_t n = m_cbProfiles.Add(pProfile->m_strName);
m_cbProfiles.ItemPtr(n, pProfile);
}
// Select the current default.
size_t nDefProfile = m_cbProfiles.FindExact(App.m_strDefProfile);
ASSERT(nDefProfile != CB_ERR);
m_cbProfiles.CurSel(nDefProfile);
// Initialise scanning defaults.
m_ckScanStart.Check(App.m_bScanOnStart);
m_ckScanSwitch.Check(App.m_bScanOnSwitch);
m_ckScanForTmp.Check(App.m_bScanForTmp);
m_ckScanIndex.Check(App.m_bScanIndex);
m_ckShowAll.Check(App.m_bShowAllFiles);
m_ckLogEdits.Check(App.m_bLogEdits);
m_ckIgnoreDates.Check(App.m_bIgnoreDates);
}
/******************************************************************************
** Method: OnOk()
**
** Description: User pressed OK.
**
** Parameters: None.
**
** Returns: true or false.
**
*******************************************************************************
*/
bool CPrefsDlg::OnOk()
{
// Get the default profile.
size_t nSel = m_cbProfiles.CurSel();
CProfile* pProfile = static_cast<CProfile*>(m_cbProfiles.ItemPtr(nSel));
ASSERT((nSel != CB_ERR) && (pProfile != nullptr));
App.m_strDefProfile = pProfile->m_strName;
// Get the scanning defaults.
App.m_bScanOnStart = m_ckScanStart.IsChecked();
App.m_bScanOnSwitch = m_ckScanSwitch.IsChecked();
App.m_bScanForTmp = m_ckScanForTmp.IsChecked();
App.m_bScanIndex = m_ckScanIndex.IsChecked();
App.m_bShowAllFiles = m_ckShowAll.IsChecked();
App.m_bLogEdits = m_ckLogEdits.IsChecked();
App.m_bIgnoreDates = m_ckIgnoreDates.IsChecked();
// Mark settings as modified.
App.m_nModified |= App.SETTINGS;
return true;
}
/******************************************************************************
** Method: OnHelp()
**
** Description: Help requested for the dialog.
**
** Parameters: See HELPINFO.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CPrefsDlg::OnHelp(HELPINFO& /*oInfo*/)
{
// Show the dialogs help topic.
App.m_oHelpFile.Topic(IDH_PREFSDLG);
}