From 555c7f83e3552a6210bc96e70b2aaecd14732e7a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jan 2021 20:32:00 +0300 Subject: fixes #2714 (Scriver: problems with resizer) --- plugins/Scriver/src/chat.h | 1 - plugins/Scriver/src/msgdialog.cpp | 56 ++++++++++++++++++++++++--------------- plugins/Scriver/src/msgs.h | 2 ++ 3 files changed, 36 insertions(+), 23 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/chat.h b/plugins/Scriver/src/chat.h index ae648917fb..777409a828 100644 --- a/plugins/Scriver/src/chat.h +++ b/plugins/Scriver/src/chat.h @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EM_ACTIVATE (WM_USER+202) #define TIMERID_MSGSEND 201 -#define TIMERID_TYPE 202 #define TIMERID_UNREAD 203 #define TIMEOUT_TYPEOFF 10000 // send type off after 10 seconds of inactivity #define TIMEOUT_UNREAD 800 // multiple-send bombproofing: send max 3 messages every 4 seconds diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index f0d55d784c..814ef6b5c8 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -152,6 +152,8 @@ void CMsgDialog::Init() m_btnOk.OnClick = Callback(this, &CMsgDialog::onClick_Ok); + timerType.OnEvent = Callback(this, &CMsgDialog::onType); + m_message.OnChange = Callback(this, &CMsgDialog::onChange_Message); m_splitterY.OnChange = Callback(this, &CMsgDialog::onChange_SplitterY); } @@ -171,7 +173,7 @@ bool CMsgDialog::OnInitDialog() m_wStatus = ID_STATUS_OFFLINE; m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); + timerType.Start(1000); m_lastEventType = -1; m_lastEventTime = time(0); @@ -574,6 +576,9 @@ void CMsgDialog::onClick_Filter(CCtrlButton *pButton) void CMsgDialog::onChange_SplitterX(CSplitter *pSplitter) { + if (!m_bInitialized) + return; + RECT rc; GetClientRect(m_hwnd, &rc); @@ -586,6 +591,9 @@ void CMsgDialog::onChange_SplitterX(CSplitter *pSplitter) void CMsgDialog::onChange_SplitterY(CSplitter *pSplitter) { + if (!m_bInitialized) + return; + RECT rc; GetClientRect(m_hwnd, &rc); m_pParent->iSplitterY = rc.bottom - pSplitter->GetPos(); @@ -593,6 +601,31 @@ void CMsgDialog::onChange_SplitterY(CSplitter *pSplitter) ///////////////////////////////////////////////////////////////////////////////////////// +void CMsgDialog::onType(CTimer *) +{ + if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - m_nLastTyping > TIMEOUT_TYPEOFF) + NotifyTyping(PROTOTYPE_SELFTYPING_OFF); + + if (m_bShowTyping) { + if (m_nTypeSecs) + m_nTypeSecs--; + else { + m_bShowTyping = false; + UpdateStatusBar(); + UpdateIcon(); + } + } + else { + if (m_nTypeSecs) { + m_bShowTyping = true; + UpdateStatusBar(); + UpdateIcon(); + } + } +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CMsgDialog::MessageDialogResize(int w, int h) { ParentWindowData *pdat = m_pParent; @@ -1274,27 +1307,6 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_TIMER: if (wParam == TIMERID_MSGSEND) ReportSendQueueTimeouts(this); - else if (wParam == TIMERID_TYPE) { - if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - m_nLastTyping > TIMEOUT_TYPEOFF) - NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - - if (m_bShowTyping) { - if (m_nTypeSecs) - m_nTypeSecs--; - else { - m_bShowTyping = false; - UpdateStatusBar(); - UpdateIcon(); - } - } - else { - if (m_nTypeSecs) { - m_bShowTyping = true; - UpdateStatusBar(); - UpdateIcon(); - } - } - } else if (wParam == TIMERID_UNREAD) { TabControlData tcd; tcd.iFlags = TCDF_ICON; diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 79b18c4504..ee0d355c24 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -172,6 +172,8 @@ public: void onChange_SplitterX(CSplitter *); void onChange_SplitterY(CSplitter *); + void onType(CTimer *); + void CloseTab() override; void LoadSettings() override; void SetStatusText(const wchar_t *, HICON) override; -- cgit v1.2.3