From ba1083b4da33ca44a5ae7d90eabbe3d6d340a81e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 16:47:04 +0300 Subject: XSoundNotify, YAPP, YaRelay, ZeroSwitch, ZeroNotify -> CMPlugin --- plugins/YAPP/src/icons.cpp | 4 ++-- plugins/YAPP/src/message_pump.cpp | 4 ++-- plugins/YAPP/src/notify_imp.cpp | 2 +- plugins/YAPP/src/options.cpp | 2 +- plugins/YAPP/src/services.cpp | 2 +- plugins/YAPP/src/stdafx.h | 15 ++++++++++----- plugins/YAPP/src/yapp.cpp | 27 ++++++++++++++------------- 7 files changed, 31 insertions(+), 25 deletions(-) (limited to 'plugins/YAPP') diff --git a/plugins/YAPP/src/icons.cpp b/plugins/YAPP/src/icons.cpp index f9364cf47e..3de365b928 100644 --- a/plugins/YAPP/src/icons.cpp +++ b/plugins/YAPP/src/icons.cpp @@ -14,6 +14,6 @@ static IconItem iconList[] = void InitIcons() { - Icon_Register(hInst, SECT_TOLBAR, iconList, 2); - Icon_Register(hInst, SECT_POPUP, iconList+2, 3); + Icon_Register(g_plugin.getInst(), SECT_TOLBAR, iconList, 2); + Icon_Register(g_plugin.getInst(), SECT_POPUP, iconList+2, 3); } diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp index 606401da6b..b6e62a415d 100644 --- a/plugins/YAPP/src/message_pump.cpp +++ b/plugins/YAPP/src/message_pump.cpp @@ -30,7 +30,7 @@ unsigned __stdcall MessagePumpThread(void* param) PopupData *pd = (PopupData*)hwndMsg.lParam; if (enabled && num_popups < MAX_POPUPS) { - HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, (LPVOID)hwndMsg.lParam); + HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), (LPVOID)hwndMsg.lParam); num_popups++; if (hwndMsg.wParam) // set notifyer handle SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0); @@ -91,7 +91,7 @@ void InitMessagePump() { WNDCLASS popup_win_class = { 0 }; popup_win_class.lpfnWndProc = PopupWindowProc; - popup_win_class.hInstance = hInst; + popup_win_class.hInstance = g_plugin.getInst(); popup_win_class.lpszClassName = POP_WIN_CLASS; popup_win_class.hCursor = LoadCursor(nullptr, IDC_ARROW); RegisterClass(&popup_win_class); diff --git a/plugins/YAPP/src/notify_imp.cpp b/plugins/YAPP/src/notify_imp.cpp index ccf5046923..ed7d92bdc2 100644 --- a/plugins/YAPP/src/notify_imp.cpp +++ b/plugins/YAPP/src/notify_imp.cpp @@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcPopups(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) int NotifyOptionsInitialize(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY); odp.szTitle.a = LPGEN("YAPP Popups"); odp.flags = ODPF_BOLDGROUPS; diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index c0ae8295c6..c02a3a17e5 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -475,7 +475,7 @@ int OptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.flags = ODPF_BOLDGROUPS; odp.position = -790000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.szTitle.a = LPGEN("Popups"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1); diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index a3d2ace7b4..a2951cb6ec 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -317,7 +317,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) INT_PTR Popup_ShowHistory(WPARAM, LPARAM) { if (!hHistoryWindow) - hHistoryWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LST_HISTORY), nullptr, DlgProcHistLst); + hHistoryWindow = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LST_HISTORY), nullptr, DlgProcHistLst); ShowWindow(hHistoryWindow, SW_SHOW); return 0; diff --git a/plugins/YAPP/src/stdafx.h b/plugins/YAPP/src/stdafx.h index 7309ef7413..d1475a724d 100644 --- a/plugins/YAPP/src/stdafx.h +++ b/plugins/YAPP/src/stdafx.h @@ -13,7 +13,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -43,10 +42,16 @@ #define MODULE "YAPP" -extern HMODULE hInst; -extern bool bShutdown; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULE) + {} +}; -extern HFONT hFontFirstLine, hFontSecondLine, hFontTime; +extern bool bShutdown; + +extern HFONT hFontFirstLine, hFontSecondLine, hFontTime; extern COLORREF colFirstLine, colSecondLine, colBg, colTime, colBorder, colSidebar, colTitleUnderline; extern MNOTIFYLINK *notifyLink; @@ -70,4 +75,4 @@ typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); #define PDF_TCHAR PDF_UNICODE -void ShowPopup(PopupData &pd_in); \ No newline at end of file +void ShowPopup(PopupData &pd_in); diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index abf01aeb67..c00ce0989c 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -3,7 +3,7 @@ #include "stdafx.h" -HMODULE hInst = nullptr; +CMPlugin g_plugin; bool bShutdown = false; MNOTIFYLINK *notifyLink = nullptr; @@ -28,7 +28,10 @@ HANDLE hTTButton; // menu items HGENMENU hMenuRoot, hMenuItem, hMenuItemHistory; -PLUGININFOEX pluginInfo={ +///////////////////////////////////////////////////////////////////////////////////////// + +PLUGININFOEX pluginInfo = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -41,18 +44,14 @@ PLUGININFOEX pluginInfo={ {0xefd15f16, 0x7ae4, 0x40d7, {0xa8, 0xe3, 0xa4, 0x11, 0xed, 0x74, 0x7b, 0xd5}} }; -BOOL WINAPI DllMain(HMODULE hModule, DWORD, LPVOID) -{ - hInst = hModule; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } -int ReloadFont(WPARAM, LPARAM) +///////////////////////////////////////////////////////////////////////////////////////// + +static int ReloadFont(WPARAM, LPARAM) { LOGFONT log_font; if (hFontFirstLine) DeleteObject(hFontFirstLine); @@ -72,7 +71,7 @@ int ReloadFont(WPARAM, LPARAM) return 0; } -int TTBLoaded(WPARAM, LPARAM) +static int TTBLoaded(WPARAM, LPARAM) { TTBButton ttb = {}; ttb.pszService = "Popup/EnableDisableMenuCommand"; @@ -163,7 +162,7 @@ static void InitFonts() ReloadFont(0, 0); } -void InitMenuItems(void) +static void InitMenuItems(void) { bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; @@ -187,7 +186,7 @@ void InitMenuItems(void) hMenuItem = Menu_AddMainMenuItem(&mi); } -int ModulesLoaded(WPARAM, LPARAM) +static int ModulesLoaded(WPARAM, LPARAM) { MNotifyGetLink(); @@ -205,7 +204,7 @@ int ModulesLoaded(WPARAM, LPARAM) return 0; } -int PreShutdown(WPARAM, LPARAM) +static int PreShutdown(WPARAM, LPARAM) { bShutdown = true; DeinitMessagePump(); @@ -229,6 +228,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload() { DeleteObject(hFontFirstLine); -- cgit v1.2.3