summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-01-11 20:55:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-01-11 20:55:23 +0300
commit5d0722936cc48af5804f75f8785d3b7583420a7c (patch)
tree56f46ffa03903f35584e8f347308802e93e0b3f5 /plugins
parentc7120d1b26426bcb8243bd850e84041a0401bdfb (diff)
SRMM windows: timer classes instead of perversions with WM_TIMER
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Scriver/src/tabs.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp4
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp29
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp4
-rw-r--r--plugins/TabSRMM/src/msgs.h3
-rw-r--r--plugins/TabSRMM/src/sendqueue.h1
7 files changed, 27 insertions, 18 deletions
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp
index e024f1d50f..e50c07cff4 100644
--- a/plugins/Scriver/src/tabs.cpp
+++ b/plugins/Scriver/src/tabs.cpp
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+#define TIMERID_FLASHWND 1
+
#define SB_CHAR_WIDTH 40
#define SB_SENDING_WIDTH 25
#define SB_UNICODE_WIDTH 18
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index 1e3043a4a4..451d73387c 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -43,7 +43,7 @@ static void __stdcall Chat_DismissPopup(void *pi)
if (g_clistApi.pfnGetEvent(si->hContact, 0))
g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
- if (si->pDlg && KillTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND))
+ if (si->pDlg && si->pDlg->timerFlash.Stop())
FlashWindow(si->pDlg->GetHwnd(), FALSE);
}
@@ -233,7 +233,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p)
dat->m_iFlashIcon = p->hNotifyIcon;
}
dat->m_bCanFlashTab = TRUE;
- SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ si->pDlg->timerFlash.Start(TIMEOUT_FLASHWND);
}
}
if (dat->m_pWnd) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 6614834eaf..8b9570c3bb 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1104,7 +1104,7 @@ void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam)
m_iFlashIcon = PluginConfig.g_IconMsgEvent;
break;
}
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ timerFlash.Start(TIMEOUT_FLASHWND);
m_bCanFlashTab = true;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 16ca4dfc45..7a2f921952 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -355,6 +355,9 @@ void CMsgDialog::Init()
m_btnOk.OnClick = Callback(this, &CMsgDialog::onClick_Ok);
m_message.OnChange = Callback(this, &CMsgDialog::onChange_Message);
+
+ timerFlash.OnEvent = Callback(this, &CMsgDialog::onFlash);
+ timerType.OnEvent = Callback(this, &CMsgDialog::onType);
}
CMsgDialog::~CMsgDialog()
@@ -474,7 +477,7 @@ bool CMsgDialog::OnInitDialog()
m_iMultiSplit = g_plugin.getDword("multisplit", 150);
if (m_si == nullptr || m_si->iType == GCW_PRIVMESS) {
m_nTypeMode = PROTOTYPE_SELFTYPING_OFF;
- SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr);
+ timerType.Start(1000);
}
m_iLastEventType = 0xffffffff;
@@ -618,7 +621,7 @@ bool CMsgDialog::OnInitDialog()
if (m_pContainer->m_flags.m_bCreateMinimized || !m_bActivate || m_pContainer->m_flags.m_bDeferredTabSelect) {
m_iFlashIcon = PluginConfig.g_IconMsgEvent;
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ timerFlash.Start(TIMEOUT_FLASHWND);
m_bCanFlashTab = true;
DBEVENTINFO dbei = {};
@@ -1077,6 +1080,18 @@ void CMsgDialog::onChange_Message(CCtrlEdit*)
}
}
+void CMsgDialog::onType(CTimer *)
+{
+ if (m_si == nullptr || m_si->iType == GCW_PRIVMESS)
+ DM_Typing(false);
+}
+
+void CMsgDialog::onFlash(CTimer *)
+{
+ if (m_bCanFlashTab)
+ FlashTab(true);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// resizer proc for the "new" layout.
@@ -2740,16 +2755,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
}
}
- else if (wParam == TIMERID_FLASHWND) {
- if (m_bCanFlashTab)
- FlashTab(true);
- break;
- }
- else if (wParam == TIMERID_TYPE) {
- if (m_si == nullptr || m_si->iType == GCW_PRIVMESS)
- DM_Typing(false);
- break;
- }
break;
case DM_QUERYLASTUNREAD:
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 757a77e74f..fd147b364a 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -2281,7 +2281,7 @@ void CMsgDialog::UpdateWindowState(UINT msg)
UpdateTitle();
m_hTabIcon = m_hTabStatusIcon;
- if (KillTimer(m_hwnd, TIMERID_FLASHWND) || m_iFlashIcon) {
+ if (timerFlash.Stop() || m_iFlashIcon) {
FlashTab(false);
m_bCanFlashTab = FALSE;
m_iFlashIcon = nullptr;
@@ -2298,7 +2298,7 @@ void CMsgDialog::UpdateWindowState(UINT msg)
m_pContainer->m_pMenuBar->configureMenu();
}
else {
- if (KillTimer(m_hwnd, TIMERID_FLASHWND)) {
+ if (timerFlash.Stop()) {
FlashTab(false);
m_bCanFlashTab = false;
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 519d1b0e10..5d25322ab6 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -538,6 +538,9 @@ public:
void onClick_CancelAdd(CCtrlButton *);
void onClick_ShowNickList(CCtrlButton *);
+ void onType(CTimer *);
+ void onFlash(CTimer *);
+
void onChange_Message(CCtrlEdit *);
void onDblClick_List(CCtrlListBox *);
diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h
index beaf4acef7..bf73526477 100644
--- a/plugins/TabSRMM/src/sendqueue.h
+++ b/plugins/TabSRMM/src/sendqueue.h
@@ -28,7 +28,6 @@
#define __SENDQUEUE_H
#define TIMERID_MSGSEND 100
-#define TIMERID_TYPE 3
#define TIMERID_AWAYMSG 4
//#define TIMERID_TOOLTIP 5
#define TIMEOUT_TYPEOFF 10000 // send type off after 10 seconds of inactivity