summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-11-03 17:38:51 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-11-03 17:38:51 +0300
commitc84d7f73fe819e830d90c59c06c7ba82265982ed (patch)
tree3c5fc911a70a89fafa10c7ccff387671b8ce69a9 /plugins/Popup
parent1a51b71e37450078a43bb26eec5c11123f788224 (diff)
fixes #3756 (PopupPlus: добавить отключение всплывающих окон при неактивности)
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/Popup.vcxproj1
-rw-r--r--plugins/Popup/Popup.vcxproj.filters3
-rw-r--r--plugins/Popup/res/resource.rc42
-rw-r--r--plugins/Popup/src/config.h3
-rw-r--r--plugins/Popup/src/main.cpp37
-rw-r--r--plugins/Popup/src/opt_class.cpp2
-rw-r--r--plugins/Popup/src/opt_gen.cpp24
-rw-r--r--plugins/Popup/src/resource.h5
-rw-r--r--plugins/Popup/src/services.cpp240
-rw-r--r--plugins/Popup/src/services.h58
-rw-r--r--plugins/Popup/src/stdafx.h3
-rw-r--r--plugins/Popup/src/version.h2
12 files changed, 229 insertions, 191 deletions
diff --git a/plugins/Popup/Popup.vcxproj b/plugins/Popup/Popup.vcxproj
index 6677f5e0a5..1c333a5f4c 100644
--- a/plugins/Popup/Popup.vcxproj
+++ b/plugins/Popup/Popup.vcxproj
@@ -83,7 +83,6 @@
<ClInclude Include="src\popup_thread.h" />
<ClInclude Include="src\popup_wnd2.h" />
<ClInclude Include="src\resource.h" />
- <ClInclude Include="src\services.h" />
<ClInclude Include="src\skin.h" />
<ClInclude Include="src\srmm_menu.h" />
<ClInclude Include="src\stdafx.h" />
diff --git a/plugins/Popup/Popup.vcxproj.filters b/plugins/Popup/Popup.vcxproj.filters
index 42e9018814..0b5d646645 100644
--- a/plugins/Popup/Popup.vcxproj.filters
+++ b/plugins/Popup/Popup.vcxproj.filters
@@ -154,9 +154,6 @@
<ClInclude Include="src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\services.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\skin.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Popup/res/resource.rc b/plugins/Popup/res/resource.rc
index 4a435e304a..0f23e5c865 100644
--- a/plugins/Popup/res/resource.rc
+++ b/plugins/Popup/res/resource.rc
@@ -17,7 +17,7 @@
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1250)
+#pragma code_page(1251)
/////////////////////////////////////////////////////////////////////////////
//
@@ -26,29 +26,51 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
+IDI_HISTORY ICON "popup_history.ico"
+
IDI_PU_FULLSCREEN ICON "popup_fs.ico"
+
IDI_PU_FAVOURITE ICON "popup_fav.ico"
-IDI_HISTORY ICON "popup_history.ico"
+
IDI_RELOAD ICON "reload.ico"
+
IDI_ACT_INFO ICON "info.ico"
+
IDI_ACT_MENU ICON "menu.ico"
+
IDI_ACT_MESSAGE ICON "message.ico"
+
IDI_ACT_OK ICON "ok.ico"
+
IDI_ACT_ADD ICON "add.ico"
+
IDI_ACT_CLOSE ICON "close.ico"
+
IDI_ACT_PINNED ICON "pinned.ico"
+
IDI_ACT_PIN ICON "pin.ico"
+
IDI_RESIZE ICON "resize.ico"
+
IDI_MB_STOP ICON "error.ico"
+
IDI_MB_INFO ICON "notify.ico"
+
IDI_MB_WARN ICON "warning.ico"
+
IDI_OPT_GROUP ICON "popup_group.ico"
+
IDI_OPT_FULLSCREEN ICON "fullscreen.ico"
+
IDI_OPT_BLOCK ICON "block.ico"
+
IDI_OPT_FAVORITE ICON "favorite.ico"
+
IDI_ACT_REPLY ICON "reply.ico"
+
IDI_ACT_COPY ICON "copy.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@@ -302,7 +324,8 @@ BEGIN
GROUPBOX "Disable when:",IDC_STATIC,151,3,146,194
CONTROL "Always (has priority)",IDC_POPUPENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,15,135,8
CONTROL "Fullscreen mode",IDC_DISABLEINFS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,159,26,135,8
- CONTROL "Tree1",IDC_STATUSES,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,159,39,130,151
+ CONTROL "Idle",IDC_DISABLEIDLE,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,159,37,135,8
+ CONTROL "Tree1",IDC_STATUSES,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,159,49,130,142
CONTROL "Debug",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,159,203,57,14
PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14
END
@@ -315,6 +338,7 @@ END
CLASSIC.POPUPSKIN SKIN "classic.popupskin"
+
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
@@ -322,6 +346,7 @@ CLASSIC.POPUPSKIN SKIN "classic.popupskin"
IDB_NOAVATAR BITMAP "avatar.bmp"
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -391,6 +416,17 @@ END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPT_POPUP_GENERAL AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h
index 9495a41bbc..ef680c058e 100644
--- a/plugins/Popup/src/config.h
+++ b/plugins/Popup/src/config.h
@@ -54,7 +54,8 @@ struct POPUPOPTIONS
// Disable when
bool bDisableWhenFullscreen;
-
+ bool bDisableWhenIdle;
+
// others
uint8_t bDebug;
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index dd43336ecb..04ee826c2e 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -236,10 +236,13 @@ static int ModulesLoaded(WPARAM, LPARAM)
// load actions and notifications
LoadActions();
LoadNotifications();
+
// hook TopToolBar
HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
+
// Folder plugin support
folderId = FoldersRegisterCustomPathW(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHW L"\\Skins\\Popup");
+
// load skin
skins.load();
const PopupSkin *skin;
@@ -248,10 +251,13 @@ static int ModulesLoaded(WPARAM, LPARAM)
PopupOptions.SkinPack = mir_wstrdup(skin->getName());
skin->loadOpts();
}
+
// init PopupEfects
PopupEfectsInitialize();
+
// MessageAPI support
SrmmMenu_Load();
+
// Hotkey
LoadHotkey();
@@ -342,36 +348,7 @@ int CMPlugin::Load()
// Service Functions
hEventNotify = CreateHookableEvent(ME_POPUP_FILTER);
-
- CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup);
- CreateServiceFunction(MS_POPUP_ADDPOPUPW, Popup_AddPopupW);
- CreateServiceFunction(MS_POPUP_ADDPOPUP2, Popup_AddPopup2);
-
- CreateServiceFunction(MS_POPUP_CHANGETEXTW, Popup_ChangeTextW);
-
- CreateServiceFunction(MS_POPUP_CHANGEW, Popup_ChangeW);
- CreateServiceFunction(MS_POPUP_CHANGEPOPUP2, Popup_Change2);
-
- CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact);
- CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData);
-
- CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage);
- CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
-
- CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions);
- CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification);
-
- CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync);
-
- CreateServiceFunction(MS_POPUP_REGISTERVFX, Popup_RegisterVfx);
-
- CreateServiceFunction(MS_POPUP_REGISTERCLASS, Popup_RegisterPopupClass);
- CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, Popup_UnregisterPopupClass);
- CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, Popup_CreateClassPopup);
-
- CreateServiceFunction(MS_POPUP_DESTROYPOPUP, Popup_DeletePopup);
-
- CreateServiceFunction("Popup/LoadSkin", Popup_LoadSkin);
+ CreateServices();
// load fonts / create hook
InitFonts();
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index b63768da97..2baf726209 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+extern int num_classes;
+
//---------------------------------------------------------------------------
// Workaround for MS bug ComboBox_SelectItemData
int ComboBox_SelectItem(HWND hwndCtl, char *data) {
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp
index 2aa7de96d2..113b87f219 100644
--- a/plugins/Popup/src/opt_gen.cpp
+++ b/plugins/Popup/src/opt_gen.cpp
@@ -83,16 +83,16 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, uint32_t fla
void LoadOption_General()
{
// Seconds
- PopupOptions.bInfiniteDelay = g_plugin.getByte("InfiniteDelay", FALSE);
+ PopupOptions.bInfiniteDelay = g_plugin.getBool("InfiniteDelay", false);
PopupOptions.Seconds =
DBGetContactSettingRangedWord(0, MODULENAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- PopupOptions.bLeaveHovered = g_plugin.getByte("LeaveHovered", TRUE);
+ PopupOptions.bLeaveHovered = g_plugin.getBool("LeaveHovered", true);
// Dynamic Resize
- PopupOptions.bDynamicResize = g_plugin.getByte("DynamicResize", FALSE);
- PopupOptions.bUseMinimumWidth = g_plugin.getByte("UseMinimumWidth", TRUE);
+ PopupOptions.bDynamicResize = g_plugin.getBool("DynamicResize", false);
+ PopupOptions.bUseMinimumWidth = g_plugin.getBool("UseMinimumWidth", true);
PopupOptions.MinimumWidth = g_plugin.getWord("MinimumWidth", 160);
- PopupOptions.bUseMaximumWidth = g_plugin.getByte("UseMaximumWidth", TRUE);
+ PopupOptions.bUseMaximumWidth = g_plugin.getBool("UseMaximumWidth", true);
PopupOptions.MaximumWidth = g_plugin.getWord("MaximumWidth", 300);
// Position
@@ -111,11 +111,12 @@ void LoadOption_General()
DBGetContactSettingRangedByte(0, MODULENAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE);
// miscellaneous
- PopupOptions.bReorderPopups = g_plugin.getByte("ReorderPopups", TRUE);
- PopupOptions.bReorderPopupsWarning = g_plugin.getByte("ReorderPopupsWarning", TRUE);
+ PopupOptions.bReorderPopups = g_plugin.getBool("ReorderPopups", true);
+ PopupOptions.bReorderPopupsWarning = g_plugin.getBool("ReorderPopupsWarning", true);
// disable When
- PopupOptions.bDisableWhenFullscreen = g_plugin.getByte("DisableWhenFullscreen", TRUE);
+ PopupOptions.bDisableWhenFullscreen = g_plugin.getBool("DisableWhenFullscreen", true);
+ PopupOptions.bDisableWhenIdle = g_plugin.getBool("DisableWhenIdle", true);
}
INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -192,6 +193,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
bool bEnabled = Popup_Enabled();
CheckDlgButton(hwnd, IDC_POPUPENABLED, bEnabled ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.bDisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_DISABLEIDLE, PopupOptions.bDisableWhenIdle ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), bEnabled);
EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), bEnabled);
}
@@ -352,6 +354,11 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
+ case IDC_DISABLEIDLE:
+ PopupOptions.bDisableWhenIdle = !PopupOptions.bDisableWhenIdle;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
case IDC_PREVIEW:
PopupPreview();
break;
@@ -512,6 +519,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
// disable When
g_plugin.setByte("DisableWhenFullscreen", PopupOptions.bDisableWhenFullscreen);
+ g_plugin.setByte("DisableWhenIdle", PopupOptions.bDisableWhenIdle);
// new status options
for (auto &pa : Accounts())
diff --git a/plugins/Popup/src/resource.h b/plugins/Popup/src/resource.h
index 58014debaa..a089d35520 100644
--- a/plugins/Popup/src/resource.h
+++ b/plugins/Popup/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\resource.rc
+// Used by W:\miranda-ng\plugins\Popup\res\resource.rc
//
#define IDD_OPT_POPUP 101
#define IDD_OPT_POPUP_ADVANCED 102
@@ -168,6 +168,7 @@
#define IDC_DISABLEINFS 1241
#define IDC_STATUSES 1242
#define IDC_GETSKINS 1243
+#define IDC_DISABLEIDLE 1244
#define IDC_CHK_OFFLINE 40071
#define IDC_CHK_ONLINE 40072
#define IDC_CHK_NA 40075
@@ -177,7 +178,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 224
+#define _APS_NEXT_RESOURCE_VALUE 225
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1244
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index 82701a59cf..09cee21427 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -23,64 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-int num_classes = 0; // for core class api support
-
-//===== Popup/AddPopup
-INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam)
-{
- if (!gbPopupLoaded)
- return -1;
+static bool g_bIdleMode = false;
- POPUPDATA *ppd = (POPUPDATA*)wParam;
- if (!ppd)
- return -1;
-
- ptrW wszText(mir_a2u(ppd->lpzText)), wszTitle(mir_a2u(ppd->lpzContactName));
-
- POPUPDATA2 ppd2 = { sizeof(ppd2) };
- ppd2.flags = PU2_UNICODE;
- ppd2.lchContact = ppd->lchContact;
- ppd2.lchIcon = ppd->lchIcon;
- ppd2.szTitle.w = wszTitle;
- ppd2.szText.w = wszText;
- ppd2.colorBack = ppd->colorBack;
- ppd2.colorText = ppd->colorText;
- ppd2.PluginWindowProc = ppd->PluginWindowProc;
- ppd2.PluginData = ppd->PluginData;
- ppd2.iSeconds = ppd->iSeconds;
- return Popup_AddPopup2((WPARAM)&ppd2, lParam);
-}
-
-//===== Popup/AddPopupW
-INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
-{
- if (!gbPopupLoaded)
- return -1;
-
- POPUPDATAW *ppd = (POPUPDATAW*)wParam;
- if (!ppd)
- return -1;
-
- POPUPDATA2 ppd2 = { 0 };
- ppd2.cbSize = sizeof(ppd2);
- ppd2.flags = PU2_UNICODE;
- ppd2.lchContact = ppd->lchContact;
- ppd2.lchIcon = ppd->lchIcon;
- 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;
- ppd2.lchNotification = ppd->hNotification;
- ppd2.actionCount = ppd->actionCount;
- ppd2.lpActions = ppd->lpActions;
+int num_classes = 0; // for core class api support
- return Popup_AddPopup2((WPARAM)&ppd2, lParam);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/AddPopup2
-//===== Popup/AddPopup2
static __forceinline uint32_t Proto_Status2Flag_My(uint32_t status)
{
if (uint32_t res = Proto_Status2Flag(status))
@@ -88,7 +37,7 @@ static __forceinline uint32_t Proto_Status2Flag_My(uint32_t status)
return PF2_IDLE;
}
-INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
+static INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
{
/* NOTE: we will return 0 instead of -1 since tabSRMM stops using popup after first failure :/ */
@@ -135,6 +84,9 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (PopupOptions.bDisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen())
return -1;
+ if (PopupOptions.bDisableWhenIdle && g_bIdleMode)
+ return -1;
+
if (g_plugin.getDword(LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
return -1;
@@ -163,8 +115,69 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
return 0;
}
-//===== Popup/GetContact
-INT_PTR Popup_GetContact(WPARAM wParam, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/AddPopup
+
+static INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam)
+{
+ if (!gbPopupLoaded)
+ return -1;
+
+ POPUPDATA *ppd = (POPUPDATA *)wParam;
+ if (!ppd)
+ return -1;
+
+ ptrW wszText(mir_a2u(ppd->lpzText)), wszTitle(mir_a2u(ppd->lpzContactName));
+
+ POPUPDATA2 ppd2 = { sizeof(ppd2) };
+ ppd2.flags = PU2_UNICODE;
+ ppd2.lchContact = ppd->lchContact;
+ ppd2.lchIcon = ppd->lchIcon;
+ ppd2.szTitle.w = wszTitle;
+ ppd2.szText.w = wszText;
+ ppd2.colorBack = ppd->colorBack;
+ ppd2.colorText = ppd->colorText;
+ ppd2.PluginWindowProc = ppd->PluginWindowProc;
+ ppd2.PluginData = ppd->PluginData;
+ ppd2.iSeconds = ppd->iSeconds;
+ return Popup_AddPopup2((WPARAM)&ppd2, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/AddPopupW
+
+static INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
+{
+ if (!gbPopupLoaded)
+ return -1;
+
+ POPUPDATAW *ppd = (POPUPDATAW *)wParam;
+ if (!ppd)
+ return -1;
+
+ POPUPDATA2 ppd2 = { 0 };
+ ppd2.cbSize = sizeof(ppd2);
+ ppd2.flags = PU2_UNICODE;
+ ppd2.lchContact = ppd->lchContact;
+ ppd2.lchIcon = ppd->lchIcon;
+ 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;
+ ppd2.lchNotification = ppd->hNotification;
+ ppd2.actionCount = ppd->actionCount;
+ ppd2.lpActions = ppd->lpActions;
+
+ return Popup_AddPopup2((WPARAM)&ppd2, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/GetContact
+
+static INT_PTR Popup_GetContact(WPARAM wParam, LPARAM)
{
if (!gbPopupLoaded) return -1;
@@ -174,8 +187,10 @@ INT_PTR Popup_GetContact(WPARAM wParam, LPARAM)
return (INT_PTR)(-1);
}
-//===== Popup/GetPluginData
-INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/GetPluginData
+
+static INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM)
{
if (!gbPopupLoaded || !wParam)
return -1;
@@ -186,8 +201,10 @@ INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM)
return (INT_PTR)(-1);
}
-//===== Popup/ChangeTextW
-INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/ChangeTextW
+
+static INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam)
{
if (!gbPopupLoaded || !wParam)
return -1;
@@ -200,8 +217,10 @@ INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam)
return 0;
}
-//===== Popup/ChangeW
-INT_PTR Popup_ChangeW(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/ChangeW
+
+static INT_PTR Popup_ChangeW(WPARAM wParam, LPARAM lParam)
{
if (!gbPopupLoaded || !wParam)
return -1;
@@ -214,8 +233,10 @@ INT_PTR Popup_ChangeW(WPARAM wParam, LPARAM lParam)
return 0;
}
-//===== Popup/Change2
-INT_PTR Popup_Change2(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/Change2
+
+static INT_PTR Popup_Change2(WPARAM wParam, LPARAM lParam)
{
if (!gbPopupLoaded) return -1;
@@ -226,7 +247,7 @@ INT_PTR Popup_Change2(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam)
+static INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam)
{
if (!gbPopupLoaded || !wParam || !lParam) return -1;
if (closing) return 0;
@@ -263,7 +284,7 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam)
return Popup_AddPopup2((WPARAM)&ppd2, (lParam & 0x80000000) ? APF_NO_HISTORY : 0);
}
-INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam)
+static INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam)
{
if (!gbPopupLoaded || !wParam || !lParam) return -1;
if (closing) return 0;
@@ -272,9 +293,10 @@ INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam)
return Popup_ShowMessageW(wszMsg, lParam);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/RegisterActions
-//===== Popup/RegisterActions
-INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
+static INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
{
POPUPACTION *actions = (POPUPACTION*)wParam;
for (int i = 0; i < lParam; ++i)
@@ -282,14 +304,15 @@ INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
return 0;
}
-
-INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM)
+static INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM)
{
return (INT_PTR)RegisterNotification((POPUPNOTIFICATION*)wParam);
}
-//===== Popup/UnhookEventAsync
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/UnhookEventAsync
+
struct SafeUnhookEventParam
{
HWND hwndPopup;
@@ -305,7 +328,7 @@ static void CALLBACK SafeUnhookEventFunc(void *param)
delete p;
}
-INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
+static INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
{
SafeUnhookEventParam *param = new SafeUnhookEventParam;
param->hwndPopup = (HWND)wParam;
@@ -314,15 +337,19 @@ INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
return 0;
}
-//===== Popup/RegisterVfx (effekt name for drop down box)
-INT_PTR Popup_RegisterVfx(WPARAM, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/RegisterVfx (effekt name for drop down box)
+
+static INT_PTR Popup_RegisterVfx(WPARAM, LPARAM lParam)
{
OptAdv_RegisterVfx((char *)lParam);
return 0;
}
-//===== Popup/RegisterClass (for core class api support)
-INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/RegisterClass (for core class api support)
+
+static INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
{
POPUPCLASS *pc = (POPUPCLASS *)lParam;
POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_calloc(sizeof(POPUPTREEDATA));
@@ -370,7 +397,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
return (INT_PTR)ptd;
}
-INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
+static INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
{
POPUPTREEDATA *ptd = (POPUPTREEDATA*)lParam;
if (ptd == nullptr)
@@ -386,8 +413,10 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
return 1;
}
-//===== Popup/AddPopupClass (for core class api support)
-INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/AddPopupClass (for core class api support)
+
+static INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam)
{
POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
if (!pdc)
@@ -430,12 +459,12 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam)
return Popup_AddPopup2((WPARAM)&ppd2, pc->lParam);
}
-INT_PTR Popup_DeletePopup(WPARAM, LPARAM lParam)
+static INT_PTR Popup_DeletePopup(WPARAM, LPARAM lParam)
{
return (INT_PTR)SendMessage((HWND)lParam, UM_DESTROYPOPUP, 0, 0);
}
-INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam)
+static INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam)
{
if (lParam)
{
@@ -451,3 +480,48 @@ INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam)
return 1;
}
+
+static int OnIdleChanged(WPARAM, LPARAM lParam)
+{
+ g_bIdleMode = (lParam & IDF_ISIDLE) != 0;
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Module entry point
+
+void CreateServices()
+{
+ CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup);
+ CreateServiceFunction(MS_POPUP_ADDPOPUPW, Popup_AddPopupW);
+ CreateServiceFunction(MS_POPUP_ADDPOPUP2, Popup_AddPopup2);
+
+ CreateServiceFunction(MS_POPUP_CHANGETEXTW, Popup_ChangeTextW);
+
+ CreateServiceFunction(MS_POPUP_CHANGEW, Popup_ChangeW);
+ CreateServiceFunction(MS_POPUP_CHANGEPOPUP2, Popup_Change2);
+
+ CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact);
+ CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData);
+
+ CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage);
+ CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
+
+ CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions);
+ CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification);
+
+ CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync);
+
+ CreateServiceFunction(MS_POPUP_REGISTERVFX, Popup_RegisterVfx);
+
+ CreateServiceFunction(MS_POPUP_REGISTERCLASS, Popup_RegisterPopupClass);
+ CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, Popup_UnregisterPopupClass);
+ CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, Popup_CreateClassPopup);
+
+ CreateServiceFunction(MS_POPUP_DESTROYPOPUP, Popup_DeletePopup);
+
+ CreateServiceFunction("Popup/LoadSkin", Popup_LoadSkin);
+
+ // register idle mode switcher
+ HookEvent(ME_IDLE_CHANGED, OnIdleChanged);
+}
diff --git a/plugins/Popup/src/services.h b/plugins/Popup/src/services.h
deleted file mode 100644
index 3e6a682a9e..0000000000
--- a/plugins/Popup/src/services.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Popup Plus plugin for Miranda IM
-
-Copyright © 2002 Luca Santarelli,
-© 2004-2007 Victor Pavlychko
-© 2010 MPK
-© 2010 Merlin_de
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef __services_h__
-#define __services_h__
-
-extern int num_classes; //for core class api support
-
-INT_PTR Popup_AddPopup(WPARAM, LPARAM);
-INT_PTR Popup_AddPopupW(WPARAM, LPARAM);
-INT_PTR Popup_AddPopup2(WPARAM, LPARAM);
-
-INT_PTR Popup_GetContact(WPARAM, LPARAM);
-INT_PTR Popup_IsSecondLineShown(WPARAM, LPARAM);
-
-INT_PTR Popup_ChangeTextW(WPARAM, LPARAM);
-
-INT_PTR Popup_ChangeW(WPARAM, LPARAM);
-INT_PTR Popup_Change2(WPARAM, LPARAM);
-
-INT_PTR Popup_ShowMessage(WPARAM, LPARAM);
-INT_PTR Popup_ShowMessageW(WPARAM, LPARAM);
-
-INT_PTR Popup_Query(WPARAM, LPARAM);
-INT_PTR Popup_GetPluginData(WPARAM, LPARAM);
-INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_RegisterVfx(WPARAM wParam, LPARAM lParam);
-
-INT_PTR Popup_RegisterPopupClass(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam);
-INT_PTR Popup_DeletePopup(WPARAM, LPARAM lParam);
-
-INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam);
-
-#endif // __services_h__
diff --git a/plugins/Popup/src/stdafx.h b/plugins/Popup/src/stdafx.h
index 56b645dd55..8d297fd0e0 100644
--- a/plugins/Popup/src/stdafx.h
+++ b/plugins/Popup/src/stdafx.h
@@ -74,6 +74,7 @@ https://miranda-ng.org/distr/
#include <m_contacts.h>
#include <m_clc.h>
#include <m_icolib.h>
+#include <m_idle.h>
#include <m_genmenu.h>
#include <m_hotkeys.h>
#include <m_fontservice.h>
@@ -116,7 +117,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
#include "opt_contacts.h"
#include "opt_adv.h"
#include "history.h"
-#include "services.h"
#include "srmm_menu.h"
#include "bitmap_funcs.h"
#include "font.h"
@@ -137,5 +137,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM);
void InitIcons();
+void CreateServices();
#endif //HEADERS_H
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h
index 366359fcc4..2e900403c3 100644
--- a/plugins/Popup/src/version.h
+++ b/plugins/Popup/src/version.h
@@ -1,6 +1,6 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
-#define __RELEASE_NUM 2
+#define __RELEASE_NUM 3
#define __BUILD_NUM 0
#include <stdver.h>