MyCoordPageScale.cpp
上传用户:cding2008
上传日期:2007-01-03
资源大小:1812k
文件大小:4k
- /////////////////////////////////////////////////////////////////////////////
- // MyCoordPageScale.cpp : implementation file
- //
- // ModelMagic 3D and 'glOOP' (OpenGL Object Oriented Programming library)
- // Copyright (c) Craig Fahrnbach 1997, 1999
- //
- // OpenGL is a registered trademark of Silicon Graphics
- //
- //
- // This program is provided for educational and personal use only and
- // is provided without guarantee or warrantee expressed or implied.
- //
- // Commercial use is strickly prohibited without written permission
- // from ImageWare Development.
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "ModelMagic3D.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyCoordPageScale property page
- IMPLEMENT_DYNCREATE(CMyCoordPageScale, CPropertyPage)
- CMyCoordPageScale::CMyCoordPageScale() : CPropertyPage(CMyCoordPageScale::IDD)
- {
- //{{AFX_DATA_INIT(CMyCoordPageScale)
- m_fScaleX = 0.0f;
- m_fScaleY = 0.0f;
- m_fScaleZ = 0.0f;
- //}}AFX_DATA_INIT
- }
- CMyCoordPageScale::~CMyCoordPageScale()
- {
- }
- void CMyCoordPageScale::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyCoordPageScale)
- DDX_Text(pDX, IDC_X, m_fScaleX);
- DDX_Text(pDX, IDC_Y, m_fScaleY);
- DDX_Text(pDX, IDC_Z, m_fScaleZ);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CMyCoordPageScale, CPropertyPage)
- //{{AFX_MSG_MAP(CMyCoordPageScale)
- ON_EN_CHANGE(IDC_X, OnChangeX)
- ON_EN_CHANGE(IDC_Y, OnChangeY)
- ON_EN_CHANGE(IDC_Z, OnChangeZ)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyCoordPageScale implementation
- void CMyCoordPageScale::UpdateDialogData()
- {
- // Get a pointer to our Main Frame
- CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
- ASSERT_VALID(pFrame);
- // Get a pointer to our view's document
- CMyglDoc* pDoc = (CMyglDoc*)pFrame->m_pActiveView->GetDocument();
- ASSERT_VALID(pDoc);
- // Get a pointer to our document's 3dWorld
- C3dWorld* pWorld = pDoc->m_pWorld;
- ASSERT_VALID(pWorld);
- // Get the appropriate object data
- // (The Camera and Points do NOT have a Scale data member)
- if(pDoc->m_bSelectCamera || pDoc->m_bSelectObjPoints)
- ResetDialogData();
- if(pDoc->m_bSelectParentObj || pDoc->m_bSelectChildObj)
- {
- if(pWorld->m_pSelectedObj)
- pWorld->m_pSelectedObj->GetScale(&m_fScaleX, &m_fScaleY, &m_fScaleZ);
- else
- ResetDialogData();
- }
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(FALSE);
- }
- void CMyCoordPageScale::GetDialogData()
- {
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(TRUE);
- // Get a pointer to our Main Frame
- CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
- ASSERT_VALID(pFrame);
- // Get a pointer to our view's document
- CMyglDoc* pDoc = (CMyglDoc*)pFrame->m_pActiveView->GetDocument();
- ASSERT_VALID(pDoc);
- // Get a pointer to our document's 3dWorld
- C3dWorld* pWorld = pDoc->m_pWorld;
- ASSERT_VALID(pWorld);
- // Now that we have the dialog data, copy to the selected Object.
- // (The Camera and Points do NOT have a Scale data member)
- if(pDoc->m_bSelectCamera)
- {
- // Do nothing
- }
- if(pDoc->m_bSelectParentObj || pDoc->m_bSelectChildObj)
- {
- if(pWorld->m_pSelectedObj)
- pWorld->m_pSelectedObj->SetScale(m_fScaleX, m_fScaleY, m_fScaleZ);
- }
- if(pDoc->m_bSelectObjPoints)
- {
- // Do nothing
- }
- }
- void CMyCoordPageScale::ResetDialogData()
- {
- m_fScaleX = 0.0f;
- m_fScaleY = 0.0f;
- m_fScaleZ = 0.0f;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyCoordPageScale message handlers
- BOOL CMyCoordPageScale::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- // Update the dialog data
- UpdateDialogData();
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CMyCoordPageScale::OnChangeX()
- {
- // Enable the Apply Now button
- SetModified(TRUE);
- }
- void CMyCoordPageScale::OnChangeY()
- {
- // Enable the Apply Now button
- SetModified(TRUE);
- }
- void CMyCoordPageScale::OnChangeZ()
- {
- // Enable the Apply Now button
- SetModified(TRUE);
- }