logview.h
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:4k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // logview.h : header file
- //
- enum // Log view log types
- {
- // default
- LV_DEFAULT,
- // Display styles for clients
- LV_COMMAND,
- LV_GET,
- LV_PUT,
- LV_ERROR,
- LV_QUOTE,
- LV_INFORM,
- LV_FILEACC,
- LV_CONNECT,
- LV_SYSTEM,
- // Standard log styles
- LV_LOGF_DEBUG,
- LV_LOGF_ERROR,
- LV_LOGF_FILEACC,
- LV_LOGF_INOUT,
- LV_LOGF_SECURITY,
- LV_LOGF_WARNINGS,
- LV_LOGF_SYSTEM,
- LV_LOGF_WINSOCK,
- // Other fonts - used internally *ONLY*
- LV_INTF_CMDLINE,
- LV_INVALID
- };
- /////////////////////////////////////////////////////////////////////////////
- // CLogView view
- class DLL_WAR_CLIENT_ CLogBuffer;
- class CLoggedLine : public CObject
- {
- public:
- CLoggedLine(CLogBuffer *pBuf, int Mode, LPCSTR Text, int Len);
- ~CLoggedLine();
- CLogBuffer *m_Origin;
- CString m_Text;
- int m_Mode;
- };
- class DLL_WAR_CLIENT_ CLogBuffer : public CObject
- {
- public:
- int m_MaxLines;
- int m_NumLines;
- CObArray m_Lines;
- int m_ScrollLines;
- public:
- CLogBuffer();
- ~CLogBuffer();
- void ClearAll();
- BOOL AddLine(int Mode, LPCSTR Text, int Len);
- CLoggedLine *GetLine(int LineNo)
- {
- ASSERT(LineNo >= 0);
- ASSERT(LineNo < m_NumLines);
- ASSERT(LineNo < m_MaxLines);
- CLoggedLine *pLB = (CLoggedLine *)m_Lines[LineNo];
- ASSERT(pLB != NULL);
- ASSERT(AfxIsValidAddress(pLB, sizeof(CLoggedLine)));
- return pLB;
- }
- };
- class CLogBuffer;
- class DLL_WAR_CLIENT_ CLogView : public CScrollView
- {
- protected:
- CLogView(); // protected constructor used by dynamic creation
- DECLARE_DYNCREATE(CLogView)
- // Attributes
- public:
- int IsInitialized;
- CRect m_CurrentSizeDP; // Last size saved
- CRect m_RealSizeDP; // Current size, after adding new lines
- CSize m_ConfirmedLineWidth; // The max linewidth that si actually used
- CSize m_LineLP; // Line hignt and character width in LP
- CSize m_LineDP; // Line defaults in DP
- CLogBuffer m_Buf;
- CSize m_CmdLineHightDP;
- CSize m_CmdLineHightLP;
- CFont *m_Font[LV_INVALID];
- COLORREF m_Color[LV_INVALID];
- CWnd *m_pCommandWin; // Window to send commands to...
- BOOL m_ShowCommandLine;
- CString m_CmdBuf;
- int m_CursorPos;
- HCURSOR m_EditCursor;
- CRect m_CmdRectSave;
- CPoint m_CaretPos;
- CStringArray m_PrevCommands;
- int m_CurrentCommandIndex;
- // Operations
- public:
- void Initialize();
- void InitializeFonts(CDC *pDC);
- void AddLogLine(LPCSTR Text);
- void _AddLogLine(int Mode, LPCSTR Text, int Len);
- void LogMultilineBuffer(int Type, LPCSTR Buffer);
- CRect RecalculateClientRectDP(CDC *pDC);
- int GetLineHightLP() {return m_LineLP.cy; }
- int GetLineHightDP() {return m_LineDP.cy; }
- int GetCharWidthLP() {return m_LineLP.cx; }
- int GetCharWidthDP() {return m_LineDP.cx; }
- CRect GetCmdLineRectDP();
- CSize GetCmdLineSizeDP();
- CRect GetViewSize();
- void DrawCmdLine(CDC *pDC);
- void EnableCommandWindow(BOOL Enable);
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CLogView)
- public:
- virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
- virtual BOOL OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll = TRUE);
- virtual void Serialize(CArchive& ar);
- protected:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
- virtual void OnInitialUpdate(); // first time after construct
- virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
- virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
- virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE);
- virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
- virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- virtual ~CLogView();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- // Generated message map functions
- //{{AFX_MSG(CLogView)
- afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnPaint();
- afx_msg void OnClearLog();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////