-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEditMapPropSheet.cpp
More file actions
201 lines (173 loc) · 4.56 KB
/
Copy pathEditMapPropSheet.cpp
File metadata and controls
201 lines (173 loc) · 4.56 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
This file is part of W3ZMapEditor (c).
W3ZMapEditor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
W3ZMapEditor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with W3ZMapEditor; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// EditMapPropSheet.cpp : implementation file
//
#include "stdafx.h"
#include "W3ZMapEdit.h"
#include "EditMapPropSheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEditMapPropSheet
IMPLEMENT_DYNAMIC(CEditMapPropSheet, CPropertySheet)
CEditMapPropSheet::CEditMapPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
m_iFeaturesFlag = W3Z_PROP_ALLENABLED;
m_bIsInited = FALSE;
AddPages();
}
CEditMapPropSheet::CEditMapPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
m_iFeaturesFlag = W3Z_PROP_ALLENABLED;
m_bIsInited = FALSE;
AddPages();
}
CEditMapPropSheet::~CEditMapPropSheet()
{
}
BEGIN_MESSAGE_MAP(CEditMapPropSheet, CPropertySheet)
//{{AFX_MSG_MAP(CEditMapPropSheet)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditMapPropSheet message handlers
void CEditMapPropSheet::AddPages()
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_psh.dwFlags |= PSP_USEHICON;
m_psh.hIcon = m_hIcon;
m_psh.dwFlags |= PSH_NOAPPLYNOW; // Lose the Apply Now button
m_psh.dwFlags &= ~PSH_HASHELP; // Lose the Help button
AddPage(&m_MapPropMainPage);
AddPage(&m_MapPropSizePage);
AddPage(&m_MapPropMinimapPage);
AddPage(&m_MapPropMenuOptPage);
AddPage(&m_MapPropPlayersPage);
AddPage(&m_MapPropProtectPage);
}
BOOL CEditMapPropSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
m_bIsInited = TRUE;
SetIcon(m_hIcon, FALSE);
EnableFeatures(m_iFeaturesFlag);
return bResult;
}
/*
EnableFeatures
**************
Enable or disable option pages.
In:
int iFlags: page flags:
const int W3Z_PROP_ALLDISABLED = 0x00000000;
const int W3Z_PROP_REGISTER = 0x00000001;
const int W3Z_PROP_PROTECT = 0x00000002;
const int W3Z_PROP_MAIN = 0x00000004;
const int W3Z_PROP_SIZE = 0x00000008;
const int W3Z_PROP_MINIMAP = 0x00000010;
const int W3Z_PROP_MENUOPT = 0x00000020;
const int W3Z_PROP_PLAYERS = 0x00000040;
const int W3Z_PROP_ALLNOPROTECT = 0xFFFFFFFD;
const int W3Z_PROP_ALLNOREGISTER = 0xFFFFFFFE;
const int W3Z_PROP_ALLENABLED = 0xFFFFFFFF;
Out:
nothing
Return:
nothing
*/
void CEditMapPropSheet::EnableFeatures(int iFlags)
{
if (TRUE == m_bIsInited)
{
// main page
if (0 != (W3Z_PROP_MAIN & iFlags))
{
m_MapPropMainPage.EnablePageItems(TRUE);
}
else
{
m_MapPropMainPage.EnablePageItems(FALSE);
}
// size page
if (0 != (W3Z_PROP_SIZE & iFlags))
{
m_MapPropSizePage.EnablePageItems(TRUE);
}
else
{
m_MapPropSizePage.EnablePageItems(FALSE);
}
// minimap page
if (0 != (W3Z_PROP_MINIMAP & iFlags))
{
m_MapPropMinimapPage.EnablePageItems(TRUE);
}
else
{
m_MapPropMinimapPage.EnablePageItems(FALSE);
}
// menu option page
if (0 != (W3Z_PROP_MENUOPT & iFlags))
{
m_MapPropMenuOptPage.EnablePageItems(TRUE);
}
else
{
m_MapPropMenuOptPage.EnablePageItems(FALSE);
}
// players page
if (0 != (W3Z_PROP_PLAYERS & iFlags))
{
m_MapPropPlayersPage.EnablePageItems(TRUE);
}
else
{
m_MapPropPlayersPage.EnablePageItems(FALSE);
}
// protection page
if (0 != (W3Z_PROP_PROTECT & iFlags))
{
m_MapPropProtectPage.EnablePageItems(TRUE);
}
else
{
m_MapPropProtectPage.EnablePageItems(FALSE);
}
if (0 != (W3Z_PROP_REGISTER & iFlags))
{
m_MapPropProtectPage.EnableRegisterBtn(TRUE);
}
else
{
m_MapPropProtectPage.EnableRegisterBtn(FALSE);
}
}
else
{
// save status for next initialisation
m_iFeaturesFlag = iFlags;
}
}
void CEditMapPropSheet::OnDestroy()
{
CPropertySheet::OnDestroy();
m_bIsInited = FALSE;
}