From b5e1c9a0314f3a3aa597c319540c8f03c6486df1 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 22 Jun 2012 20:32:34 +0000 Subject: plusified git-svn-id: http://svn.miranda-ng.org/main/trunk@535 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../ChangeKeyboardLayout.vcxproj | 8 +++--- .../ChangeKeyboardLayout.vcxproj.filters | 8 +++--- plugins/ChangeKeyboardLayout/commonheaders.h | 29 ++++++++++------------ plugins/ChangeKeyboardLayout/hook_events.cpp | 14 ----------- plugins/ChangeKeyboardLayout/hook_events.h | 1 - plugins/ChangeKeyboardLayout/main.cpp | 24 ++++++++++-------- plugins/ChangeKeyboardLayout/text_operations.cpp | 12 --------- 7 files changed, 35 insertions(+), 61 deletions(-) (limited to 'plugins/ChangeKeyboardLayout') diff --git a/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj b/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj index 671c0f9b49..4ce7d77fca 100644 --- a/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj +++ b/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj @@ -166,10 +166,10 @@ - - - - + + + + diff --git a/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj.filters b/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj.filters index ea1cc85f5c..9b6985c2df 100644 --- a/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj.filters +++ b/plugins/ChangeKeyboardLayout/ChangeKeyboardLayout.vcxproj.filters @@ -15,16 +15,16 @@ - + Source Files - + Source Files - + Source Files - + Source Files diff --git a/plugins/ChangeKeyboardLayout/commonheaders.h b/plugins/ChangeKeyboardLayout/commonheaders.h index e7d8c78283..d91c1f4562 100644 --- a/plugins/ChangeKeyboardLayout/commonheaders.h +++ b/plugins/ChangeKeyboardLayout/commonheaders.h @@ -93,29 +93,26 @@ typedef struct POPUPACTION paActions[1]; } PopupOptions; -PLUGININFOEX pluginInfoEx; +extern HINSTANCE hInst; -HINSTANCE hInst; +extern HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout; +extern HANDLE hIcoLibIconsChanged; -HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout; -HANDLE hIcoLibIconsChanged; +extern HICON hPopupIcon, hCopyIcon; -HICON hPopupIcon, hCopyIcon; +extern LPCTSTR ptszKeybEng; +extern HKL hklEng; -LPCTSTR ptszKeybEng; -HKL hklEng; +extern BYTE bLayNum; +extern HKL hklLayouts[20]; +extern LPTSTR ptszLayStrings[20]; -BYTE bLayNum; -HKL hklLayouts[20]; -LPTSTR ptszLayStrings[20]; +extern LPCTSTR ptszSeparators; -LPCTSTR ptszSeparators; +extern HHOOK kbHook_All; -HHOOK kbHook_All; - -MainOptions moOptions; -PopupOptions poOptions, poOptionsTemp; -DWORD dwMirandaVersion; +extern MainOptions moOptions; +extern PopupOptions poOptions, poOptionsTemp; LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam); diff --git a/plugins/ChangeKeyboardLayout/hook_events.cpp b/plugins/ChangeKeyboardLayout/hook_events.cpp index 5fb03491ee..5c94609252 100644 --- a/plugins/ChangeKeyboardLayout/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/hook_events.cpp @@ -25,20 +25,6 @@ INT_PTR APIChangeTextLayout(WPARAM wParam, LPARAM lParam) return (int) ChangeTextLayout(ptszInText, ckllFromToLay->hklFrom, ckllFromToLay->hklTo, ckllFromToLay->bTwoWay); } -BOOL CoreCheck() -{ - char version[1024], exepath[1024]; - GetModuleFileNameA(GetModuleHandle(NULL), exepath, sizeof(exepath)); - CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(version), (LPARAM)version); - strlwr(version); strlwr(exepath); - if (!strstr(strrchr(exepath, '\\'), "miranda") || - strstr(version, "coffee") || - !strncmp(version, "1.", 2) || strstr(version, " 1.") || - (dwMirandaVersion >= PLUGIN_MAKE_VERSION(1, 0, 0, 0))) - return FALSE; - else return TRUE; -} - void ReadMainOptions() { moOptions.dwHotkey_Layout = DBGetContactSettingDword(NULL, ModuleName, "HotkeyLayout", 119); diff --git a/plugins/ChangeKeyboardLayout/hook_events.h b/plugins/ChangeKeyboardLayout/hook_events.h index 7f6ea17ff3..992c7cd0c3 100644 --- a/plugins/ChangeKeyboardLayout/hook_events.h +++ b/plugins/ChangeKeyboardLayout/hook_events.h @@ -3,7 +3,6 @@ #include "commonheaders.h" -BOOL CoreCheck(); void ReadMainOptions(); void WriteMainOptions(); void ReadPopupOptions(); diff --git a/plugins/ChangeKeyboardLayout/main.cpp b/plugins/ChangeKeyboardLayout/main.cpp index 188813111c..f51977df2c 100644 --- a/plugins/ChangeKeyboardLayout/main.cpp +++ b/plugins/ChangeKeyboardLayout/main.cpp @@ -3,6 +3,16 @@ struct MM_INTERFACE mmi; PLUGINLINK *pluginLink; int hLangpack; +LPTSTR ptszLayStrings[20]; +HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout; +HICON hPopupIcon, hCopyIcon; +HKL hklLayouts[20]; +BYTE bLayNum; +HINSTANCE hInst; +HHOOK kbHook_All; +MainOptions moOptions; +PopupOptions poOptions, poOptionsTemp; +HANDLE hIcoLibIconsChanged; PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), @@ -26,22 +36,18 @@ LPCTSTR ptszSeparators = _T(" \t\n\r"); HANDLE hOptionsInitialize; HANDLE hModulesLoaded; - BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) { hInst = hinstDLL; return TRUE; } - -__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { - dwMirandaVersion = mirandaVersion; return &pluginInfoEx; } - -int __declspec(dllexport) Load(PLUGINLINK *link) +extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); @@ -55,7 +61,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) return 0; } -int __declspec(dllexport) Unload(void) +extern "C" __declspec(dllexport) int Unload(void) { DWORD i; @@ -70,6 +76,4 @@ int __declspec(dllexport) Unload(void) DestroyServiceFunction(hChangeTextLayout); UnhookWindowsHookEx(kbHook_All); return 0; -} - - +} \ No newline at end of file diff --git a/plugins/ChangeKeyboardLayout/text_operations.cpp b/plugins/ChangeKeyboardLayout/text_operations.cpp index c7652c7776..8a1b8b097d 100644 --- a/plugins/ChangeKeyboardLayout/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/text_operations.cpp @@ -158,12 +158,6 @@ LPTSTR ChangeTextCase(LPCTSTR ptszInText) ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR)); - if (!CoreCheck()) - { - _tcscpy(ptszOutText, TranslateT("Change Keyboard Layout plugin was designed to be used with Miranda IM only. For use with any other application, please contact author.")); - return ptszOutText; - } - _tcscpy(ptszOutText, ptszInText); for (i = 0;i<_tcslen(ptszInText);i++) @@ -187,12 +181,6 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR)); - if (!CoreCheck()) - { - _tcscpy(ptszOutText, TranslateT("Change Keyboard Layout plugin was designed to be used with Miranda IM only. For use with any other application, please contact author.")); - return ptszOutText; - } - _tcscpy(ptszOutText, ptszInText); if ((hklCurLay == NULL)||(hklToLay == NULL)) -- cgit v1.2.3