From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- plugins/SpellChecker/src/dictionary.cpp | 2 +- plugins/SpellChecker/src/options.cpp | 14 +++++++------- plugins/SpellChecker/src/spellchecker.cpp | 14 +++++++++----- plugins/SpellChecker/src/stdafx.h | 6 ++---- plugins/SpellChecker/src/utils.cpp | 18 +++++++++--------- 5 files changed, 28 insertions(+), 26 deletions(-) (limited to 'plugins/SpellChecker/src') diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index 0bb88d0482..3127000d69 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -777,7 +777,7 @@ void GetDictsInfo(LIST &dicts) char lang[128]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), nullptr, nullptr); - if (!db_get_ws(NULL, MODULE_NAME, lang, &dbv)) { + if (!db_get_ws(NULL, MODULENAME, lang, &dbv)) { mir_wstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name)); db_free(&dbv); } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 9f4f8e22b9..9ed6be4e3c 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -84,8 +84,8 @@ void InitOptions() void LoadOptions() { - LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME); - LoadOpts(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME); + LoadOpts(optionsControls, _countof(optionsControls), MODULENAME); + LoadOpts(autoReplaceControls, _countof(autoReplaceControls), MODULENAME); if (languages.getCount() <= 0) { opts.default_language[0] = '\0'; @@ -93,7 +93,7 @@ void LoadOptions() } DBVARIANT dbv; - if (!db_get_ws(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "DefaultLanguage", &dbv)) { mir_wstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language)); db_free(&dbv); } @@ -210,7 +210,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int sel = SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_GETCURSEL, 0, 0); if (sel >= languages.getCount()) sel = 0; - db_set_ws(NULL, MODULE_NAME, "DefaultLanguage", + db_set_ws(NULL, MODULENAME, "DefaultLanguage", (wchar_t *)languages[sel]->language); mir_wstrcpy(opts.default_language, languages[sel]->language); } @@ -239,7 +239,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; } - return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); + return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULENAME, hwndDlg, msg, wParam, lParam); } struct AutoreplaceData @@ -368,7 +368,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (msg) { case WM_INITDIALOG: { - BOOL ret = SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); + BOOL ret = SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULENAME, hwndDlg, msg, wParam, lParam); int sel = -1; for (int i = 0; i < languages.getCount(); i++) { @@ -497,5 +497,5 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; } - return SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); + return SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULENAME, hwndDlg, msg, wParam, lParam); } diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 96d535f873..cabb16747a 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -43,7 +43,7 @@ LIST languages(1); ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -57,9 +57,13 @@ PLUGININFOEX pluginInfo = { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 }} }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } // Functions //////////////////////////////////////////////////////////////////////////// @@ -67,7 +71,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) static int IconsChanged(WPARAM, LPARAM) { StatusIconData sid = {}; - sid.szModule = MODULE_NAME; + sid.szModule = MODULENAME; sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled"); sid.flags = MBF_HIDDEN | MBF_UNICODE; @@ -189,7 +193,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_MSG_ICONPRESSED, IconPressed); StatusIconData sid = {}; - sid.szModule = MODULE_NAME; + sid.szModule = MODULENAME; sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled"); sid.flags = MBF_UNICODE | MBF_HIDDEN; @@ -227,7 +231,7 @@ static IconItem iconList[] = extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); // icons g_plugin.registerIcon(LPGEN("Spell Checker"), iconList); diff --git a/plugins/SpellChecker/src/stdafx.h b/plugins/SpellChecker/src/stdafx.h index 38317e99c4..130ad02c76 100644 --- a/plugins/SpellChecker/src/stdafx.h +++ b/plugins/SpellChecker/src/stdafx.h @@ -66,7 +66,7 @@ using namespace std; #include "ardialog.h" #include "RichEdit.h" -#define MODULE_NAME "SpellChecker" +#define MODULENAME "SpellChecker" #define FLAGS_DLL_FOLDER L"%miranda_path%\\Icons" #define CUSTOM_DICTIONARIES_FOLDER L"%miranda_userdata%\\Dictionaries" @@ -76,9 +76,7 @@ using namespace std; struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(MODULE_NAME) - {} + CMPlugin(); }; extern BOOL uinfoex_enabled; diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 4fd399f44f..1902d21b20 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -525,7 +525,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void ToggleEnabled(Dialog *dlg) { dlg->enabled = !dlg->enabled; - db_set_b(dlg->hContact, MODULE_NAME, dlg->name, dlg->enabled); + db_set_b(dlg->hContact, MODULENAME, dlg->name, dlg->enabled); if (!dlg->enabled) SetNoUnderline(dlg); @@ -769,13 +769,13 @@ void GetContactLanguage(Dialog *dlg) dlg->lang_name[0] = '\0'; if (dlg->hContact == NULL) { - if (!db_get_ws(NULL, MODULE_NAME, dlg->name, &dbv)) { + if (!db_get_ws(NULL, MODULENAME, dlg->name, &dbv)) { mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } } else { - if (!db_get_ws(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) { + if (!db_get_ws(dlg->hContact, MODULENAME, "TalkLanguage", &dbv)) { mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } @@ -789,7 +789,7 @@ void GetContactLanguage(Dialog *dlg) if (dlg->lang_name[0] == '\0') { MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact); if (hMetaContact != NULL) { - if (!db_get_ws(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) { + if (!db_get_ws(hMetaContact, MODULENAME, "TalkLanguage", &dbv)) { mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } @@ -833,7 +833,7 @@ void GetContactLanguage(Dialog *dlg) void ModifyIcon(Dialog *dlg) { StatusIconData sid = {}; - sid.szModule = MODULE_NAME; + sid.szModule = MODULENAME; for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; @@ -876,7 +876,7 @@ int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND dlg->hContact = hContact; dlg->hwnd = hwnd; strncpy(dlg->name, name, _countof(dlg->name)); - dlg->enabled = db_get_b(dlg->hContact, MODULE_NAME, dlg->name, 1); + dlg->enabled = db_get_b(dlg->hContact, MODULENAME, dlg->name, 1); dlg->srmm = srmm; GetContactLanguage(dlg); @@ -1203,10 +1203,10 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) SetNoUnderline(dlg); if (dlg->hContact == NULL) - db_set_ws(NULL, MODULE_NAME, dlg->name, + db_set_ws(NULL, MODULENAME, dlg->name, languages[selection - LANGUAGE_MENU_ID_BASE]->language); else - db_set_ws(dlg->hContact, MODULE_NAME, "TalkLanguage", + db_set_ws(dlg->hContact, MODULENAME, "TalkLanguage", languages[selection - LANGUAGE_MENU_ID_BASE]->language); GetContactLanguage(dlg); @@ -1352,7 +1352,7 @@ int MsgWindowEvent(WPARAM, LPARAM lParam) int IconPressed(WPARAM hContact, LPARAM lParam) { StatusIconClickData *sicd = (StatusIconClickData *)lParam; - if (sicd == nullptr || mir_strcmp(sicd->szModule, MODULE_NAME) != 0) + if (sicd == nullptr || mir_strcmp(sicd->szModule, MODULENAME) != 0) return 0; if (hContact == NULL) -- cgit v1.2.3