-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathScaleDialog.cpp
More file actions
126 lines (99 loc) · 2.98 KB
/
ScaleDialog.cpp
File metadata and controls
126 lines (99 loc) · 2.98 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
// ScaleDialog.cpp : implementation file
//
#include "stdafx.h"
#include "ldlite.h"
#include "ScaleDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CScaleDialog dialog
CScaleDialog::CScaleDialog(CWnd* pParent /*=NULL*/)
: CDialog(CScaleDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CScaleDialog)
m_scale = 0.0f;
m_viewpoint = _T("");
//}}AFX_DATA_INIT
}
void CScaleDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CScaleDialog)
DDX_Control(pDX, IDC_COMBO1, m_viewpoint_list);
DDX_Text(pDX, IDC_EDIT1, m_scale);
DDV_MinMaxFloat(pDX, m_scale, 0.f, 1.e+017f);
DDX_CBString(pDX, IDC_COMBO1, m_viewpoint);
DDV_MaxChars(pDX, m_viewpoint, 64);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CScaleDialog, CDialog)
//{{AFX_MSG_MAP(CScaleDialog)
ON_NOTIFY(UDN_DELTAPOS, IDC_SCALESPIN1, OnDeltaposScalespin1)
ON_NOTIFY(UDN_DELTAPOS, IDC_SCALESPIN2, OnDeltaposScalespin2)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScaleDialog message handlers
BOOL CScaleDialog::OnInitDialog()
{
static char bigbuffer[4096];
char *p;
m_changed = FALSE;
CDialog::OnInitDialog();
GetPrivateProfileString("Views",NULL,"no views defined",bigbuffer,4095,"ldraw.ini");
p = bigbuffer;
while(*p != 0) {
m_viewpoint_list.AddString(p);
p += strlen(p)+1;
}
m_viewpoint_list.AddString("Current");
m_viewpoint = "Current";
m_viewpoint_list.SelectString(-1,m_viewpoint);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CScaleDialog::OnDeltaposScalespin1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_scale += -(pNMUpDown->iDelta) * (float)0.1;
if( m_scale < 0.1 ) {
m_scale = (float)0.1;
}
UpdateData(FALSE);
m_changed = TRUE;
*pResult = 0;
}
void CScaleDialog::OnDeltaposScalespin2(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_scale += -(pNMUpDown->iDelta) * 1;
if( m_scale < 0.1 ) {
m_scale = (float)0.1;
}
UpdateData(FALSE);
m_changed = TRUE;
*pResult = 0;
}
void CScaleDialog::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
m_changed = TRUE;
}
void CScaleDialog::OnSelchangeCombo1()
{
// TODO: Add your control notification handler code here
m_changed = TRUE;
}