diff options
Diffstat (limited to 'plugins/SpellChecker/src')
-rw-r--r-- | plugins/SpellChecker/src/ardialog.cpp | 4 | ||||
-rw-r--r-- | plugins/SpellChecker/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/SpellChecker/src/spellchecker.cpp | 40 | ||||
-rw-r--r-- | plugins/SpellChecker/src/stdafx.h | 12 |
4 files changed, 31 insertions, 29 deletions
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index eec0687100..060fa80846 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -55,9 +55,9 @@ BOOL ShowAutoReplaceDialog(HWND parent, BOOL modal, data->replace = replace;
if (modal)
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
- HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
+ HWND hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_REPLACEMENT), parent, AddReplacementDlgProc, (LPARAM)data);
SetForegroundWindow(hwnd);
SetFocus(hwnd);
SetFocus(GetDlgItem(hwnd, IDC_NEW));
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 6f0d0e22e9..9f4f8e22b9 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -56,7 +56,7 @@ static OptPageControl autoReplaceControls[] = { int InitOptionsCallback(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = LPGEN("Spell Checker");
odp.pfnDlgProc = OptionsDlgProc;
@@ -65,7 +65,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) Options_AddPage(wParam, &odp);
memset(&odp, 0, sizeof(odp));
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = LPGEN("Auto-replacements");
odp.pfnDlgProc = AutoreplaceDlgProc;
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 9770861c9c..276c2b650c 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -21,22 +21,8 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {36753AE3-840B-4797-94A5-FD9F5852B942} - { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 } } -}; - -HINSTANCE hInst; - int hLangpack = 0; +CMPlugin g_plugin; HANDLE hDictionariesFolder = nullptr; wchar_t *dictionariesFolder; @@ -55,19 +41,29 @@ BOOL loaded = FALSE; LIST<Dictionary> languages(1); -// Functions //////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) +PLUGININFOEX pluginInfo = { - hInst = hinstDLL; - return TRUE; -} + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {36753AE3-840B-4797-94A5-FD9F5852B942} + { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 }} +}; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } +// Functions //////////////////////////////////////////////////////////////////////////// + static int IconsChanged(WPARAM, LPARAM) { StatusIconData sid = {}; @@ -137,7 +133,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HMODULE hFlagsDll = LoadLibraryEx(flag_file, nullptr, LOAD_LIBRARY_AS_DATAFILE); wchar_t path[MAX_PATH]; - GetModuleFileName(hInst, path, MAX_PATH); + GetModuleFileName(g_plugin.getInst(), path, MAX_PATH); SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE | SIDF_SORTED; @@ -234,7 +230,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); // icons - Icon_Register(hInst, LPGEN("Spell Checker"), iconList, _countof(iconList)); + Icon_Register(g_plugin.getInst(), LPGEN("Spell Checker"), iconList, _countof(iconList)); // hooks HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/SpellChecker/src/stdafx.h b/plugins/SpellChecker/src/stdafx.h index 83ab91a8b5..38317e99c4 100644 --- a/plugins/SpellChecker/src/stdafx.h +++ b/plugins/SpellChecker/src/stdafx.h @@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. #include <string>
using namespace std;
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_protosvc.h>
#include <m_langpack.h>
@@ -67,14 +66,21 @@ using namespace std; #include "ardialog.h"
#include "RichEdit.h"
-#define MODULE_NAME "SpellChecker"
+#define MODULE_NAME "SpellChecker"
#define FLAGS_DLL_FOLDER L"%miranda_path%\\Icons"
#define CUSTOM_DICTIONARIES_FOLDER L"%miranda_userdata%\\Dictionaries"
#define DICTIONARIES_FOLDER L"%miranda_path%\\Dictionaries"
// Global Variables
-extern HINSTANCE hInst;
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
extern BOOL uinfoex_enabled;
extern BOOL variables_enabled;
|