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

📄 toolbarpage.cpp

📁 TabBars的开源源码
💻 CPP
字号:
// ToolbarPage.cpp : implementation file
/*********************************************************************
*	Author:		Simon Wang
*	Date:		2003-12-16
*	Contact us:	inte2000@263.net
*	Web Page: http://www.winmsg.com/cn/orbit.htm (for Chinese version)
*						http://www.winmsg.com/orbit.htm (for English version)
**********************************************************************/

#include "stdafx.h"
#include "tabbars.h"
#include "ToolbarPage.h"
#include "TabBarWnd.h"
#include "math.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CToolbarPage property page

IMPLEMENT_DYNCREATE(CToolbarPage, CPropertyPage)

CToolbarPage::CToolbarPage() : CPropertyPage(CToolbarPage::IDD)
{
	//{{AFX_DATA_INIT(CToolbarPage)
	//}}AFX_DATA_INIT
}

CToolbarPage::~CToolbarPage()
{
}

void CToolbarPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CToolbarPage)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CToolbarPage, CPropertyPage)
	//{{AFX_MSG_MAP(CToolbarPage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CToolbarPage message handlers

BOOL CToolbarPage::OnApply() 
{
	UpdateData(TRUE);

	CString strKey;
	WORD wCode,wModify;
	CIni ini(g_szIniPathName);
	CHotKeyCtrl *pHotKeyCtrl;
	for(int i = 0; i < nCommandItem; i++)
	{
		pHotKeyCtrl = (CHotKeyCtrl *)GetDlgItem(IDC_HOTKEY_FLIP + i);
		ASSERT(pHotKeyCtrl != NULL);
		pHotKeyCtrl->GetHotKey(wCode,wModify);
		strKey.Empty();
		if(wCode != 0 && wModify != 0)
		{
			if((wModify & HOTKEYF_CONTROL) == HOTKEYF_CONTROL)
				strKey += _T("CTRL+");
			if((wModify & HOTKEYF_SHIFT) == HOTKEYF_SHIFT)
				strKey += _T("SHIFT+");
			if((wModify & HOTKEYF_ALT) == HOTKEYF_ALT)
				strKey += _T("ALT+");

			strKey += wCode;
		}

		//如果没有指定快捷键就写空字符串
		ini.SetValue(lpszToolbar,g_szHotkeyItem[i],strKey);

		//更新快捷键
		CComBSTR bszKeystroke = strKey;
		CComBSTR bszEditor(lpszCommandWnd);
		CComBSTR bszCommand = g_toolbar_cmds[i].sCmdString;
//			VERIFY(SUCCEEDED(pGlobalTabs->m_pApplication->AddKeyBinding(bszKeystroke, bszCommand,bszEditor)));
		pGlobalTabs->m_pApplication->AddKeyBinding(bszKeystroke, bszCommand,bszEditor);
	}
//HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Keyboard\Aut
	ini.Write(g_szIniPathName);
	ini.Clear();

	return CPropertyPage::OnApply();
}

BOOL CToolbarPage::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	CString strKey;
	WORD wCode,wModify;
	
	CIni ini(g_szIniPathName);
	CHotKeyCtrl *pHotKeyCtrl;
	for(int i = 0; i < nCommandItem; i++)
	{
		ini.GetValue(lpszToolbar,g_szHotkeyItem[i],strKey);
		wCode = wModify = 0;
		if(strKey.GetLength() >= 1)
		{
			if(strKey.Find(_T("ALT"),0) != -1)
				wModify |= HOTKEYF_ALT;
			if(strKey.Find(_T("CTRL"),0) != -1)
				wModify |= HOTKEYF_CONTROL;
			if(strKey.Find(_T("SHIFT"),0) != -1)
				wModify |= HOTKEYF_SHIFT;

			wCode = strKey.Right(1)[0];
		}
		pHotKeyCtrl = (CHotKeyCtrl *)GetDlgItem(IDC_HOTKEY_FLIP + i);
		ASSERT(pHotKeyCtrl != NULL);
		pHotKeyCtrl->SetHotKey(wCode,wModify);
	}

	ini.Clear();
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CToolbarPage::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message == WM_CHAR || pMsg->message == WM_KEYDOWN)
		SetModified();
	
	return CPropertyPage::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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