summaryrefslogtreecommitdiff
path: root/plugins/ChangeKeyboardLayout/main.c
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-06 19:11:34 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-06 19:11:34 +0000
commit3dfe76ebba2cc8264d5548db3446587fd08f032e (patch)
tree6354fc3c57cf56b182d0b3e58654f6855fa71d8c /plugins/ChangeKeyboardLayout/main.c
parent46a53191c1ad11a41c948594e972568e62d155b4 (diff)
ChangeKeyboardLayout added
git-svn-id: http://svn.miranda-ng.org/main/trunk@333 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ChangeKeyboardLayout/main.c')
-rw-r--r--plugins/ChangeKeyboardLayout/main.c123
1 files changed, 123 insertions, 0 deletions
diff --git a/plugins/ChangeKeyboardLayout/main.c b/plugins/ChangeKeyboardLayout/main.c
new file mode 100644
index 0000000000..5aabf34801
--- /dev/null
+++ b/plugins/ChangeKeyboardLayout/main.c
@@ -0,0 +1,123 @@
+#include "commonheaders.h"
+
+struct MM_INTERFACE mmi;
+PLUGINLINK *pluginLink;
+int hLangpack;
+
+PLUGININFOEX pluginInfoEx={
+ sizeof(PLUGININFOEX),
+ #if defined (_UNICODE)
+ "Change Keyboard Layout (Unicode)",
+ #else
+ "Change Keyboard Layout (ANSI)",
+ #endif
+ VERSION,
+ "Plugin for change keyboard layout of text (multilayout).",
+ "Yasnovidyashii",
+ "Yasnovidyashii@gmail.com",
+ "© 2006-2009 Mikhail Yur'ev",
+ "http://lemnews.com/forum/viewtopic.php?t=1493",
+ 0, //not transient
+ 0, //doesn't replace anything built-in
+ #if defined (_UNICODE)
+ MIID_CKL_UNICODE
+ #else
+ MIID_CKL_ANSI
+ #endif
+
+};
+
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+ #if defined (_UNICODE)
+ "Change Keyboard Layout (UNICODE)",
+ #else
+ "Change Keyboard Layout (ANSI)",
+ #endif
+ VERSION,
+ "Plugin for change keyboard layout of text (multilayout)",
+ "Yasnovidyashii",
+ "Yasnovidyashii@gmail.com",
+ "© 2006-2009 Mikhail Yur'ev",
+ "http://lemnews.com/forum/viewtopic.php?t=1493",
+ 0, //not transient
+ 0 //doesn't replace anything built-in
+};
+
+
+LPCTSTR ptszKeybEng=_T("`1234567890-=\\qwertyuiop[]asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+|QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?");
+HKL hklEng=(HKL)0x04090409;
+
+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)
+{
+ dwMirandaVersion = mirandaVersion;
+ return &pluginInfoEx;
+}
+
+__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ dwMirandaVersion = mirandaVersion;
+ return &pluginInfo;
+}
+
+
+#if defined (_UNICODE)
+ static const MUUID interfaces[] = {MIID_CKL_UNICODE, MIID_LAST};
+#else
+ static const MUUID interfaces[] = {MIID_CKL_ANSI, MIID_LAST};
+#endif
+
+__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ #if defined (_UNICODE)
+ pluginInfoEx.flags = 1; // dynamic UNICODE_AWARE
+ #endif
+ return interfaces;
+}
+
+
+int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink=link;
+ mir_getMMI(&mmi);
+ mir_getLP(&pluginInfoEx);
+ ZeroMemory(hklLayouts, 20 * sizeof(HKL));
+ bLayNum=GetKeyboardLayoutList(20,hklLayouts);
+ if (bLayNum<2)
+ return 1;
+ hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
+ hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
+ return 0;
+}
+
+int __declspec(dllexport) Unload(void)
+{
+ DWORD i;
+
+ for (i=0;i<bLayNum;i++)
+ mir_free(ptszLayStrings[i]);
+
+ UnhookEvent(hOptionsInitialize);
+ UnhookEvent(hIcoLibIconsChanged);
+ UnhookEvent(hModulesLoaded);
+ DestroyServiceFunction(hChangeLayout);
+ DestroyServiceFunction(hGetLayoutOfText);
+ DestroyServiceFunction(hChangeTextLayout);
+ UnhookWindowsHookEx(kbHook_All);
+ return 0;
+}
+
+