-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSelProfileDlg.cpp
More file actions
166 lines (145 loc) · 4.3 KB
/
SelProfileDlg.cpp
File metadata and controls
166 lines (145 loc) · 4.3 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: SELPROFILEDLG.CPP
** COMPONENT: The Application.
** DESCRIPTION: CSelProfileDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "SelProfileDlg.hpp"
#include "UTCMGRApp.hpp"
#include "HelpTopics.h"
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CSelProfileDlg::CSelProfileDlg()
: CDialog(IDD_SEL_PROFILE)
, m_pProfiles(nullptr)
, m_pChoice(nullptr)
{
DEFINE_CTRL_TABLE
CTRL(IDC_PROFILES, &m_cbProfiles )
CTRL(IDC_FORMAT, &m_cbFormat )
CTRL(IDC_CACHE_DIR, &m_ebCacheDir )
CTRL(IDC_READ_ONLY, &m_ckReadOnly )
CTRL(IDC_SYSTEM_DIR, &m_ebSystemDir )
CTRL(IDC_MAPS_DIR, &m_ebMapDir )
CTRL(IDC_TEXTURES_DIR, &m_ebTextureDir)
CTRL(IDC_SOUNDS_DIR, &m_ebSoundDir )
CTRL(IDC_MUSIC_DIR, &m_ebMusicDir )
CTRL(IDC_MESH_DIR, &m_ebMeshDir )
CTRL(IDC_ANIM_DIR, &m_ebAnimDir )
CTRL(IDC_KARMA_DIR, &m_ebKarmaDir )
CTRL(IDC_CONFIG_FILE, &m_ebConfigFile)
END_CTRL_TABLE
DEFINE_CTRLMSG_TABLE
CMD_CTRLMSG(IDC_PROFILES, CBN_SELCHANGE, &CSelProfileDlg::OnSelectProfile)
END_CTRLMSG_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CSelProfileDlg::OnInitDialog()
{
ASSERT(m_pProfiles != nullptr);
ASSERT(m_pChoice != nullptr);
// Load the names combo.
for (uint i = 0; i < m_pProfiles->size(); ++i)
{
CProfile* pProfile = m_pProfiles->at(i);
size_t n = m_cbProfiles.Add(pProfile->m_strName);
m_cbProfiles.ItemPtr(n, pProfile);
}
// Load formats combo.
for (int i = 0; i < CProfile::NUM_FORMATS; ++i)
m_cbFormat.Add(CProfile::s_pszFormats[i]);
// Select the default.
m_cbProfiles.CurSel(m_cbProfiles.FindExact(m_pChoice->m_strName));
OnSelectProfile();
}
/******************************************************************************
** Method: OnOk()
**
** Description: User pressed OK.
**
** Parameters: None.
**
** Returns: true or false.
**
*******************************************************************************
*/
bool CSelProfileDlg::OnOk()
{
// Get the selection.
size_t nSel = m_cbProfiles.CurSel();
CProfile* pProfile = static_cast<CProfile*>(m_cbProfiles.ItemPtr(nSel));
ASSERT((nSel != CB_ERR) && (pProfile != nullptr));
// Save selection.
m_pChoice = pProfile;
return true;
}
/******************************************************************************
** Method: OnSelectProfile()
**
** Description: User selected a profile, display profile details.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CSelProfileDlg::OnSelectProfile()
{
// Get the selected profile.
size_t nSel = m_cbProfiles.CurSel();
CProfile* pProfile = static_cast<CProfile*>(m_cbProfiles.ItemPtr(nSel));
ASSERT((nSel != CB_ERR) && (pProfile != nullptr));
// Load details into controls.
m_cbFormat.CurSel(pProfile->m_nFormat);
m_ebCacheDir.Text(pProfile->m_strCacheDir);
m_ckReadOnly.Check(pProfile->m_bReadOnly);
m_ebSystemDir.Text(pProfile->m_strSystemDir);
m_ebMapDir.Text(pProfile->m_strMapDir);
m_ebTextureDir.Text(pProfile->m_strTextureDir);
m_ebSoundDir.Text(pProfile->m_strSoundDir);
m_ebMusicDir.Text(pProfile->m_strMusicDir);
m_ebMeshDir.Text(pProfile->m_strMeshDir);
m_ebAnimDir.Text(pProfile->m_strAnimDir);
m_ebKarmaDir.Text(pProfile->m_strKarmaDir);
m_ebConfigFile.Text(pProfile->m_strConfigFile);
}
/******************************************************************************
** Method: OnHelp()
**
** Description: Help requested for the dialog.
**
** Parameters: See HELPINFO.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CSelProfileDlg::OnHelp(HELPINFO& /*oInfo*/)
{
// Show the dialogs help topic.
App.m_oHelpFile.Topic(IDH_SELPROFDLG);
}