forked from tcobbs/ldview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CameraLocationDialog.cpp
79 lines (70 loc) · 1.76 KB
/
CameraLocationDialog.cpp
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
#include "CameraLocationDialog.h"
#include "ModelWindow.h"
#include "Resource.h"
#include <LDLib/LDUserDefaultsKeys.h>
#include <TCFoundation/TCUserDefaults.h>
#if defined(_MSC_VER) && _MSC_VER >= 1400 && defined(_DEBUG)
#define new DEBUG_CLIENTBLOCK
#endif // _DEBUG
CameraLocationDialog::CameraLocationDialog(HINSTANCE hInstance):
LocationDialog(hInstance, IDD_CAMERA_LOCATION)
, m_lookAt(LDVLookAtModel)
{
}
CameraLocationDialog::~CameraLocationDialog(void)
{
}
void CameraLocationDialog::dealloc(void)
{
LocationDialog::dealloc();
}
BOOL CameraLocationDialog::doInitDialog(HWND hKbControl)
{
LocationDialog::doInitDialog(hKbControl);
m_lookAt = (LDVLookAt)TCUserDefaults::longForKey(
CAMERA_LOCATION_LOOK_AT_KEY, LDVLookAtModel, false);
updateLookAtChecks();
updateEnabled();
setAutosaveName("CameraLocationDialog");
return TRUE;
}
void CameraLocationDialog::updateLookAtChecks(void)
{
checkSet(IDC_LOOKATMODEL_CHECK, m_lookAt == LDVLookAtModel);
checkSet(IDC_LOOKATORIGIN_CHECK, m_lookAt == LDVLookAtOrigin);
}
LRESULT CameraLocationDialog::doLookAtCheck(int buttonId, LDVLookAt lookAtValue)
{
if (checkGet(buttonId))
{
m_lookAt = lookAtValue;
}
else
{
m_lookAt = LDVLookAtNone;
}
updateLookAtChecks();
return 0;
}
LRESULT CameraLocationDialog::doCommand(
int notifyCode,
int commandId,
HWND control)
{
if (notifyCode == BN_CLICKED)
{
switch (commandId)
{
case IDC_LOOKATMODEL_CHECK:
return doLookAtCheck(IDC_LOOKATMODEL_CHECK, LDVLookAtModel);
case IDC_LOOKATORIGIN_CHECK:
return doLookAtCheck(IDC_LOOKATORIGIN_CHECK, LDVLookAtOrigin);
}
}
return CUIDialog::doCommand(notifyCode, commandId, control);
}
void CameraLocationDialog::doOK(void)
{
TCUserDefaults::setLongForKey(m_lookAt, CAMERA_LOCATION_LOOK_AT_KEY, false);
CUIDialog::doOK();
}