home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / MSGTRACE.ZIP / MyProjects / MsgTrace / MsgTracer / OutputDoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-30  |  4.5 KB  |  164 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File        : OutputDoc.h
  4. // Project     : MsgTrace
  5. // Component   : MsgTracer
  6. //---------------------------------------------------------------------------
  7. // Description : document of output-view
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // SourceSafe Strings. Do not change.
  12. //---------------------------------------------------------------------------
  13. // $Author: jeskes $
  14. // $Date: $
  15. // $Revision: $
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef OUTPUTDOC_H
  20. #define OUTPUTDOC_H
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23.  
  24. class COutputLine;
  25. class COutputLineFormat;
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // document notifictions
  29. /////////////////////////////////////////////////////////////////////////////
  30.  
  31. #define OUTPUTDOC_LINEADDED    1
  32. #define OUTPUTDOC_CLEARED    2
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35.  
  36. class COutputDoc : public CDocument
  37. {
  38.     DECLARE_SERIAL( COutputDoc )
  39. //---------------------------------------------------------------------------
  40. // construction
  41. //---------------------------------------------------------------------------
  42. public:
  43.     COutputDoc();
  44.     virtual ~COutputDoc();
  45.  
  46. public:
  47.     virtual    BOOL OnNewDocument();
  48.  
  49. protected:
  50.     virtual void OnChangedViewList();
  51.     void DeleteContents();
  52.  
  53. public:
  54.     virtual HMENU GetDefaultMenu();
  55.  
  56. //---------------------------------------------------------------------------
  57. // attributes
  58. //---------------------------------------------------------------------------
  59. private:
  60.     COutputLine* m_psLineArray;
  61.         // pointer to array of lines
  62.  
  63.     int m_nMaxBufferedLines;
  64.         // size of array of lines
  65.                                                         
  66.     int m_nMaxLines;
  67.         // max lines in array
  68.                             
  69.     int m_nNextFreeLine;
  70.         // next free line in array
  71.  
  72.     int m_nMaxLineLen;
  73.         // max length of lines in array
  74.  
  75. public:
  76.     int GetMaxLines() const;
  77.     int GetMaxLineLen() const;
  78.     
  79.     int GetMaxBufferedLines() const;
  80.     void SetMaxBufferedLines( int nMaxBufferedLines );
  81.         
  82. //---------------------------------------------------------------------------
  83. // current output-line-format
  84. //---------------------------------------------------------------------------
  85. private:
  86.     COutputLineFormat* m_pCurrentFormat;
  87.  
  88. public:
  89.     void InitTabStops( int nTabStops = 0 );
  90.     void SetTabStop( int nIndex, int nTabPos );
  91.  
  92.     const COutputLineFormat& GetCurrentFormat() const;
  93.  
  94. //---------------------------------------------------------------------------
  95. // operations
  96. //---------------------------------------------------------------------------
  97. protected:
  98.     CMutex m_mutexAddLine;
  99.  
  100. public:
  101.     void AddLine( LPCSTR lpszText );
  102.     COutputLine& GetLine( int nLine );
  103.     
  104. //---------------------------------------------------------------------------
  105. // serialize
  106. //---------------------------------------------------------------------------
  107. protected:
  108.     virtual void Serialize(CArchive& ar);
  109.  
  110. //---------------------------------------------------------------------------
  111. // message map
  112. //---------------------------------------------------------------------------
  113. protected:
  114.     CMutex m_mutexThreadSafeUpdateAllViews;
  115.  
  116.     typedef struct
  117.     {
  118.         CView*                m_pView;
  119.         LPARAM                m_lHint;
  120.         CObject*            m_pHint;
  121.  
  122.     } SUpdateAllViews;
  123.  
  124.     SUpdateAllViews m_sUpdateAllViews;
  125.  
  126. public:
  127.     void ThreadSafeUpdateAllViews( CView*, LPARAM = 0L, CObject* = NULL );
  128.  
  129. //---------------------------------------------------------------------------
  130. // message map
  131. //---------------------------------------------------------------------------
  132. protected:
  133.     //{{AFX_MSG(COutputDoc)
  134.     afx_msg void OnEditClearAll();
  135.     //}}AFX_MSG
  136.     afx_msg BOOL OnExtUpdateAllViews( UINT );
  137.     DECLARE_MESSAGE_MAP()
  138.  
  139. //---------------------------------------------------------------------------
  140. // friends
  141. //---------------------------------------------------------------------------
  142.     friend class COutputView;
  143. };
  144.  
  145. /////////////////////////////////////////////////////////////////////////////
  146.  
  147. inline int COutputDoc::GetMaxLineLen() const
  148. {
  149.     return( m_nMaxLineLen );
  150. }
  151.  
  152. inline int COutputDoc::GetMaxLines() const
  153. {
  154.     return( m_nMaxLines );
  155. }
  156.  
  157. inline int COutputDoc::GetMaxBufferedLines() const
  158. {
  159.     return( m_nMaxBufferedLines );
  160. }
  161.  
  162. /////////////////////////////////////////////////////////////////////////////
  163. #endif
  164.