From 7e9d92453de0fbe4fdb4168ab2275108f37d6152 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 20 May 2022 21:04:44 +0300 Subject: =?UTF-8?q?fixes=20#3071=20(TabSRMM=20=D0=B8=D0=BC=D0=B5=D0=B5?= =?UTF-8?q?=D1=82=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D1=83?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BF=D0=B0=D0=BF=D0=BE=D0=B2=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=20=D0=BD=D0=B0=D0=B1=D0=BE=D1=80=20=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D1=82=D0=B0,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=84=D0=BB=D0=B8=D0=BA=D1=82=D1=83?= =?UTF-8?q?=D0=B5=D1=82=20=D1=81=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=BE=D0=B9=20StdPopup)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/TabSRMM/res/resource.rc | 3 +-- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 18 +++++++-------- plugins/TabSRMM/src/msgs.h | 2 ++ plugins/TabSRMM/src/resource.h | 2 -- plugins/TabSRMM/src/srmm.cpp | 3 ++- plugins/TabSRMM/src/typingnotify.cpp | 44 +++++++++++++++++------------------- plugins/TabSRMM/src/typingnotify.h | 2 +- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 2b64a58a9e..79160c1d8a 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -272,8 +272,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,175,230,10 CONTROL "Show balloon tooltip in the system tray",IDC_NOTIFYBALLOON, "Button",BS_AUTOCHECKBOX | WS_GROUP,44,188,206,10 - GROUPBOX " Show popups when a user is typing",IDC_STATIC111,7,203,269,30 - CONTROL "",IDC_NOTIFYPOPUP,"Button",BS_AUTOCHECKBOX,16,202,12,12 + GROUPBOX "Show popups when a user is typing",IDC_STATIC,7,203,269,30 COMBOBOX IDC_MTN_POPUPMODE,32,216,230,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "More about typing notifications",IDC_MTN_HELP,"Hyperlink",WS_TABSTOP | 0x1,9,237,262,9 END diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 7039c21bbe..b96b7b84aa 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -255,7 +255,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM nSecs) if ((!foundWin || !pContainer->m_flags.m_bNoSound) && preTyping != (nSecs != 0)) Skin_PlaySound(nSecs ? "TNStart" : "TNStop"); - if (g_plugin.getByte("ShowTypingPopup", 0)) { + if (g_plugin.bPopups) { BOOL fShow = false; int iMode = M.GetByte("MTN_PopupMode", 0); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index fce1efd134..e71a21132f 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1005,7 +1005,7 @@ class COptTypingDlg : public CDlgBase CCtrlClc m_clist; CCtrlCheck chkWin, chkNoWin; - CCtrlCheck chkNotifyPopup, chkNotifyTray, chkShowNotify; + CCtrlCheck chkNotifyTray, chkShowNotify; CCtrlHyperlink urlHelp; void ResetCList(CCtrlClc* = nullptr) @@ -1049,8 +1049,7 @@ public: chkWin(this, IDC_TYPEWIN), chkNoWin(this, IDC_TYPENOWIN), chkNotifyTray(this, IDC_NOTIFYTRAY), - chkShowNotify(this, IDC_SHOWNOTIFY), - chkNotifyPopup(this, IDC_NOTIFYPOPUP) + chkShowNotify(this, IDC_SHOWNOTIFY) { m_clist.OnListRebuilt = Callback(this, &COptTypingDlg::RebuildList); m_clist.OnOptionsChanged = Callback(this, &COptTypingDlg::ResetCList); @@ -1059,7 +1058,6 @@ public: chkNotifyTray.OnChange = Callback(this, &COptTypingDlg::onCheck_NotifyTray); chkShowNotify.OnChange = Callback(this, &COptTypingDlg::onCheck_ShowNotify); - chkNotifyPopup.OnChange = Callback(this, &COptTypingDlg::onCheck_NotifyPopup); } bool OnInitDialog() override @@ -1082,15 +1080,13 @@ public: CheckDlgButton(m_hwnd, IDC_NOTIFYTRAY, g_plugin.getByte(SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_NOTIFYBALLOON, g_plugin.getByte("ShowTypingBalloon", 0)); - CheckDlgButton(m_hwnd, IDC_NOTIFYPOPUP, g_plugin.getByte("ShowTypingPopup", 0) ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(m_hwnd, IDC_TYPEWIN, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY) != 0); Utils::enableDlgControl(m_hwnd, IDC_TYPENOWIN, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY) != 0); Utils::enableDlgControl(m_hwnd, IDC_NOTIFYBALLOON, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY) && (IsDlgButtonChecked(m_hwnd, IDC_TYPEWIN) || IsDlgButtonChecked(m_hwnd, IDC_TYPENOWIN))); Utils::enableDlgControl(m_hwnd, IDC_TYPEFLASHWIN, IsDlgButtonChecked(m_hwnd, IDC_SHOWNOTIFY) != 0); - Utils::enableDlgControl(m_hwnd, IDC_MTN_POPUPMODE, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYPOPUP) != 0); + Utils::enableDlgControl(m_hwnd, IDC_MTN_POPUPMODE, g_plugin.bPopups); SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always")); SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always, but no popup when window is focused")); @@ -1109,15 +1105,17 @@ public: g_plugin.setByte(SRMSGSET_SHOWTYPINGWINOPEN, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_TYPEWIN)); g_plugin.setByte(SRMSGSET_SHOWTYPINGCLIST, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY)); g_plugin.setByte("ShowTypingBalloon", (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_NOTIFYBALLOON)); - g_plugin.setByte("ShowTypingPopup", (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_NOTIFYPOPUP)); db_set_b(0, SRMSGMOD_T, "MTN_PopupMode", (uint8_t)SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_GETCURSEL, 0, 0)); PluginConfig.reloadSettings(); return true; } - void onCheck_NotifyPopup(CCtrlCheck*) + INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override { - Utils::enableDlgControl(m_hwnd, IDC_MTN_POPUPMODE, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYPOPUP) != 0); + if (msg == WM_SETFOCUS) + Utils::enableDlgControl(m_hwnd, IDC_MTN_POPUPMODE, g_plugin.bPopups); + + return CDlgBase::DlgProc(msg, wParam, lParam); } void onCheck_NotifyTray(CCtrlCheck*) diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 671fd02512..7eb3272da4 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -1074,6 +1074,8 @@ struct CMPlugin : public PLUGIN { HANDLE hLogger; + CMOption bPopups; + CMPlugin(); int Load() override; diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index d3eac2f639..8a5df602a9 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -226,7 +226,6 @@ #define IDC_NOTIFYTRAY 1153 #define IDC_NOTIFYBALLOON 1154 #define IDC_NOTIFYBALLOON2 1155 -#define IDC_NOTIFYPOPUP 1155 #define IDC_MathSubst 1156 #define IDC_INDENTAMOUNT 1158 #define IDC_MSGTABS 1159 @@ -408,7 +407,6 @@ #define IDC_NRFLASHSPIN 1326 #define IDC_FLASHINTERVAL 1327 #define IDC_USEKBDHOOK 1328 -#define IDC_STATIC111 1329 #define IDC_TAB1 1330 #define IDC_ALWAYSFULLWIDTHTOOLBAR 1335 #define IDC_FORMATWHOLEWORDSONLY 1337 diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index c906c220c1..721e96799d 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -52,7 +52,8 @@ PLUGININFOEX pluginInfoEx = { }; CMPlugin::CMPlugin() : - PLUGIN("SRMsg", pluginInfoEx) + PLUGIN("SRMsg", pluginInfoEx), + bPopups(TypingModule, "TypingPopup", true) {} ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 0480a23afe..81318084f1 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -static CMOption g_bPopups(TypigModule, "TypingPopup", true); - static HGENMENU hDisableMenu = nullptr; static MWindowList hPopupsList = nullptr; @@ -69,7 +67,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 (!g_bPopups) + if (!g_plugin.bPopups) return; wchar_t *szContactName = Clist_GetContactDisplayName(hContact); @@ -431,7 +429,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case PSN_APPLY: for (int i = 0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) { colorPicker[i].color = SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_GETCOLOUR, 0, 0); - db_set_dw(0, TypigModule, colorPicker[i].desc, colorPicker[i].color); + db_set_dw(0, TypingModule, colorPicker[i].desc, colorPicker[i].color); } Timeout = newTimeout; TimeoutMode = newTimeoutMode; @@ -442,13 +440,13 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4; OnePopup = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP); - db_set_b(0, TypigModule, SET_ONEPOPUP, OnePopup); - 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); - db_set_b(0, TypigModule, SET_TIMEOUT, (uint8_t)Timeout); - db_set_b(0, TypigModule, SET_TIMEOUT_MODE2, TimeoutMode2); - db_set_b(0, TypigModule, SET_TIMEOUT2, (uint8_t)Timeout2); + db_set_b(0, TypingModule, SET_ONEPOPUP, OnePopup); + db_set_b(0, TypingModule, SET_DISABLED, (uint8_t)(StartDisabled | StopDisabled)); + db_set_b(0, TypingModule, SET_COLOR_MODE, ColorMode); + db_set_b(0, TypingModule, SET_TIMEOUT_MODE, TimeoutMode); + db_set_b(0, TypingModule, SET_TIMEOUT, (uint8_t)Timeout); + db_set_b(0, TypingModule, SET_TIMEOUT_MODE2, TimeoutMode2); + db_set_b(0, TypingModule, SET_TIMEOUT2, (uint8_t)Timeout2); return TRUE; } } @@ -474,25 +472,25 @@ int TN_ModuleInit() { hPopupsList = WindowList_Create(); - OnePopup = db_get_b(0, TypigModule, SET_ONEPOPUP, DEF_ONEPOPUP); + OnePopup = db_get_b(0, TypingModule, SET_ONEPOPUP, DEF_ONEPOPUP); - int i = db_get_b(0, TypigModule, SET_DISABLED, DEF_DISABLED); + int i = db_get_b(0, TypingModule, SET_DISABLED, DEF_DISABLED); if (i & 1) - g_bPopups = false; + g_plugin.bPopups = false; StartDisabled = i & 2; StopDisabled = i & 4; - ColorMode = db_get_b(0, TypigModule, SET_COLOR_MODE, DEF_COLOR_MODE); - TimeoutMode = db_get_b(0, TypigModule, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE); - Timeout = db_get_b(0, TypigModule, SET_TIMEOUT, DEF_TIMEOUT); - TimeoutMode2 = db_get_b(0, TypigModule, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2); - Timeout2 = db_get_b(0, TypigModule, SET_TIMEOUT2, DEF_TIMEOUT2); + ColorMode = db_get_b(0, TypingModule, SET_COLOR_MODE, DEF_COLOR_MODE); + TimeoutMode = db_get_b(0, TypingModule, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE); + Timeout = db_get_b(0, TypingModule, SET_TIMEOUT, DEF_TIMEOUT); + TimeoutMode2 = db_get_b(0, TypingModule, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2); + Timeout2 = db_get_b(0, TypingModule, SET_TIMEOUT2, DEF_TIMEOUT2); - if (!(db_get_dw(0, TypigModule, colorPicker[0].desc, 1) && !db_get_dw(0, TypigModule, colorPicker[0].desc, 0))) + if (!(db_get_dw(0, TypingModule, colorPicker[0].desc, 1) && !db_get_dw(0, TypingModule, colorPicker[0].desc, 0))) for (auto &it : colorPicker) - it.color = db_get_dw(0, TypigModule, it.desc, 0); + it.color = db_get_dw(0, TypingModule, it.desc, 0); - g_plugin.addPopupOption(LPGEN("Typing notifications"), g_bPopups); + g_plugin.addPopupOption(LPGEN("Typing notifications"), g_plugin.bPopups); g_plugin.addSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); g_plugin.addSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); @@ -502,6 +500,6 @@ int TN_ModuleInit() int TN_ModuleDeInit() { WindowList_Destroy(hPopupsList); - db_set_b(0, TypigModule, SET_DISABLED, (uint8_t)(StartDisabled | StopDisabled)); + db_set_b(0, TypingModule, SET_DISABLED, (uint8_t)(StartDisabled | StopDisabled)); return 0; } diff --git a/plugins/TabSRMM/src/typingnotify.h b/plugins/TabSRMM/src/typingnotify.h index 92a33a3d27..d42e595dde 100644 --- a/plugins/TabSRMM/src/typingnotify.h +++ b/plugins/TabSRMM/src/typingnotify.h @@ -12,7 +12,7 @@ #define COLOR_WINDOWS 2 #define COLOR_POPUP 3 -#define TypigModule "TypingNotify" +#define TypingModule "TypingNotify" #define SET_WO "NotWhenFocused" #define DEF_WO 0 -- cgit v1.2.3