home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************/
- /* */
- /* TurboCAD for Windows */
- /* Copyright (c) 1993 - 2001 */
- /* International Microcomputer Software, Inc. */
- /* (IMSI) */
- /* All rights reserved. */
- /* */
- /******************************************************************/
-
- // Begin.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "resource.h"
- #include "Begin.h"
- #include "PaperSpaceWizard.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CBegin property page
-
- IMPLEMENT_DYNCREATE(CBegin, CPropertyPage)
-
- CBegin::CBegin() : CPropertyPage(CBegin::IDD)
- {
- //{{AFX_DATA_INIT(CBegin)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
- CBegin::~CBegin()
- {
- }
-
- void CBegin::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CBegin)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CBegin, CPropertyPage)
- //{{AFX_MSG_MAP(CBegin)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CBegin message handlers
-
- BOOL CBegin::OnSetActive()
- {
- CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
- ASSERT_KINDOF(CPropertySheet, pSheet);
- pSheet->SetWizardButtons( PSWIZB_NEXT);// | PSWIZB_FINISH);
-
- CEdit *pEdit = (CEdit *) GetDlgItem(IDC_EDITPSNAME);
- pEdit->SetWindowText (pSheet->m_PSInfo->cstrPSpaceName);
-
- return CPropertyPage::OnSetActive();
- }
-
- LRESULT CBegin::OnWizardNext()
- {
- HRESULT hRes = E_FAIL;
- CString cstrTmp;
- CString cstrErr;
- COleVariant varName;
- varName.vt = VT_BSTR;
- PaperSpace *pPs = NULL;
-
- try
- {
-
- CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
- CEdit *pEdit = (CEdit *) GetDlgItem(IDC_EDITPSNAME);
- pEdit->GetWindowText(cstrTmp);
- varName.bstrVal = cstrTmp.AllocSysString ();
- // try get PaperSpace fro PaperSpaces collection to define if PaperSpace with such name already exist
- hRes = pSheet->m_pPss->get_Item(&varName, &pPs);
- if(FAILED(hRes))
- {
- pSheet->m_PSInfo->cstrPSpaceName = cstrTmp;
- cstrTmp.Empty ();
- return CPropertyPage::OnWizardNext();
- }
- cstrErr.LoadString (IDS_ERRDUPLICATEPS);
- AfxMessageBox(cstrErr);
- pEdit->SetFocus ();
- pEdit->SetSel(0, strlen(cstrTmp), FALSE);
- }
- catch(...)
- {
- TRACE("CBegin::OnWizardNext");
- }
-
- RELEASE(pPs)
- return CPropertyPage::OnSetActive();
- }
-