From d387ed11456e40f36f359cb3aa9f74a54b8f369b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 9 Mar 2022 16:01:24 +0300 Subject: popup control moved from main menu to Options - Popups - Enabled items --- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 47 +++---------- plugins/ClientChangeNotify/src/OptDlg.cpp | 2 +- plugins/ClientChangeNotify/src/stdafx.h | 8 +-- plugins/Db_autobackups/src/backup.cpp | 4 +- plugins/Db_autobackups/src/main.cpp | 39 +++-------- plugins/Db_autobackups/src/stdafx.h | 12 ++-- plugins/ExternalAPI/m_proxySwitch.h | 1 - plugins/NewEventNotify/neweventnotify.vcxproj | 1 - .../NewEventNotify/neweventnotify.vcxproj.filters | 3 - plugins/NewEventNotify/src/main.cpp | 16 +++-- plugins/NewEventNotify/src/menuitem.cpp | 67 ------------------ plugins/NewEventNotify/src/options.cpp | 18 +---- plugins/NewEventNotify/src/stdafx.h | 10 +-- plugins/NewXstatusNotify/res/main_off.ico | Bin 1150 -> 0 bytes plugins/NewXstatusNotify/res/main_on.ico | Bin 1150 -> 0 bytes plugins/NewXstatusNotify/res/resource.rc | 2 - plugins/NewXstatusNotify/src/main.cpp | 77 +++++---------------- plugins/NewXstatusNotify/src/options.cpp | 1 - plugins/NewXstatusNotify/src/options.h | 1 - plugins/NewXstatusNotify/src/resource.h | 2 - plugins/NewXstatusNotify/src/stdafx.h | 4 +- plugins/NewXstatusNotify/src/xstatus.cpp | 6 +- plugins/ProxySwitch/src/main.cpp | 46 ++---------- plugins/ProxySwitch/src/opt.cpp | 15 ++-- plugins/ProxySwitch/src/stdafx.h | 4 +- plugins/TabSRMM/res/resource.rc | 1 - plugins/TabSRMM/src/resource.h | 1 - plugins/TabSRMM/src/typingnotify.cpp | 70 ++++++------------- plugins/TabSRMM/src/typingnotify.h | 2 - plugins/WhoUsesMyFiles/src/stdafx.h | 4 +- plugins/WhoUsesMyFiles/src/wumf.cpp | 2 +- plugins/WhoUsesMyFiles/src/wumfplug.cpp | 39 ++--------- 32 files changed, 113 insertions(+), 392 deletions(-) delete mode 100644 plugins/NewEventNotify/src/menuitem.cpp delete mode 100644 plugins/NewXstatusNotify/res/main_off.ico delete mode 100644 plugins/NewXstatusNotify/res/main_on.ico (limited to 'plugins') 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(MODULENAME, pluginInfoEx) -{} + PLUGIN(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 @@ -58,6 +60,8 @@ struct CMPlugin : public PLUGIN { CMPlugin(); + CMOption 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(); bool bCloudFilePresent = false; - HANDLE hevBackup; + HANDLE hevBackup = nullptr; wchar_t folder[MAX_PATH]; CMOption backup_types; - CMOption period; + CMOption period; CMOption period_type; - CMOption file_mask; - CMOption num_backups; + CMOption file_mask; + CMOption num_backups; CMOption disable_progress; - CMOption disable_popups; + CMOption bPopups; CMOption use_zip; CMOption backup_profile; CMOption use_cloudfile; - CMOption cloudfile_service; + CMOption 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 @@ - 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 @@ Source Files - - Source Files - Source Files 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(MODULENAME, pluginInfoEx) + PLUGIN(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, - 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 void OptionsRead(void); void OptionsWrite(void); - bool bDisable; + CMOption 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 deleted file mode 100644 index f2cc323064..0000000000 Binary files a/plugins/NewXstatusNotify/res/main_off.ico and /dev/null differ diff --git a/plugins/NewXstatusNotify/res/main_on.ico b/plugins/NewXstatusNotify/res/main_on.ico deleted file mode 100644 index 23921f8a7f..0000000000 Binary files a/plugins/NewXstatusNotify/res/main_on.ico and /dev/null differ 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(MODULENAME, pluginInfoEx) -{} + PLUGIN(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(); + CMOption 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(MODULENAME, pluginInfoEx) -{} + PLUGIN(MODULENAME, pluginInfoEx), + bPopups(MODULENAME, "PopupEnabled", true) +{ +} -HGENMENU hEnableDisablePopupMenu = 0; HGENMENU hMenuRoot; OBJLIST 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(); + CMOption 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 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(); + CMOption 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(MODULENAME, pluginInfoEx) -{} + PLUGIN(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); -- cgit v1.2.3