home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n08 / sketchsc.exe / DATA.H < prev    next >
C/C++ Source or Header  |  1995-08-01  |  3KB  |  82 lines

  1. //-----------------------------------------------------------------------
  2. // DATA.H: Definitions for the data_interface (document) class
  3. //-----------------------------------------------------------------------
  4.  
  5. #ifndef DATA_H__
  6. #define DATA_H__
  7.  
  8. #include "stroke.h"
  9.  
  10. // sketcdoc.h : interface of the CSketchDoc class
  11. //-----------------------------------------------------------------------
  12. // Since the mapping mode controls the "document" coordinate system,
  13. // it makes sense to store it here. As a concequence, the document
  14. // will have to prepare mapping-mode componants of the DC. The main
  15. // advantage is that all views into this document are then guaranteed
  16. // to use the same mapping mode.
  17.  
  18. class data_interface : public CDocument
  19. {
  20. private:
  21.     enum element_type      { a_stroke, a_line             };       
  22.     enum pen_width           { thin = 2, thick = 5            };
  23.     enum Serialize_schema{ version = 1                    };
  24.     enum default_sizes   { hor_size=800, vert_size=800    };
  25.     enum map_mode          { mapping_mode = MM_TEXT        };
  26.  
  27.     unsigned    use_thick_lines : 1;
  28.     unsigned    element_in_use  : 1;   // Holds an element_type
  29.  
  30.     CSize        doc_size ;
  31.  
  32.     CTypedPtrList<CObList,drawing_element*>    dwg_objects;
  33.  
  34. protected:    
  35.     data_interface();                // created by CView, not by user
  36.     virtual ~data_interface();        // so constructor/destuctor
  37.                                     // are private.
  38.     DECLARE_DYNCREATE(data_interface)
  39.  
  40. private:
  41.     //{{AFXVIRTUAL(data_interface)
  42.     virtual BOOL OnNewDocument    ( void );
  43.     virtual void Serialize        (CArchive& ar);
  44.     virtual void DeleteContents    (void);
  45.     //}}AFXVIRTUAL
  46.  
  47. #ifdef _DEBUG
  48.     virtual void AssertValid() const;
  49.     virtual void Dump(CDumpContext& dc) const;
  50. #endif
  51.  
  52. public: // interface to the view
  53.  
  54.     drawing_element *give_me_an_empty_drawing_element( void );
  55.     void am_done_loading( CWnd *src, drawing_element *p );
  56.  
  57.     void print_all_objects_in_this_rect    ( device      *dc,
  58.                                           const CRect &print_area,
  59.                                           int           as_text        );
  60.     void set_up_scrolling                ( CScrollView *view ) const;
  61.  
  62. private:    // menu-message handlers
  63.  
  64.     //{{AFX_MSG(data_interface)
  65.     afx_msg void OnEditUndo();
  66.     afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
  67.     afx_msg void OnEditClearAll();
  68.     afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
  69.     afx_msg void on_line_thick( void );
  70.     afx_msg void on_update_thick( CCmdUI *line_item );                                              
  71.     //}}AFX_MSG
  72.  
  73.     afx_msg void on_select_element         ( UINT id              );
  74.     afx_msg void on_update_select_element( CCmdUI *line_item );                                              
  75.  
  76.     DECLARE_MESSAGE_MAP()
  77. };
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80.  
  81. #endif // DATA_H__
  82.