1919// AnimationSpeed.cpp : implementation file
2020//
2121
22+ #include " StdAfx.h"
23+ #include " W3DView.h"
2224#include " AnimationSpeed.h"
23- #include " GraphicView.h"
2425#include " MainFrm.h"
25- #include " StdAfx .h"
26+ #include " GraphicView .h"
2627#include " Utils.h"
27- #include " W3DView.h"
2828#include " W3DViewDoc.h"
2929
3030#ifdef RTS_DEBUG
3333static char THIS_FILE[] = __FILE__;
3434#endif
3535
36- // extern bool CompressQ;
37- // extern int QnBytes;
36+
37+ // extern bool CompressQ;
38+ // extern int QnBytes;
39+
3840
3941// ///////////////////////////////////////////////////////////////////////////
4042// CAnimationSpeed dialog
@@ -43,168 +45,193 @@ static char THIS_FILE[] = __FILE__;
4345//
4446// CAnimationSpeed
4547//
46- CAnimationSpeed::CAnimationSpeed (CWnd *pParent)
47- : m_iInitialPercent(0 ), CDialog(CAnimationSpeed::IDD, pParent) {
48- // {{AFX_DATA_INIT(CAnimationSpeed)
49- // NOTE: the ClassWizard will add member initialization here
50- // }}AFX_DATA_INIT
51- }
48+ CAnimationSpeed::CAnimationSpeed (CWnd* pParent)
49+ : m_iInitialPercent (0 ),
50+ CDialog(CAnimationSpeed::IDD, pParent)
51+ {
52+ // {{AFX_DATA_INIT(CAnimationSpeed)
53+ // NOTE: the ClassWizard will add member initialization here
54+ // }}AFX_DATA_INIT
55+ }
5256
5357// ////////////////////////////////////////////////////////////
5458//
5559// DoDataExchange
5660//
57- void CAnimationSpeed::DoDataExchange (CDataExchange *pDX) {
58- CDialog::DoDataExchange (pDX);
59- // {{AFX_DATA_MAP(CAnimationSpeed)
60- DDX_Control (pDX, IDC_SPEED_SLIDER, m_speedSlider);
61- // }}AFX_DATA_MAP
62- }
61+ void
62+ CAnimationSpeed::DoDataExchange (CDataExchange* pDX)
63+ {
64+ CDialog::DoDataExchange (pDX);
65+ // {{AFX_DATA_MAP(CAnimationSpeed)
66+ DDX_Control (pDX, IDC_SPEED_SLIDER, m_speedSlider);
67+ // }}AFX_DATA_MAP
68+ }
69+
6370
6471BEGIN_MESSAGE_MAP (CAnimationSpeed, CDialog)
65- // {{AFX_MSG_MAP(CAnimationSpeed)
66- ON_WM_HSCROLL()
67- ON_WM_DESTROY()
68- ON_BN_CLICKED(IDC_BLEND, OnBlend)
69- ON_BN_CLICKED(IDC_COMPRESSQ, OnCompressq)
70- ON_BN_CLICKED(IDC_16BIT, On16bit)
71- ON_BN_CLICKED(IDC_8BIT, On8bit)
72- // }}AFX_MSG_MAP
72+ // {{AFX_MSG_MAP(CAnimationSpeed)
73+ ON_WM_HSCROLL()
74+ ON_WM_DESTROY()
75+ ON_BN_CLICKED(IDC_BLEND, OnBlend)
76+ ON_BN_CLICKED(IDC_COMPRESSQ, OnCompressq)
77+ ON_BN_CLICKED(IDC_16BIT, On16bit)
78+ ON_BN_CLICKED(IDC_8BIT, On8bit)
79+ // }}AFX_MSG_MAP
7380END_MESSAGE_MAP()
7481
82+
7583// ////////////////////////////////////////////////////////////
7684//
7785// OnInitDialog
7886//
79- BOOL CAnimationSpeed::OnInitDialog(void ) {
80- // Allow the base class to process this message
81- CDialog::OnInitDialog ();
82-
83- // Center the dialog around the data tree view instead
84- // of the direct center of the screen
85- ::CenterDialogAroundTreeView (m_hWnd);
86-
87- // Get a pointer to the doc so we can get at the current scene
88- // pointer.
89- CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
90- if (pCDoc) {
91- SendDlgItemMessage (IDC_BLEND, BM_SETCHECK,
92- (WPARAM)pCDoc->GetAnimationBlend ());
93- CheckDlgButton (IDC_COMPRESSQ, pCDoc->GetChannelQCompression ());
94- CheckRadioButton (IDC_16BIT, IDC_8BIT,
95- IDC_16BIT + 2 ); // -pCDoc->GetChannelQnBytes());
96- if (pCDoc->GetChannelQCompression ()) {
97- GetDlgItem (IDC_16BIT)->EnableWindow (TRUE );
98- GetDlgItem (IDC_8BIT)->EnableWindow (TRUE );
99- } else {
100- GetDlgItem (IDC_16BIT)->EnableWindow (FALSE );
101- GetDlgItem (IDC_8BIT)->EnableWindow (FALSE );
102- }
103- }
104-
105- // Get a pointer to the main window
106- CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd ();
107- if (pCMainWnd) {
108- // Get a pointer to the graphic view pane
109- CGraphicView *pCGraphicView = (CGraphicView *)pCMainWnd->GetPane (0 , 1 );
110- if (pCGraphicView) {
111- // Determine the current display speed
112- float animationSpeed = pCGraphicView->GetAnimationSpeed ();
113-
114- // Convert the current display speed to a percentage
115- m_iInitialPercent = int (animationSpeed * 100 .00F );
87+ BOOL
88+ CAnimationSpeed::OnInitDialog (void )
89+ {
90+ // Allow the base class to process this message
91+ CDialog::OnInitDialog ();
92+
93+ // Center the dialog around the data tree view instead
94+ // of the direct center of the screen
95+ ::CenterDialogAroundTreeView (m_hWnd);
96+
97+ // Get a pointer to the doc so we can get at the current scene
98+ // pointer.
99+ CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
100+ if (pCDoc)
101+ {
102+ SendDlgItemMessage (IDC_BLEND, BM_SETCHECK, (WPARAM)pCDoc->GetAnimationBlend ());
103+ CheckDlgButton (IDC_COMPRESSQ, pCDoc->GetChannelQCompression ());
104+ CheckRadioButton (IDC_16BIT, IDC_8BIT, IDC_16BIT+2 );// -pCDoc->GetChannelQnBytes());
105+ if (pCDoc->GetChannelQCompression ()){
106+ GetDlgItem (IDC_16BIT)->EnableWindow (TRUE );
107+ GetDlgItem (IDC_8BIT)->EnableWindow (TRUE );
108+ }else {
109+ GetDlgItem (IDC_16BIT)->EnableWindow (FALSE );
110+ GetDlgItem (IDC_8BIT)->EnableWindow (FALSE );
111+ }
112+ }
113+
114+ // Get a pointer to the main window
115+ CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd ();
116+ if (pCMainWnd)
117+ {
118+ // Get a pointer to the graphic view pane
119+ CGraphicView *pCGraphicView = (CGraphicView *)pCMainWnd->GetPane (0 , 1 );
120+ if (pCGraphicView)
121+ {
122+ // Determine the current display speed
123+ float animationSpeed = pCGraphicView->GetAnimationSpeed ();
124+
125+ // Convert the current display speed to a percentage
126+ m_iInitialPercent = int (animationSpeed*100 .00F );
127+ }
116128 }
117- }
118129
119- // Set the range of the slider control
120- m_speedSlider.SetRange (1 , 200 );
130+ // Set the range of the slider control
131+ m_speedSlider.SetRange (1 , 200 );
121132
122- // Set the initial pos of the slider control
123- m_speedSlider.SetPos (m_iInitialPercent);
124- return TRUE ;
133+ // Set the initial pos of the slider control
134+ m_speedSlider.SetPos (m_iInitialPercent);
135+ return TRUE ;
125136}
126137
127138// ////////////////////////////////////////////////////////////
128139//
129140// OnInitDialog
130141//
131- void CAnimationSpeed::OnHScroll (UINT nSBCode, UINT nPos,
132- CScrollBar *pScrollBar) {
133- // Get the current position of the slider control
134- m_iInitialPercent = m_speedSlider.GetPos ();
135-
136- // Get a pointer to the main window
137- CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd ();
138- if (pCMainWnd) {
139- // Get a pointer to the graphic view pane
140- CGraphicView *pCGraphicView = (CGraphicView *)pCMainWnd->GetPane (0 , 1 );
141- if (pCGraphicView) {
142- pCGraphicView->SetAnimationSpeed (((float )m_iInitialPercent) / (100 .00F ));
142+ void
143+ CAnimationSpeed::OnHScroll
144+ (
145+ UINT nSBCode,
146+ UINT nPos,
147+ CScrollBar* pScrollBar
148+ )
149+ {
150+ // Get the current position of the slider control
151+ m_iInitialPercent = m_speedSlider.GetPos ();
152+
153+ // Get a pointer to the main window
154+ CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd ();
155+ if (pCMainWnd)
156+ {
157+ // Get a pointer to the graphic view pane
158+ CGraphicView *pCGraphicView = (CGraphicView *)pCMainWnd->GetPane (0 , 1 );
159+ if (pCGraphicView)
160+ {
161+ pCGraphicView->SetAnimationSpeed (((float )m_iInitialPercent) / (100 .00F ));
162+ }
143163 }
144- }
145164
146- // Allow the base class to process this message
147- CDialog::OnHScroll (nSBCode, nPos, pScrollBar);
148- }
165+ // Allow the base class to process this message
166+ CDialog::OnHScroll (nSBCode, nPos, pScrollBar);
167+ }
149168
150169// ////////////////////////////////////////////////////////////
151170//
152171// OnDestroy
153172//
154- void CAnimationSpeed::OnDestroy (void ) {
155- m_iInitialPercent = m_speedSlider.GetPos ();
156- CDialog::OnDestroy ();
157- }
173+ void
174+ CAnimationSpeed::OnDestroy (void )
175+ {
176+ m_iInitialPercent = m_speedSlider.GetPos ();
177+ CDialog::OnDestroy ();
178+ }
158179
159180// ////////////////////////////////////////////////////////////
160181//
161182// OnBlend
162183//
163- void CAnimationSpeed::OnBlend (void ) {
164- // Get a pointer to the doc so we can get at the current scene
165- // pointer.
166- CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
167- if (pCDoc) {
168- // Turn on/off the blending option
169- pCDoc->SetAnimationBlend (SendDlgItemMessage (IDC_BLEND, BM_GETCHECK));
170- }
184+ void
185+ CAnimationSpeed::OnBlend (void )
186+ {
187+ // Get a pointer to the doc so we can get at the current scene
188+ // pointer.
189+ CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
190+ if (pCDoc)
191+ {
192+ // Turn on/off the blending option
193+ pCDoc->SetAnimationBlend (SendDlgItemMessage (IDC_BLEND, BM_GETCHECK));
194+ }
171195}
172196
173- void CAnimationSpeed::OnCompressq () {
174- /* CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
175- if(pCDoc){
176- bool b_was_compressed = pCDoc->GetChannelQCompression();
177- bool b_compress = IsDlgButtonChecked(IDC_COMPRESSQ) ==
178- BST_CHECKED; pCDoc->SetChannelQCompression(b_compress);
179- //Enable/Disable
180- if(b_compress){
181- GetDlgItem(IDC_16BIT)->EnableWindow(TRUE);
182- GetDlgItem(IDC_8BIT)->EnableWindow(TRUE);
183- }else{
184- GetDlgItem(IDC_16BIT)->EnableWindow(FALSE);
185- GetDlgItem(IDC_8BIT)->EnableWindow(FALSE);
186- }
187- //Update
188- if(b_compress != b_was_compressed){
189- int n_bytes = pCDoc->GetChannelQnBytes();
190- CompressQ = b_compress;
191- QnBytes = n_bytes;
192- }
193- }
194- */
197+ void CAnimationSpeed::
198+ OnCompressq (){
199+ /* CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
200+ if(pCDoc){
201+ bool b_was_compressed = pCDoc->GetChannelQCompression();
202+ bool b_compress = IsDlgButtonChecked(IDC_COMPRESSQ) == BST_CHECKED;
203+ pCDoc->SetChannelQCompression(b_compress);
204+ //Enable/Disable
205+ if(b_compress){
206+ GetDlgItem(IDC_16BIT)->EnableWindow(TRUE);
207+ GetDlgItem(IDC_8BIT)->EnableWindow(TRUE);
208+ }else{
209+ GetDlgItem(IDC_16BIT)->EnableWindow(FALSE);
210+ GetDlgItem(IDC_8BIT)->EnableWindow(FALSE);
211+ }
212+ //Update
213+ if(b_compress != b_was_compressed){
214+ int n_bytes = pCDoc->GetChannelQnBytes();
215+ CompressQ = b_compress;
216+ QnBytes = n_bytes;
217+ }
218+ }
219+ */
195220}
196221
197- void CAnimationSpeed::On16bit () {
198- /*
199- CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
200- pCDoc->SetChannelQnBytes(2);
201- QnBytes = 2;
202- */
222+ void CAnimationSpeed::
223+ On16bit (){
224+ /*
225+ CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
226+ pCDoc->SetChannelQnBytes(2);
227+ QnBytes = 2;
228+ */
203229}
204- void CAnimationSpeed::On8bit () {
205- /*
206- CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
207- pCDoc->SetChannelQnBytes(1);
208- QnBytes = 1;
209- */
230+ void CAnimationSpeed::
231+ On8bit (){
232+ /*
233+ CW3DViewDoc *pCDoc = ::GetCurrentDocument ();
234+ pCDoc->SetChannelQnBytes(1);
235+ QnBytes = 1;
236+ */
210237}
0 commit comments