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

📄 prefdialogcommands.cpp

📁 Crimson编辑器的英文版,完成从韩文版变成英文版的移植,并且附带可执行文件和注册表文件,无需原先的安装包,是改写编辑器的最理想选择.
💻 CPP
📖 第 1 页 / 共 2 页
字号:

	dlg.m_ofn.lpstrTitle = szTitle; dlg.m_ofn.lpstrInitialDir = szInitialDirectory;
	if( dlg.DoModal() != IDOK ) return;

	SetCurrentDirectory( szCurrentDirectory );
	FileSaveUserCommands( dlg.GetPathName() );
}

void CPreferenceDialog::OnCommandRemove() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];

	rCommand.DeleteContents();
	DispCommandText( nCommand );

	m_edtCommandText.SetWindowText( rCommand.m_szName );
	m_edtCommandCommand.SetWindowText( rCommand.m_szCommand );
	m_edtCommandArgument.SetWindowText( rCommand.m_szArgument );
	m_edtCommandDirectory.SetWindowText( rCommand.m_szDirectory );
	m_hkyCommandHotKey.SetHotKey( rCommand.m_wVirtualKeyCode, rCommand.m_wModifiers );

	m_chkCommandCloseOnExit.SetCheck( rCommand.m_bCloseOnExit );
	m_chkCommandShortFileName.SetCheck( rCommand.m_bUseShortFileName );
	m_chkCommandCaptureOutput.SetCheck( rCommand.m_bCaptureOutput );
	m_chkCommandSaveBefore.SetCheck( rCommand.m_bSaveBeforeExecute );
}

void CPreferenceDialog::OnCommandMoveUp() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand0 = m_clsUserCommand[         0];
	CUserCommand & rCommand1 = m_clsUserCommand[nCommand+0];
	CUserCommand & rCommand2 = m_clsUserCommand[nCommand+1];

	if( nCommand > 0 ) {
		rCommand0.CopyContents( rCommand1 );
		rCommand1.CopyContents( rCommand2 );
		rCommand2.CopyContents( rCommand0 );

		DispCommandText( nCommand-1 );
		DispCommandText( nCommand+0 );

		m_lstCommandList.SetItemState( nCommand-1, LVIS_SELECTED, LVIS_SELECTED );
		m_lstCommandList.EnsureVisible( nCommand-1, FALSE );
	}
}

void CPreferenceDialog::OnCommandMoveDown() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand0 = m_clsUserCommand[         0];
	CUserCommand & rCommand1 = m_clsUserCommand[nCommand+1];
	CUserCommand & rCommand2 = m_clsUserCommand[nCommand+2];

	if( nCommand < 9 ) {
		rCommand0.CopyContents( rCommand1 );
		rCommand1.CopyContents( rCommand2 );
		rCommand2.CopyContents( rCommand0 );

		DispCommandText( nCommand+0 );
		DispCommandText( nCommand+1 );

		m_lstCommandList.SetItemState( nCommand+1, LVIS_SELECTED, LVIS_SELECTED );
		m_lstCommandList.EnsureVisible( nCommand+1, FALSE );
	}
}

void CPreferenceDialog::OnChangeCommandText() 
{
	INT nCommand = m_nActiveUserCommand; 
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	m_edtCommandText.GetWindowText( rCommand.m_szName );
	DispCommandText( nCommand );
}

void CPreferenceDialog::OnChangeCommandCommand() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	m_edtCommandCommand.GetWindowText( rCommand.m_szCommand );
}

void CPreferenceDialog::OnChangeCommandArgument() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	m_edtCommandArgument.GetWindowText( rCommand.m_szArgument );
}

void CPreferenceDialog::OnChangeCommandDirectory() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	m_edtCommandDirectory.GetWindowText( rCommand.m_szDirectory );
}

void CPreferenceDialog::OnChangeCommandHotKey()
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	m_hkyCommandHotKey.GetHotKey( rCommand.m_wVirtualKeyCode, rCommand.m_wModifiers );
	DispCommandText( nCommand );
}

void CPreferenceDialog::OnCommandCloseOnExit() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	rCommand.m_bCloseOnExit = m_chkCommandCloseOnExit.GetCheck();
}

void CPreferenceDialog::OnCommandShortFileName() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	rCommand.m_bUseShortFileName = m_chkCommandShortFileName.GetCheck();
}

void CPreferenceDialog::OnCommandCaptureOutput() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	rCommand.m_bCaptureOutput = m_chkCommandCaptureOutput.GetCheck();
	m_chkCommandCloseOnExit.EnableWindow( ! m_chkCommandCaptureOutput.GetCheck() );
}

