📄 editpaddoc.h
字号:
///////////////////////////////////////////////////////////////////////////
// File: editpaddoc.h
// Version: 1.1.0.4
// Updated: 19-Jul-1998
//
// Document core
//
// Copyright: Ferdinand Prantl, portions by Stcherbatchenko Andrei
// E-mail: prantl@ff.cuni.cz
//
// You are free to use or modify this code to the following restrictions:
// - Acknowledge me somewhere in your about box, simple "Parts of code by.."
// will be enough. If you can't (or don't want to), contact me personally.
// - LEAVE THIS HEADER INTACT
////////////////////////////////////////////////////////////////////////////
// editpaddoc.h : interface of the CEditPadDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_EDITPADDOC_H__BC121A96_FEE3_11D2_9ACA_00600875DD5F__INCLUDED_)
#define AFX_EDITPADDOC_H__BC121A96_FEE3_11D2_9ACA_00600875DD5F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ccrystaltextbuffer.h"
#include "filevent.h"
class CEditPadDoc : public CDocument, public CFileEvent
{
protected : // create from serialization only
CEditPadDoc ();
DECLARE_DYNCREATE (CEditPadDoc)
// Attributes
public :
class CEditPadTextBuffer : public CCrystalTextBuffer
{
private :
CEditPadDoc * m_pOwnerDoc;
public :
CEditPadTextBuffer (CEditPadDoc * pDoc)
{
m_pOwnerDoc = pDoc;
};
BOOL GetLine( int nLineIndex, CString &strLine )
{
int nLineLength = CCrystalTextBuffer::GetLineLength( nLineIndex );
if( nLineLength <= 0 )
return FALSE;
_tcsncpy ( strLine.GetBuffer( nLineLength ), CCrystalTextBuffer::GetLineChars( nLineIndex ), nLineLength );
strLine.ReleaseBuffer( nLineLength );
return TRUE;
}
virtual void SetModified (BOOL bModified = TRUE)
{
CCrystalTextBuffer::SetModified (bModified);
m_pOwnerDoc->SetModifiedFlag (bModified);
if (bModified)
{
CString sTitle;
CWnd *pWnd = AfxGetMainWnd ();
pWnd->GetWindowText (sTitle);
if (sTitle.Right (2) != _T(" *"))
{
sTitle += _T (" *");
pWnd->SetWindowText (sTitle);
}
}
else
{
CString sTitle;
CWnd *pWnd = AfxGetMainWnd ();
pWnd->GetWindowText (sTitle);
if (sTitle.Right (2) == _T(" *"))
{
sTitle = sTitle.Left (sTitle.GetLength () - 2);
pWnd->SetWindowText (sTitle);
}
}
};
};
CEditPadTextBuffer m_xTextBuffer;
virtual void OnFileEvent (WPARAM wEvent, LPCTSTR pszPathName);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditPadDoc)
public:
virtual BOOL OnNewDocument ();
virtual void Serialize (CArchive & ar);
virtual void DeleteContents ();
virtual BOOL OnOpenDocument (LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument (LPCTSTR lpszPathName);
virtual void OnCloseDocument();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEditPadDoc ();
#ifdef _DEBUG
virtual void AssertValid ()const;
virtual void Dump (CDumpContext & dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CEditPadDoc)
afx_msg void OnReadOnly ();
afx_msg void OnUpdateReadOnly (CCmdUI * pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP ()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EDITPADDOC_H__BC121A96_FEE3_11D2_9ACA_00600875DD5F__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -