📄 generpg.cpp
字号:
///////////////////////////////////////////////////////////////////////////
// File: generpg.cpp
// Version: 1.1.0.4
// Updated: 19-Jul-1998
//
// Property page with general information
//
// Copyright: Ferdinand Prantl
// 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
////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "generpg.h"
#include "editpaddoc.h"
#include "editpadview.h"
#include "foldrdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGeneralPage property page
IMPLEMENT_DYNCREATE(CGeneralPage, CPropertyPage)
CGeneralPage::CGeneralPage() : CPropertyPage(CGeneralPage::IDD), m_pParent (&theApp)
{
//{{AFX_DATA_INIT(CGeneralPage)
m_bOpenLastDoc = FALSE;
m_nCreateNewDoc = -1;
m_bMaxFrameWnd = FALSE;
m_bMaxChildWnd = FALSE;
m_bSaveDocsOnExit = FALSE;
m_bSaveSetingsOnExit = FALSE;
m_bAutoReload = FALSE;
m_bNotifyChanges = TRUE;
m_bAdvancedUi = TRUE;
m_bNoSplash = FALSE;
m_sIspellPath = _T("");
m_bRememberLastPos = TRUE;
//}}AFX_DATA_INIT
}
CGeneralPage::~CGeneralPage()
{
}
void CGeneralPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGeneralPage)
DDX_Check(pDX, IDC_OPEN_LAST_DOC, m_bOpenLastDoc);
DDX_Radio(pDX, IDC_CREATE_NEW_DOC_NEVER, m_nCreateNewDoc);
DDX_Check(pDX, IDC_MAXIMIZE_FRAME_WND, m_bMaxFrameWnd);
DDX_Check(pDX, IDC_MAXIMIZE_CHILD_WND, m_bMaxChildWnd);
DDX_Check(pDX, IDC_SAVE_DOCS_ON_EXIT, m_bSaveDocsOnExit);
DDX_Check(pDX, IDC_SAVE_SETS_ON_EXIT, m_bSaveSetingsOnExit);
DDX_Check(pDX, IDC_DRAG_N_DROP_EDIT, m_bDragnDropEditing);
DDX_Check(pDX, IDC_AUTORELOAD, m_bAutoReload);
DDX_Check(pDX, IDC_NOTIFY_CHANGES, m_bNotifyChanges);
DDX_Check(pDX, IDC_ADVANCED_UI, m_bAdvancedUi);
DDX_Check(pDX, IDC_NO_SPLASH, m_bNoSplash);
DDX_Text(pDX, IDC_ISPELL_PATH, m_sIspellPath);
DDX_Check(pDX, IDC_REMEMBER_LASTPOS, m_bRememberLastPos);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGeneralPage, CPropertyPage)
//{{AFX_MSG_MAP(CGeneralPage)
ON_BN_CLICKED(IDC_OPEN_LAST_DOC, OnModify)
ON_BN_CLICKED(IDC_ISPELL_PATH_BUT, OnIspellPathBut)
ON_BN_CLICKED(IDC_CREATE_NEW_DOC_NEVER, OnModify)
ON_BN_CLICKED(IDC_CREATE_NEW_DOC_ALWAYS, OnModify)
ON_BN_CLICKED(IDC_CREATE_NEW_DOC_IF_ALONE, OnModify)
ON_BN_CLICKED(IDC_MAXIMIZE_FRAME_WND, OnModify)
ON_BN_CLICKED(IDC_MAXIMIZE_CHILD_WND, OnModify)
ON_BN_CLICKED(IDC_SAVE_DOCS_ON_EXIT, OnModify)
ON_BN_CLICKED(IDC_SAVE_SETS_ON_EXIT, OnModify)
ON_BN_CLICKED(IDC_DRAG_N_DROP_EDIT, OnModify)
ON_BN_CLICKED(IDC_NOTIFY_CHANGES, OnModify)
ON_BN_CLICKED(IDC_ADVANCED_UI, OnModify)
ON_BN_CLICKED(IDC_NO_SPLASH, OnModify)
ON_EN_CHANGE(IDC_ISPELL_PATH, OnModify)
ON_BN_CLICKED(IDC_REMEMBER_LASTPOS, OnModify)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGeneralPage message handlers
BOOL CGeneralPage::OnInitDialog()
{
ASSERT (m_pParent);
m_bOpenLastDoc = (m_pParent->m_dwFlags & EP_OPEN_LAST_DOCS) != 0;
m_nCreateNewDoc = m_pParent->m_dwFlags & EP_CREATE_NEW_DOC_ALWAYS ? 1 : (m_pParent->m_dwFlags & EP_CREATE_NEW_DOC_IF_ALONE ? 2 : 0);
m_bMaxFrameWnd = (m_pParent->m_dwFlags & EP_MAXIMIZE_FRAME_WND) != 0;
m_bMaxChildWnd = (m_pParent->m_dwFlags & EP_MAXIMIZE_CHILD_WND) != 0;
m_bSaveDocsOnExit = (m_pParent->m_dwFlags & EP_SAVE_DOCS_ON_EXIT) != 0;
m_bSaveSetingsOnExit = (m_pParent->m_dwFlags & EP_SAVE_SETS_ON_EXIT) != 0;
m_bDragnDropEditing = (m_pParent->m_dwFlags & EP_DRAG_N_DROP_EDIT) != 0;
m_bAutoReload = (m_pParent->m_dwFlags & EP_AUTO_RELOAD) != 0;
m_bNotifyChanges = (m_pParent->m_dwFlags & EP_NOTIFY_CHANGES) != 0;
m_bAdvancedUi = (m_pParent->m_dwFlags & EP_ADVANCED_UI) != 0;
m_bNoSplash = (m_pParent->m_dwFlags & EP_NO_SPLASH) != 0;
m_sIspellPath = CEditPadView::szWIspellPath;
m_bRememberLastPos = (m_pParent->m_dwFlags & EP_REMEMBER_LASTPOS) != 0;
CPropertyPage::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CGeneralPage::OnOK()
{
CPropertyPage::OnOK();
ASSERT (m_pParent);
if ((m_bNotifyChanges != 0) != ((m_pParent->m_dwFlags & EP_NOTIFY_CHANGES) != 0))
{
POSITION pos = AfxGetApp ()->GetFirstDocTemplatePosition ();
ASSERT (pos);
CDocTemplate *pDocTempl = AfxGetApp ()->GetNextDocTemplate (pos);
pos = pDocTempl->GetFirstDocPosition ();
if (m_bNotifyChanges)
while (pos)
{
CEditPadDoc *pDoc = (CEditPadDoc*) pDocTempl->GetNextDoc (pos);
pDoc->AddFile (pDoc->GetPathName ());
pDoc->StartWatching ();
}
else
while (pos)
{
CEditPadDoc *pDoc = (CEditPadDoc*) pDocTempl->GetNextDoc (pos);
pDoc->StopWatching ();
pDoc->RemoveFile (pDoc->GetPathName ());
}
}
if ((m_bAdvancedUi != 0) != ((m_pParent->m_dwFlags & EP_ADVANCED_UI) != 0))
{
AfxMessageBox (_T ("Changes of the advanced user interface\ndo not take effect until EditPad is restarted."));
}
switch (m_nCreateNewDoc)
{
case 1:
m_pParent->m_dwFlags = EP_CREATE_NEW_DOC_ALWAYS;
break;
case 2:
m_pParent->m_dwFlags = EP_CREATE_NEW_DOC_IF_ALONE;
break;
default: /* case 0: */
m_pParent->m_dwFlags = EP_CREATE_NEW_DOC_NEVER;
};
m_pParent->m_dwFlags |= (m_bOpenLastDoc ? EP_OPEN_LAST_DOCS : 0) |
(m_bMaxFrameWnd ? EP_MAXIMIZE_FRAME_WND : 0) |
(m_bMaxChildWnd ? EP_MAXIMIZE_CHILD_WND : 0) |
(m_bSaveDocsOnExit ? EP_SAVE_DOCS_ON_EXIT : 0) |
(m_bSaveSetingsOnExit ? EP_SAVE_SETS_ON_EXIT : 0) |
(m_bDragnDropEditing ? EP_DRAG_N_DROP_EDIT : 0) |
(m_bAutoReload ? EP_AUTO_RELOAD : 0) |
(m_bNotifyChanges ? EP_NOTIFY_CHANGES : 0) |
(m_bAdvancedUi ? EP_ADVANCED_UI : 0) |
(m_bNoSplash ? EP_NO_SPLASH : 0) |
(m_bRememberLastPos ? EP_REMEMBER_LASTPOS : 0);
POSITION pos = m_pParent->GetFirstDocTemplatePosition ();
ASSERT (pos);
CDocTemplate *pDocTempl = m_pParent->GetNextDocTemplate (pos);
ASSERT (pDocTempl);
pos = pDocTempl->GetFirstDocPosition ();
while (pos)
{
CDocument *pDoc = pDocTempl->GetNextDoc (pos);
ASSERT (pDoc);
POSITION pos1 = pDoc->GetFirstViewPosition ();
CEditPadView *pView;
while (pos1)
{
pView = (CEditPadView*) pDoc->GetNextView (pos1);
pView->SetDisableDragAndDrop (m_bDragnDropEditing);
}
}
_tcscpy (CEditPadView::szWIspellPath, m_sIspellPath);
SetModified (FALSE);
}
void CGeneralPage::OnModify()
{
SetModified ();
}
void CGeneralPage::OnIspellPathBut()
{
UpdateData ();
TCHAR szPath[_MAX_PATH];
if (folderdlg (szPath, m_sIspellPath, NULL, 0, GetSafeHwnd ()) == IDOK)
{
m_sIspellPath = szPath;
UpdateData (FALSE);
SetModified ();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -