diff options
Diffstat (limited to 'plugins/ChangeKeyboardLayout/src')
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/hook_events.cpp | 98 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/main.cpp | 2 |
3 files changed, 35 insertions, 67 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/commonheaders.h b/plugins/ChangeKeyboardLayout/src/commonheaders.h index 27646be794..3e148b9278 100644 --- a/plugins/ChangeKeyboardLayout/src/commonheaders.h +++ b/plugins/ChangeKeyboardLayout/src/commonheaders.h @@ -22,6 +22,7 @@ #include <m_ieview.h>
#include "m_changekeyboardlayout.h"
#include <m_popup2.h>
+#include <win2k.h>
#include "resource.h"
#include "options.h"
@@ -94,7 +95,6 @@ typedef struct extern HINSTANCE hInst;
extern HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout;
-extern HANDLE hIcoLibIconsChanged;
extern HICON hPopupIcon, hCopyIcon;
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 69f5266a5b..227ba6e2fb 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -100,6 +100,11 @@ int OnIconsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem iconList[] =
+{
+ { LPGEN("Popup"), "ckl_popup_icon", IDI_POPUPICON },
+ { LPGEN("Copy to clipboard"), "ckl_copy_icon", IDI_COPYICON }
+};
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
@@ -150,25 +155,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hChangeTextLayout = CreateServiceFunction(MS_CKL_CHANGETEXTLAYOUT, APIChangeTextLayout);
// IcoLib support
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- sid.pszSection = Translate(ModuleName);
- sid.pszDescription = Translate("Popup");
- sid.pszName = "ckl_popup_icon";
- sid.iDefaultIndex = -IDI_POPUPICON;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList));
- sid.pszDescription = Translate("Copy to clipboard");
- sid.pszName = "ckl_copy_icon";
- sid.iDefaultIndex = -IDI_COPYICON;
- Skin_AddIcon(&sid);
-
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
OnIconsChanged(0, 0);
RegPopupActions();
@@ -214,24 +203,20 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam) lcode += wParam;
// Проверка на пустой хоткей. Иначе - пиздец, как в версии 1.4
- if (lcode != 0)
- if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam&0x40000000)))
- {
+ if (lcode != 0) {
+ if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout);
return 1;
}
- else
- if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam&0x40000000)))
- {
+ if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout2);
return 1;
}
- else
- if ((lcode == moOptions.dwHotkey_Case) && (!(lParam&0x40000000)))
- {
+ if ((lcode == moOptions.dwHotkey_Case) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Case, moOptions.CurrentWordCase);
return 1;
}
+ }
}
return CallNextHookEx(kbHook_All, code, wParam, lParam);
}
@@ -241,43 +226,28 @@ int CALLBACK CKLPopupDlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lP LPTSTR ptszPopupText;
ptszPopupText = (LPTSTR)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&ptszPopupText);
- switch(uiMessage)
- {
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == STN_CLICKED)
- {
- if (!IsBadStringPtr(ptszPopupText, MaxTextSize))
- CopyTextToClipboard(ptszPopupText);
- PUDeletePopUp(hWnd);
-
- }
- break;
- }
-
- case WM_CONTEXTMENU:
- {
- PUDeletePopUp(hWnd);
- break;
- }
-
- case UM_POPUPACTION:
- {
- if ((lParam == 0) && (!IsBadStringPtr(ptszPopupText, MaxTextSize)))
- {
- CopyTextToClipboard(ptszPopupText);
- }
- break;
- }
-
- case UM_FREEPLUGINDATA:
- {
- mir_free(ptszPopupText);
- return TRUE;
- }
-
- default:
- break;
+ switch(uiMessage) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ if (!IsBadStringPtr(ptszPopupText, MaxTextSize))
+ CopyTextToClipboard(ptszPopupText);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_POPUPACTION:
+ if ((lParam == 0) && (!IsBadStringPtr(ptszPopupText, MaxTextSize)))
+ CopyTextToClipboard(ptszPopupText);
+ break;
+
+ case UM_FREEPLUGINDATA:
+ mir_free(ptszPopupText);
+ return TRUE;
}
+
return DefWindowProc(hWnd, uiMessage, wParam, lParam);
}
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp index e175cb5278..c90bd39f66 100644 --- a/plugins/ChangeKeyboardLayout/src/main.cpp +++ b/plugins/ChangeKeyboardLayout/src/main.cpp @@ -10,7 +10,6 @@ HINSTANCE hInst; HHOOK kbHook_All;
MainOptions moOptions;
PopupOptions poOptions, poOptionsTemp;
-HANDLE hIcoLibIconsChanged;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -65,7 +64,6 @@ extern "C" __declspec(dllexport) int Unload(void) mir_free(ptszLayStrings[i]);
UnhookEvent(hOptionsInitialize);
- UnhookEvent(hIcoLibIconsChanged);
UnhookEvent(hModulesLoaded);
DestroyServiceFunction(hChangeLayout);
DestroyServiceFunction(hGetLayoutOfText);
|