From f580be3d9dcccb14831d6bed9e7dfca600f5b6f8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Mar 2019 16:15:45 +0300 Subject: popups: - internal implementation details & all service declarations moved to m_popup_int.h; - all service calls removed and replaced with function calls; - direct access to popup serttings replaced with Popup_Enable / Popup_Enabled; --- plugins/Popup/src/config.cpp | 15 ++++----- plugins/Popup/src/config.h | 1 - plugins/Popup/src/history.cpp | 28 ++++++++-------- plugins/Popup/src/main.cpp | 29 +++++------------ plugins/Popup/src/opt_class.cpp | 4 +-- plugins/Popup/src/opt_gen.cpp | 19 ++++++----- plugins/Popup/src/opt_skins.cpp | 4 +-- plugins/Popup/src/popup_wnd2.cpp | 8 ++--- plugins/Popup/src/popup_wnd2.h | 4 +-- plugins/Popup/src/services.cpp | 70 +++++++++++----------------------------- plugins/Popup/src/stdafx.h | 2 +- 11 files changed, 69 insertions(+), 115 deletions(-) (limited to 'plugins/Popup') diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index ecc5a02e78..e137b9d722 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -71,23 +71,22 @@ void PopupPreview() LPGENW("This is a special test preview for the popup plugin settings. The text and title are quite long so you can tweak your skin and plugin settings to best fit your needs :)") ); - POPUPDATA2 ppd = { 0 }; - - memset(&ppd, 0, sizeof(ppd)); + POPUPDATA2 ppd = {}; ppd.cbSize = sizeof(ppd); ppd.flags = PU2_UNICODE; - ppd.lptzTitle = lptzTitle1Eng; - ppd.lpwzText = lptzText1Eng; + ppd.szTitle.w = lptzTitle1Eng; + ppd.szText.w = lptzText1Eng; ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) + Sleep((ANIM_TIME * 2) / 3); // Pause memset(&ppd, 0, sizeof(ppd)); ppd.cbSize = sizeof(ppd); ppd.flags = PU2_UNICODE; - ppd.lptzTitle = lptzTitle2; - ppd.lpwzText = lptzText2; + ppd.szTitle.w = lptzTitle2; + ppd.szText.w = lptzText2; ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); ppd.hbmAvatar = hbmNoAvatar; diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index 2819fd52f3..ec7f7bafca 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -48,7 +48,6 @@ typedef struct tagPOPUPOPTIONS { BYTE ReorderPopups; BYTE ReorderPopupsWarning; //Disable when - BOOL ModuleIsEnabled; BYTE DisableWhenFullscreen; //others BYTE debug; diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index d0e745da64..c4da220b9c 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -37,8 +37,8 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA static void FreeHistoryItem(POPUPDATA2 *ppd) { - mir_free(ppd->lpzTitle); - mir_free(ppd->lpzText); + mir_free(ppd->szTitle.w); + mir_free(ppd->szText.w); mir_free(ppd->lpzSkin); mir_free(ppd); } @@ -74,12 +74,12 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc(sizeof(POPUPDATA2)); *ppd = *ppdNew; if (ppd->flags & PU2_UNICODE) { - ppd->lptzTitle = mir_wstrdup(ppd->lpwzTitle); - ppd->lpwzText = mir_wstrdup(ppd->lpwzText); + ppd->szTitle.w = mir_wstrdup(ppd->szTitle.w); + ppd->szText.w = mir_wstrdup(ppd->szText.w); } else { - ppd->lpzTitle = mir_strdup(ppd->lpzTitle); - ppd->lpzText = mir_strdup(ppd->lpzText); + ppd->szTitle.a = mir_strdup(ppd->szTitle.a); + ppd->szText.a = mir_strdup(ppd->szText.a); } ppd->lpzSkin = mir_strdup(ppd->lpzSkin); ppd->dwTimestamp = time(0); @@ -187,14 +187,14 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.color = ppd->colorText; if (ppd->flags & PU2_UNICODE) { ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; - ieData.pszNickW = ppd->lptzTitle; - ieData.pszTextW = ppd->lpwzText; + ieData.pszNickW = ppd->szTitle.w; + ieData.pszTextW = ppd->szText.w; ieData.pszText2W = nullptr; } else { ieData.dwFlags |= 0; - ieData.pszNick = ppd->lpzTitle; - ieData.pszText = ppd->lpzText; + ieData.pszNick = ppd->szTitle.a; + ieData.pszText = ppd->szText.a; ieData.pszText2 = nullptr; } ieData.bIsMe = FALSE; @@ -371,14 +371,14 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.color = ppd->colorText; if (ppd->flags & PU2_UNICODE) { ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; - ieData.pszNickW = ppd->lptzTitle; - ieData.pszTextW = ppd->lpwzText; + ieData.pszNickW = ppd->szTitle.w; + ieData.pszTextW = ppd->szText.w; ieData.pszText2W = nullptr; } else { ieData.dwFlags |= 0; - ieData.pszNick = ppd->lpzTitle; - ieData.pszText = ppd->lpzText; + ieData.pszNick = ppd->szTitle.a; + ieData.pszText = ppd->szText.a; ieData.pszText2 = nullptr; } ieData.bIsMe = FALSE; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 2a84de3e69..6f7348bb01 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -109,9 +109,7 @@ static int IconsChanged(WPARAM, LPARAM) { LoadActions(); - HANDLE hIcon = PopupOptions.ModuleIsEnabled == TRUE - ? GetIconHandle(IDI_POPUP) - : GetIconHandle(IDI_NOPOPUP); + HANDLE hIcon = Popup_Enabled() ? GetIconHandle(IDI_POPUP) : GetIconHandle(IDI_NOPOPUP); Menu_ModifyItem(hMenuItem, nullptr, hIcon); Menu_ModifyItem(hMenuRoot, nullptr, hIcon); @@ -126,7 +124,7 @@ static int TTBLoaded(WPARAM, LPARAM) ttb.pszService = MENUCOMMAND_SVC; ttb.lParamUp = 1; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON; - if (PopupOptions.ModuleIsEnabled) + if (Popup_Enabled()) ttb.dwFlags |= TTBBF_PUSHED; ttb.name = LPGEN("Toggle Popups"); ttb.hIconHandleUp = GetIconHandle(IDI_NOPOPUP); @@ -141,25 +139,23 @@ static int TTBLoaded(WPARAM, LPARAM) INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) { HANDLE hIcon; - if (PopupOptions.ModuleIsEnabled) { + if (Popup_Enabled()) { // The module is enabled. // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. - PopupOptions.ModuleIsEnabled = FALSE; - db_set_b(0, "Popup", "ModuleIsEnabled", FALSE); + Popup_Enable(false); Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), hIcon = GetIconHandle(IDI_NOPOPUP)); } else { // The module is disabled. // The action to do is enable popups (show enabled), then write "disable popup" in the new item. - PopupOptions.ModuleIsEnabled = TRUE; - db_set_b(0, "Popup", "ModuleIsEnabled", TRUE); + Popup_Enable(true); Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP)); } Menu_ModifyItem(hMenuRoot, nullptr, hIcon); if (hTTButton) - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopupOptions.ModuleIsEnabled) ? TTBST_PUSHED : 0); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (Popup_Enabled()) ? TTBST_PUSHED : 0); return 0; } @@ -175,7 +171,7 @@ void InitMenuItems(void) CMenuItem mi(&g_plugin); mi.flags = CMIF_UNICODE; - HANDLE hIcon = GetIconHandle(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP); + HANDLE hIcon = GetIconHandle(Popup_Enabled() ? IDI_POPUP : IDI_NOPOPUP); // Build main menu hMenuRoot = mi.root = g_plugin.addRootMenu(MO_MAIN, MODULNAME_PLUW, -1000000000, hIcon); @@ -185,7 +181,7 @@ void InitMenuItems(void) SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); mi.pszService = MENUCOMMAND_SVC; CreateServiceFunction(mi.pszService, svcEnableDisableMenuCommand); - mi.name.w = PopupOptions.ModuleIsEnabled ? LPGENW("Disable Popups") : LPGENW("Enable Popups"); + mi.name.w = Popup_Enabled() ? LPGENW("Disable Popups") : LPGENW("Enable Popups"); mi.hIcolibItem = hIcon; hMenuItem = Menu_AddMainMenuItem(&mi); @@ -199,12 +195,6 @@ void InitMenuItems(void) hMenuItemHistory = Menu_AddMainMenuItem(&mi); } -//===== GetStatus ======================================================================= -INT_PTR GetStatus(WPARAM, LPARAM) -{ - return PopupOptions.ModuleIsEnabled; -} - // register Hotkey void LoadHotkey() { @@ -324,8 +314,6 @@ static int OnShutdown(WPARAM, LPARAM) int CMPlugin::Load() { - CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); - #if defined(_DEBUG) PopupOptions.debug = g_plugin.getByte("debug", FALSE); #else @@ -377,7 +365,6 @@ int CMPlugin::Load() CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage); CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW); - CreateServiceFunction(MS_POPUP_QUERY, Popup_Query); CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions); CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification); diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index b3fbfe469a..f68cca8e11 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -341,8 +341,8 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l POPUPDATA2 ppd = { 0 }; ppd.cbSize = sizeof(ppd); ppd.flags = PU2_UNICODE; - ppd.lptzTitle = ptd->pszDescription; - ppd.lpwzText = TranslateT("Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!"); + ppd.szTitle.w = ptd->pszDescription; + ppd.szText.w = TranslateT("Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!"); ppd.iSeconds = ptd->timeoutValue; ppd.colorBack = ptd->colorBack; ppd.colorText = ptd->colorText; diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 80620f84dd..ebe0c4d6e0 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -121,7 +121,6 @@ void LoadOption_General() PopupOptions.ReorderPopupsWarning = g_plugin.getByte("ReorderPopupsWarning", TRUE); // disable When - PopupOptions.ModuleIsEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", TRUE); PopupOptions.DisableWhenFullscreen = g_plugin.getByte("DisableWhenFullscreen", TRUE); } @@ -195,10 +194,13 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED); // Popup enabled - CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); - EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); + { + bool bEnabled = Popup_Enabled(); + CheckDlgButton(hwnd, IDC_POPUPENABLED, bEnabled ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), bEnabled); + EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), bEnabled); + } // new status options { @@ -341,11 +343,12 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_POPUPENABLED: { + bool bEnabled = Popup_Enabled(); int chk = IsDlgButtonChecked(hwnd, IDC_POPUPENABLED); - if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled && !chk) + if (bEnabled && chk || !bEnabled && !chk) svcEnableDisableMenuCommand(0, 0); - EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); - EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); + EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), bEnabled); + EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), bEnabled); } break; diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 7dc2ac93f7..45418a6e6a 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -76,8 +76,8 @@ static void updatePreviewImage(HWND hwndBox) ppd.cbSize = sizeof(ppd); ppd.flags = PU2_UNICODE; ppd.lchIcon = Skin_LoadIcon(SKINICON_STATUS_ONLINE); - ppd.lptzTitle = TranslateT("Skin preview"); - ppd.lpwzText = TranslateT("Just take a look at this skin... ;)"); + ppd.szTitle.w = TranslateT("Skin preview"); + ppd.szText.w = TranslateT("Just take a look at this skin... ;)"); POPUPOPTIONS customOptions = PopupOptions; customOptions.DynamicResize = FALSE; diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 0b41e89e3c..e2dcc6bfce 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -677,7 +677,7 @@ void PopupWnd2::setIcon(HICON hNewIcon) } } -void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) +void PopupWnd2::updateData(POPUPDATAW *ppd) { m_hContact = ppd->lchContact; @@ -717,8 +717,8 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (ppd->flags & PU2_UNICODE) { if (m_textType == TT_NONE) m_textType = TT_UNICODE; - replaceStrW(m_lptzTitle, ppd->lptzTitle); - replaceStrW(m_lptzText, ppd->lpwzText); + replaceStrW(m_lptzTitle, ppd->szTitle.w); + replaceStrW(m_lptzText, ppd->szText.w); } else { replaceStrW(m_lptzTitle, nullptr); @@ -1127,7 +1127,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara switch (wParam) { case CPT_TEXTW: updateText((wchar_t *)lParam); mir_free((void *)lParam); break; case CPT_TITLEW: updateTitle((wchar_t *)lParam); mir_free((void *)lParam); break; - case CPT_DATAW: updateData((POPUPDATAW_V2 *)lParam); mir_free((void *)lParam); break; + case CPT_DATAW: updateData((POPUPDATAW *)lParam); mir_free((void *)lParam); break; } update(); break; diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index bed4bd7ba2..45b940fbb6 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -128,7 +128,7 @@ public: void setIcon(HICON); - void updateData(POPUPDATAW_V2 *ppd); + void updateData(POPUPDATAW *ppd); void updateData(POPUPDATA2 *ppd); void buildMText(); void updateText(wchar_t *text); @@ -208,7 +208,7 @@ public: SendMessage(m_hwnd, UM_CALLMETHOD, (WPARAM)method_copy, (LPARAM)lParam); } - LRESULT m_updateData_POPUPDATAW_V2(LPARAM arg) { updateData((POPUPDATAW_V2 *)arg); update(); return 0; } + LRESULT m_updateData_POPUPDATAW_V2(LPARAM arg) { updateData((POPUPDATAW *)arg); update(); return 0; } LRESULT m_updateData_POPUPDATA2(LPARAM arg) { updateData((POPUPDATA2 *)arg); update(); return 0; } LRESULT m_updateText(LPARAM arg) { updateText((wchar_t *)arg); update(); return 0; } LRESULT m_updateTitle(LPARAM arg) { updateTitle((wchar_t *)arg); update(); return 0; } diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index d14f0aa622..9a87bbcf81 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -41,8 +41,8 @@ INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam) ppd2.flags = PU2_UNICODE; ppd2.lchContact = ppd->lchContact; ppd2.lchIcon = ppd->lchIcon; - ppd2.lpwzTitle = wszTitle; - ppd2.lpwzText = wszText; + ppd2.szTitle.w = wszTitle; + ppd2.szText.w = wszText; ppd2.colorBack = ppd->colorBack; ppd2.colorText = ppd->colorText; ppd2.PluginWindowProc = ppd->PluginWindowProc; @@ -57,7 +57,7 @@ INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam) if (!gbPopupLoaded) return -1; - POPUPDATAW_V2 *ppd = (POPUPDATAW_V2*)wParam; + POPUPDATAW *ppd = (POPUPDATAW*)wParam; if (!ppd) return -1; @@ -66,19 +66,16 @@ INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam) ppd2.flags = PU2_UNICODE; ppd2.lchContact = ppd->lchContact; ppd2.lchIcon = ppd->lchIcon; - ppd2.lpwzTitle = ppd->lpwzContactName; - ppd2.lpwzText = ppd->lpwzText; + ppd2.szTitle.w = ppd->lpwzContactName; + ppd2.szText.w = ppd->lpwzText; ppd2.colorBack = ppd->colorBack; ppd2.colorText = ppd->colorText; ppd2.PluginWindowProc = ppd->PluginWindowProc; ppd2.PluginData = ppd->PluginData; ppd2.iSeconds = ppd->iSeconds; - - if (lParam & APF_NEWDATA) { - ppd2.lchNotification = ppd->hNotification; - ppd2.actionCount = ppd->actionCount; - ppd2.lpActions = ppd->lpActions; - } + ppd2.lchNotification = ppd->hNotification; + ppd2.actionCount = ppd->actionCount; + ppd2.lpActions = ppd->lpActions; return Popup_AddPopup2((WPARAM)&ppd2, lParam); } @@ -132,7 +129,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) return -1; if (bShowMode != PU_SHOWMODE_FAVORITE) { - if (!PopupOptions.ModuleIsEnabled) + if (!Popup_Enabled()) return -1; if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen()) @@ -237,28 +234,28 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) POPUPDATA2 ppd2 = { 0 }; ppd2.cbSize = sizeof(ppd2); ppd2.flags = PU2_UNICODE; - ppd2.lpwzText = (wchar_t*)wParam; + ppd2.szText.w = (wchar_t*)wParam; switch (lParam & 0x7fffffff) { case SM_ERROR: ppd2.lchIcon = LoadIconEx(IDI_MB_STOP, 0); ppd2.colorBack = RGB(191, 0, 0); ppd2.colorText = RGB(255, 245, 225); ppd2.lchNotification = g_hntfError; - ppd2.lptzTitle = TranslateT("Error"); + ppd2.szTitle.w = TranslateT("Error"); break; case SM_WARNING: ppd2.lchIcon = LoadIconEx(IDI_MB_WARN, 0); ppd2.colorBack = RGB(210, 210, 150); ppd2.colorText = RGB(0, 0, 0); ppd2.lchNotification = g_hntfWarning; - ppd2.lptzTitle = TranslateT("Warning"); + ppd2.szTitle.w = TranslateT("Warning"); break; case SM_NOTIFY: ppd2.lchIcon = LoadIconEx(IDI_MB_INFO, 0); ppd2.colorBack = RGB(230, 230, 230); ppd2.colorText = RGB(0, 0, 0); ppd2.lchNotification = g_hntfNotification; - ppd2.lptzTitle = TranslateT("Notify"); + ppd2.szTitle.w = TranslateT("Notify"); break; default: // No no no... you must give me a good value. return -1; @@ -275,42 +272,11 @@ INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam) return Popup_ShowMessageW(wszMsg, lParam); } -//===== Popup/Query -INT_PTR Popup_Query(WPARAM wParam, LPARAM) -{ - if (!gbPopupLoaded) return -1; - - if (closing) - return 0; - - switch (wParam) { - case PUQS_ENABLEPOPUPS: - if (PopupOptions.ModuleIsEnabled) - return 1; // They're already ON!!! - - // Module was disabled. - svcEnableDisableMenuCommand(0, 0); - return 0; - - case PUQS_DISABLEPOPUPS: - if (!(PopupOptions.ModuleIsEnabled)) - return 1; // They're already OFF!!! - - svcEnableDisableMenuCommand(0, 0); - return 0; - - case PUQS_GETSTATUS: - return (PopupOptions.ModuleIsEnabled); - - default: - return -1; - } -} //===== Popup/RegisterActions INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam) { - LPPOPUPACTION actions = (LPPOPUPACTION)wParam; + POPUPACTION *actions = (POPUPACTION*)wParam; for (int i = 0; i < lParam; ++i) RegisterAction(&actions[i]); return 0; @@ -458,13 +424,13 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) ppd2.PluginWindowProc = pc->PluginWindowProc; if (pc->flags & PCF_UNICODE) { ppd2.flags = PU2_UNICODE; - ppd2.lptzTitle = (wchar_t*)pdc->pwszTitle; - ppd2.lpwzText = (wchar_t*)pdc->pwszText; + ppd2.szTitle.w = (wchar_t*)pdc->szTitle.w; + ppd2.szText.w = (wchar_t*)pdc->szText.w; } else { ppd2.flags = PU2_ANSI; - ppd2.lpzTitle = (char *)pdc->pszTitle; - ppd2.lpzText = (char *)pdc->pszText; + ppd2.szTitle.a = (char *)pdc->szTitle.a; + ppd2.szText.a = (char *)pdc->szText.a; } ppd2.lchContact = pdc->hContact; ppd2.PluginData = pdc->PluginData; diff --git a/plugins/Popup/src/stdafx.h b/plugins/Popup/src/stdafx.h index 74e34acc48..d91eb951ec 100644 --- a/plugins/Popup/src/stdafx.h +++ b/plugins/Popup/src/stdafx.h @@ -80,7 +80,7 @@ https://miranda-ng.org/distr/ #include #include #include -#include +#include #include #include -- cgit v1.2.3