void CPreferenceDialog::OnCommandSaveBefore() 
{
	INT nCommand = m_nActiveUserCommand;
	CUserCommand & rCommand = m_clsUserCommand[nCommand+1];
	rCommand.m_bSaveBeforeExecute = m_chkCommandSaveBefore.GetCheck();
}

void CPreferenceDialog::OnCommandCommandBrowse() 
{
	DWORD dwFlags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
	CString szFilter; szFilter.LoadString(IDS_FILTER_COMMAND_BROWSE);
	CString szPathName; m_edtCommandCommand.GetWindowText( szPathName );
	CFileDialog dlg(TRUE, NULL, szPathName, dwFlags, szFilter);

	CString szTitle; szTitle.LoadString(IDS_DLG_SELECT_FILE);
	TCHAR szCurrentDirectory[MAX_PATH]; GetCurrentDirectory( MAX_PATH, szCurrentDirectory );

	dlg.m_ofn.lpstrTitle = szTitle; dlg.m_ofn.lpstrInitialDir = szCurrentDirectory;
	if( dlg.DoModal() != IDOK ) return;

	m_edtCommandCommand.SetWindowText( dlg.GetPathName() );
	SetCurrentDirectory( szCurrentDirectory );
}

void CPreferenceDialog::OnCommandArgumentMenu() 
{
	CMenu * pMenu, context; context.LoadMenu(IDR_PREF_DIALOG);
	pMenu = context.GetSubMenu(0);

	CRect rect; m_btnCommandArgument.GetWindowRect( & rect );
	CPoint point(rect.right, rect.top);

	UINT nFlags = TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON;
	pMenu->TrackPopupMenu(nFlags, point.x, point.y, this);
}

void CPreferenceDialog::OnCommandDirectoryMenu() 
{
	CMenu * pMenu, context; context.LoadMenu(IDR_PREF_DIALOG);
	pMenu = context.GetSubMenu(1);

	CRect rect; m_btnCommandDirectory.GetWindowRect( & rect );
	CPoint point(rect.right, rect.top);

	UINT nFlags = TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON;
	pMenu->TrackPopupMenu(nFlags, point.x, point.y, this);
}

void CPreferenceDialog::OnArgumentFilePath()			{ m_edtCommandArgument.ReplaceSel("$(FilePath)"); }
void CPreferenceDialog::OnArgumentFileDirectory()		{ m_edtCommandArgument.ReplaceSel("$(FileDir)"); }
void CPreferenceDialog::OnArgumentFileName()			{ m_edtCommandArgument.ReplaceSel("$(FileName)"); }
void CPreferenceDialog::OnArgumentFileTitle()			{ m_edtCommandArgument.ReplaceSel("$(FileTitle)"); }
void CPreferenceDialog::OnArgumentLineNumber()			{ m_edtCommandArgument.ReplaceSel("$(LineNum)"); }
void CPreferenceDialog::OnArgumentCurrentWord()			{ m_edtCommandArgument.ReplaceSel("$(CurrWord)"); }

void CPreferenceDialog::OnArgumentUserInput()			{ m_edtCommandArgument.ReplaceSel("$(UserInput)"); }
void CPreferenceDialog::OnArgumentSelectPath1()			{ m_edtCommandArgument.ReplaceSel("$(SelectPath1)"); }
void CPreferenceDialog::OnArgumentSelectPath2()			{ m_edtCommandArgument.ReplaceSel("$(SelectPath2)"); }
void CPreferenceDialog::OnArgumentSelectDirectory1()	{ m_edtCommandArgument.ReplaceSel("$(SelectDir1)"); }
void CPreferenceDialog::OnArgumentSelectDirectory2()	{ m_edtCommandArgument.ReplaceSel("$(SelectDir2)"); }

void CPreferenceDialog::OnDirectoryFileDirectory()		{ m_edtCommandDirectory.SetWindowText("$(FileDir)"); }
void CPreferenceDialog::OnDirectoryBrowse() 
{
	CString szText( (LPCTSTR)IDS_CHOOSE_DIRECTORY );
	CString szDirectory; m_edtCommandDirectory.GetWindowText( szDirectory );
	CFolderDialog dlg(szText, szDirectory, NULL, this);
	if( dlg.DoModal() != IDOK ) return;
	m_edtCommandDirectory.SetWindowText(dlg.GetPathName());
}

⌨️ 快捷键说明

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