OSDN Git Service

Remove typedef of Translate_t and the declaration of struct
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Wed, 18 May 2011 11:15:35 +0000 (20:15 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Thu, 26 May 2011 23:38:38 +0000 (08:38 +0900)
Translate and enum Instance in xkeymacs/xkeymacs.h. Remove
m_Instance in CXkeymacsApp. Remove CXkeymacsApp::OnAppAbout.

xkeymacs/dotxkeymacs.cpp
xkeymacs/xkeymacs.cpp
xkeymacs/xkeymacs.h

index a2579e6..bf4dee3 100644 (file)
@@ -5,7 +5,6 @@
 #include "stdafx.h"\r
 #include <direct.h>\r
 #include <Shlwapi.h>\r
-#include "xkeymacs.h"\r
 #include "DotXkeymacs.h"\r
 \r
 #ifdef _DEBUG\r
@@ -276,10 +275,13 @@ LPCTSTR CDotXkeymacs::GetLanguage()
                LPVOID lpData = malloc(dwLen);\r
 \r
                if (lpData && GetFileVersionInfo(lptstrFilename, NULL, dwLen, lpData)) {\r
-                       Translate_t *lpTranslate;\r
+                       struct Translate {\r
+                               WORD wLanguage;\r
+                               WORD wCodePage;\r
+                       } *lpTranslate;\r
                        UINT cbTranslate = 0;\r
 \r
-                       if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate_t) <= cbTranslate) {\r
+                       if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate) <= cbTranslate) {\r
                                for (int i = 0; i < sizeof(Languages)/sizeof(Languages[0]); ++i) {\r
                                        if (Languages[i].wLanguage == lpTranslate->wLanguage) {\r
                                                szLanguage = Languages[i].szLanguage;\r
index 8f1e433..5ca71bc 100644 (file)
@@ -17,13 +17,9 @@ static char THIS_FILE[] = __FILE__;
 \r
 BEGIN_MESSAGE_MAP(CXkeymacsApp, CWinApp)\r
        //{{AFX_MSG_MAP(CXkeymacsApp)\r
-       ON_COMMAND(ID_APP_ABOUT, OnAppAbout)\r
                // NOTE - the ClassWizard will add and remove mapping macros here.\r
                //    DO NOT EDIT what you see in these blocks of generated code!\r
        //}}AFX_MSG_MAP\r
-       // Standard file based document commands\r
-       ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)\r
-       ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)\r
 END_MESSAGE_MAP()\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
@@ -31,7 +27,7 @@ END_MESSAGE_MAP()
 \r
 CXkeymacsApp::CXkeymacsApp()\r
 {\r
-       m_Instance = FirstInstance;\r
+       m_hMutex = NULL;\r
 }\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
@@ -55,10 +51,9 @@ BOOL CXkeymacsApp::InitInstance()
 #else\r
        m_hMutex = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)));\r
 #endif\r
-\r
-    if (::GetLastError() == ERROR_ALREADY_EXISTS) {\r
-               m_Instance = SecondInstance;\r
-        CloseHandle( m_hMutex );\r
+    if (GetLastError() == ERROR_ALREADY_EXISTS) {\r
+        CloseHandle(m_hMutex);\r
+               m_hMutex = NULL;\r
         return FALSE;\r
     }\r
 \r
@@ -129,9 +124,12 @@ CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
                                wRevisionVersion        = (WORD)((pInfo->dwProductVersionLS      ) & 0xffff);\r
                        }\r
 \r
-                       Translate_t *lpTranslate = NULL;\r
+                       struct Translate {\r
+                               WORD wLanguage;\r
+                               WORD wCodePage;\r
+                       } *lpTranslate = NULL;\r
                        UINT cbTranslate = 0;\r
-                       if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate_t) <= cbTranslate) {\r
+                       if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate) <= cbTranslate) {\r
                                LPVOID lpLegalCopyright = NULL;\r
                                UINT uLen = 0;\r
                                CString SubBlock;\r
@@ -180,22 +178,15 @@ BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
        //}}AFX_MSG_MAP\r
 END_MESSAGE_MAP()\r
 \r
-// App command to run the dialog\r
-void CXkeymacsApp::OnAppAbout()\r
-{\r
-       CAboutDlg aboutDlg;\r
-       aboutDlg.DoModal();\r
-}\r
-\r
 /////////////////////////////////////////////////////////////////////////////\r
 // CXkeymacsApp message handlers\r
 \r
 \r
 int CXkeymacsApp::ExitInstance() \r
 {\r
-       if (m_Instance == FirstInstance) {\r
-           ReleaseMutex( m_hMutex );\r
-               CloseHandle( m_hMutex );\r
+       if (m_hMutex) {\r
+               ReleaseMutex(m_hMutex);\r
+               CloseHandle(m_hMutex);\r
 \r
                m_pMainWnd->DestroyWindow();\r
                delete m_pMainWnd;\r
index a47fbb0..d290777 100644 (file)
 \r
 #include "resource.h"       // main symbols\r
 \r
-enum Instance\r
-{\r
-       FirstInstance,\r
-       SecondInstance,\r
-};\r
-\r
-\r
 /////////////////////////////////////////////////////////////////////////////\r
 // CXkeymacsApp:\r
 // See xkeymacs.cpp for the implementation of this class\r
@@ -41,13 +34,11 @@ public:
 \r
 // Implementation\r
        //{{AFX_MSG(CXkeymacsApp)\r
-       afx_msg void OnAppAbout();\r
                // NOTE - the ClassWizard will add and remove member functions here.\r
                //    DO NOT EDIT what you see in these blocks of generated code !\r
        //}}AFX_MSG\r
        DECLARE_MESSAGE_MAP()\r
 private:\r
-       Instance m_Instance;\r
        HANDLE m_hMutex;\r
 };\r
 \r
@@ -87,11 +78,6 @@ protected:
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 \r
-typedef struct Translate {\r
-       WORD wLanguage;\r
-       WORD wCodePage;\r
-} Translate_t;\r
-\r
 //{{AFX_INSERT_LOCATION}}\r
 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.\r
 \r