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

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File        : OutputView.h
  4. // Project     : MsgTrace
  5. // Component   : MsgTracer
  6. //---------------------------------------------------------------------------
  7. // Description : output view for MsgTracer
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // SourceSafe Strings. Do not change.
  12. //---------------------------------------------------------------------------
  13. // $Author: jeskes $
  14. // $Date: $
  15. // $Revision: $
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef OUTPUTVIEW_H
  20. #define OUTPUTVIEW_H
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23.  
  24. class COutputDoc;
  25. class CColoredFont;
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28.  
  29. class COutputView : public CScrollView
  30. {
  31.     DECLARE_DYNCREATE( COutputView )
  32. //---------------------------------------------------------------------------
  33. // construction
  34. //---------------------------------------------------------------------------
  35. public:
  36.     COutputView();
  37.     virtual ~COutputView();
  38.     
  39. //---------------------------------------------------------------------------
  40. // associated document
  41. //---------------------------------------------------------------------------
  42. public:
  43.     COutputDoc* GetDocument();
  44.  
  45. protected:
  46.     virtual    void OnInitialUpdate();
  47.     virtual void OnUpdate( CView*, LPARAM, CObject* );
  48.  
  49. //---------------------------------------------------------------------------
  50. // colored font
  51. //---------------------------------------------------------------------------
  52. protected:
  53.     CColoredFont* m_pColoredFont;
  54. public:
  55.     CColoredFont* ColoredFontGet() const;
  56.  
  57. //---------------------------------------------------------------------------
  58. // track menu
  59. //---------------------------------------------------------------------------
  60. protected:
  61.     CMenu* m_pTrackMenu;
  62.  
  63. //---------------------------------------------------------------------------
  64. // current caret position and selection
  65. //---------------------------------------------------------------------------
  66. protected:
  67.     BOOL m_bWhileSelecting;
  68.  
  69.     int m_nCurCol;
  70.     int m_nCurRow;
  71.  
  72.     void SetCurPos( int nCol, int nRow, BOOL bMoveCaret = TRUE, BOOL bClearSelection = TRUE );
  73.     void SetCurPos( CPoint pt, BOOL bMoveCaret = TRUE, BOOL bClearSelection = TRUE );
  74.  
  75.     void MoveCaretToCurPos();
  76.  
  77.     int GetCurCol() const;
  78.     int GetCurRow() const;
  79.  
  80.     int m_nSelCol;
  81.     int m_nSelRow;
  82.  
  83.     BOOL GetSelForRow( int nRow, int& nStartCol, int& nEndCol ) const;
  84.     
  85.     void CharCoordsFromVirtPoint( CPoint pt, int& nCol, int& nRow );
  86.     CPoint VirtCharPosFromCoords( int nCol, int nRow );
  87.     void AdjustScrollToVirtPoint( CPoint pt );
  88.  
  89.     void InvalidateSelRange();
  90.     void InvalidateNewRange( int nCol, int nRow );
  91.     void InvalidateRange( int nStartCol, int nStartRow, int nEndCol, int nEndRow );
  92.  
  93. public:
  94.     void GetSelectedText( CString& strResult );
  95.  
  96.     BOOL GetSelRange( int& nSelStartCol, 
  97.                        int& nSelStartRow, 
  98.                       int& nSelEndCol, 
  99.                       int& nSelEndRow ) const;
  100.  
  101.     CString GetCurRowAsString();
  102.  
  103. //---------------------------------------------------------------------------
  104. // own capture mechanism
  105. //---------------------------------------------------------------------------
  106. protected:
  107.     UINT m_nIDCaptureTimer;
  108.  
  109. public:
  110.     void SetCapture();
  111.     void ReleaseCapture();
  112.  
  113. //---------------------------------------------------------------------------
  114. // attributes
  115. //---------------------------------------------------------------------------
  116. private:
  117.     int m_nMaxVisibleLines;
  118.         // max number of visible lines in window
  119.     
  120.     int m_nRowWidth;
  121.         // max width of ever displayed rows
  122.  
  123.     int m_nRowHeight;
  124.         // height of any displayed row 
  125.  
  126. public:
  127.     int GetMaxVisibleLines() const;
  128.  
  129. //---------------------------------------------------------------------------
  130. // drawing
  131. //---------------------------------------------------------------------------
  132. protected:
  133.     virtual void OnPrepareDC( CDC* pDC, CPrintInfo* pInfo = NULL );
  134.     virtual    void OnDraw(CDC* pDC);
  135.     virtual void OnDrawLine( CDC*, int, int, BOOL );
  136.     virtual void UpdateScrollSizes();
  137.     
  138.     void RectToRange( const CRect& rect, int& nFirst, int& nLast );
  139.  
  140. //---------------------------------------------------------------------------
  141. // printing
  142. //---------------------------------------------------------------------------
  143. protected:
  144.     HFONT m_hPrinterFont;
  145.     int m_nPrintRowHeight;
  146.     int m_nPrintLinesPerPage;
  147.     
  148.     virtual    BOOL OnPreparePrinting( CPrintInfo* pInfo );
  149.     virtual    void OnBeginPrinting( CDC* pDC, CPrintInfo* pInfo );
  150.     virtual    void OnPrint( CDC* pDC, CPrintInfo* pInfo );
  151.     virtual    void OnEndPrinting( CDC* pDC, CPrintInfo* pInfo );
  152.     
  153. //---------------------------------------------------------------------------
  154. // message map
  155. //---------------------------------------------------------------------------
  156. protected:
  157.     //{{AFX_MSG(COutputView)
  158.     afx_msg void OnSize(UINT nType, int cx, int cy);
  159.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  160.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  161.     afx_msg void OnViewFont();
  162.     afx_msg void OnKillFocus(CWnd* pNewWnd);
  163.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  164.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  165.     afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  166.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  167.     afx_msg void OnEditCopy();
  168.     afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
  169.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  170.     afx_msg void OnTimer(UINT nIDEvent);
  171.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  172.     //}}AFX_MSG
  173.     DECLARE_MESSAGE_MAP()
  174.  
  175.     friend class CMainFrame;
  176. };
  177.  
  178. /////////////////////////////////////////////////////////////////////////////
  179.  
  180. inline CColoredFont* COutputView::ColoredFontGet() const
  181. {
  182.     return( m_pColoredFont );
  183. }
  184.  
  185. inline int COutputView::GetMaxVisibleLines() const
  186. {
  187.     return( m_nMaxVisibleLines );
  188. }
  189.  
  190. inline int COutputView::GetCurCol() const
  191. {
  192.     return( m_nCurCol );
  193. }
  194.  
  195. inline int COutputView::GetCurRow() const
  196. {
  197.     return( m_nCurRow );
  198. }
  199.  
  200. /////////////////////////////////////////////////////////////////////////////
  201. #endif
  202.