diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
commit | 8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch) | |
tree | 03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/ChangeKeyboardLayout | |
parent | c5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff) |
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/ChangeKeyboardLayout')
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/hook_events.cpp | 82 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/main.cpp | 32 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/options.cpp | 6 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/stdafx.h | 6 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/text_operations.cpp | 4 |
5 files changed, 68 insertions, 62 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 22fc9ddc7d..bc339f1435 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -22,61 +22,61 @@ INT_PTR APIChangeTextLayout(WPARAM wParam, LPARAM lParam) void ReadMainOptions()
{
- moOptions.dwHotkey_Layout = db_get_dw(NULL, ModuleName, "HotkeyLayout", 119);
- moOptions.dwHotkey_Layout2 = db_get_dw(NULL, ModuleName, "HotkeyLayout2", 120);
- moOptions.dwHotkey_Case = db_get_dw(NULL, ModuleName, "HotkeyCase", 121);
- moOptions.CurrentWordLayout = db_get_b(NULL, ModuleName, "CurrentWordLayout", 0);
- moOptions.CurrentWordLayout2 = db_get_b(NULL, ModuleName, "CurrentWordLayout2", 1);
- moOptions.CurrentWordCase = db_get_b(NULL, ModuleName, "CurrentWordCase", 0);
- moOptions.TwoWay = db_get_b(NULL, ModuleName, "TwoWay", 1);
- moOptions.ChangeSystemLayout = db_get_b(NULL, ModuleName, "ChangeSystemLayout", 1);
- moOptions.CopyToClipboard = db_get_b(NULL, ModuleName, "CopyToClipboard", 0);
- moOptions.ShowPopup = db_get_b(NULL, ModuleName, "ShowPopup", 1);
- moOptions.bCaseOperations = db_get_b(NULL, ModuleName, "CaseOperations", 0);
+ moOptions.dwHotkey_Layout = db_get_dw(NULL, MODULENAME, "HotkeyLayout", 119);
+ moOptions.dwHotkey_Layout2 = db_get_dw(NULL, MODULENAME, "HotkeyLayout2", 120);
+ moOptions.dwHotkey_Case = db_get_dw(NULL, MODULENAME, "HotkeyCase", 121);
+ moOptions.CurrentWordLayout = db_get_b(NULL, MODULENAME, "CurrentWordLayout", 0);
+ moOptions.CurrentWordLayout2 = db_get_b(NULL, MODULENAME, "CurrentWordLayout2", 1);
+ moOptions.CurrentWordCase = db_get_b(NULL, MODULENAME, "CurrentWordCase", 0);
+ moOptions.TwoWay = db_get_b(NULL, MODULENAME, "TwoWay", 1);
+ moOptions.ChangeSystemLayout = db_get_b(NULL, MODULENAME, "ChangeSystemLayout", 1);
+ moOptions.CopyToClipboard = db_get_b(NULL, MODULENAME, "CopyToClipboard", 0);
+ moOptions.ShowPopup = db_get_b(NULL, MODULENAME, "ShowPopup", 1);
+ moOptions.bCaseOperations = db_get_b(NULL, MODULENAME, "CaseOperations", 0);
}
void WriteMainOptions()
{
- db_set_dw(NULL, ModuleName, "HotkeyLayout", moOptions.dwHotkey_Layout);
- db_set_dw(NULL, ModuleName, "HotkeyLayout2", moOptions.dwHotkey_Layout2);
- db_set_dw(NULL, ModuleName, "HotkeyCase", moOptions.dwHotkey_Case);
- db_set_b(NULL, ModuleName, "CurrentWordLayout", moOptions.CurrentWordLayout);
- db_set_b(NULL, ModuleName, "CurrentWordLayout2", moOptions.CurrentWordLayout2);
- db_set_b(NULL, ModuleName, "CurrentWordCase", moOptions.CurrentWordCase);
- db_set_b(NULL, ModuleName, "TwoWay", moOptions.TwoWay);
- db_set_b(NULL, ModuleName, "ChangeSystemLayout", moOptions.ChangeSystemLayout);
- db_set_b(NULL, ModuleName, "CopyToClipboard", moOptions.CopyToClipboard);
- db_set_b(NULL, ModuleName, "ShowPopup", moOptions.ShowPopup);
- db_set_b(NULL, ModuleName, "CaseOperations", moOptions.bCaseOperations);
+ db_set_dw(NULL, MODULENAME, "HotkeyLayout", moOptions.dwHotkey_Layout);
+ db_set_dw(NULL, MODULENAME, "HotkeyLayout2", moOptions.dwHotkey_Layout2);
+ db_set_dw(NULL, MODULENAME, "HotkeyCase", moOptions.dwHotkey_Case);
+ db_set_b(NULL, MODULENAME, "CurrentWordLayout", moOptions.CurrentWordLayout);
+ db_set_b(NULL, MODULENAME, "CurrentWordLayout2", moOptions.CurrentWordLayout2);
+ db_set_b(NULL, MODULENAME, "CurrentWordCase", moOptions.CurrentWordCase);
+ db_set_b(NULL, MODULENAME, "TwoWay", moOptions.TwoWay);
+ db_set_b(NULL, MODULENAME, "ChangeSystemLayout", moOptions.ChangeSystemLayout);
+ db_set_b(NULL, MODULENAME, "CopyToClipboard", moOptions.CopyToClipboard);
+ db_set_b(NULL, MODULENAME, "ShowPopup", moOptions.ShowPopup);
+ db_set_b(NULL, MODULENAME, "CaseOperations", moOptions.bCaseOperations);
}
void ReadPopupOptions()
{
- poOptions.bColourType = db_get_b(NULL, ModuleName, "ColourType", 0);
- poOptions.crBackColour = (COLORREF)db_get_dw(NULL, ModuleName, "BackColor", 0xD2CABF);
- poOptions.crTextColour = (COLORREF)db_get_dw(NULL, ModuleName, "TextColor", 0x000000);
- poOptions.bTimeoutType = db_get_b(NULL, ModuleName, "TimeoutType", 0);
- poOptions.bTimeout = db_get_b(NULL, ModuleName, "Timeout", 10);
- poOptions.bLeftClick = db_get_b(NULL, ModuleName, "LeftClick", 0);
- poOptions.bRightClick = db_get_b(NULL, ModuleName, "RightClick", 1);
+ poOptions.bColourType = db_get_b(NULL, MODULENAME, "ColourType", 0);
+ poOptions.crBackColour = (COLORREF)db_get_dw(NULL, MODULENAME, "BackColor", 0xD2CABF);
+ poOptions.crTextColour = (COLORREF)db_get_dw(NULL, MODULENAME, "TextColor", 0x000000);
+ poOptions.bTimeoutType = db_get_b(NULL, MODULENAME, "TimeoutType", 0);
+ poOptions.bTimeout = db_get_b(NULL, MODULENAME, "Timeout", 10);
+ poOptions.bLeftClick = db_get_b(NULL, MODULENAME, "LeftClick", 0);
+ poOptions.bRightClick = db_get_b(NULL, MODULENAME, "RightClick", 1);
}
void WritePopupOptions()
{
- db_set_b(NULL, ModuleName, "ColourType", poOptions.bColourType);
- db_set_dw(NULL, ModuleName, "BackColor", poOptions.crBackColour);
- db_set_dw(NULL, ModuleName, "TextColor", poOptions.crTextColour);
- db_set_b(NULL, ModuleName, "TimeoutType", poOptions.bTimeoutType);
- db_set_b(NULL, ModuleName, "Timeout", poOptions.bTimeout);
- db_set_b(NULL, ModuleName, "LeftClick", poOptions.bLeftClick);
- db_set_b(NULL, ModuleName, "RightClick", poOptions.bRightClick);
+ db_set_b(NULL, MODULENAME, "ColourType", poOptions.bColourType);
+ db_set_dw(NULL, MODULENAME, "BackColor", poOptions.crBackColour);
+ db_set_dw(NULL, MODULENAME, "TextColor", poOptions.crTextColour);
+ db_set_b(NULL, MODULENAME, "TimeoutType", poOptions.bTimeoutType);
+ db_set_b(NULL, MODULENAME, "Timeout", poOptions.bTimeout);
+ db_set_b(NULL, MODULENAME, "LeftClick", poOptions.bLeftClick);
+ db_set_b(NULL, MODULENAME, "RightClick", poOptions.bRightClick);
}
void RegPopupActions()
{
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
poOptions.paActions[0].cbSize = sizeof(POPUPACTION);
- strncpy_s(poOptions.paActions[0].lpzTitle, ModuleName, _TRUNCATE);
+ strncpy_s(poOptions.paActions[0].lpzTitle, MODULENAME, _TRUNCATE);
strncat_s(poOptions.paActions[0].lpzTitle, _countof(poOptions.paActions[0].lpzTitle), "/Copy to clipboard", _TRUNCATE);
poOptions.paActions[0].flags = PAF_ENABLED;
poOptions.paActions[0].wParam = poOptions.paActions[0].lParam = 0;
@@ -101,7 +101,7 @@ int ModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < bLayNum; i++) {
LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]);
LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]);
- ptrW tszValue(db_get_wsa(NULL, ModuleName, ptszTemp));
+ ptrW tszValue(db_get_wsa(NULL, MODULENAME, ptszTemp));
if (tszValue == 0)
ptszLayStrings[i] = ptszCurrLayout;
else if (!mir_wstrcmp(tszValue, ptszEmptySting))
@@ -109,7 +109,7 @@ int ModulesLoaded(WPARAM, LPARAM) else {
ptszLayStrings[i] = tszValue.detach();
if (!mir_wstrcmp(ptszCurrLayout, ptszLayStrings[i]))
- db_unset(NULL, ModuleName, ptszTemp);
+ db_unset(NULL, MODULENAME, ptszTemp);
mir_free(ptszCurrLayout);
}
mir_free(ptszTemp);
@@ -134,7 +134,7 @@ int ModulesLoaded(WPARAM, LPARAM) RegPopupActions();
- db_set_dw(NULL, ModuleName, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
+ db_set_dw(NULL, MODULENAME, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
return 0;
}
@@ -143,7 +143,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN_OPTION_FORM);
- odp.szTitle.a = ModuleName;
+ odp.szTitle.a = MODULENAME;
odp.szGroup.a = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgMainProcOptions;
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp index d3da1e1fb4..d80ac7916f 100644 --- a/plugins/ChangeKeyboardLayout/src/main.cpp +++ b/plugins/ChangeKeyboardLayout/src/main.cpp @@ -11,6 +11,21 @@ HHOOK kbHook_All; MainOptions moOptions;
PopupOptions poOptions, poOptionsTemp;
+LPCTSTR ptszKeybEng = L"`1234567890- = \\qwertyuiop[]asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+|QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?";
+HKL hklEng = (HKL)0x04090409;
+
+LPCTSTR ptszSeparators = L" \t\n\r";
+
+HANDLE hOptionsInitialize;
+
+static IconItem iconList[] =
+{
+ { LPGEN("Popup"), "ckl_popup_icon", IDI_POPUPICON },
+ { LPGEN("Copy to clipboard"), "ckl_copy_icon", IDI_COPYICON }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -24,23 +39,16 @@ PLUGININFOEX pluginInfoEx = { {0xc5ef53a8, 0x80d4, 0x4ce9, {0xb3, 0x41, 0xec, 0x90, 0xd3, 0xec, 0x91, 0x56}}
};
-LPCTSTR ptszKeybEng = L"`1234567890- = \\qwertyuiop[]asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+|QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?";
-HKL hklEng = (HKL)0x04090409;
-
-LPCTSTR ptszSeparators = L" \t\n\r";
-
-HANDLE hOptionsInitialize;
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-static IconItem iconList[] =
-{
- { LPGEN("Popup"), "ckl_popup_icon", IDI_POPUPICON },
- { LPGEN("Copy to clipboard"), "ckl_copy_icon", IDI_COPYICON }
-};
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load(void)
{
@@ -54,7 +62,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
// IcoLib support
- g_plugin.registerIcon(ModuleName, iconList);
+ g_plugin.registerIcon(MODULENAME, iconList);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 1833095662..d70b37048e 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -211,9 +211,9 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP pszNameLay = GetNameOfLayout(hklLayouts[i]);
if (mir_wstrcmp(ptszMemLay, ptszGenLay) != 0)
- db_set_ws(NULL, ModuleName, pszNameLay, ptszMemLay);
+ db_set_ws(NULL, MODULENAME, pszNameLay, ptszMemLay);
else
- db_unset(NULL, ModuleName, pszNameLay);
+ db_unset(NULL, MODULENAME, pszNameLay);
mir_free(pszNameLay);
mir_free(ptszGenLay);
@@ -354,7 +354,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, POPUPDATAT_V2 pdtData = { 0 };
pdtData.cbSize = sizeof(pdtData);
- wcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
+ wcsncpy(pdtData.lptzContactName, TranslateT(MODULENAME), MAX_CONTACTNAME);
wcsncpy(pdtData.lptzText, L"Ghbdtn? rfr ltkf&", MAX_SECONDLINE);
switch(poOptionsTemp.bColourType) {
diff --git a/plugins/ChangeKeyboardLayout/src/stdafx.h b/plugins/ChangeKeyboardLayout/src/stdafx.h index fc572a11c8..3b54648181 100644 --- a/plugins/ChangeKeyboardLayout/src/stdafx.h +++ b/plugins/ChangeKeyboardLayout/src/stdafx.h @@ -26,14 +26,12 @@ #include "version.h"
#define MaxTextSize 64000
-#define ModuleName LPGEN("ChangeKeyboardLayout")
+#define MODULENAME LPGEN("ChangeKeyboardLayout")
#define ModuleNameW LPGENW("ChangeKeyboardLayout")
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(ModuleName)
- {}
+ CMPlugin();
};
// History++ API
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 678d7116ac..8136933674 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -450,7 +450,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) POPUPDATAT_V2 pdtData = { 0 };
pdtData.cbSize = sizeof(pdtData);
- wcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
+ wcsncpy(pdtData.lptzContactName, TranslateT(MODULENAME), MAX_CONTACTNAME);
wcsncpy(pdtData.lptzText, ptszPopupText, MAX_SECONDLINE);
switch (poOptions.bColourType) {
@@ -488,7 +488,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pdtData, APF_NEWDATA) < 0) {
mir_free(ptszPopupText);
- MessageBox(nullptr, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
+ MessageBox(nullptr, ptszMBox, TranslateT(MODULENAME), MB_ICONINFORMATION);
}
}
}
|