From 621085cc9a294c7c69b3bfab4125d6b8ff094524 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Jan 2023 16:10:56 +0300 Subject: =?UTF-8?q?fixes=20#3299=20(NewEventNotify:=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20"Use=20Windows=20colors")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewEventNotify/src/options.cpp | 72 +++++++++++++++++-------- plugins/NewEventNotify/src/popup.cpp | 16 +++--- plugins/NewEventNotify/src/resource.h | 4 ++ plugins/NewEventNotify/src/stdafx.h | 99 ++++++++++++++++++++-------------- plugins/NewEventNotify/src/version.h | 2 +- 5 files changed, 123 insertions(+), 70 deletions(-) (limited to 'plugins/NewEventNotify/src') diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 84f25493d7..5507a230f9 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -32,21 +32,25 @@ void CMPlugin::OptionsRead(void) bMsgReplyWindow = getBool(OPT_MSGREPLYWINDOW, false); msg.bDefault = getBool(OPT_COLDEFAULT_MESSAGE, false); + msg.bWindows = getBool(OPT_COLWIN_MESSAGE, false); msg.backColor = getDword(OPT_COLBACK_MESSAGE, DEFAULT_COLBACK); msg.textColor = getDword(OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT); msg.iDelay = getDword(OPT_DELAY_MESSAGE, DEFAULT_DELAY); file.bDefault = getBool(OPT_COLDEFAULT_FILE, false); + file.bWindows = getBool(OPT_COLWIN_FILE, false); file.backColor = getDword(OPT_COLBACK_FILE, DEFAULT_COLBACK); file.textColor = getDword(OPT_COLTEXT_FILE, DEFAULT_COLTEXT); file.iDelay = getDword(OPT_DELAY_FILE, DEFAULT_DELAY); err.bDefault = getBool(OPT_COLDEFAULT_ERR, false); + err.bWindows = getBool(OPT_COLWIN_ERR, false); err.backColor = getDword(OPT_COLBACK_ERR, DEFAULT_COLBACK); err.textColor = getDword(OPT_COLTEXT_ERR, DEFAULT_COLTEXT); err.iDelay = getDword(OPT_DELAY_ERR, DEFAULT_DELAY); other.bDefault = getBool(OPT_COLDEFAULT_OTHERS, false); + other.bWindows = getBool(OPT_COLWIN_OTHERS, false); other.backColor = getDword(OPT_COLBACK_OTHERS, DEFAULT_COLBACK); other.textColor = getDword(OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT); other.iDelay = getDword(OPT_DELAY_OTHERS, DEFAULT_DELAY); @@ -75,21 +79,25 @@ void CMPlugin::OptionsWrite(void) setByte(OPT_MSGWINDOWCHECK, bMsgWindowCheck); setByte(OPT_MSGREPLYWINDOW, bMsgReplyWindow); + setByte(OPT_COLWIN_MESSAGE, msg.bWindows); setByte(OPT_COLDEFAULT_MESSAGE, msg.bDefault); setDword(OPT_COLBACK_MESSAGE, msg.backColor); setDword(OPT_COLTEXT_MESSAGE, msg.textColor); setDword(OPT_DELAY_MESSAGE, msg.iDelay); + setByte(OPT_COLWIN_FILE, file.bWindows); setByte(OPT_COLDEFAULT_FILE, file.bDefault); setDword(OPT_COLBACK_FILE, file.backColor); setDword(OPT_COLTEXT_FILE, file.textColor); setDword(OPT_DELAY_FILE, file.iDelay); + setByte(OPT_COLWIN_ERR, err.bWindows); setByte(OPT_COLDEFAULT_ERR, err.bDefault); setDword(OPT_COLBACK_ERR, err.backColor); setDword(OPT_COLTEXT_ERR, err.textColor); setDword(OPT_DELAY_ERR, err.iDelay); + setByte(OPT_COLWIN_OTHERS, other.bWindows); setByte(OPT_COLDEFAULT_OTHERS, other.bDefault); setDword(OPT_COLBACK_OTHERS, other.backColor); setDword(OPT_COLTEXT_OTHERS, other.textColor); @@ -214,6 +222,7 @@ public: class COptionsEventsDlg : public COptionsBaseDlg { CCtrlSpin spinMessage, spinFile, spinErr, spinOther; + CCtrlCheck chkWinColorMsg, chkWinColorFile, chkWinColorErr, chkWinColorOthers; CCtrlCheck chkDefaultColorMsg, chkDefaultColorFile, chkDefaultColorErr, chkDefaultColorOthers; CCtrlColor clrBackMessage, clrTextMessage, clrBackFile, clrTextFile, clrBackErr, clrTextErr, clrBackOther, clrTextOther; CCtrlButton btnPreview; @@ -221,22 +230,26 @@ class COptionsEventsDlg : public COptionsBaseDlg void GrabData() { // update options - g_plugin.msg.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE); + g_plugin.msg.bWindows = chkWinColorMsg.IsChecked(); + g_plugin.msg.bDefault = chkDefaultColorMsg.IsChecked(); g_plugin.msg.backColor = clrBackMessage.GetColor(); g_plugin.msg.textColor = clrTextMessage.GetColor(); g_plugin.msg.iDelay = spinMessage.GetPosition(); - g_plugin.file.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_FILE); + g_plugin.file.bWindows = chkWinColorFile.IsChecked(); + g_plugin.file.bDefault = chkDefaultColorFile.IsChecked(); g_plugin.file.backColor = clrBackFile.GetColor(); g_plugin.file.textColor = clrTextFile.GetColor(); g_plugin.file.iDelay = spinFile.GetPosition(); - g_plugin.err.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_ERR); + g_plugin.err.bWindows = chkWinColorErr.IsChecked(); + g_plugin.err.bDefault = chkDefaultColorErr.IsChecked(); g_plugin.err.backColor = clrBackErr.GetColor(); g_plugin.err.textColor = clrTextErr.GetColor(); g_plugin.err.iDelay = spinErr.GetPosition(); - g_plugin.other.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_OTHERS); + g_plugin.other.bWindows = chkWinColorOthers.IsChecked(); + g_plugin.other.bDefault = chkDefaultColorOthers.IsChecked(); g_plugin.other.backColor = clrBackOther.GetColor(); g_plugin.other.textColor = clrTextOther.GetColor(); g_plugin.other.iDelay = spinOther.GetPosition(); @@ -254,6 +267,10 @@ public: clrTextErr(this, IDC_COLTEXT_ERR), clrBackOther(this, IDC_COLBACK_OTHERS), clrTextOther(this, IDC_COLTEXT_OTHERS), + chkWinColorMsg(this, IDC_CHKWINCOL_MESSAGE), + chkWinColorFile(this, IDC_CHKWINCOL_FILE), + chkWinColorErr(this, IDC_CHKWINCOL_ERR), + chkWinColorOthers(this, IDC_CHKWINCOL_OTHERS), chkDefaultColorMsg(this, IDC_CHKDEFAULTCOL_MESSAGE), chkDefaultColorFile(this, IDC_CHKDEFAULTCOL_FILE), chkDefaultColorErr(this, IDC_CHKDEFAULTCOL_ERR), @@ -264,11 +281,11 @@ public: spinMessage(this, IDC_SPIN_MESSAGE, 1000, -1) { btnPreview.OnClick = Callback(this, &COptionsEventsDlg::onClick_Preview); - - chkDefaultColorMsg.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultMsg); - chkDefaultColorFile.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultFile); - chkDefaultColorErr.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultErr); - chkDefaultColorOthers.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultOther); + + chkDefaultColorMsg.OnChange = chkWinColorMsg.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultMsg); + chkDefaultColorFile.OnChange = chkWinColorFile.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultFile); + chkDefaultColorErr.OnChange = chkWinColorErr.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultErr); + chkDefaultColorOthers.OnChange = chkWinColorOthers.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultOther); } bool OnInitDialog() override @@ -289,6 +306,11 @@ public: chkDefaultColorErr.SetState(g_plugin.err.bDefault); chkDefaultColorOthers.SetState(g_plugin.other.bDefault); + chkWinColorMsg.SetState(g_plugin.msg.bWindows); + chkWinColorFile.SetState(g_plugin.file.bWindows); + chkWinColorErr.SetState(g_plugin.err.bWindows); + chkWinColorOthers.SetState(g_plugin.other.bWindows); + spinMessage.SetPosition(g_plugin.msg.iDelay); spinFile.SetPosition(g_plugin.file.iDelay); spinErr.SetPosition(g_plugin.err.iDelay); @@ -315,30 +337,38 @@ public: void onChange_DefaultMsg(CCtrlCheck *) { - bool bEnabled = chkDefaultColorMsg.GetState(); - clrBackMessage.Enable(!bEnabled); - clrTextMessage.Enable(!bEnabled); + bool b1 = !chkDefaultColorMsg.IsChecked(), b2 = !chkWinColorMsg.IsChecked(); + chkWinColorMsg.Enable(b1); + chkDefaultColorMsg.Enable(b2); + clrBackMessage.Enable(b1 && b2); + clrTextMessage.Enable(b1 && b2); } void onChange_DefaultFile(CCtrlCheck *) { - bool bEnabled = chkDefaultColorFile.GetState(); - clrBackFile.Enable(!bEnabled); - clrTextFile.Enable(!bEnabled); + bool b1 = !chkDefaultColorFile.IsChecked(), b2 = !chkWinColorFile.IsChecked(); + chkWinColorFile.Enable(b1); + chkDefaultColorFile.Enable(b2); + clrBackFile.Enable(b1 && b2); + clrTextFile.Enable(b1 && b2); } void onChange_DefaultErr(CCtrlCheck *) { - bool bEnabled = chkDefaultColorErr.GetState(); - clrBackErr.Enable(!bEnabled); - clrTextErr.Enable(!bEnabled); + bool b1 = !chkDefaultColorErr.IsChecked(), b2 = !chkWinColorErr.IsChecked(); + chkWinColorErr.Enable(b1); + chkDefaultColorErr.Enable(b2); + clrBackErr.Enable(b1 && b2); + clrTextErr.Enable(b1 && b2); } void onChange_DefaultOther(CCtrlCheck *) { - bool bEnabled = chkDefaultColorOthers.GetState(); - clrBackOther.Enable(!bEnabled); - clrTextOther.Enable(!bEnabled); + bool b1 = !chkDefaultColorOthers.IsChecked(), b2 = !chkWinColorOthers.IsChecked(); + chkWinColorOthers.Enable(b1); + chkDefaultColorOthers.Enable(b2); + clrBackOther.Enable(b1 && b2); + clrTextOther.Enable(b1 && b2); } }; diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index dca446fb4f..4da66331b7 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -323,8 +323,8 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) case EVENTTYPE_MESSAGE: if (!(g_plugin.maskNotify & MASK_MESSAGE)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - pudw.colorBack = g_plugin.msg.bDefault ? 0 : g_plugin.msg.backColor; - pudw.colorText = g_plugin.msg.bDefault ? 0 : g_plugin.msg.textColor; + pudw.colorBack = g_plugin.msg.getBackColor(); + pudw.colorText = g_plugin.msg.getTextColor(); iSeconds = g_plugin.msg.iDelay; sampleEvent = TranslateT("This is a sample message event :-)"); break; @@ -332,8 +332,8 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) case EVENTTYPE_FILE: if (!(g_plugin.maskNotify & MASK_FILE)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); - pudw.colorBack = g_plugin.file.bDefault ? 0 : g_plugin.file.backColor; - pudw.colorText = g_plugin.file.bDefault ? 0 : g_plugin.file.textColor; + pudw.colorBack = g_plugin.file.getBackColor(); + pudw.colorText = g_plugin.file.getTextColor(); iSeconds = g_plugin.file.iDelay; sampleEvent = TranslateT("This is a sample file event :-D"); break; @@ -341,8 +341,8 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) case EVENTTYPE_ERRMSG: if (!(g_plugin.maskNotify & MASK_ERROR)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_OTHER_DELETE); - pudw.colorBack = g_plugin.err.bDefault ? 0 : g_plugin.err.backColor; - pudw.colorText = g_plugin.err.bDefault ? 0 : g_plugin.err.textColor; + pudw.colorBack = g_plugin.err.getBackColor(); + pudw.colorText = g_plugin.err.getTextColor(); iSeconds = g_plugin.err.iDelay; sampleEvent = TranslateT("This is a sample error event :-D"); break; @@ -350,8 +350,8 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) default: if (!(g_plugin.maskNotify & MASK_OTHER)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - pudw.colorBack = g_plugin.other.bDefault ? 0 : g_plugin.other.backColor; - pudw.colorText = g_plugin.other.bDefault ? 0 : g_plugin.other.textColor; + pudw.colorBack = g_plugin.other.getBackColor(); + pudw.colorText = g_plugin.other.getTextColor(); iSeconds = g_plugin.other.iDelay; sampleEvent = TranslateT("This is a sample other event ;-D"); break; diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index 9cfe804873..6f6d911e00 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -45,6 +45,10 @@ #define IDC_TESTFORREAD 1038 #define IDC_OPT_TREE 1040 #define IDC_SPIN_MSGNUMBER 1041 +#define IDC_CHKWINCOL_MESSAGE 1042 +#define IDC_CHKWINCOL_FILE 1043 +#define IDC_CHKWINCOL_ERR 1044 +#define IDC_CHKWINCOL_OTHERS 1045 // Next default values for new objects // diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index 66f3e00283..c6d4e596a3 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -82,47 +82,52 @@ #define TIMER_TO_ACTION 50685 //Entries in the database, don't translate -#define OPT_DISABLE "Disabled" -#define OPT_MUCDISABLE "MUCDisabled" -#define OPT_PREVIEW "Preview" -#define OPT_MENUITEM "MenuItem" -#define OPT_LIMITPREVIEW "LimitPreview" +#define OPT_DISABLE "Disabled" +#define OPT_MUCDISABLE "MUCDisabled" +#define OPT_PREVIEW "Preview" +#define OPT_MENUITEM "MenuItem" +#define OPT_LIMITPREVIEW "LimitPreview" +#define OPT_COLWIN_MESSAGE "WinColorMsg" #define OPT_COLDEFAULT_MESSAGE "DefaultColorMsg" -#define OPT_COLBACK_MESSAGE "ColorBackMsg" -#define OPT_COLTEXT_MESSAGE "ColorTextMsg" -#define OPT_DELAY_MESSAGE "DelayMessage" - -#define OPT_COLDEFAULT_FILE "DefaultColorFile" -#define OPT_COLBACK_FILE "ColorBackFile" -#define OPT_COLTEXT_FILE "ColorTextFile" -#define OPT_DELAY_FILE "DelayFile" - -#define OPT_COLDEFAULT_ERR "DefaultColorErr" -#define OPT_COLBACK_ERR "ColorBackErr" -#define OPT_COLTEXT_ERR "ColorTextErr" -#define OPT_DELAY_ERR "DelayErr" - -#define OPT_COLDEFAULT_OTHERS "DefaultColorOthers" -#define OPT_COLBACK_OTHERS "ColorBackOthers" -#define OPT_COLTEXT_OTHERS "ColorTextOthers" -#define OPT_DELAY_OTHERS "DelayOthers" - -#define OPT_MASKNOTIFY "Notify" -#define OPT_MASKACTL "ActionLeft" -#define OPT_MASKACTR "ActionRight" -#define OPT_MASKACTTE "ActionTimeExpires" -#define OPT_MSGWINDOWCHECK "WindowCheck" -#define OPT_MSGREPLYWINDOW "ReplyWindow" -#define OPT_MERGEPOPUP "MergePopup" -#define OPT_SHOW_DATE "ShowDate" -#define OPT_SHOW_TIME "ShowTime" -#define OPT_SHOW_HEADERS "ShowHeaders" -#define OPT_NUMBER_MSG "NumberMsg" -#define OPT_SHOW_ON "ShowOldOrNew" -#define OPT_HIDESEND "HideSend" -#define OPT_NORSS "NoRSSAnnounces" -#define OPT_READCHECK "ReadCheck" +#define OPT_COLBACK_MESSAGE "ColorBackMsg" +#define OPT_COLTEXT_MESSAGE "ColorTextMsg" +#define OPT_DELAY_MESSAGE "DelayMessage" + +#define OPT_COLWIN_FILE "WinColorFile" +#define OPT_COLDEFAULT_FILE "DefaultColorFile" +#define OPT_COLBACK_FILE "ColorBackFile" +#define OPT_COLTEXT_FILE "ColorTextFile" +#define OPT_DELAY_FILE "DelayFile" + +#define OPT_COLWIN_ERR "WinColorErr" +#define OPT_COLDEFAULT_ERR "DefaultColorErr" +#define OPT_COLBACK_ERR "ColorBackErr" +#define OPT_COLTEXT_ERR "ColorTextErr" +#define OPT_DELAY_ERR "DelayErr" + +#define OPT_COLWIN_OTHERS "WinColorOthers" +#define OPT_COLDEFAULT_OTHERS "DefaultColorOthers" +#define OPT_COLBACK_OTHERS "ColorBackOthers" +#define OPT_COLTEXT_OTHERS "ColorTextOthers" +#define OPT_DELAY_OTHERS "DelayOthers" + +#define OPT_MASKNOTIFY "Notify" +#define OPT_MASKACTL "ActionLeft" +#define OPT_MASKACTR "ActionRight" +#define OPT_MASKACTTE "ActionTimeExpires" +#define OPT_MSGWINDOWCHECK "WindowCheck" +#define OPT_MSGREPLYWINDOW "ReplyWindow" +#define OPT_MERGEPOPUP "MergePopup" +#define OPT_SHOW_DATE "ShowDate" +#define OPT_SHOW_TIME "ShowTime" +#define OPT_SHOW_HEADERS "ShowHeaders" +#define OPT_NUMBER_MSG "NumberMsg" +#define OPT_SHOW_ON "ShowOldOrNew" +#define OPT_HIDESEND "HideSend" +#define OPT_NORSS "NoRSSAnnounces" +#define OPT_READCHECK "ReadCheck" + //--------------------------- //---Translateable Strings @@ -169,7 +174,21 @@ struct CMPlugin : public PLUGIN { COLORREF backColor, textColor; int iDelay; - bool bDefault; + bool bDefault, bWindows; + + COLORREF getBackColor() const + { + if (bDefault) return 0; + if (bWindows) return GetSysColor(COLOR_BTNFACE); + return backColor; + } + + COLORREF getTextColor() const + { + if (bDefault) return 0; + if (bWindows) return GetSysColor(COLOR_WINDOWTEXT); + return textColor; + } } msg, file, err, other; diff --git a/plugins/NewEventNotify/src/version.h b/plugins/NewEventNotify/src/version.h index f01c9e64d9..d7e4d28ddc 100644 --- a/plugins/NewEventNotify/src/version.h +++ b/plugins/NewEventNotify/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 2 -#define __BUILD_NUM 6 +#define __BUILD_NUM 7 #include -- cgit v1.2.3