⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logview.h

📁 串口调试助手的源代码
💻 H
字号:
// Written by JHCC

// LogView.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CLogView view

class CLogView : public CRowView
{
protected:
	CLogView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CLogView)

// Attributes
public:
	// The file is kept open to do read/writes on per transaction basis.
	CFile	m_file;
		
	// The following header, and optional extra header implemented
	// in the derived class, are updated each time a new record is
	// added, or WriteHeader() is called.
	struct
	{
		ULONG	nLogCount;	// count of log records in the file
		UINT	nLogLength;	// length of fixed-length log records
		UINT	nExtraHeaderLength;	// length of additional header written by derived class
	}m_header;

	// Extra header (in addition to)
	struct
	{
		DWORD	dwFileSignature;
		UINT	nFirstLogNo;
	}m_extraHeader;

	enum
	{
		DATE_COL = 0,
		DATE_LEN = 10,

		TIME_COL = DATE_COL + DATE_LEN + 1,
		TIME_LEN = 8,

		MEMO_COL = TIME_COL + TIME_LEN + 1,
		MEMO_LEN = 40,

		ROW_WIDTH = MEMO_COL + MEMO_LEN + 1,

		JHHB_LOG_SIGNATURE = 0xABCDE123,
	};

	// Each log is written in a fixed length record.
	struct
	{
		TCHAR	szDate[DATE_LEN + 1];	// 1997.03.27\0
		TCHAR	szTime[TIME_LEN + 1];	// 14:25:33\0
		TCHAR	szMemo[MEMO_LEN + 1];	// description
	}m_record;

	UINT	m_nActiveLog;

// Operations
public:
	CJHHBDoc*	GetDocument(void);

	BOOL	Open(LPCTSTR  lpszPathName);
	void	WriteHeader(CFile*  pFile, BOOL  bNewHeader);
	virtual BOOL OnReadExtraHeader(CFile*  pFile);
	virtual void OnWriteExtraHeader(CFile*  pFile, BOOL  bNewHeader);
	BOOL ReadHeader(CFile*  pFile);
//	UINT	CreateNewRecord(void);
	UINT	AddNewLog(CString  strMemo);
	void	FileSeekRecord(UINT nRecord);
	void	GetRecord(UINT  nRecordIndex, void*  pRecord);
	void	UpdateRecord(CView*  pSourceView, UINT  nRecordIndex,
		void*  pRecord);
	virtual void*	OnCreateNewRecord(int  nNewRecordIndex, CString  strMemo);

	virtual void	GetRowWidthHeight(CDC*  pDC, int&  nRowWidth,
		int&  nRowHeight);
	UINT	GetRecordCount(void);

	virtual int	GetActiveRow();
	virtual int	GetRowCount();
	virtual void	OnDrawRow(CDC*  pDC, int  nRow, int  y, BOOL  bSelected);
	virtual void	ChangeSelectionNextRow(BOOL  bNext);
	virtual void	ChangeSelectionToRow(int  nRow);
	UINT GetActiveLogNo(void);
	UINT	GetFirstLogNo(void);
	UINT	GetLastLogNo(void);

	void	GetLog(UINT  nLogNo, CString&  strDate,
		CString&  strTime, CString&  strMemo);
	void	PackRecord(LPCTSTR  lpszDate, LPCTSTR  lpszTime, LPCTSTR  lpszMemo);
	void	ParseRecord(CString&  strDate, CString& strTime, CString&  strMemo);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CLogView)
	protected:
	virtual void OnInitialUpdate();     // first time after construct
	//}}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
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -