home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / v8trial / TurboCADv8ProfessionalNoReg.exe / Data.Cab / F38798_PaperOrientation.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-16  |  3.5 KB  |  121 lines

  1. /******************************************************************/
  2. /*                                                                */
  3. /*                      TurboCAD for Windows                      */
  4. /*                   Copyright (c) 1993 - 2001                    */
  5. /*             International Microcomputer Software, Inc.         */
  6. /*                            (IMSI)                              */
  7. /*                      All rights reserved.                      */
  8. /*                                                                */
  9. /******************************************************************/
  10.  
  11. // PaperOrientation.cpp : implementation file
  12. //
  13.  
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include "PaperOrientation.h"
  17. #include "PaperSpaceWizard.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CPaperOrientation property page
  27.  
  28. IMPLEMENT_DYNCREATE(CPaperOrientation, CPropertyPage)
  29.  
  30. CPaperOrientation::CPaperOrientation() : CPropertyPage(CPaperOrientation::IDD)
  31. {
  32.     //{{AFX_DATA_INIT(CPaperOrientation)
  33.         // NOTE: the ClassWizard will add member initialization here
  34.     //}}AFX_DATA_INIT
  35. }
  36.  
  37. CPaperOrientation::~CPaperOrientation()
  38. {
  39. }
  40.  
  41. void CPaperOrientation::DoDataExchange(CDataExchange* pDX)
  42. {
  43.     CPropertyPage::DoDataExchange(pDX);
  44.     //{{AFX_DATA_MAP(CPaperOrientation)
  45.         // NOTE: the ClassWizard will add DDX and DDV calls here
  46.     //}}AFX_DATA_MAP
  47. }
  48.  
  49.  
  50. BEGIN_MESSAGE_MAP(CPaperOrientation, CPropertyPage)
  51.     //{{AFX_MSG_MAP(CPaperOrientation)
  52.     ON_BN_CLICKED(IDC_PORIENTATIONP, OnPorientationp)
  53.     ON_BN_CLICKED(IDC_PORIENTATIONL, OnPorientationl)
  54.     //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CPaperOrientation message handlers
  59.  
  60. BOOL CPaperOrientation::OnSetActive() 
  61. {
  62.     CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
  63.  
  64.     ASSERT_KINDOF(CPropertySheet, pSheet);
  65.     pSheet->SetWizardButtons( PSWIZB_BACK | PSWIZB_FINISH);
  66.     LPTSTR IDB;
  67.     CButton *pRbPortrait = (CButton *) GetDlgItem(IDC_PORIENTATIONP);
  68.     CButton *pRbLandscape = (CButton *) GetDlgItem(IDC_PORIENTATIONL);
  69.     CStatic *pPaperPreview = (CStatic *) GetDlgItem(IDC_PAPERPREVIEW);
  70.  
  71.  
  72.     if (pSheet->m_PSInfo->bPaperOrientation == 0)
  73.     {
  74.         IDB = MAKEINTRESOURCE(IDI_ICONP);
  75.         pRbPortrait->SetCheck(1);
  76.     }
  77.     else
  78.     {
  79.         IDB = MAKEINTRESOURCE(IDI_ICONL);
  80.         pRbLandscape->SetCheck(1);
  81.  
  82.     }
  83.     HICON pIcon = ::LoadIcon (AfxGetResourceHandle(), IDB);
  84.     pPaperPreview->SetIcon (pIcon);
  85.  
  86.     return CPropertyPage::OnSetActive();
  87. }
  88.  
  89. void CPaperOrientation::OnPorientationp() 
  90. {
  91.     LPTSTR IDB;
  92.     CStatic *pPaperPreview = (CStatic *) GetDlgItem(IDC_PAPERPREVIEW);
  93.     IDB = MAKEINTRESOURCE(IDI_ICONP);
  94.     HICON pIcon = ::LoadIcon (AfxGetResourceHandle(), IDB);
  95.     pPaperPreview->SetIcon (pIcon);
  96.     DeleteObject(pIcon);    
  97.     CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
  98.     pSheet->m_PSInfo->bPaperOrientation = 0;
  99. }
  100.  
  101. void CPaperOrientation::OnPorientationl() 
  102. {
  103.     LPTSTR IDB;
  104.     CStatic *pPaperPreview = (CStatic *) GetDlgItem(IDC_PAPERPREVIEW);
  105.  
  106.     IDB = MAKEINTRESOURCE(IDI_ICONL);
  107.     HICON pIcon = ::LoadIcon (AfxGetResourceHandle(), IDB);
  108.     pPaperPreview->SetIcon (pIcon);
  109.     
  110.     DeleteObject(pIcon);
  111.     
  112.     CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
  113.  
  114.     pSheet->m_PSInfo->bPaperOrientation = 1;
  115. }
  116.  
  117. BOOL CPaperOrientation::OnWizardFinish() 
  118. {
  119.     return CPropertyPage::OnWizardFinish();
  120. }
  121.