home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////
- //
- // ppHSGen.cpp : Implementation of the CHSGeneralPage class
- //
- /////////////////////////////////////////////////////////////////////////////
- //
- // (C) Copyright Black Diamond Consulting, Inc 1996. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that Black
- // Diamond Consulting has no warranty obligations or liability
- // for any Sample Application Files which are modified.
- //
- // Revision History:
- //
- /////////////////////////////////////////////////////////////////////////////
-
- #include "stdafx.h"
-
- #ifndef __PPHSGEN_H__
- #include "ppHSGen.h"
- #endif
-
- #ifndef __CHOTSPOT_H__
- #include "CHotspot.h"
- #endif
-
- #ifndef __SVDOC_H__
- #include "svdoc.h"
- #endif
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CHSGeneralPage property page
-
-
- CHSGeneralPage::CHSGeneralPage( CSVViewerDoc* pDoc, CHotspot* pHotspot )
- : CPropertyPage(CHSGeneralPage::IDD)
- {
-
- m_pDocument = pDoc;
- m_pHotspot = pHotspot;
-
- //{{AFX_DATA_INIT(CHSGeneralPage)
- //}}AFX_DATA_INIT
- }
-
- void CHSGeneralPage::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CHSGeneralPage)
- DDX_Text( pDX, EB_NAME, m_pHotspot->m_name );
- DDX_Text( pDX, EB_LATITUDE, m_pHotspot->m_location.latitude );
- DDV_MinMaxLong( pDX, m_pHotspot->m_location.latitude, -1*(MAX_ARCSECONDS/2), (MAX_ARCSECONDS/2) );
- DDX_Text( pDX, EB_LONGITUDE, m_pHotspot->m_location.longitude );
- DDV_MinMaxLong( pDX, m_pHotspot->m_location.longitude, 0, MAX_ARCSECONDS-1 );
- DDX_Text( pDX, EB_HEIGHT, m_pHotspot->m_size.cy );
- DDX_Text( pDX, EB_WIDTH, m_pHotspot->m_size.cx );
- DDX_Check( pDX, CHK_LOCKED, m_pHotspot->m_bLocked );
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CHSGeneralPage, CPropertyPage)
-
- //{{AFX_MSG_MAP(CHSGeneralPage)
- ON_BN_CLICKED( CHK_LOCKED, OnUpdateControls )
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CHSGeneralPage message handlers
-
- BOOL CHSGeneralPage::OnInitDialog()
- {
-
- CPropertyPage::OnInitDialog();
-
- OnUpdateControls();
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
- void CHSGeneralPage::OnCancel()
- {
- CPropertyPage::OnCancel();
- m_pDocument->UpdateAllViews( NULL );
- }
-
- void CHSGeneralPage::OnOK()
- {
- CPropertyPage::OnOK();
-
- // Flag Document as dirty
- m_pDocument->SetModifiedFlag();
-
- // Cause all views to invalidate
- m_pDocument->UpdateAllViews( NULL );
- }
-
- // OnUpdateControls()
- //
- // This routine uses the canned controls[] struct array to determine
- // which controls should be enabled/disabled depending on the current
- // states of of its "master" control
- //
- void CHSGeneralPage::OnUpdateControls()
- {
- typedef struct _tagCONTROLS
- {
- int type;
- int idMaster;
- BOOL bState;
- int idSlave;
- } CONTROLS, *PCONTROLS;
-
- CWnd* pWndMaster;
- CWnd* pWnd;
- BOOL bEnable;
- CONTROLS* ctrl;
- CString text;
-
- CONTROLS controls[] =
- {
- 0, CHK_LOCKED, FALSE, EB_LATITUDE,
- 0, 0, FALSE, EB_LONGITUDE,
- 0, 0, FALSE, EB_HEIGHT,
- 0, 0, FALSE, EB_WIDTH,
- 0,0,0,0
- };
-
- ctrl = controls;
- while( ctrl->idSlave != 0 )
- {
- if( ctrl->idMaster != 0 )
- {
- if( (pWndMaster = GetDlgItem( ctrl->idMaster )) == 0 )
- return;
-
- if( pWndMaster->IsWindowEnabled() == FALSE )
- bEnable = FALSE;
- else
- {
- switch( ctrl->type )
- {
- case 0:
- bEnable = IsDlgButtonChecked( ctrl->idMaster );
- break;
-
- case 1:
- pWndMaster->GetWindowText( text );
- bEnable = !text.IsEmpty();
- break;
-
- default:
- bEnable = FALSE;
- break;
- }
- }
- }
-
- if( (pWnd = GetDlgItem( ctrl->idSlave )) != NULL )
- pWnd->EnableWindow( bEnable == ctrl->bState );
-
- ctrl++;
- }
- }
-
-
-