home *** CD-ROM | disk | FTP | other *** search
- // TabDeDoc.cpp : implementation of the CTabDemoDoc class
- //
-
- #include "stdafx.h"
- #include "TabDemo.h"
-
- #include "TabDeDoc.h"
- #include "style.h"
- #include "justify.h"
- #include "pitch.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CTabDemoDoc
-
- IMPLEMENT_DYNCREATE(CTabDemoDoc, CDocument)
-
- BEGIN_MESSAGE_MAP(CTabDemoDoc, CDocument)
- //{{AFX_MSG_MAP(CTabDemoDoc)
- ON_COMMAND(ID_TEXT_FORMAT, OnTextFormat)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CTabDemoDoc construction/destruction
-
- CTabDemoDoc::CTabDemoDoc()
- {
- // TODO: add one-time construction code here
- m_Bold = FALSE;
- m_Italic = FALSE;
- m_Underline = FALSE;
- m_Justify = JUSTIFY_LEFT;
- m_Pitch = PITCH_VARIABLE;
- m_Spacing = 1;
- }
-
- CTabDemoDoc::~CTabDemoDoc()
- {
- }
-
- BOOL CTabDemoDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
-
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
-
- return TRUE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CTabDemoDoc serialization
-
- void CTabDemoDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CTabDemoDoc diagnostics
-
- #ifdef _DEBUG
- void CTabDemoDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
-
- void CTabDemoDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CTabDemoDoc commands
-
- void CTabDemoDoc::OnTextFormat()
- {
- // TODO: Add your command handler code here
-
- // create tabbed dialog box object:
- CPropertySheet PropertySheet ("Format");
-
- // create object for each page:
- CStyle StylePage;
- CJustify JustifyPage;
- CPitch PitchPage;
-
- // add pages to dialog box object:
- PropertySheet.AddPage (&StylePage);
- PropertySheet.AddPage (&JustifyPage);
- PropertySheet.AddPage (&PitchPage);
-
- // initialize page object data members:
- StylePage.m_Bold = m_Bold;
- StylePage.m_Italic = m_Italic;
- StylePage.m_Underline = m_Underline;
- JustifyPage.m_Justify = m_Justify;
- PitchPage.m_Pitch = m_Pitch;
- PitchPage.m_Spacing = m_Spacing;
-
- // display tabbed dialog box:
- if (PropertySheet.DoModal () == IDOK)
- {
- // save values of page object data members:
- m_Bold = StylePage.m_Bold;
- m_Italic = StylePage.m_Italic;
- m_Underline = StylePage.m_Underline;
- m_Justify = JustifyPage.m_Justify;
- m_Pitch = PitchPage.m_Pitch;
- m_Spacing = PitchPage.m_Spacing;
-
- // redraw the text:
- UpdateAllViews (NULL);
- }
- }
-