summaryrefslogtreecommitdiff
path: root/plugins/ChangeKeyboardLayout/src
diff options
context:
space:
mode:
authorMataes <mataes2007@gmail.com>2018-05-16 19:12:38 +0300
committerMataes <mataes2007@gmail.com>2018-05-16 19:12:38 +0300
commitb12321b9897b511e94301b73c1c48c533412d739 (patch)
treeaeec4c481dc82376e22879e76a81fd2abb7138f5 /plugins/ChangeKeyboardLayout/src
parent3c4beeb99d4324fb453e928421c9b13d70ab4923 (diff)
BossKey, BuddyExpectator, BuddyPounce, ChangeKeyboardLayout, ClientChangeNotify, Cln_skinedit, CmdLine: cmplugin adaptation
Diffstat (limited to 'plugins/ChangeKeyboardLayout/src')
-rw-r--r--plugins/ChangeKeyboardLayout/src/hook_events.cpp4
-rw-r--r--plugins/ChangeKeyboardLayout/src/main.cpp18
-rw-r--r--plugins/ChangeKeyboardLayout/src/stdafx.h11
3 files changed, 15 insertions, 18 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
index ab73812bd7..c7148fb985 100644
--- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp
+++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
@@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM)
// Зарегим звук
Skin_AddSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout"));
- Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
+ Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
// Хук на нажатие клавиши
kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
@@ -141,7 +141,7 @@ int ModulesLoaded(WPARAM, LPARAM)
int OnOptionsInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN_OPTION_FORM);
odp.szTitle.a = ModuleName;
odp.szGroup.a = LPGEN("Message sessions");
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp
index 5286a2f871..9d53aed4b1 100644
--- a/plugins/ChangeKeyboardLayout/src/main.cpp
+++ b/plugins/ChangeKeyboardLayout/src/main.cpp
@@ -1,12 +1,12 @@
#include "stdafx.h"
+CMPlugin g_plugin;
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;
@@ -31,12 +31,6 @@ LPCTSTR ptszSeparators = L" \t\n\r";
HANDLE hOptionsInitialize;
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -49,18 +43,18 @@ static IconItem iconList[] =
};
extern "C" __declspec(dllexport) int Load(void)
-{
+{
mir_getLP(&pluginInfoEx);
memset(hklLayouts, 0, sizeof(hklLayouts));
bLayNum = GetKeyboardLayoutList(20, hklLayouts);
- if (bLayNum < 2)
+ if (bLayNum < 2)
return 1;
-
+
HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
// IcoLib support
- Icon_Register(hInst, ModuleName, iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), ModuleName, iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
@@ -71,7 +65,7 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload(void)
{
- for (int i = 0; i < bLayNum; i++)
+ for (int i = 0; i < bLayNum; i++)
mir_free(ptszLayStrings[i]);
DestroyServiceFunction(hChangeLayout);
diff --git a/plugins/ChangeKeyboardLayout/src/stdafx.h b/plugins/ChangeKeyboardLayout/src/stdafx.h
index 7be6d07a35..fc572a11c8 100644
--- a/plugins/ChangeKeyboardLayout/src/stdafx.h
+++ b/plugins/ChangeKeyboardLayout/src/stdafx.h
@@ -5,8 +5,6 @@
#include <commctrl.h>
#include <richedit.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_options.h>
#include <m_langpack.h>
@@ -31,6 +29,13 @@
#define ModuleName LPGEN("ChangeKeyboardLayout")
#define ModuleNameW LPGENW("ChangeKeyboardLayout")
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
+
// History++ API
#define MS_HPP_EG_WINDOW "History++/ExtGrid/NewWindow"
#define MS_HPP_EG_EVENT "History++/ExtGrid/Event"
@@ -90,8 +95,6 @@ typedef struct
POPUPACTION paActions[1];
} PopupOptions;
-extern HINSTANCE hInst;
-
extern HICON hPopupIcon, hCopyIcon;
extern LPCTSTR ptszKeybEng;