diff options
author | Kirill Volinsky <Mataes2007@gmail.com> | 2018-05-17 11:42:46 +0300 |
---|---|---|
committer | Kirill Volinsky <Mataes2007@gmail.com> | 2018-05-17 11:43:07 +0300 |
commit | 73d93114e2c4d4c1c259fa1474a5c6bd723b92ee (patch) | |
tree | 328603e0b26a88e74aca6e728a1fe0c28bf094ec /plugins/IgnoreState | |
parent | ad103f4be37b7082bcca7106b77b7606e4173920 (diff) |
IEView, IgnoreState, Import: cmplugin adaptation
Diffstat (limited to 'plugins/IgnoreState')
-rw-r--r-- | plugins/IgnoreState/src/main.cpp | 11 | ||||
-rw-r--r-- | plugins/IgnoreState/src/options.cpp | 34 | ||||
-rw-r--r-- | plugins/IgnoreState/src/stdafx.h | 11 |
3 files changed, 26 insertions, 30 deletions
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index ef00426533..bdf90c3e97 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -20,12 +20,11 @@ #include "stdafx.h"
-HINSTANCE g_hInst;
-
HANDLE hIcoLibIconsChanged = nullptr;
HANDLE hHookExtraIconsRebuild = nullptr, hHookExtraIconsApply = nullptr, hContactSettingChanged = nullptr;
HANDLE hPrebuildContactMenu = nullptr;
HANDLE hExtraIcon = nullptr;
+CMPlugin g_plugin;
int hLangpack;
INT currentFilter = 0;
@@ -60,12 +59,6 @@ PLUGININFOEX pluginInfo = { { 0xa6872bcd, 0xf2a1, 0x41b8, { 0xb2, 0xf1, 0xdd, 0x7c, 0xec, 0x05, 0x57, 0x34 } }
};
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -166,7 +159,7 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
//IcoLib support
- Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Ignore State"), iconList, _countof(iconList));
hExtraIcon = ExtraIcon_RegisterIcolib("ignore", LPGEN("Ignore State"), "ignore_full");
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index db24cf3045..8db1304186 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -74,23 +74,23 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- DWORD flags = 0;
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
- tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
- while (tvi.hItem) {
- TreeView_GetItem(hTree, &tvi);
- if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
- tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
- }
- db_set_dw(NULL, MODULENAME, "Filter", flags);
-
- bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
- db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
-
- fill_filter();
+ {
+ DWORD flags = 0;
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
+ tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
+ while (tvi.hItem) {
+ TreeView_GetItem(hTree, &tvi);
+ if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
}
+ db_set_dw(NULL, MODULENAME, "Filter", flags);
+
+ bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
+ db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+
+ fill_filter();
+ }
}
case IDC_FILTER:
if (((LPNMHDR)lParam)->code == NM_CLICK)
@@ -104,7 +104,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.szGroup.a = LPGEN("Icons");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_IGNORE_OPT);
diff --git a/plugins/IgnoreState/src/stdafx.h b/plugins/IgnoreState/src/stdafx.h index 765038ff49..24925c1310 100644 --- a/plugins/IgnoreState/src/stdafx.h +++ b/plugins/IgnoreState/src/stdafx.h @@ -25,8 +25,6 @@ #include <windows.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -41,6 +39,13 @@ #define MODULENAME "IgnoreState"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
struct IGNOREITEMS
{
wchar_t* name;
@@ -54,8 +59,6 @@ extern int nII; static byte bUseMirandaSettings;
-extern HINSTANCE g_hInst;
-
void applyExtraImage(MCONTACT hContact);
int onOptInitialise(WPARAM wParam, LPARAM lParam);
|