From 3d8ca17492f7dcf1d47cddda9afb3797c0f2752b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 10 Jul 2018 22:15:30 +0300 Subject: related to #1455 - ZeroNotify --- plugins/ZeroNotification/res/ZeroNotify.rc | 8 +++----- plugins/ZeroNotification/src/main.cpp | 25 ++++++++++++++----------- plugins/ZeroNotification/src/options.cpp | 3 --- plugins/ZeroNotification/src/resource.h | 1 - plugins/ZeroNotification/src/version.h | 14 +++++++------- 5 files changed, 24 insertions(+), 27 deletions(-) (limited to 'plugins/ZeroNotification') diff --git a/plugins/ZeroNotification/res/ZeroNotify.rc b/plugins/ZeroNotification/res/ZeroNotify.rc index add9e9a0cd..e22908c095 100644 --- a/plugins/ZeroNotification/res/ZeroNotify.rc +++ b/plugins/ZeroNotification/res/ZeroNotify.rc @@ -50,7 +50,7 @@ END // Dialog // -IDD_OPT_NOSOUND DIALOGEX 0, 0, 244, 145 +IDD_OPT_NOSOUND DIALOGEX 0, 0, 244, 134 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -61,8 +61,6 @@ BEGIN CONTROL "Tree1",IDC_NOBLINK,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,87,22,73,105 LTEXT "No SysTray blink when:",IDC_STATIC,87,4,77,16 CONTROL "Tree1",IDC_NOCLCBLINK,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,165,22,73,105 - CONTROL "Hide the ""toggle sound"" menu item (requires restart of Miranda)",IDC_HIDEMENU, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,133,234,10 END @@ -79,9 +77,9 @@ BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 238 TOPMARGIN, 4 - BOTTOMMARGIN, 126 + BOTTOMMARGIN, 128 HORZGUIDE, 109 - HORZGUIDE, 143 + HORZGUIDE, 126 END END #endif // APSTUDIO_INVOKED diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index f0d4808dd2..78c3aa0f05 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -85,19 +85,22 @@ static INT_PTR NoSoundMenuCommand(WPARAM, LPARAM) int CMPlugin::Load() { - if (!db_get_b(NULL, MODULENAME, "HideMenu", 1)) { - CreateServiceFunction(MODULENAME "/MenuCommand", NoSoundMenuCommand); - - CMenuItem mi(g_plugin); - SET_UID(mi, 0x6bd635eb, 0xc4bb, 0x413b, 0xb9, 0x3, 0x81, 0x6d, 0x8f, 0xf1, 0x9b, 0xb0); - mi.position = -0x7FFFFFFF; - mi.flags = CMIF_UNICODE; - mi.pszService = MODULENAME "/MenuCommand"; - noSoundMenu = Menu_AddMainMenuItem(&mi); - - UpdateMenuItem(); + CMenuItem mi(g_plugin); + SET_UID(mi, 0x6bd635eb, 0xc4bb, 0x413b, 0xb9, 0x3, 0x81, 0x6d, 0x8f, 0xf1, 0x9b, 0xb0); + mi.position = -0x7FFFFFFF; + mi.flags = CMIF_UNICODE; + mi.pszService = MODULENAME "/MenuCommand"; + noSoundMenu = Menu_AddMainMenuItem(&mi); + CreateServiceFunction(mi.pszService, NoSoundMenuCommand); + + int bHideMenu = db_get_b(NULL, MODULENAME, "HideMenu", 100); + if (bHideMenu != 100) { + Menu_SetVisible(noSoundMenu, !bHideMenu); + db_unset(0, MODULENAME, "HideMenu"); } + UpdateMenuItem(); + HookEvent(ME_PROTO_ACK, ProtoAck); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SoundSettingChanged); HookEvent(ME_OPT_INITIALISE, OptionsInitialize); diff --git a/plugins/ZeroNotification/src/options.cpp b/plugins/ZeroNotification/src/options.cpp index 7e611d09f6..efb190cb4f 100644 --- a/plugins/ZeroNotification/src/options.cpp +++ b/plugins/ZeroNotification/src/options.cpp @@ -75,7 +75,6 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM, LPARA SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOSOUND), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOSOUND), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOBLINK), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOBLINK), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); - CheckDlgButton(hwndDlg, IDC_HIDEMENU, db_get_b(NULL, MODULENAME, "HideMenu", 1) ? BST_CHECKED : BST_UNCHECKED); FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOSOUND), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), db_get_dw(NULL, MODULENAME, "NoSound", DEFAULT_NOSOUND)); FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOBLINK), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), db_get_dw(NULL, MODULENAME, "NoBlink", DEFAULT_NOBLINK)); @@ -112,8 +111,6 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM, LPARA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, MODULENAME, "HideMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEMENU)); - db_set_dw(NULL, MODULENAME, "NoSound", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOSOUND))); db_set_dw(NULL, MODULENAME, "NoBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOBLINK))); db_set_dw(NULL, MODULENAME, "NoCLCBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOCLCBLINK))); diff --git a/plugins/ZeroNotification/src/resource.h b/plugins/ZeroNotification/src/resource.h index ac11d8b30b..fb8320a02c 100644 --- a/plugins/ZeroNotification/src/resource.h +++ b/plugins/ZeroNotification/src/resource.h @@ -6,7 +6,6 @@ #define IDC_NOSOUND 1000 #define IDC_NOBLINK 1002 #define IDC_NOCLCBLINK 1003 -#define IDC_HIDEMENU 1008 // Next default values for new objects // diff --git a/plugins/ZeroNotification/src/version.h b/plugins/ZeroNotification/src/version.h index 21438a72eb..69c07c89db 100644 --- a/plugins/ZeroNotification/src/version.h +++ b/plugins/ZeroNotification/src/version.h @@ -1,13 +1,13 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 5 +#define __BUILD_NUM 1 #include #define __PLUGIN_NAME "Zero notifications" #define __FILENAME "ZeroNotify.dll" -#define __DESCRIPTION "Adds options to automatically disable notifications when a protocol is in a certain status." -#define __AUTHOR "bidyut, Maat" -#define __AUTHORWEB "https://miranda-ng.org/p/ZeroNotify/" -#define __COPYRIGHT "© 2005 bidyut, 2009 Maat" +#define __DESCRIPTION "Adds options to automatically disable notifications when a protocol is in a certain status." +#define __AUTHOR "bidyut, Maat" +#define __AUTHORWEB "https://miranda-ng.org/p/ZeroNotify/" +#define __COPYRIGHT "© 2005 bidyut, 2009 Maat" -- cgit v1.2.3