• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

XKeymacs for 64bit Windows


Commit MetaInfo

修订版0b04ad496ffff59f440651bd4360fcf2fc7183bf (tree)
时间2011-05-27 08:38:41
作者Kazuhiro Fujieda <fujieda@user...>
CommiterKazuhiro Fujieda

Log Message

Move CAboutDlg in xkeymacs/xkeymacs.{cpp,h} to xkeymacs/about.{cpp,h}.

更改概述

差异

--- /dev/null
+++ b/xkeymacs/about.cpp
@@ -0,0 +1,143 @@
1+#include "stdafx.h"
2+#include "about.h"
3+
4+/////////////////////////////////////////////////////////////////////////////
5+// CAboutDlg dialog used for App About
6+
7+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
8+{
9+ //{{AFX_DATA_INIT(CAboutDlg)
10+ m_szVersionInformation = _T("");
11+ m_szLegalCopyright = _T("");
12+ //}}AFX_DATA_INIT
13+
14+ m_szLegalCopyright.Format(_T("Copyright (C) 2001-2006")); // rough
15+
16+ WORD wMajorVersion = 0;
17+ WORD wMinorVersion = 0;
18+ WORD wBuildVersion = 0;
19+ WORD wRevisionVersion = 0;
20+
21+ TCHAR szFileName[MAX_PATH] = {'\0'};
22+ GetModuleFileName(NULL, szFileName, sizeof(szFileName));
23+ DWORD dwHandle = 0;
24+
25+ DWORD dwLen = GetFileVersionInfoSize(szFileName, &dwHandle);
26+ if (dwLen) {
27+ LPVOID lpData = new BYTE[dwLen];
28+ if (GetFileVersionInfo(szFileName, dwHandle, dwLen, lpData)) {
29+ VS_FIXEDFILEINFO *pInfo;
30+ UINT uLen;
31+ if (VerQueryValue(lpData, _T("\\"), (LPVOID *)&pInfo, &uLen)) {
32+ wMajorVersion = (WORD)((pInfo->dwProductVersionMS >> 16) & 0xffff);
33+ wMinorVersion = (WORD)((pInfo->dwProductVersionMS ) & 0xffff);
34+ wBuildVersion = (WORD)((pInfo->dwProductVersionLS >> 16) & 0xffff);
35+ wRevisionVersion = (WORD)((pInfo->dwProductVersionLS ) & 0xffff);
36+ }
37+
38+ struct Translate {
39+ WORD wLanguage;
40+ WORD wCodePage;
41+ } *lpTranslate = NULL;
42+ UINT cbTranslate = 0;
43+ if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(*lpTranslate) <= cbTranslate) {
44+ LPVOID lpLegalCopyright = NULL;
45+ UINT uLen = 0;
46+ CString SubBlock;
47+
48+ SubBlock.Format(_T("\\StringFileInfo\\%04x%04x\\LegalCopyright"), lpTranslate->wLanguage, lpTranslate->wCodePage);
49+ if (VerQueryValue(lpData, SubBlock.GetBuffer(SubBlock.GetLength()), (LPVOID *)&lpLegalCopyright, &uLen) && uLen) {
50+ m_szLegalCopyright.Format(_T("%s"), lpLegalCopyright);
51+ }
52+ }
53+ }
54+ delete[] lpData;
55+ lpData = NULL;
56+ }
57+
58+ m_szVersionInformation.Format(_T("%s Version %d.%d"), CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)), wMajorVersion, wMinorVersion);
59+
60+ if (wBuildVersion) {
61+ CString sz;
62+ sz.Format(_T(".%d"), wBuildVersion);
63+ m_szVersionInformation += sz;
64+
65+ if (wRevisionVersion) {
66+ CString sz;
67+ sz.Format(_T(".%d"), wRevisionVersion);
68+ m_szVersionInformation += sz;
69+ }
70+ }
71+}
72+
73+void CAboutDlg::DoDataExchange(CDataExchange *pDX)
74+{
75+ CDialog::DoDataExchange(pDX);
76+ //{{AFX_DATA_MAP(CAboutDlg)
77+ DDX_Control(pDX, IDC_URL, m_cURL);
78+ DDX_Text(pDX, IDC_VERSION_INFORMATION, m_szVersionInformation);
79+ DDX_Text(pDX, IDC_LEGAL_COPYRIGHT, m_szLegalCopyright);
80+ //}}AFX_DATA_MAP
81+}
82+
83+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
84+ //{{AFX_MSG_MAP(CAboutDlg)
85+ ON_WM_CLOSE()
86+ ON_BN_CLICKED(IDC_URL, OnUrl)
87+ ON_WM_CTLCOLOR()
88+ ON_WM_SETCURSOR()
89+ //}}AFX_MSG_MAP
90+END_MESSAGE_MAP()
91+
92+/////////////////////////////////////////////////////////////////////////////
93+// CAboutDlg message handlers
94+
95+
96+void CAboutDlg::OnOK()
97+{
98+ CDialog::OnOK();
99+}
100+
101+void CAboutDlg::OnClose()
102+{
103+ CDialog::OnClose();
104+}
105+
106+void CAboutDlg::OnUrl()
107+{
108+ CString szURL;
109+ m_cURL.GetWindowText(szURL);
110+
111+ ShellExecute(m_hWnd, NULL, szURL, NULL, NULL, SW_SHOWNORMAL);
112+}
113+
114+HBRUSH CAboutDlg::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
115+{
116+ HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
117+
118+ COLORREF crBlue = RGB(0, 0, 0xff);
119+
120+ if (pWnd == &m_cURL) {
121+ pDC->SetTextColor(crBlue);
122+ }
123+
124+ return hbr;
125+}
126+
127+BOOL CAboutDlg::OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message)
128+{
129+ CRect rect;
130+ m_cURL.GetWindowRect(rect);
131+
132+ POINT p;
133+ ::GetCursorPos(&p);
134+
135+ if (rect.PtInRect(p)) {
136+ HCURSOR hCursor = (HCURSOR)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_HAND_CURSOR),
137+ IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
138+ SetCursor(hCursor);
139+ return TRUE;
140+ }
141+
142+ return CDialog::OnSetCursor(pWnd, nHitTest, message);
143+}
--- /dev/null
+++ b/xkeymacs/about.h
@@ -0,0 +1,46 @@
1+#ifndef ABOUT_H_INCLUDED
2+#define ABOUT_H_INCLUDED
3+
4+#if _MSC_VER > 1000
5+#pragma once
6+#endif // _MSC_VER > 1000
7+
8+#include "resource.h"
9+
10+/////////////////////////////////////////////////////////////////////////////
11+// CAboutDlg dialog used for App About
12+
13+class CAboutDlg : public CDialog
14+{
15+public:
16+ CAboutDlg();
17+
18+// Dialog Data
19+ //{{AFX_DATA(CAboutDlg)
20+ enum { IDD = IDD_ABOUTBOX };
21+ CStatic m_cURL;
22+ CString m_szVersionInformation;
23+ CString m_szLegalCopyright;
24+ //}}AFX_DATA
25+
26+ // ClassWizard generated virtual function overrides
27+ //{{AFX_VIRTUAL(CAboutDlg)
28+ protected:
29+ virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
30+ //}}AFX_VIRTUAL
31+
32+// Implementation
33+protected:
34+ //{{AFX_MSG(CAboutDlg)
35+ virtual void OnOK();
36+ afx_msg void OnClose();
37+ afx_msg void OnUrl();
38+ afx_msg HBRUSH OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor);
39+ afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
40+ //}}AFX_MSG
41+ DECLARE_MESSAGE_MAP()
42+};
43+
44+/////////////////////////////////////////////////////////////////////////////
45+
46+#endif // ABOUT_H_INCLUDED
--- a/xkeymacs/mainfrm.h
+++ b/xkeymacs/mainfrm.h
@@ -10,6 +10,7 @@
1010 #pragma once
1111 #endif // _MSC_VER > 1000
1212
13+#include "about.h"
1314 #include "104Keyboard.h"
1415 #include "109Keyboard.h"
1516 #include "Properties.h"
--- a/xkeymacs/xkeymacs-vc10x64.vcxproj
+++ b/xkeymacs/xkeymacs-vc10x64.vcxproj
@@ -175,6 +175,7 @@
175175 <ItemGroup>
176176 <ClCompile Include="104keyboard.cpp" />
177177 <ClCompile Include="109keyboard.cpp" />
178+ <ClCompile Include="about.cpp" />
178179 <ClCompile Include="data.cpp" />
179180 <ClCompile Include="dotxkeymacs.cpp" />
180181 <ClCompile Include="key.cpp" />
@@ -192,6 +193,7 @@
192193 <ItemGroup>
193194 <ClInclude Include="104keyboard.h" />
194195 <ClInclude Include="109keyboard.h" />
196+ <ClInclude Include="about.h" />
195197 <ClInclude Include="data.h" />
196198 <ClInclude Include="dotxkeymacs.h" />
197199 <ClInclude Include="key.h" />
--- a/xkeymacs/xkeymacs-vc10x64.vcxproj.filters
+++ b/xkeymacs/xkeymacs-vc10x64.vcxproj.filters
@@ -60,6 +60,9 @@
6060 <ClCompile Include="data.cpp">
6161 <Filter>Source Files</Filter>
6262 </ClCompile>
63+ <ClCompile Include="about.cpp">
64+ <Filter>Source Files</Filter>
65+ </ClCompile>
6366 </ItemGroup>
6467 <ItemGroup>
6568 <ClInclude Include="104keyboard.h">
@@ -110,6 +113,9 @@
110113 <ClInclude Include="data.h">
111114 <Filter>Header Files</Filter>
112115 </ClInclude>
116+ <ClInclude Include="about.h">
117+ <Filter>Header Files</Filter>
118+ </ClInclude>
113119 </ItemGroup>
114120 <ItemGroup>
115121 <ResourceCompile Include="xkeymacs.rc">
--- a/xkeymacs/xkeymacs-vc10x86.vcxproj
+++ b/xkeymacs/xkeymacs-vc10x86.vcxproj
@@ -175,6 +175,7 @@
175175 <ItemGroup>
176176 <ClCompile Include="104keyboard.cpp" />
177177 <ClCompile Include="109keyboard.cpp" />
178+ <ClCompile Include="about.cpp" />
178179 <ClCompile Include="data.cpp" />
179180 <ClCompile Include="dotxkeymacs.cpp" />
180181 <ClCompile Include="key.cpp" />
@@ -192,6 +193,7 @@
192193 <ItemGroup>
193194 <ClInclude Include="104keyboard.h" />
194195 <ClInclude Include="109keyboard.h" />
196+ <ClInclude Include="about.h" />
195197 <ClInclude Include="data.h" />
196198 <ClInclude Include="dotxkeymacs.h" />
197199 <ClInclude Include="key.h" />
--- a/xkeymacs/xkeymacs-vc10x86.vcxproj.filters
+++ b/xkeymacs/xkeymacs-vc10x86.vcxproj.filters
@@ -60,6 +60,9 @@
6060 <ClCompile Include="data.cpp">
6161 <Filter>Source Files</Filter>
6262 </ClCompile>
63+ <ClCompile Include="about.cpp">
64+ <Filter>Source Files</Filter>
65+ </ClCompile>
6366 </ItemGroup>
6467 <ItemGroup>
6568 <ClInclude Include="104keyboard.h">
@@ -110,6 +113,9 @@
110113 <ClInclude Include="data.h">
111114 <Filter>Header Files</Filter>
112115 </ClInclude>
116+ <ClInclude Include="about.h">
117+ <Filter>Header Files</Filter>
118+ </ClInclude>
113119 </ItemGroup>
114120 <ItemGroup>
115121 <ResourceCompile Include="xkeymacs.rc">
--- a/xkeymacs/xkeymacs.cpp
+++ b/xkeymacs/xkeymacs.cpp
@@ -89,99 +89,6 @@ BOOL CXkeymacsApp::InitInstance()
8989 return TRUE;
9090 }
9191
92-
93-/////////////////////////////////////////////////////////////////////////////
94-// CAboutDlg dialog used for App About
95-
96-CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
97-{
98- //{{AFX_DATA_INIT(CAboutDlg)
99- m_szVersionInformation = _T("");
100- m_szLegalCopyright = _T("");
101- //}}AFX_DATA_INIT
102-
103- m_szLegalCopyright.Format(_T("Copyright (C) 2001-2006")); // rough
104-
105- WORD wMajorVersion = 0;
106- WORD wMinorVersion = 0;
107- WORD wBuildVersion = 0;
108- WORD wRevisionVersion = 0;
109-
110- TCHAR szFileName[MAX_PATH] = {'\0'};
111- GetModuleFileName(NULL, szFileName, sizeof(szFileName));
112- DWORD dwHandle = 0;
113-
114- DWORD dwLen = GetFileVersionInfoSize(szFileName, &dwHandle);
115- if (dwLen) {
116- LPVOID lpData = new BYTE[dwLen];
117- if (GetFileVersionInfo(szFileName, dwHandle, dwLen, lpData)) {
118- VS_FIXEDFILEINFO *pInfo;
119- UINT uLen;
120- if (VerQueryValue(lpData, _T("\\"), (LPVOID *)&pInfo, &uLen)) {
121- wMajorVersion = (WORD)((pInfo->dwProductVersionMS >> 16) & 0xffff);
122- wMinorVersion = (WORD)((pInfo->dwProductVersionMS ) & 0xffff);
123- wBuildVersion = (WORD)((pInfo->dwProductVersionLS >> 16) & 0xffff);
124- wRevisionVersion = (WORD)((pInfo->dwProductVersionLS ) & 0xffff);
125- }
126-
127- struct Translate {
128- WORD wLanguage;
129- WORD wCodePage;
130- } *lpTranslate = NULL;
131- UINT cbTranslate = 0;
132- if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate) <= cbTranslate) {
133- LPVOID lpLegalCopyright = NULL;
134- UINT uLen = 0;
135- CString SubBlock;
136-
137- SubBlock.Format(_T("\\StringFileInfo\\%04x%04x\\LegalCopyright"), lpTranslate->wLanguage, lpTranslate->wCodePage);
138- if (VerQueryValue(lpData, SubBlock.GetBuffer(SubBlock.GetLength()), (LPVOID *)&lpLegalCopyright, &uLen) && uLen) {
139- m_szLegalCopyright.Format(_T("%s"), lpLegalCopyright);
140- }
141- }
142- }
143- delete[] lpData;
144- lpData = NULL;
145- }
146-
147- m_szVersionInformation.Format(_T("%s Version %d.%d"), CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)), wMajorVersion, wMinorVersion);
148-
149- if (wBuildVersion) {
150- CString sz;
151- sz.Format(_T(".%d"), wBuildVersion);
152- m_szVersionInformation += sz;
153-
154- if (wRevisionVersion) {
155- CString sz;
156- sz.Format(_T(".%d"), wRevisionVersion);
157- m_szVersionInformation += sz;
158- }
159- }
160-}
161-
162-void CAboutDlg::DoDataExchange(CDataExchange *pDX)
163-{
164- CDialog::DoDataExchange(pDX);
165- //{{AFX_DATA_MAP(CAboutDlg)
166- DDX_Control(pDX, IDC_URL, m_cURL);
167- DDX_Text(pDX, IDC_VERSION_INFORMATION, m_szVersionInformation);
168- DDX_Text(pDX, IDC_LEGAL_COPYRIGHT, m_szLegalCopyright);
169- //}}AFX_DATA_MAP
170-}
171-
172-BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
173- //{{AFX_MSG_MAP(CAboutDlg)
174- ON_WM_CLOSE()
175- ON_BN_CLICKED(IDC_URL, OnUrl)
176- ON_WM_CTLCOLOR()
177- ON_WM_SETCURSOR()
178- //}}AFX_MSG_MAP
179-END_MESSAGE_MAP()
180-
181-/////////////////////////////////////////////////////////////////////////////
182-// CXkeymacsApp message handlers
183-
184-
18592 int CXkeymacsApp::ExitInstance()
18693 {
18794 if (m_hMutex) {
@@ -195,53 +102,3 @@ int CXkeymacsApp::ExitInstance()
195102
196103 return CWinApp::ExitInstance();
197104 }
198-
199-void CAboutDlg::OnOK()
200-{
201- CDialog::OnOK();
202-}
203-
204-
205-void CAboutDlg::OnClose()
206-{
207- CDialog::OnClose();
208-}
209-
210-void CAboutDlg::OnUrl()
211-{
212- CString szURL;
213- m_cURL.GetWindowText(szURL);
214-
215- ShellExecute(m_hWnd, NULL, szURL, NULL, NULL, SW_SHOWNORMAL);
216-}
217-
218-HBRUSH CAboutDlg::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
219-{
220- HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
221-
222- COLORREF crBlue = RGB(0, 0, 0xff);
223-
224- if (pWnd == &m_cURL) {
225- pDC->SetTextColor(crBlue);
226- }
227-
228- return hbr;
229-}
230-
231-BOOL CAboutDlg::OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message)
232-{
233- CRect rect;
234- m_cURL.GetWindowRect(rect);
235-
236- POINT p;
237- ::GetCursorPos(&p);
238-
239- if (rect.PtInRect(p)) {
240- HCURSOR hCursor = (HCURSOR)LoadImage(theApp.m_hInstance, MAKEINTRESOURCE(IDC_HAND_CURSOR),
241- IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
242- SetCursor(hCursor);
243- return TRUE;
244- }
245-
246- return CDialog::OnSetCursor(pWnd, nHitTest, message);
247-}
--- a/xkeymacs/xkeymacs.h
+++ b/xkeymacs/xkeymacs.h
@@ -42,42 +42,6 @@ private:
4242 HANDLE m_hMutex;
4343 };
4444
45-/////////////////////////////////////////////////////////////////////////////
46-// CAboutDlg dialog used for App About
47-
48-class CAboutDlg : public CDialog
49-{
50-public:
51- CAboutDlg();
52-
53-// Dialog Data
54- //{{AFX_DATA(CAboutDlg)
55- enum { IDD = IDD_ABOUTBOX };
56- CStatic m_cURL;
57- CString m_szVersionInformation;
58- CString m_szLegalCopyright;
59- //}}AFX_DATA
60-
61- // ClassWizard generated virtual function overrides
62- //{{AFX_VIRTUAL(CAboutDlg)
63- protected:
64- virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
65- //}}AFX_VIRTUAL
66-
67-// Implementation
68-protected:
69- //{{AFX_MSG(CAboutDlg)
70- virtual void OnOK();
71- afx_msg void OnClose();
72- afx_msg void OnUrl();
73- afx_msg HBRUSH OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor);
74- afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
75- //}}AFX_MSG
76- DECLARE_MESSAGE_MAP()
77-};
78-
79-/////////////////////////////////////////////////////////////////////////////
80-
8145 //{{AFX_INSERT_LOCATION}}
8246 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
8347