-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGridSizeDialog.cpp
149 lines (130 loc) · 4.43 KB
/
GridSizeDialog.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
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
/****************************************************************************************/
/* GridSizeDialog.cpp */
/* */
/* Author: Jim Mischel, Ken Baird, Jeff Lomax */
/* Description: UI for grid settings */
/* */
/* The contents of this file are subject to the Genesis3D Public License */
/* Version 1.01 (the "License"); you may not use this file except in */
/* compliance with the License. You may obtain a copy of the License at */
/* http://www.genesis3d.com */
/* */
/* Software distributed under the License is distributed on an "AS IS" */
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */
/* the License for the specific language governing rights and limitations */
/* under the License. */
/* */
/* The Original Code is Genesis3D, released March 25, 1999. */
/*Genesis3D Version 1.1 released November 15, 1999 */
/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */
/* */
/****************************************************************************************/
#include "stdafx.h"
#include <afxcmn.h>
#include "GridSizeDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGridSizeDialog dialog
CGridSizeDialog::CGridSizeDialog(CWnd* pParent /*=NULL*/)
: CDialog(CGridSizeDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CGridSizeDialog)
m_SnapDegrees = 0.0;
m_UseSnap = FALSE;
MetricOrTexelSnap = -1;
MetricOrTexelGrid = -1;
m_GridUnits = -1;
//}}AFX_DATA_INIT
}
void CGridSizeDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGridSizeDialog)
DDX_Text(pDX, IDC_ROTSNAPDEGREES, m_SnapDegrees);
DDV_MinMaxDouble(pDX, m_SnapDegrees, 0., 90.);
DDX_Check(pDX, IDC_USEROTSNAP, m_UseSnap);
DDX_Radio(pDX, IDC_1RADIO, m_GridUnits);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGridSizeDialog, CDialog)
//{{AFX_MSG_MAP(CGridSizeDialog)
ON_BN_CLICKED(IDC_SNAP15, OnSnap15)
ON_BN_CLICKED(IDC_SNAP30, OnSnap30)
ON_BN_CLICKED(IDC_SNAP45, OnSnap45)
ON_BN_CLICKED(IDC_SNAP60, OnSnap60)
ON_BN_CLICKED(IDC_USEROTSNAP, OnUsertosnap)
ON_BN_CLICKED(IDC_SNAP90, OnSnap90)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// ON_COMMAND_RANGE(ID_MYCMD_ONE, ID_MYCMD_TEN, OnDoSomething)
void CGridSizeDialog::OnSnap15()
{
UpdateData();
m_SnapDegrees = 15.0;
UpdateData(FALSE);
}
void CGridSizeDialog::OnSnap30()
{
UpdateData();
m_SnapDegrees = 30.0;
UpdateData(FALSE);
}
void CGridSizeDialog::OnSnap45()
{
UpdateData();
m_SnapDegrees = 45.0;
UpdateData(FALSE);
}
void CGridSizeDialog::OnSnap60()
{
UpdateData();
m_SnapDegrees = 60.0;
UpdateData(FALSE);
}
void CGridSizeDialog::OnSnap90()
{
UpdateData();
m_SnapDegrees = 90.0;
UpdateData(FALSE);
}
static UINT snapdisable[] =
{
IDC_SNAP15,
IDC_SNAP30,
IDC_SNAP45,
IDC_SNAP60,
IDC_SNAP90,
IDC_ROTSNAPDEGREES,
IDC_SPINROTSNAPDEGREES
};
BOOL CGridSizeDialog::OnInitDialog()
{
CWnd * pWnd ;
CSpinButtonCtrl * pSpin ;
int i ;
CDialog::OnInitDialog();
for( i=0; i< sizeof( snapdisable ) / sizeof( UINT); i++ )
{
pWnd = GetDlgItem( snapdisable[i] ) ;
pWnd->EnableWindow( m_UseSnap ) ;
}
pSpin = (CSpinButtonCtrl*)GetDlgItem( IDC_SPINROTSNAPDEGREES ) ;
pSpin->SetRange( 0, 90 ) ;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CGridSizeDialog::OnUsertosnap()
{
CWnd * pWnd ;
int i ;
m_UseSnap = !m_UseSnap ;
for( i=0; i< sizeof( snapdisable ) / sizeof( UINT); i++ )
{
pWnd = GetDlgItem( snapdisable[i] ) ;
pWnd->EnableWindow( m_UseSnap ) ;
}
}