diff options
53 files changed, 647 insertions, 450 deletions
diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 77d111d9ae..99e617cd5b 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _IMAGELIST* HIMAGELIST; #endif -#include <m_core.h> +#include <m_gui.h> #include <m_database.h> #include <m_protocols.h> @@ -212,6 +212,7 @@ public: int addFrame(const struct CLISTFrame*); int addHotkey(const struct HOTKEYDESC*); + int addPopupOption(const char *pszDescr, CMOption<bool> &pVar); int addSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr); int addUserInfo(WPARAM wParam, struct OPTIONSDIALOGPAGE *odp); diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 521b025b7a..d1f938908f 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex fd9472c8ec..da04590002 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index c489ddd1d9..95068d4ce1 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -19,8 +19,6 @@ #include "stdafx.h"
-HGENMENU g_hTogglePopupsMenuItem;
-
CMPlugin g_plugin;
COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview)
@@ -42,8 +40,10 @@ PLUGININFOEX pluginInfoEx = { };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bPopups(MODULENAME, "PopupNotify", true)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -241,7 +241,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) _ASSERT(hContact);
return 0;
}
- if (PerContactSetting == NOTIFY_ALWAYS || (PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || -1 == PcreCheck(sd.MirVer)))) {
+ if (PerContactSetting == NOTIFY_ALWAYS || (g_plugin.bPopups && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || -1 == PcreCheck(sd.MirVer)))) {
ShowPopup(&sd);
Skin_PlaySound(CLIENTCHANGED_SOUND);
}
@@ -259,22 +259,6 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
-static INT_PTR srvTogglePopups(WPARAM, LPARAM)
-{
- g_PopupOptPage.SetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY, !g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY));
- return 0;
-}
-
-static int PrebuildMainMenu(WPARAM, LPARAM)
-{
- // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
- if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY))
- Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Disable c&lient change notification"), IcoLib_GetIconHandle("popup_enabled"));
- else
- Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Enable c&lient change notification"), IcoLib_GetIconHandle("popup_disabled"));
- return 0;
-}
-
INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM)
{
switch (uMsg) {
@@ -311,23 +295,6 @@ static int MirandaLoaded(WPARAM, LPARAM) PopupOptPage.DBToMem();
RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS));
- g_plugin.addSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed"));
-
- CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups);
- HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu);
-
- CMenuItem mi(&g_plugin);
- SET_UID(mi, 0xfabb9181, 0xdb92, 0x43f4, 0x86, 0x40, 0xca, 0xb6, 0x4c, 0x93, 0x34, 0x27);
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
- mi.flags = CMIF_UNICODE;
- if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY))
- mi.name.w = LPGENW("Disable c&lient change notification");
- else
- mi.name.w = LPGENW("Enable c&lient change notification");
-
- mi.pszService = MS_CCN_TOGGLEPOPUPS;
- g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi);
-
// seems that Fingerprint is not installed
if (!bFingerprintExists && !g_plugin.getByte(DB_NO_FINGERPRINT_ERROR, 0))
CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc);
@@ -343,6 +310,10 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
+ addPopupOption(LPGEN("Client change notifications"), bPopups);
+
+ addSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed"));
+
InitOptions();
if (g_plugin.getByte(DB_SETTINGSVER, 0) < 1) {
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 536334e4a4..15e7879c32 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -27,7 +27,7 @@ void EnablePopupOptDlgControls() {
int I;
g_PopupOptPage.PageToMem();
- bool UsePopups = g_PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) != 0;
+ bool UsePopups = g_plugin.bPopups;
for (I = 0; I < g_PopupOptPage.Items.GetSize(); I++) {
switch (g_PopupOptPage.Items[I]->GetParam()) {
case IDC_POPUPOPTDLG_POPUPNOTIFY:
diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index 4775140184..7053a56ed4 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -49,8 +49,10 @@ #include "m_genmenu.h"
#include "m_metacontacts.h"
#include "m_netlib.h"
+#include "m_gui.h"
#include "m_fingerprint.h"
+#include "m_variables.h"
#include <pcre.h>
@@ -58,6 +60,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ CMOption<bool> bPopups;
+
int Load() override;
};
@@ -116,10 +120,6 @@ extern BOOL bFingerprintExists; extern COptPage g_PopupOptPage;
extern COptPage *g_PreviewOptPage;
-#define MS_VARS_FORMATSTRING "Vars/FormatString"
-#define MS_CCN_TOGGLEPOPUPS "ClientChangeNotify/TogglePopups"
-
-
static __inline CString LogMessage(const char *Format, ...)
{
va_list va;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 21d3f0d826..0dab268428 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -232,7 +232,7 @@ static int Backup(wchar_t *backup_filename) bZip = true;
}
- if (!g_plugin.disable_popups)
+ if (g_plugin.bPopups)
ShowPopup(dbname, TranslateT("Backup in progress"), nullptr);
HWND progress_dialog = nullptr;
@@ -276,7 +276,7 @@ static int Backup(wchar_t *backup_filename) wchar_t *pd = wcsrchr(dest_file, '\\');
- if (!g_plugin.disable_popups) {
+ if (g_plugin.bPopups) {
CMStringW puText;
if (pd && mir_wstrlen(dest_file) > 50) {
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 1b898f31c2..b629e5c657 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -2,7 +2,6 @@ CMPlugin g_plugin;
-HGENMENU g_hPopupMenu;
HANDLE hFolder;
char g_szMirVer[100];
@@ -35,22 +34,13 @@ CMPlugin::CMPlugin() : num_backups(MODULENAME, "NumBackups", 3),
file_mask(MODULENAME, "FileMask", L"%miranda_profilename%_%currtime%_%compname%"),
disable_progress(MODULENAME, "NoProgress", 0),
- disable_popups(MODULENAME, "NoPopups", 0),
+ bPopups(MODULENAME, "Popups", 1),
use_zip(MODULENAME, "UseZip", 0),
backup_profile(MODULENAME, "BackupProfile", 0),
use_cloudfile(MODULENAME, "UseCloudFile", 0),
cloudfile_service(MODULENAME, "CloudFileService", nullptr)
{
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static void UpdateMenuIcons()
-{
- if (g_plugin.disable_popups)
- Menu_ModifyItem(g_hPopupMenu, LPGENW("Enable &AutoBackups notification"), Skin_GetIconHandle(SKINICON_OTHER_NOPOPUP));
- else
- Menu_ModifyItem(g_hPopupMenu, LPGENW("Disable &AutoBackups notification"), Skin_GetIconHandle(SKINICON_OTHER_POPUP));
+ folder[0] = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -91,13 +81,6 @@ static int FoldersGetBackupPath(WPARAM, LPARAM) return 0;
}
-static INT_PTR OnTogglePopups(WPARAM, LPARAM)
-{
- g_plugin.disable_popups = !g_plugin.disable_popups;
- UpdateMenuIcons();
- return 0;
-}
-
static int PluginLoaded(WPARAM, LPARAM)
{
g_plugin.bCloudFilePresent = ServiceExists(MS_CLOUDFILE_UPLOAD);
@@ -126,15 +109,6 @@ static int ModulesLoad(WPARAM, LPARAM) mi.position = 500100001;
Menu_AddMainMenuItem(&mi);
- // Popup menu item
- SET_UID(mi, 0xe9250a75, 0x30da, 0x42f2, 0x85, 0x27, 0x54, 0x24, 0x62, 0x59, 0x9e, 0xae);
- mi.position = 0;
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
- mi.pszService = "DbAutoBackup/EnableDisableMenuCommand";
- g_hPopupMenu = Menu_AddMainMenuItem(&mi);
- UpdateMenuIcons();
- CreateServiceFunction(mi.pszService, &OnTogglePopups);
-
if (hFolder = FoldersRegisterCustomPathW(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
FoldersGetBackupPath(0, 0);
@@ -171,6 +145,11 @@ static int OkToExit(WPARAM, LPARAM) int CMPlugin::Load()
{
+ if (getBool("NoPopups")) {
+ bPopups = false;
+ delSetting("NoPopups");
+ }
+
Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit);
@@ -178,7 +157,9 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULELOAD, PluginLoaded);
HookEvent(ME_SYSTEM_MODULEUNLOAD, PluginLoaded);
- g_plugin.registerIcon(LPGEN("Database") "/" LPGEN("Database backups"), iconList);
+ addPopupOption(LPGEN("AutoBackups notifications"), bPopups);
+
+ registerIcon(LPGEN("Database") "/" LPGEN("Database backups"), iconList);
CreateServiceFunction(MS_AB_BACKUP, ABService);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h index 9c84fc678c..f569f099bd 100644 --- a/plugins/Db_autobackups/src/stdafx.h +++ b/plugins/Db_autobackups/src/stdafx.h @@ -38,20 +38,20 @@ struct CMPlugin : public PLUGIN<CMPlugin> CMPlugin();
bool bCloudFilePresent = false;
- HANDLE hevBackup;
+ HANDLE hevBackup = nullptr;
wchar_t folder[MAX_PATH];
CMOption<uint8_t> backup_types;
- CMOption<uint16_t> period;
+ CMOption<uint16_t> period;
CMOption<uint8_t> period_type;
- CMOption<wchar_t*> file_mask;
- CMOption<uint16_t> num_backups;
+ CMOption<wchar_t*> file_mask;
+ CMOption<uint16_t> num_backups;
CMOption<uint8_t> disable_progress;
- CMOption<uint8_t> disable_popups;
+ CMOption<bool> bPopups;
CMOption<uint8_t> use_zip;
CMOption<uint8_t> backup_profile;
CMOption<uint8_t> use_cloudfile;
- CMOption<char*> cloudfile_service;
+ CMOption<char*> cloudfile_service;
int Load() override;
};
diff --git a/plugins/ExternalAPI/m_proxySwitch.h b/plugins/ExternalAPI/m_proxySwitch.h index 286afcde61..d21bb6af99 100644 --- a/plugins/ExternalAPI/m_proxySwitch.h +++ b/plugins/ExternalAPI/m_proxySwitch.h @@ -3,6 +3,5 @@ #define MS_PROXYSWITCH_SHOWMYIPADDRS "proxySwitch/ShowMyIPAddrs" #define MS_PROXYSWITCH_PROXYENABLE "proxySwitch/ProxyEnable" #define MS_PROXYSWITCH_PROXYDISABLE "proxySwitch/ProxyDisable" -#define MS_PROXYSWITCH_POPUPSWITCH "proxySwitch/PopupSwitch" #define MS_PROXYSWITCH_COPYIP2CLIP "proxySwitch/CopyIP2Clipboard" #endif diff --git a/plugins/NewEventNotify/neweventnotify.vcxproj b/plugins/NewEventNotify/neweventnotify.vcxproj index 59e3cdb516..afe0d759c5 100644 --- a/plugins/NewEventNotify/neweventnotify.vcxproj +++ b/plugins/NewEventNotify/neweventnotify.vcxproj @@ -27,7 +27,6 @@ </ImportGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\menuitem.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\popup.cpp" />
<ClCompile Include="src\stdafx.cxx">
diff --git a/plugins/NewEventNotify/neweventnotify.vcxproj.filters b/plugins/NewEventNotify/neweventnotify.vcxproj.filters index e99acbf5da..cc4b3e56fe 100644 --- a/plugins/NewEventNotify/neweventnotify.vcxproj.filters +++ b/plugins/NewEventNotify/neweventnotify.vcxproj.filters @@ -5,9 +5,6 @@ <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\menuitem.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 8039f7bd4b..051177106e 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -46,7 +46,8 @@ PLUGININFOEX pluginInfoEx = };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bPopups(MODULENAME, "Popups", true)
{}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -59,7 +60,7 @@ CMPlugin::CMPlugin() : int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent)
{
//are popups currently enabled?
- if (g_plugin.bDisable)
+ if (!g_plugin.bPopups)
return 0;
//get DBEVENTINFO without pBlob
@@ -113,8 +114,6 @@ int HookedInit(WPARAM, LPARAM) if (ServiceExists("PluginSweeper/Add"))
CallService("PluginSweeper/Add", (WPARAM)MODULENAME, (LPARAM)MODULENAME);
- if (g_plugin.bMenuitem)
- MenuitemInit(!g_plugin.bDisable);
return 0;
}
@@ -122,10 +121,17 @@ int HookedInit(WPARAM, LPARAM) int CMPlugin::Load()
{
+ if (getBool(OPT_DISABLE)) {
+ bPopups = false;
+ delSetting(OPT_DISABLE);
+ }
+
HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit);
HookEvent(ME_OPT_INITIALISE, OptionsAdd);
- g_plugin.OptionsRead();
+ addPopupOption(LPGEN("New event notifications"), bPopups);
+
+ OptionsRead();
return 0;
}
diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp deleted file mode 100644 index 42cb38e813..0000000000 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*
- Name: NewEventNotify - Plugin for Miranda IM
- File: mi.c - Manages item(s) in the Miranda Menu
- Version: 0.0.4
- Description: Notifies you about some events
- Author: icebreaker, <icebreaker@newmail.net>
- Date: 22.07.02 19:56 / Update: 24.07.02 01:39
- Copyright: (C) 2002 Starzinger Michael
-
- 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
-*/
-
-#include "stdafx.h"
-
-HGENMENU hMenuitemNotify;
-BOOL bNotify;
-
-static INT_PTR MenuitemNotifyCmd(WPARAM, LPARAM)
-{
- bNotify = !bNotify;
- MenuitemUpdate(bNotify);
-
- // write changes to options->bDisable and into database
- Opt_DisableNEN(!bNotify);
- return 0;
-}
-
-int MenuitemUpdate(BOOL bStatus)
-{
- if (bStatus)
- Menu_ModifyItem(hMenuitemNotify, MENUITEM_DISABLE, Skin_GetIconHandle(SKINICON_OTHER_POPUP));
- else
- Menu_ModifyItem(hMenuitemNotify, MENUITEM_ENABLE, Skin_GetIconHandle(SKINICON_OTHER_NOPOPUP));
- return 0;
-}
-
-int MenuitemInit(BOOL bStatus)
-{
- HGENMENU hRoot = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
-
- CMenuItem mi(&g_plugin);
- SET_UID(mi, 0x7aed93f7, 0x835, 0x4ff6, 0xb1, 0x34, 0xae, 0x0, 0x21, 0x2a, 0xd7, 0x81);
- mi.root = hRoot;
- mi.position = 1;
- mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_POPUP);
- mi.pszService = "NewEventNotify/MenuitemNotifyCommand";
- mi.flags = 0;
- hMenuitemNotify = Menu_AddMainMenuItem(&mi);
-
- CreateServiceFunction(mi.pszService, MenuitemNotifyCmd);
-
- bNotify = bStatus;
- MenuitemUpdate(bNotify);
- return 0;
-}
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index c035cd93f1..c9f5354ea3 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -26,11 +26,9 @@ void CMPlugin::OptionsRead(void)
{
- bDisable = getBool(OPT_DISABLE, false);
bMUCDisable = getBool(OPT_MUCDISABLE, false);
bPreview = getBool(OPT_PREVIEW, true);
- bMenuitem = getBool(OPT_MENUITEM, false);
bMergePopup = getBool(OPT_MERGEPOPUP, true);
bMsgWindowCheck = getBool(OPT_MSGWINDOWCHECK, true);
bMsgReplyWindow = getBool(OPT_MSGREPLYWINDOW, false);
@@ -74,11 +72,9 @@ void CMPlugin::OptionsRead(void) void CMPlugin::OptionsWrite(void)
{
- setByte(OPT_DISABLE, bDisable);
setByte(OPT_MUCDISABLE, bMUCDisable);
setByte(OPT_PREVIEW, bPreview);
- setByte(OPT_MENUITEM, bMenuitem);
setByte(OPT_MERGEPOPUP, bMergePopup);
setByte(OPT_MSGWINDOWCHECK, bMsgWindowCheck);
setByte(OPT_MSGREPLYWINDOW, bMsgReplyWindow);
@@ -132,7 +128,6 @@ class COptionsBaseDlg : public CDlgBase void OnFinish(CDlgBase *)
{
g_plugin.OptionsWrite();
- MenuitemUpdate(!g_plugin.bDisable);
}
public:
@@ -145,9 +140,6 @@ public: void OnReset() override
{
g_plugin.OptionsRead();
-
- // maybe something changed with the mi
- MenuitemUpdate(!g_plugin.bDisable);
}
};
@@ -214,9 +206,8 @@ public: spinMessage(this, IDC_SPIN_MESSAGE, 1000, -1)
{
auto *pwszSection = TranslateT("General options");
- m_opts.AddOption(pwszSection, TranslateT("Show entry in the Popups menu"), g_plugin.bMenuitem);
m_opts.AddOption(pwszSection, TranslateT("Show preview of event in popup"), g_plugin.bPreview);
- m_opts.AddOption(pwszSection, TranslateT("Disable event notifications for instant messages"), g_plugin.bDisable);
+ m_opts.AddOption(pwszSection, TranslateT("Enable event notifications for instant messages"), g_plugin.bPopups);
m_opts.AddOption(pwszSection, TranslateT("Disable event notifications for group chats"), g_plugin.bMUCDisable);
pwszSection = TranslateT("Notify me of...");
@@ -419,10 +410,3 @@ int OptionsAdd(WPARAM addInfo, LPARAM) g_plugin.addOptions(addInfo, &odp);
return 0;
}
-
-int Opt_DisableNEN(BOOL Status)
-{
- g_plugin.bDisable = Status;
- g_plugin.OptionsWrite(); // JK: really necessary to write everything here ????
- return 0;
-}
diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index 1e0f5d515a..a83ef4c160 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -136,9 +136,6 @@ #define MENUITEM_NAME LPGEN("Notify of new events")
-#define MENUITEM_ENABLE LPGENW("Enable new event notification")
-#define MENUITEM_DISABLE LPGENW("Disable new event notification")
-
//---------------------------
//---Structures
@@ -151,10 +148,10 @@ struct CMPlugin : public PLUGIN<CMPlugin> void OptionsRead(void);
void OptionsWrite(void);
- bool bDisable;
+ CMOption<bool> bPopups;
+
bool bMUCDisable;
bool bPreview;
- bool bMenuitem;
bool bDisableNonMessage;
bool bMsgWindowCheck;
bool bMsgReplyWindow;
@@ -204,9 +201,6 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType); int PopupUpdate(PLUGIN_DATA &pdata, MEVENT hEvent);
int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA *pdata);
int OptionsAdd(WPARAM addInfo, LPARAM);
-int Opt_DisableNEN(BOOL Status);
-int MenuitemInit(BOOL bStatus);
-int MenuitemUpdate(BOOL bStatus);
int CheckMsgWnd(MCONTACT hContact);
PLUGIN_DATA* PU_GetByContact(MCONTACT hContact, UINT eventType);
diff --git a/plugins/NewXstatusNotify/res/main_off.ico b/plugins/NewXstatusNotify/res/main_off.ico Binary files differdeleted file mode 100644 index f2cc323064..0000000000 --- a/plugins/NewXstatusNotify/res/main_off.ico +++ /dev/null diff --git a/plugins/NewXstatusNotify/res/main_on.ico b/plugins/NewXstatusNotify/res/main_on.ico Binary files differdeleted file mode 100644 index 23921f8a7f..0000000000 --- a/plugins/NewXstatusNotify/res/main_on.ico +++ /dev/null diff --git a/plugins/NewXstatusNotify/res/resource.rc b/plugins/NewXstatusNotify/res/resource.rc index 3c9cced358..a21bdb9b4a 100644 --- a/plugins/NewXstatusNotify/res/resource.rc +++ b/plugins/NewXstatusNotify/res/resource.rc @@ -346,8 +346,6 @@ END // remains consistent on all systems.
IDI_RESET ICON "reset.ico"
IDI_SOUND ICON "sound.ico"
-IDI_NOTIFICATION_OFF ICON "main_off.ico"
-IDI_NOTIFICATION_ON ICON "main_on.ico"
IDI_XSTATUS ICON "xstatus.ico"
IDI_DISABLEALL ICON "disable_all.ico"
IDI_ENABLEALL ICON "enable_all.ico"
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 4b195b0982..7ee5fdfd62 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -40,8 +40,6 @@ IconItem iconList[ICO_MAXID] = {
{ LPGEN("Reset"), "reset", IDI_RESET },
{ LPGEN("Sounds"), "sound", IDI_SOUND },
- { LPGEN("Notification enabled"), "notification_off", IDI_NOTIFICATION_OFF },
- { LPGEN("Notification disabled"), "notification_on", IDI_NOTIFICATION_ON },
{ LPGEN("Extra status notify"), "xstatus", IDI_XSTATUS },
{ LPGEN("Disable all"), "disable_all", IDI_DISABLEALL },
{ LPGEN("Enable all"), "enable_all", IDI_ENABLEALL },
@@ -68,8 +66,10 @@ PLUGININFOEX pluginInfoEx = };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bPopups(MODULENAME, "Popups", true)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -422,7 +422,7 @@ int ContactStatusChanged(MCONTACT hContact, uint16_t oldStatus, uint16_t newStat bEnablePopup = g_plugin.getByte(statusIDp, 1) ? FALSE : TRUE;
}
- if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && !opt.TempDisabled) {
+ if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && g_plugin.bPopups) {
int wStatus = Proto_GetStatus(szProto);
wchar_t str[MAX_SECONDLINE] = { 0 };
if (opt.ShowStatus)
@@ -439,14 +439,14 @@ int ContactStatusChanged(MCONTACT hContact, uint16_t oldStatus, uint16_t newStat ShowChangePopup(hContact, Skin_LoadProtoIcon(szProto, newStatus), newStatus, str, pdp);
}
- if (opt.BlinkIcon && !opt.TempDisabled) {
+ if (opt.BlinkIcon && g_plugin.bPopups) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, newStatus) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
wchar_t str[256];
mir_snwprintf(str, TranslateT("%s is now %s"), Clist_GetContactDisplayName(hContact), StatusList[Index(newStatus)].lpzStandardText);
BlinkIcon(hContact, hIcon, str);
}
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && g_plugin.bPopups) {
if (oldStatus == ID_STATUS_OFFLINE)
PlayChangeSound(hContact, StatusListEx[ID_STATUS_FROMOFFLINE].lpzSkinSoundName);
else
@@ -679,7 +679,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (g_plugin.getByte(szProto, 1) == 0 && !opt.PSMsgOnConnect)
bEnablePopup = false;
- if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && !opt.TempDisabled) {
+ if (bEnablePopup && g_plugin.getByte(hContact, "EnablePopups", 1) && g_plugin.bPopups) {
// cut message if needed
wchar_t *copyText = nullptr;
if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_wstrlen(smi.newstatusmsg) > opt.PSMsgLen)) {
@@ -729,14 +729,14 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) }
}
- if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled) {
+ if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && g_plugin.bPopups) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
wchar_t str[256];
mir_snwprintf(str, TranslateT("%s changed status message to %s"), Clist_GetContactDisplayName(hContact), smi.newstatusmsg);
BlinkIcon(hContact, hIcon, str);
}
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && !opt.TempDisabled) {
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", TRUE) && g_plugin.getByte(hContact, "EnableSounds", 1) && g_plugin.bPopups) {
if (smi.compare == COMPARE_DEL)
PlayChangeSound(hContact, StatusListEx[ID_STATUS_SMSGREMOVED].lpzSkinSoundName);
else
@@ -1026,32 +1026,6 @@ int ProtoAck(WPARAM, LPARAM lParam) return 0;
}
-INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
-{
- g_plugin.setByte("TempDisable", opt.TempDisabled = !opt.TempDisabled);
-
- if (opt.TempDisabled)
- Menu_ModifyItem(hEnableDisableMenu, LPGENW("Enable status notification"), iconList[ICO_NOTIFICATION_OFF].hIcolib);
- else
- Menu_ModifyItem(hEnableDisableMenu, LPGENW("Disable status notification"), iconList[ICO_NOTIFICATION_ON].hIcolib);
-
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton, opt.TempDisabled ? 0 : TTBST_PUSHED);
- return 0;
-}
-
-void InitMainMenuItem()
-{
- CMenuItem mi(&g_plugin);
- SET_UID(mi, 0x22b7b4db, 0xa9a1, 0x4d43, 0x88, 0x80, 0x4c, 0x23, 0x20, 0x31, 0xc6, 0xa0);
- mi.flags = CMIF_UNICODE;
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
- mi.pszService = MS_STATUSCHANGE_MENUCOMMAND;
- hEnableDisableMenu = Menu_AddMainMenuItem(&mi);
-
- opt.TempDisabled = !opt.TempDisabled;
- EnableDisableMenuCommand(0, 0);
-}
-
static void InitSound()
{
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
@@ -1061,28 +1035,10 @@ static void InitSound() g_plugin.addSound(StatusListEx[i].lpzSkinSoundName, LPGENW("Status Notify"), StatusListEx[i].lpzSkinSoundDesc);
}
-static int InitTopToolbar(WPARAM, LPARAM)
-{
- TTBButton tbb = {};
- tbb.pszService = MS_STATUSCHANGE_MENUCOMMAND;
- tbb.dwFlags = (opt.TempDisabled ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON;
- tbb.name = LPGEN("Toggle status notification");
- tbb.hIconHandleUp = iconList[ICO_NOTIFICATION_OFF].hIcolib;
- tbb.hIconHandleDn = iconList[ICO_NOTIFICATION_ON].hIcolib;
- tbb.pszTooltipUp = LPGEN("Enable status notification");
- tbb.pszTooltipDn = LPGEN("Disable status notification");
- hToolbarButton = g_plugin.addTTB(&tbb);
-
- return 0;
-}
-
static int ModulesLoaded(WPARAM, LPARAM)
{
- InitMainMenuItem();
-
HookEvent(ME_USERINFO_INITIALISE, UserInfoInitialise);
HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent);
- HookEvent(ME_TTB_MODULELOADED, InitTopToolbar);
SecretWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", L"ConnectionTimerWindow", 0,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
@@ -1105,7 +1061,14 @@ static int OnShutdown(WPARAM, LPARAM) int CMPlugin::Load()
{
- g_plugin.registerIcon(LPGEN("New Status Notify"), iconList, MODULENAME);
+ if (getByte("TempDisable")) {
+ bPopups = false;
+ delSetting("TempDisable");
+ }
+
+ addPopupOption(LPGEN("Status notifications"), bPopups);
+
+ registerIcon(LPGEN("New Status Notify"), iconList, MODULENAME);
//"Service" Hook, used when the DB settings change: we'll monitor the "status" setting.
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
@@ -1137,11 +1100,9 @@ int CMPlugin::Load() evtype.module = MODULENAME;
evtype.eventType = EVENTTYPE_STATUSCHANGE;
evtype.descr = LPGEN("Status change");
- evtype.eventIcon = iconList[ICO_NOTIFICATION_OFF].hIcolib;
+ evtype.eventIcon = iconList[ICO_XSTATUS].hIcolib;
evtype.flags = DETF_HISTORY | DETF_MSGWINDOW;
DbEvent_RegisterType(&evtype);
-
- CreateServiceFunction(MS_STATUSCHANGE_MENUCOMMAND, EnableDisableMenuCommand);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 5852d4cbc9..3bca081936 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -111,7 +111,6 @@ void LoadOptions() opt.PSMsgLen = g_plugin.getDword("PSMsgLen", 64);
// OTHER
- opt.TempDisabled = g_plugin.getByte("TempDisable", 0);
opt.EnableLastSeen = g_plugin.getByte("EnableLastSeen", 0);
LoadTemplates();
diff --git a/plugins/NewXstatusNotify/src/options.h b/plugins/NewXstatusNotify/src/options.h index 2355b7602f..eec6be1b24 100644 --- a/plugins/NewXstatusNotify/src/options.h +++ b/plugins/NewXstatusNotify/src/options.h @@ -83,7 +83,6 @@ struct OPTIONS uint32_t PSMsgLen;
// OTHER
- uint8_t TempDisabled;
uint8_t PopupAutoDisabled;
uint8_t SoundAutoDisabled;
uint8_t EnableLastSeen;
diff --git a/plugins/NewXstatusNotify/src/resource.h b/plugins/NewXstatusNotify/src/resource.h index 4b3b9784f4..d870a28716 100644 --- a/plugins/NewXstatusNotify/src/resource.h +++ b/plugins/NewXstatusNotify/src/resource.h @@ -19,8 +19,6 @@ #define IDI_XSTATUS 120
#define IDI_DISABLEALL 121
#define IDI_ENABLEALL 122
-#define IDI_NOTIFICATION_OFF 123
-#define IDI_NOTIFICATION_ON 124
#define IDI_STATUS_MESSAGE 125
#define IDC_STATUS_STATIC_INFINITE 1002
#define IDC_STATUS_STATIC_DEFAULT 1003
diff --git a/plugins/NewXstatusNotify/src/stdafx.h b/plugins/NewXstatusNotify/src/stdafx.h index d4fde75939..2e2806d654 100644 --- a/plugins/NewXstatusNotify/src/stdafx.h +++ b/plugins/NewXstatusNotify/src/stdafx.h @@ -71,6 +71,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ CMOption<bool> bPopups;
+
int Load() override;
int Unload() override;
};
@@ -108,8 +110,6 @@ enum {
ICO_RESET,
ICO_SOUND,
- ICO_NOTIFICATION_OFF,
- ICO_NOTIFICATION_ON,
ICO_XSTATUS,
ICO_DISABLEALL,
ICO_ENABLEALL,
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 292de34fd7..72381c301d 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -375,13 +375,13 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) if (opt.PXDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
bEnableSound = bEnablePopup = false;
- if (bEnablePopup && g_plugin.getByte(xsc->hContact, "EnablePopups", 1) && !opt.TempDisabled)
+ if (bEnablePopup && g_plugin.getByte(xsc->hContact, "EnablePopups", 1) && g_plugin.bPopups)
ShowXStatusPopup(xsc);
- if (bEnableSound && db_get_b(0, "Skin", "UseSound", 1) && g_plugin.getByte(xsc->hContact, "EnableSounds", 1) && !opt.TempDisabled)
+ if (bEnableSound && db_get_b(0, "Skin", "UseSound", 1) && g_plugin.getByte(xsc->hContact, "EnableSounds", 1) && g_plugin.bPopups)
PlayXStatusSound(xsc->hContact, xsc->action);
- if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled)
+ if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && g_plugin.bPopups)
BlinkXStatusIcon(xsc);
if (opt.XLogDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index 5d61c866ed..d8ced5f0fe 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -24,10 +24,11 @@ PLUGININFOEX pluginInfoEx = }; CMPlugin::CMPlugin() : - PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx) -{} + PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx), + bPopups(MODULENAME, "PopupEnabled", true) +{ +} -HGENMENU hEnableDisablePopupMenu = 0; HGENMENU hMenuRoot; OBJLIST<ACTIVE_CONNECTION> g_arConnections(10, PtrKeySortT); @@ -42,7 +43,6 @@ wchar_t opt_useProxy[MAX_IPLIST_LENGTH]; wchar_t opt_noProxy[MAX_IPLIST_LENGTH]; wchar_t opt_hideIntf[MAX_IPLIST_LENGTH]; UINT opt_defaultColors; -UINT opt_popups; UINT opt_showProxyState; UINT opt_miranda; UINT opt_ie; @@ -55,7 +55,6 @@ COLORREF opt_txtColor; static HANDLE hEventConnect = NULL; static HANDLE hEventDisconnect = NULL; -static HANDLE hSvcPopupSwitch = NULL; static HANDLE hSvcProxyDisable = NULL; static HANDLE hSvcProxyEnable = NULL; static HANDLE hSvcShowMyIP = NULL; @@ -154,32 +153,6 @@ void UpdateInterfacesMenu(void) /* ################################################################################ */ -void UpdatePopupMenu(BOOL State) -{ - if (!hEnableDisablePopupMenu) - return; - - // popup is now disabled - if (State == FALSE) { - Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Enable &IP change notification")); - // mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_NOTIF_0)); - } - else { - Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Disable &IP change notification")); - // mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_NOTIF_1)); - } -} - -static INT_PTR PopupSwitch(WPARAM, LPARAM) -{ - opt_popups = !opt_popups; - UpdatePopupMenu(opt_popups); - SaveSettings(); - return 0; -} - -/* ################################################################################ */ - int CMPlugin::Load() { char proxy = -1; @@ -190,6 +163,8 @@ int CMPlugin::Load() LoadSettings(); + addPopupOption(LPGEN("IP change notification"), bPopups); + Create_NIF_List_Ex(&g_arNIF); if (opt_ie || opt_miranda || opt_firefox) { @@ -273,15 +248,6 @@ int Init(WPARAM, LPARAM) } UpdateInterfacesMenu(); - - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000); - mi.name.w = LPGENW("IP change notification"); - mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); - mi.pszService = MS_PROXYSWITCH_POPUPSWITCH; - hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); - hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch); - - UpdatePopupMenu(opt_popups); return 0; } diff --git a/plugins/ProxySwitch/src/opt.cpp b/plugins/ProxySwitch/src/opt.cpp index 3f9048ce3e..917353ea8f 100644 --- a/plugins/ProxySwitch/src/opt.cpp +++ b/plugins/ProxySwitch/src/opt.cpp @@ -45,14 +45,14 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) SetDlgItemText(hdlg, IDC_EDIT_HIDEINTF, opt_hideIntf); SendDlgItemMessage(hdlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, opt_bgColor); SendDlgItemMessage(hdlg, IDC_TEXTCOLOR, CPM_SETCOLOUR, 0, opt_txtColor); - CheckDlgButton(hdlg, IDC_CHECK_POPUPS, opt_popups ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_CHECK_POPUPS, g_plugin.bPopups ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_DEFAULTCOLORS, opt_defaultColors ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_SHOWPROXYSTATUS, opt_showProxyState ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hdlg, IDC_CHECK_FIREFOX), Firefox_Installed()); - EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), opt_popups && !opt_defaultColors); - EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), opt_popups && !opt_defaultColors); - EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), opt_popups); - EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), opt_popups); + EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), g_plugin.bPopups && !opt_defaultColors); + EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), g_plugin.bPopups && !opt_defaultColors); + EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), g_plugin.bPopups); + EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), g_plugin.bPopups); ShowWindow(GetDlgItem(hdlg, IDC_RESTARTREQUIRED), opt_not_restarted ? SW_SHOW : SW_HIDE); TranslateDialogDefault(hdlg); opt_startup = FALSE; @@ -69,13 +69,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) opt_ie = IsDlgButtonChecked(hdlg, IDC_CHECK_IE); opt_firefox = IsDlgButtonChecked(hdlg, IDC_CHECK_FIREFOX); opt_alwayReconnect = IsDlgButtonChecked(hdlg, IDC_CHECK_ALWAY_RECONNECT); - opt_popups = IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS); + g_plugin.bPopups = IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS); opt_defaultColors = IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS); opt_showProxyState = IsDlgButtonChecked(hdlg, IDC_CHECK_SHOWPROXYSTATUS); opt_bgColor = SendDlgItemMessage(hdlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0); opt_txtColor = SendDlgItemMessage(hdlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0); SaveSettings(); - UpdatePopupMenu(opt_popups); return 1; } break; @@ -161,7 +160,6 @@ void LoadSettings(void) opt_ie = g_plugin.getByte("ManageIEProxy", FALSE); opt_firefox = g_plugin.getByte("ManageFirefoxProxy", FALSE) && Firefox_Installed(); opt_alwayReconnect = g_plugin.getByte("AlwaysReconnect", FALSE); - opt_popups = g_plugin.getByte("PopupEnabled", TRUE); opt_defaultColors = g_plugin.getByte("PopupDefaultColors", TRUE); opt_showProxyState = g_plugin.getByte("ShowProxyStatus", TRUE); opt_bgColor = g_plugin.getDword("PopupBgColor", GetSysColor(COLOR_BTNFACE)); @@ -177,7 +175,6 @@ void SaveSettings(void) g_plugin.setByte("ManageIEProxy", (uint8_t)opt_ie); g_plugin.setByte("ManageFirefoxProxy", (uint8_t)opt_firefox); g_plugin.setByte("AlwaysReconnect", (uint8_t)opt_alwayReconnect); - g_plugin.setByte("PopupEnabled", (uint8_t)opt_popups); g_plugin.setByte("PopupDefaultColors", (uint8_t)opt_defaultColors); g_plugin.setByte("ShowProxyStatus", (uint8_t)opt_showProxyState); g_plugin.setDword("PopupBgColor", (uint32_t)opt_bgColor); diff --git a/plugins/ProxySwitch/src/stdafx.h b/plugins/ProxySwitch/src/stdafx.h index ea19ffdd1a..40d5313fef 100644 --- a/plugins/ProxySwitch/src/stdafx.h +++ b/plugins/ProxySwitch/src/stdafx.h @@ -38,6 +38,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> { CMPlugin(); + CMOption<bool> bPopups; + int Load() override; int Unload() override; }; @@ -96,7 +98,6 @@ extern wchar_t opt_useProxy[MAX_IPLIST_LENGTH]; extern wchar_t opt_noProxy[MAX_IPLIST_LENGTH]; extern wchar_t opt_hideIntf[MAX_IPLIST_LENGTH]; extern UINT opt_defaultColors; -extern UINT opt_popups; extern UINT opt_showProxyState; extern UINT opt_miranda; extern UINT opt_ie; @@ -117,7 +118,6 @@ void PopupMyIPAddrs(const wchar_t *msg); int OptInit(WPARAM wParam, LPARAM lParam); int Init(WPARAM wParam, LPARAM lParam); void UpdateInterfacesMenu(void); -void UpdatePopupMenu(BOOL State); /**** Network ******************************************************************************/ diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index dc5fdca0c8..57c98765d9 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -408,7 +408,6 @@ BEGIN CONTROL "Use &default colors",IDC_USEPOPUPCOLORS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,11,71,235,13
CONTROL "Use &Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,11,84,242,13
CONTROL "Only &one popup for each contact",IDC_ONEPOPUP,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,11,109,250,13
- CONTROL "Show &entry in the main menu",IDC_SHOWMENU,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,11,122,247,13
GROUPBOX "...is typing",IDC_STATIC,8,151,148,58,WS_GROUP
CONTROL "Default",IDC_TIMEOUT_POPUP,"Button",BS_AUTORADIOBUTTON,16,161,130,10
CONTROL "From protocol",IDC_TIMEOUT_PROTO,"Button",BS_AUTORADIOBUTTON,16,172,130,10
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index b5e82e0f2e..139650fe6c 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -661,7 +661,6 @@ #define IDC_WO 31617
#define IDC_TIMEOUT_PERMANENT1 31618
#define IDC_TIMEOUT_PERMANENT 31618
-#define IDC_SHOWMENU 31619
#define IDC_DISABLED 31620
#define IDC_ONEPOPUP 31621
#define IDC_WOCL 31622
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 14b00bea61..0480a23afe 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -1,24 +1,24 @@ #include "stdafx.h"
+static CMOption<bool> g_bPopups(TypigModule, "TypingPopup", true);
+
static HGENMENU hDisableMenu = nullptr;
static MWindowList hPopupsList = nullptr;
-static uint8_t OnePopup;
-static uint8_t ShowMenu;
-static uint8_t StartDisabled;
-static uint8_t StopDisabled;
-static uint8_t Disabled;
-static uint8_t ColorMode;
-static uint8_t TimeoutMode;
-static uint8_t TimeoutMode2;
-static int Timeout;
-static int Timeout2;
-static int newTimeout;
-static int newTimeout2;
-static uint8_t newTimeoutMode;
-static uint8_t newTimeoutMode2;
-static uint8_t newColorMode;
+static uint8_t OnePopup;
+static uint8_t StartDisabled;
+static uint8_t StopDisabled;
+static uint8_t ColorMode;
+static uint8_t TimeoutMode;
+static uint8_t TimeoutMode2;
+static int Timeout;
+static int Timeout2;
+static int newTimeout;
+static int newTimeout2;
+static uint8_t newTimeoutMode;
+static uint8_t newTimeoutMode2;
+static uint8_t newColorMode;
static HANDLE hntfStarted = nullptr;
static HANDLE hntfStopped = nullptr;
@@ -37,21 +37,6 @@ static colorPicker[4] = { IDC_TYPEOFF_TX, "OFF_TX", RGB(0, 0, 0) }
};
-static void UpdateMenuItems()
-{
- if (!Disabled)
- Menu_ModifyItem(hDisableMenu, LPGENW("Disable &typing notification"), Skin_LoadIcon(SKINICON_OTHER_POPUP));
- else
- Menu_ModifyItem(hDisableMenu, LPGENW("Enable &typing notification"), Skin_LoadIcon(SKINICON_OTHER_NOPOPUP));
-}
-
-static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
-{
- Disabled = !Disabled;
- UpdateMenuItems();
- return 0;
-}
-
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
@@ -84,7 +69,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) if (Contact_IsHidden(hContact) || (db_get_dw(hContact, "Ignore", "Mask1", 0) & 1)) // 9 - online notification
return;
- if (Disabled)
+ if (!g_bPopups)
return;
wchar_t *szContactName = Clist_GetContactDisplayName(hContact);
@@ -211,7 +196,6 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(hwndDlg, IDC_STOP, (StopDisabled) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopup) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
newTimeout = Timeout;
newTimeoutMode = TimeoutMode;
@@ -276,7 +260,6 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_ONEPOPUP:
case IDC_CLIST:
case IDC_DISABLED:
- case IDC_SHOWMENU:
case IDC_START:
case IDC_STOP:
case IDC_WOCL:
@@ -455,16 +438,11 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Timeout2 = newTimeout2; TimeoutMode2 = newTimeoutMode2;
ColorMode = newColorMode;
- if (Disabled != IsDlgButtonChecked(hwndDlg, IDC_DISABLED))
- EnableDisableMenuCommand(0, 0);
-
StartDisabled = IsDlgButtonChecked(hwndDlg, IDC_START) ? 0 : 2;
StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4;
OnePopup = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP);
- ShowMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMENU);
db_set_b(0, TypigModule, SET_ONEPOPUP, OnePopup);
- db_set_b(0, TypigModule, SET_SHOWDISABLEMENU, ShowMenu);
db_set_b(0, TypigModule, SET_DISABLED, (uint8_t)(StartDisabled | StopDisabled));
db_set_b(0, TypigModule, SET_COLOR_MODE, ColorMode);
db_set_b(0, TypigModule, SET_TIMEOUT_MODE, TimeoutMode);
@@ -497,10 +475,10 @@ int TN_ModuleInit() hPopupsList = WindowList_Create();
OnePopup = db_get_b(0, TypigModule, SET_ONEPOPUP, DEF_ONEPOPUP);
- ShowMenu = db_get_b(0, TypigModule, SET_SHOWDISABLEMENU, DEF_SHOWDISABLEMENU);
int i = db_get_b(0, TypigModule, SET_DISABLED, DEF_DISABLED);
- Disabled = i & 1;
+ if (i & 1)
+ g_bPopups = false;
StartDisabled = i & 2;
StopDisabled = i & 4;
@@ -514,15 +492,7 @@ int TN_ModuleInit() for (auto &it : colorPicker)
it.color = db_get_dw(0, TypigModule, it.desc, 0);
- if (ShowMenu) {
- CMenuItem mi(&g_plugin);
- SET_UID(mi, 0xe18fd2cf, 0xcf90, 0x459e, 0xb6, 0xe6, 0x70, 0xec, 0xad, 0xc6, 0x73, 0xef);
- mi.pszService = "TypingNotify/EnableDisableMenuCommand";
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
- hDisableMenu = Menu_AddMainMenuItem(&mi);
- UpdateMenuItems();
- CreateServiceFunction(mi.pszService, EnableDisableMenuCommand);
- }
+ g_plugin.addPopupOption(LPGEN("Typing notifications"), g_bPopups);
g_plugin.addSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing"));
g_plugin.addSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing"));
@@ -532,6 +502,6 @@ int TN_ModuleInit() int TN_ModuleDeInit()
{
WindowList_Destroy(hPopupsList);
- db_set_b(0, TypigModule, SET_DISABLED, (uint8_t)(Disabled | StartDisabled | StopDisabled));
+ db_set_b(0, TypigModule, SET_DISABLED, (uint8_t)(StartDisabled | StopDisabled));
return 0;
}
diff --git a/plugins/TabSRMM/src/typingnotify.h b/plugins/TabSRMM/src/typingnotify.h index 3d298dae8b..92a33a3d27 100644 --- a/plugins/TabSRMM/src/typingnotify.h +++ b/plugins/TabSRMM/src/typingnotify.h @@ -30,7 +30,5 @@ #define DEF_COLOR_MODE COLOR_OWN
#define SET_ICON_SETID "IconSet"
#define DEF_ICON_SETID 0
-#define SET_SHOWDISABLEMENU "ShowDisableMenu"
-#define DEF_SHOWDISABLEMENU 1
#define SET_ONEPOPUP "OnePopup"
#define DEF_ONEPOPUP 1
diff --git a/plugins/WhoUsesMyFiles/src/stdafx.h b/plugins/WhoUsesMyFiles/src/stdafx.h index db434fd83b..e6e88d1f8f 100644 --- a/plugins/WhoUsesMyFiles/src/stdafx.h +++ b/plugins/WhoUsesMyFiles/src/stdafx.h @@ -49,7 +49,6 @@ struct WUMF_OPTIONS
{
- BOOL PopupsEnabled;
BOOL UseWinColor;
BOOL UseDefColor;
BOOL SelectColor;
@@ -109,6 +108,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ CMOption<bool> bPopups;
+
int Load() override;
int Unload() override;
};
@@ -132,5 +133,4 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info); void printError(uint32_t res);
#define msg(X) MessageBox(NULL, X, L"WUMF", MB_OK|MB_ICONSTOP)
-#define MS_WUMF_SWITCHPOPUP "WUMF/SwitchPopup"
#define MS_WUMF_CONNECTIONSSHOW "WUMF/ShowConnections"
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index c2d037e673..500dea74a2 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -200,7 +200,7 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info) if (!add_cell(&list, w))
msg(TranslateT("Error memory allocation"));
- if (WumfOptions.PopupsEnabled) ShowWumfPopup(w);
+ if (g_plugin.bPopups) ShowWumfPopup(w);
if (WumfOptions.LogToFile) LogWumf(w);
}
else w->mark = FALSE;
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index f5ae72ebb6..0ef373eac5 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -23,8 +23,10 @@ static PLUGININFOEX pluginInfoEx = };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bPopups(MODULENAME, POPUPS_ENABLED, true)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -39,10 +41,7 @@ void LoadOptions() wcsncpy(WumfOptions.LogFile, dbv.pwszVal, 255);
db_free(&dbv);
}
- else
- WumfOptions.LogFile[0] = '\0';
-
- WumfOptions.PopupsEnabled = g_plugin.getByte(POPUPS_ENABLED, TRUE);
+ else WumfOptions.LogFile[0] = '\0';
WumfOptions.UseDefColor = g_plugin.getByte(COLOR_DEF, TRUE);
WumfOptions.UseWinColor = g_plugin.getByte(COLOR_WIN, FALSE);
@@ -179,21 +178,6 @@ static INT_PTR WumfShowConnections(WPARAM, LPARAM) return 0;
}
-static INT_PTR WumfMenuCommand(WPARAM, LPARAM)
-{
- if (WumfOptions.PopupsEnabled == TRUE) {
- WumfOptions.PopupsEnabled = FALSE;
- Menu_ModifyItem(hMenuItem, LPGENW("Enable WUMF popups"), Skin_GetIconHandle(SKINICON_OTHER_NOPOPUP));
- }
- else {
- WumfOptions.PopupsEnabled = TRUE;
- Menu_ModifyItem(hMenuItem, LPGENW("Disable WUMF popups"), Skin_GetIconHandle(SKINICON_OTHER_POPUP));
- }
-
- g_plugin.setByte(POPUPS_ENABLED, (uint8_t)WumfOptions.PopupsEnabled);
- return 0;
-}
-
int InitTopToolbar(WPARAM, LPARAM)
{
TTBButton ttb = {};
@@ -211,22 +195,11 @@ int CMPlugin::Load() {
LoadOptions();
- CreateServiceFunction(MS_WUMF_SWITCHPOPUP, WumfMenuCommand);
CreateServiceFunction(MS_WUMF_CONNECTIONSSHOW, WumfShowConnections);
CMenuItem mi(&g_plugin);
- SET_UID(mi, 0xcfce6487, 0x907b, 0x4822, 0xb0, 0x49, 0x18, 0x4e, 0x47, 0x17, 0x0, 0x69);
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 1999990000);
- if (WumfOptions.PopupsEnabled == FALSE) {
- mi.name.a = LPGEN("Enable WUMF popups");
- mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_NOPOPUP);
- }
- else {
- mi.name.a = LPGEN("Disable WUMF popups");
- mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_POPUP);
- }
- mi.pszService = MS_WUMF_SWITCHPOPUP;
+ addPopupOption(LPGEN("WUMF popups"), bPopups);
hMenuItem = Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0xbf93984c, 0xaa05, 0x447c, 0xbd, 0x5c, 0x5f, 0x43, 0x60, 0x92, 0x6a, 0x12);
diff --git a/protocols/Weather/res/popup.ico b/protocols/Weather/res/popup.ico Binary files differdeleted file mode 100644 index 5b3fe4e65b..0000000000 --- a/protocols/Weather/res/popup.ico +++ /dev/null diff --git a/protocols/Weather/res/popup_no.ico b/protocols/Weather/res/popup_no.ico Binary files differdeleted file mode 100644 index 2b298a96ea..0000000000 --- a/protocols/Weather/res/popup_no.ico +++ /dev/null diff --git a/protocols/Weather/res/resource.rc b/protocols/Weather/res/resource.rc index 7b17f8e87f..40e7d2a957 100644 --- a/protocols/Weather/res/resource.rc +++ b/protocols/Weather/res/resource.rc @@ -380,8 +380,6 @@ IDI_S ICON "brief.ico" IDI_LOG ICON "log.ico" IDI_EDIT ICON "edit.ico" IDI_MAP ICON "map.ico" -IDI_POPUP ICON "popup.ico" -IDI_NOPOPUP ICON "popup_no.ico" IDI_UPDATE2 ICON "update2.ico" IDI_DISABLED ICON "disabled.ico" diff --git a/protocols/Weather/src/resource.h b/protocols/Weather/src/resource.h index eecba58268..67e9006fb3 100644 --- a/protocols/Weather/src/resource.h +++ b/protocols/Weather/src/resource.h @@ -15,8 +15,6 @@ #define IDI_S 211 #define IDI_MAP 212 #define IDR_PMENU 213 -#define IDI_POPUP 214 -#define IDI_NOPOPUP 215 #define IDD_TEXTOPT 216 #define IDD_BRIEF 217 #define IDD_SETUP 218 diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h index 0c462e8a6f..ea25f3f28c 100644 --- a/protocols/Weather/src/stdafx.h +++ b/protocols/Weather/src/stdafx.h @@ -205,7 +205,6 @@ struct MYOPTIONS uint8_t DisCondIcon; // popup options - uint8_t UsePopup; uint8_t UpdatePopup; uint8_t AlertPopup; uint8_t PopupOnChange; @@ -526,7 +525,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> { CMPlugin(); - HINSTANCE hIconsDll; + HINSTANCE hIconsDll = nullptr; + CMOption<bool> bPopups; int Load() override; int Unload() override; diff --git a/protocols/Weather/src/weather.cpp b/protocols/Weather/src/weather.cpp index 259426957b..f5e6bb2e7b 100644 --- a/protocols/Weather/src/weather.cpp +++ b/protocols/Weather/src/weather.cpp @@ -77,7 +77,8 @@ static const PLUGININFOEX pluginInfoEx = }; CMPlugin::CMPlugin() : - PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx) + PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx), + bPopups(MODULENAME, "UsePopup", true) { opt.NoProtoCondition = g_plugin.getByte("NoStatus", true); RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL); @@ -151,8 +152,6 @@ static IconItem iconList[] = { LPGEN("View Complete"), "read", IDI_READ }, { LPGEN("Weather Update"), "update", IDI_UPDATE }, { LPGEN("Weather Map"), "map", IDI_MAP }, - { LPGEN("Popup"), "popup", IDI_POPUP }, - { LPGEN("No Popup"), "nopopup", IDI_NOPOPUP }, { LPGEN("Edit Settings"), "edit", IDI_EDIT }, }; @@ -198,8 +197,11 @@ int CMPlugin::Load() InitServices(); // add sound event - g_plugin.addSound("weatherupdated", _A2W(MODULENAME), LPGENW("Condition Changed")); - g_plugin.addSound("weatheralert", _A2W(MODULENAME), LPGENW("Alert Issued")); + addSound("weatherupdated", _A2W(MODULENAME), LPGENW("Condition Changed")); + addSound("weatheralert", _A2W(MODULENAME), LPGENW("Alert Issued")); + + // popup initialization + addPopupOption(LPGEN("Weather notifications"), bPopups); // window needed for popup commands wchar_t SvcFunc[100]; diff --git a/protocols/Weather/src/weather_opt.cpp b/protocols/Weather/src/weather_opt.cpp index 9dd186f751..c4b42ede5c 100644 --- a/protocols/Weather/src/weather_opt.cpp +++ b/protocols/Weather/src/weather_opt.cpp @@ -108,7 +108,6 @@ void LoadOptions(void) opt.DisCondIcon = g_plugin.getByte("DisableConditionIcon", false); // popup options - opt.UsePopup = g_plugin.getByte("UsePopUp", true); opt.UpdatePopup = g_plugin.getByte("UpdatePopup", true); opt.AlertPopup = g_plugin.getByte("AlertPopup", true); opt.PopupOnChange = g_plugin.getByte("PopUpOnChange", true); @@ -161,7 +160,6 @@ void SaveOptions(void) g_plugin.setByte("DisableConditionIcon", (uint8_t)opt.DisCondIcon); // popup options - g_plugin.setByte("UsePopUp", (uint8_t)opt.UsePopup); g_plugin.setByte("UpdatePopup", (uint8_t)opt.UpdatePopup); g_plugin.setByte("AlertPopup", (uint8_t)opt.AlertPopup); g_plugin.setByte("PopUpOnChange", (uint8_t)opt.PopupOnChange); diff --git a/protocols/Weather/src/weather_popup.cpp b/protocols/Weather/src/weather_popup.cpp index e6276167f7..992db0a69a 100644 --- a/protocols/Weather/src/weather_popup.cpp +++ b/protocols/Weather/src/weather_popup.cpp @@ -37,7 +37,7 @@ static MCONTACT hPopupContact; // Type can either be SM_WARNING, SM_NOTIFY, or SM_WEATHERALERT int WeatherError(WPARAM wParam, LPARAM lParam) { - if (!opt.UsePopup) + if (!g_plugin.bPopups) return 0; wchar_t* tszMsg = (wchar_t*)wParam; @@ -125,7 +125,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA int WeatherPopup(WPARAM hContact, LPARAM lParam) { // determine if the popup should display or not - if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) && !g_plugin.getByte(hContact, "DPopUp")) { + if (g_plugin.bPopups && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) && !g_plugin.getByte(hContact, "DPopUp")) { WEATHERINFO winfo = LoadWeatherInfo(hContact); // setup the popup @@ -235,7 +235,6 @@ void ReadPopupOpt(HWND hdlg) // other options opt.UseWinColors = (uint8_t)IsDlgButtonChecked(hdlg, IDC_USEWINCOLORS); - opt.UsePopup = (uint8_t)IsDlgButtonChecked(hdlg, IDC_E); opt.UpdatePopup = (uint8_t)IsDlgButtonChecked(hdlg, IDC_POP1); opt.AlertPopup = (uint8_t)IsDlgButtonChecked(hdlg, IDC_POP2); opt.PopupOnChange = (uint8_t)IsDlgButtonChecked(hdlg, IDC_CH); @@ -268,7 +267,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) DestroyMenu(hMenu); // other options - CheckDlgButton(hdlg, IDC_E, opt.UsePopup ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_E, g_plugin.bPopups ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_POP2, opt.AlertPopup ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_POP1, opt.UpdatePopup ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CH, opt.PopupOnChange ? BST_CHECKED : BST_UNCHECKED); @@ -435,7 +434,6 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) // save the options, and update main menu SaveOptions(); - UpdatePopupMenu(opt.UsePopup); return TRUE; } break; diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp index 113669d968..7a7dff321c 100644 --- a/protocols/Weather/src/weather_svcs.cpp +++ b/protocols/Weather/src/weather_svcs.cpp @@ -26,7 +26,6 @@ building/changing the weather menu items. #include "stdafx.h" -static HGENMENU hEnableDisablePopupMenu; static HGENMENU hEnableDisableMenu; extern VARSW g_pwszIconsName; @@ -302,18 +301,6 @@ void UpdateMenu(BOOL State) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, !State ? TTBST_PUSHED : 0); } -void UpdatePopupMenu(BOOL State) -{ - // update option setting - opt.UsePopup = State; - g_plugin.setByte("UsePopup", (uint8_t)opt.UsePopup); - - if (State) // to enable popup - Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Disable &weather notification"), g_plugin.getIconHandle(IDI_POPUP)); - else // to disable popup - Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Enable &weather notification"), g_plugin.getIconHandle(IDI_NOPOPUP)); -} - // update the weather auto-update menu item when click on it INT_PTR EnableDisableCmd(WPARAM wParam, LPARAM lParam) { @@ -321,13 +308,6 @@ INT_PTR EnableDisableCmd(WPARAM wParam, LPARAM lParam) return 0; } -// update the weather popup menu item when click on it -INT_PTR MenuitemNotifyCmd(WPARAM, LPARAM) -{ - UpdatePopupMenu(!opt.UsePopup); - return 0; -} - // adding weather contact menus // copied and modified form "modified MSN Protocol" void AddMenuItems(void) @@ -420,16 +400,6 @@ void AddMenuItems(void) mi.pszService = MS_WEATHER_REFRESHALL; Menu_AddMainMenuItem(&mi); - SET_UID(mi, 0xdc5411cb, 0xb7c7, 0x443b, 0x88, 0x5a, 0x90, 0x24, 0x43, 0xde, 0x54, 0x3e); - CreateServiceFunction(MODULENAME "/PopupMenu", MenuitemNotifyCmd); - mi.name.a = LPGEN("Weather Notification"); - mi.hIcolibItem = g_plugin.getIconHandle(IDI_POPUP); - mi.position = 0; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); - mi.pszService = MODULENAME "/PopupMenu"; - hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); - UpdatePopupMenu(opt.UsePopup); - if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { SET_UID(mi, 0xe193fe9b, 0xf6ad, 0x41ac, 0x95, 0x29, 0x45, 0x4, 0x44, 0xb1, 0xeb, 0x5d); mi.pszService = "Weather/mwin_menu"; diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj index 4ced95c9a1..cf8eec0f0c 100644 --- a/src/mir_app/mir_app.vcxproj +++ b/src/mir_app/mir_app.vcxproj @@ -130,6 +130,7 @@ <ClCompile Include="src\options.cpp" />
<ClCompile Include="src\path.cpp" />
<ClCompile Include="src\pluginopts.cpp" />
+ <ClCompile Include="src\popupOption.cpp" />
<ClCompile Include="src\popups.cpp" />
<ClCompile Include="src\profilemanager.cpp" />
<ClCompile Include="src\protocols.cpp" />
@@ -210,10 +211,105 @@ <ResourceCompile Include="res\version.rc" />
</ItemGroup>
<ItemGroup>
+ <None Include="res\cursor_drag_copy.cur" />
+ <None Include="res\cursor_drop_user.cur" />
+ <None Include="res\cursor_hyperlink.cur" />
<None Include="src\mir_app.def" />
<None Include="src\mir_app64.def" />
</ItemGroup>
<ItemGroup>
<Text Include="..\docs\contributors.txt" />
</ItemGroup>
+ <ItemGroup>
+ <Image Include="res\addgroup.ico" />
+ <Image Include="res\always_visible.ico" />
+ <Image Include="res\auth_add.ico" />
+ <Image Include="res\auth_grant.ico" />
+ <Image Include="res\auth_request.ico" />
+ <Image Include="res\auth_revoke.ico" />
+ <Image Include="res\chat\1.ico" />
+ <Image Include="res\chat\2.ico" />
+ <Image Include="res\chat\3.ico" />
+ <Image Include="res\chat\4.ico" />
+ <Image Include="res\chat\5.ico" />
+ <Image Include="res\chat\6.ico" />
+ <Image Include="res\chat_channel.ico" />
+ <Image Include="res\chat_join.ico" />
+ <Image Include="res\chat_leave.ico" />
+ <Image Include="res\check_off.ico" />
+ <Image Include="res\check_on.ico" />
+ <Image Include="res\contact_add.ico" />
+ <Image Include="res\contact_delete.ico" />
+ <Image Include="res\contact_groups.ico" />
+ <Image Include="res\contact_rename.ico" />
+ <Image Include="res\contact_view_details.ico" />
+ <Image Include="res\database.ico" />
+ <Image Include="res\female.ico" />
+ <Image Include="res\group_closed.ico" />
+ <Image Include="res\group_opened.ico" />
+ <Image Include="res\icon_accmgr.ico" />
+ <Image Include="res\icon_all.ico" />
+ <Image Include="res\icon_ansi.ico" />
+ <Image Include="res\icon_auth_request.ico" />
+ <Image Include="res\icon_connecting.ico" />
+ <Image Include="res\icon_down_arrow.ico" />
+ <Image Include="res\icon_error.ico" />
+ <Image Include="res\Icon_exit.ico" />
+ <Image Include="res\icon_fatal.ico" />
+ <Image Include="res\icon_file.ico" />
+ <Image Include="res\icon_find_user.ico" />
+ <Image Include="res\icon_frame.ico" />
+ <Image Include="res\icon_help.ico" />
+ <Image Include="res\icon_history.ico" />
+ <Image Include="res\icon_loaded_gray.ico" />
+ <Image Include="res\icon_mail.ico" />
+ <Image Include="res\icon_mainmenu.ico" />
+ <Image Include="res\icon_message.ico" />
+ <Image Include="res\icon_notify.ico" />
+ <Image Include="res\icon_notloaded.ico" />
+ <Image Include="res\icon_notloaded_gray.ico" />
+ <Image Include="res\icon_options.ico" />
+ <Image Include="res\icon_password.ico" />
+ <Image Include="res\icon_popup.ico" />
+ <Image Include="res\icon_popup_no.ico" />
+ <Image Include="res\icon_search_all.ico" />
+ <Image Include="res\Icon_show_hide.ico" />
+ <Image Include="res\icon_small_dot.ico" />
+ <Image Include="res\icon_sms.ico" />
+ <Image Include="res\icon_typing.ico" />
+ <Image Include="res\icon_undo.ico" />
+ <Image Include="res\icon_unicode.ico" />
+ <Image Include="res\icon_url.ico" />
+ <Image Include="res\icon_warning.ico" />
+ <Image Include="res\icon_window.ico" />
+ <Image Include="res\icon_windows.ico" />
+ <Image Include="res\male.ico" />
+ <Image Include="res\meta_add.ico" />
+ <Image Include="res\meta_convert.ico" />
+ <Image Include="res\meta_edit.ico" />
+ <Image Include="res\meta_menu.ico" />
+ <Image Include="res\meta_menuof.ico" />
+ <Image Include="res\meta_remove2.ico" />
+ <Image Include="res\meta_set_as_default.ico" />
+ <Image Include="res\miranda_home.ico" />
+ <Image Include="res\miranda_logo.ico" />
+ <Image Include="res\miranda_manager.ico" />
+ <Image Include="res\never_visible.ico" />
+ <Image Include="res\Off.ico" />
+ <Image Include="res\On.ico" />
+ <Image Include="res\sound.ico" />
+ <Image Include="res\status_away.ico" />
+ <Image Include="res\status_DND.ico" />
+ <Image Include="res\status_free4chat.ico" />
+ <Image Include="res\status_invisible.ico" />
+ <Image Include="res\status_locked.ico" />
+ <Image Include="res\status_NA.ico" />
+ <Image Include="res\status_occupied.ico" />
+ <Image Include="res\status_offline.ico" />
+ <Image Include="res\status_online.ico" />
+ <Image Include="res\status_on_the_phone.ico" />
+ <Image Include="res\status_out2lunch.ico" />
+ <Image Include="res\status_user_online.ico" />
+ <Image Include="res\_blank.ico" />
+ </ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters index 7686b8957a..0b29744b8c 100644 --- a/src/mir_app/mir_app.vcxproj.filters +++ b/src/mir_app/mir_app.vcxproj.filters @@ -11,9 +11,6 @@ <ClCompile Include="src\button.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\CMPluginBase.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\contact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -83,9 +80,6 @@ <ClCompile Include="src\modules.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\newplugins.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -395,6 +389,15 @@ <ClCompile Include="src\Docking.cpp">
<Filter>Source Files\Contact list</Filter>
</ClCompile>
+ <ClCompile Include="src\CMPluginBase.cpp">
+ <Filter>Source Files\Plugins</Filter>
+ </ClCompile>
+ <ClCompile Include="src\newplugins.cpp">
+ <Filter>Source Files\Plugins</Filter>
+ </ClCompile>
+ <ClCompile Include="src\popupOption.cpp">
+ <Filter>Source Files\Plugins</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\filter.h">
@@ -469,6 +472,15 @@ <ItemGroup>
<None Include="src\mir_app.def" />
<None Include="src\mir_app64.def" />
+ <None Include="res\cursor_hyperlink.cur">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\cursor_drag_copy.cur">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\cursor_drop_user.cur">
+ <Filter>Resource Files</Filter>
+ </None>
</ItemGroup>
<ItemGroup>
<Text Include="..\docs\contributors.txt" />
@@ -501,5 +513,280 @@ <Filter Include="Source Files\Protocols">
<UniqueIdentifier>{7e7992e9-1b69-4f98-84ff-f0be4653866c}</UniqueIdentifier>
</Filter>
+ <Filter Include="Source Files\Plugins">
+ <UniqueIdentifier>{2f5b2fe9-25c8-4029-8a52-f34a11f984a7}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\miranda_logo.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\miranda_home.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\miranda_manager.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\contact_view_details.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\contact_add.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\contact_rename.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\contact_delete.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\group_closed.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\group_opened.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_user_online.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_online.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_away.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_NA.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_occupied.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_DND.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_free4chat.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_invisible.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_on_the_phone.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_out2lunch.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_offline.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_connecting.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_typing.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_find_user.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_search_all.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_options.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_accmgr.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_mainmenu.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_help.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_message.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_file.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_history.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_url.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_sms.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_mail.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_small_dot.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_auth_request.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_all.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_down_arrow.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\check_off.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\check_on.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_unicode.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_ansi.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_loaded_gray.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_notloaded.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_notloaded_gray.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_frame.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_fatal.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_error.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_warning.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_notify.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\_blank.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_undo.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_window.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_windows.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat_join.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat_leave.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\status_locked.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\Icon_show_hide.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\Icon_exit.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\contact_groups.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\On.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\Off.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\always_visible.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\never_visible.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat_channel.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\male.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\female.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\auth_add.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\auth_grant.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\auth_request.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\auth_revoke.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_menu.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_menuof.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_edit.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_remove2.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_convert.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_add.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\meta_set_as_default.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\addgroup.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_popup.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_popup_no.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\icon_password.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\sound.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\database.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\1.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\2.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\3.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\4.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\5.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\chat\6.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index 0886833b0f..423dbc7941 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -732,6 +732,14 @@ BEGIN PUSHBUTTON "Insert separator",IDC_SEPARATOR,137,211,103,15,BS_MULTILINE
END
+IDD_OPT_POPUPOPTION DIALOGEX 0, 0, 303, 229
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "",IDC_TREE,"SysListView32",LVS_LIST | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,0,0,303,226
+END
+
IDD_AUTHREQ DIALOGEX 0, 0, 271, 197
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
EXSTYLE WS_EX_CONTROLPARENT
@@ -1160,6 +1168,10 @@ BEGIN BOTTOMMARGIN, 186
END
+ IDD_OPT_POPUPOPTION, DIALOG
+ BEGIN
+ END
+
IDD_AUTHREQ, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -1419,6 +1431,7 @@ IDI_STATUS4 ICON "chat/5.ico" IDI_STATUS5 ICON "chat/6.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
@@ -1598,6 +1611,11 @@ BEGIN 0
END
+IDD_OPT_POPUPOPTION AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 0b72e6d333..57a1833b72 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -373,7 +373,8 @@ static int ContactOptInit(WPARAM wParam, LPARAM) odp.pDialog = new CContactOptsDlg();
odp.flags = ODPF_BOLDGROUPS;
g_plugin.addOptions(wParam, &odp);
- return 0;
+
+ return PopupOptionsInit(wParam);
}
int LoadContactsModule(void)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index e4dd6236b9..5dcd71c162 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -793,3 +793,4 @@ _Netlib_SslWrite@12 @877 NONAME ?IsMirandaFolderWritable@PU@@YG_NXZ @881 NONAME
?IsDuplicateEvent@DB@@YG_NIAAUDBEVENTINFO@@@Z @882 NONAME
Srmm_GetButtonGap @883
+?addPopupOption@CMPluginBase@@QAEHPBDAAV?$CMOption@_N@@@Z @884 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index b8b265a9d3..f40aa28380 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -793,3 +793,4 @@ Netlib_SslWrite @877 NONAME ?IsMirandaFolderWritable@PU@@YA_NXZ @881 NONAME
?IsDuplicateEvent@DB@@YA_NIAEAUDBEVENTINFO@@@Z @882 NONAME
Srmm_GetButtonGap @883
+?addPopupOption@CMPluginBase@@QEAAHPEBDAEAV?$CMOption@_N@@@Z @884 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index 17c9812570..bd2e85fb03 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -53,6 +53,7 @@ extern bool g_bModulesLoadedFired, g_bMirandaTerminated; char* GetPluginNameByInstance(HINSTANCE hInstance);
int LoadStdPlugins(void);
int LaunchServicePlugin(pluginEntry *p);
+int PopupOptionsInit(WPARAM);
/**** path.cpp *************************************************************************/
diff --git a/src/mir_app/src/popupOption.cpp b/src/mir_app/src/popupOption.cpp new file mode 100644 index 0000000000..25243de0e5 --- /dev/null +++ b/src/mir_app/src/popupOption.cpp @@ -0,0 +1,104 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org), +Copyright (c) 2000-12 Miranda IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +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. +*/ + +#include "stdafx.h" +#include "plugins.h" + +struct MPopupOption +{ + const char *m_descr; + CMPluginBase *m_plugin; + CMOption<bool> &pVal; +}; + +static OBJLIST<MPopupOption> g_arOptions(1); + +///////////////////////////////////////////////////////////////////////////////////////// + +int CMPluginBase::addPopupOption(const char *pszDescr, CMOption<bool> &pVal) +{ + MPopupOption tmp = { pszDescr, this, pVal }; + g_arOptions.insert(new MPopupOption(tmp)); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +class CPopupOptionsDlg : public CDlgBase +{ + CCtrlListView m_tree; + +public: + CPopupOptionsDlg() : + CDlgBase(g_plugin, IDD_OPT_POPUPOPTION), + m_tree(this, IDC_TREE) + {} + + bool OnInitDialog() override + { + m_tree.SetExtendedListViewStyleEx(0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); + + LVITEM lvi; + lvi.mask = LVIF_TEXT | LVIF_PARAM; + lvi.iSubItem = 0; + + for (auto &it : g_arOptions) { + _A2T tmp(it->m_descr); + lvi.pszText = TranslateW_LP(tmp, it->m_plugin); + lvi.lParam = LPARAM(it); + + int iRow = m_tree.InsertItem(&lvi); + m_tree.SetItemState(iRow, it->pVal ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK); + } + + return true; + } + + bool OnApply() override + { + int iRows = m_tree.GetItemCount(); + for (int i = 0; i < iRows; i++) { + LVITEM lvi; + lvi.iItem = i; + lvi.mask = LVIF_STATE | LVIF_PARAM; + m_tree.GetItem(&lvi); + + auto *p = (MPopupOption *)lvi.lParam; + p->pVal = lvi.state == 0x2000; + } + return true; + } +}; + +int PopupOptionsInit(WPARAM wParam) +{ + OPTIONSDIALOGPAGE odp = {}; + odp.position = -1000000000; + odp.szGroup.a = LPGEN("Popups"); + odp.szTitle.a = LPGEN("Enabled items"); + odp.pDialog = new CPopupOptionsDlg(); + odp.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &odp); + return 0; +} diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index ede8012f12..8fda4efe5c 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -30,6 +30,7 @@ #define IDD_AUTHREQ 121
#define IDD_SELECT_CRYPTOPROVIDER 122
#define IDD_LOGIN 123
+#define IDD_OPT_POPUPOPTION 124
#define IDD_DETAILS 125
#define IDD_OPT_DATABASE 126
#define IDD_HISTORY 127
@@ -592,6 +593,7 @@ #define IDC_LOGROTATE 1749
#define IDC_RIGHTCLICK 1751
#define IDC_FILTER_SEARCH 1752
+#define IDC_TREE 1753
#define IDC_EFFECT_COLOUR_TEXT1 1853
#define IDC_EFFECT_COLOUR_SPIN1 1854
#define IDC_EXTRAORDER 1889
@@ -698,9 +700,9 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 334
+#define _APS_NEXT_RESOURCE_VALUE 335
#define _APS_NEXT_COMMAND_VALUE 40018
-#define _APS_NEXT_CONTROL_VALUE 1753
+#define _APS_NEXT_CONTROL_VALUE 1755
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|