📄 editoroptionpage.cpp
字号:
// EditorOptionPage.cpp : implementation file
//
#include "stdafx.h"
#include "VisualJava.h"
#include "EditorOptionPage.h"
#include "registry.h"
#include "VisualJavaDoc.h"
#include "VisualJavaView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define CPropertyPage CSAPrefsSubDlg
/////////////////////////////////////////////////////////////////////////////
// CEditorOptionPage property page
const UINT wm_msgEditorUpdate = ::RegisterWindowMessage(_T("7BEF451B-821F-4af7-AF6B-7EFE21C01808"));
IMPLEMENT_DYNCREATE(CEditorOptionPage, CPropertyPage)
CEditorOptionPage::CEditorOptionPage(): CSAPrefsSubDlg(CEditorOptionPage::IDD)
{
//{{AFX_DATA_INIT(CEditorOptionPage)
m_bAutoTypeInfo = FALSE;
m_bAutoListMembers = FALSE;
m_bAutoParamInfo = FALSE;
m_bAutoReloadExtModFiles = FALSE;
m_bAutoWinRecycling = FALSE;
m_bCodeComments = FALSE;
m_bDragDrop = FALSE;
m_bHorizScrllBar = FALSE;
m_bPrmtB4SavingFiles = FALSE;
m_bSaveB4RunningTools = FALSE;
m_bSelectionMargin = FALSE;
m_bVertScrllBar = FALSE;
//}}AFX_DATA_INIT
}
CEditorOptionPage::~CEditorOptionPage()
{
}
void CEditorOptionPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEditorOptionPage)
DDX_Check(pDX, IDC_AUTO_TYPE_INFO_CHECK, m_bAutoTypeInfo);
DDX_Check(pDX, IDC_AUTO_LIST_MEMBERS_CHECK, m_bAutoListMembers);
DDX_Check(pDX, IDC_AUTO_PARAMETER_INFO_CHECK, m_bAutoParamInfo);
DDX_Check(pDX, IDC_AUTO_RELOAD_EXTERNALLY_MODIFIED_FILES_CHECK, m_bAutoReloadExtModFiles);
DDX_Check(pDX, IDC_AUTO_WIN_REC_CHECK, m_bAutoWinRecycling);
DDX_Check(pDX, IDC_CODE_COMMENTS_CHECK, m_bCodeComments);
DDX_Check(pDX, IDC_DRAG_DROP_CHECK, m_bDragDrop);
DDX_Check(pDX, IDC_HORIZSCRLLBAR_CHECK, m_bHorizScrllBar);
DDX_Check(pDX, IDC_PROMPT_B4_SAVING_FILES_CHECK, m_bPrmtB4SavingFiles);
DDX_Check(pDX, IDC_SAVE_B4_RUNNING_TOOLS_CHECK, m_bSaveB4RunningTools);
DDX_Check(pDX, IDC_SELECTION_MARGIN_CHECK, m_bSelectionMargin);
DDX_Check(pDX, IDC_VERTSCRLLBAR_CHECK, m_bVertScrllBar);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEditorOptionPage, CPropertyPage)
//{{AFX_MSG_MAP(CEditorOptionPage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditorOptionPage message handlers
BOOL CEditorOptionPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
LoadSettings();
UpdateData(FALSE);
return TRUE;
}
void CEditorOptionPage::LoadSettings()
{
CReg reg;
LPCTSTR lszpBase = REGISTRY_ROOT;
if(reg.Create(HKEY_CURRENT_USER,lszpBase,KEY_READ))
{
CReg optionsReg;
if(optionsReg.Create(reg.hKey,"Options",KEY_READ))
{
CReg edtReg;
if(edtReg.Create(optionsReg.hKey,"\\Editor",KEY_READ))
{
edtReg.LoadNumber(_T ("Vertical Scroll bar"),(DWORD*)&m_bVertScrllBar);
edtReg.LoadNumber(_T ("Horizontal Scroll bar"),(DWORD*)&m_bHorizScrllBar);
edtReg.LoadNumber(_T ("Auto window recycling"),(DWORD*)&m_bAutoWinRecycling);
edtReg.LoadNumber(_T ("Selection Margin"),(DWORD*)&m_bSelectionMargin);
edtReg.LoadNumber(_T ("Drag and drop text editing"),(DWORD*)&m_bDragDrop);
edtReg.LoadNumber(_T ("Save before running tools"),(DWORD*)&m_bSaveB4RunningTools);
edtReg.LoadNumber(_T ("Prompt before saving files"),(DWORD*)&m_bPrmtB4SavingFiles);
edtReg.LoadNumber(_T ("Auto reload of externally modified files"),(DWORD*)&m_bAutoReloadExtModFiles);
edtReg.LoadNumber(_T ("Auto list members"),(DWORD*)&m_bAutoListMembers);
edtReg.LoadNumber(_T ("Code comments"),(DWORD*)&m_bCodeComments);
edtReg.LoadNumber(_T ("Auto type info"),(DWORD*)&m_bAutoTypeInfo);
edtReg.LoadNumber(_T ("Auto parameter info"),(DWORD*)&m_bAutoParamInfo);
edtReg.Close();
}
optionsReg.Close();
}
reg.Close();
}
}
void CEditorOptionPage::SaveSettings()
{
CReg reg;
LPCTSTR lszpBase = REGISTRY_ROOT;
if(reg.Create(HKEY_CURRENT_USER,lszpBase,KEY_WRITE))
{
CReg optionsReg;
if(optionsReg.Create(reg.hKey,"Options",KEY_WRITE))
{
CReg edtReg;
if(edtReg.Create(optionsReg.hKey,"\\Editor",KEY_WRITE))
{
VERIFY(edtReg.SaveNumber(_T ("Vertical Scroll bar"),m_bVertScrllBar));
VERIFY(edtReg.SaveNumber(_T ("Horizontal Scroll bar"),m_bHorizScrllBar));
VERIFY(edtReg.SaveNumber(_T ("Auto window recycling"),m_bAutoWinRecycling));
VERIFY(edtReg.SaveNumber(_T ("Selection Margin"),m_bSelectionMargin));
VERIFY(edtReg.SaveNumber(_T ("Drag and drop text editing"),m_bDragDrop));
VERIFY(edtReg.SaveNumber(_T ("Save before running tools"),m_bSaveB4RunningTools));
VERIFY(edtReg.SaveNumber(_T ("Prompt before saving files"),m_bPrmtB4SavingFiles));
VERIFY(edtReg.SaveNumber(_T ("Auto reload of externally modified files"),m_bAutoReloadExtModFiles));
VERIFY(edtReg.SaveNumber(_T ("Auto list members"),m_bAutoListMembers));
VERIFY(edtReg.SaveNumber(_T ("Code comments"),m_bCodeComments));
VERIFY(edtReg.SaveNumber(_T ("Auto type info"),m_bAutoTypeInfo));
VERIFY(edtReg.SaveNumber(_T ("Auto parameter info"),m_bAutoParamInfo));
edtReg.Close();
}
optionsReg.Close();
}
reg.Close();
}
}
void CEditorOptionPage::OnOK()
{
UpdateData();
SaveSettings();
POSITION nPos = theApp.GetFirstDocTemplatePosition();
CDocTemplate* pTmp = theApp.GetNextDocTemplate(nPos);
for(POSITION nPos1 = pTmp->GetFirstDocPosition();nPos1 != NULL;)
{
CVisualJavaDoc* pDoc = (CVisualJavaDoc*)pTmp->GetNextDoc(nPos1);
CVisualJavaView* pView = (CVisualJavaView*)pDoc->getBuffer()->getHeadView();
if(pView != NULL)
pView->OnEditorUpdate();
}
CPropertyPage::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -