From 615afbd839b22a7a170c477481ef67e5603b9709 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 May 2021 23:01:52 +0300 Subject: SetDraw(bool bEnable) - a wrapper for WM_SETREDRAW command --- include/m_gui.h | 34 +++++++++++++----------- libs/win32/mir_core.lib | Bin 477920 -> 478448 bytes libs/win64/mir_core.lib | Bin 483088 -> 483626 bytes plugins/Clist_modern/src/modern_viewmodebar.cpp | 14 +++++----- plugins/Ping/src/pingthread.cpp | 1 - plugins/QuickSearch/src/window_misc.cpp | 12 ++++----- plugins/Scriver/src/msgdialog.cpp | 4 +-- plugins/Scriver/src/msglog.cpp | 14 +++++----- plugins/Scriver/src/msgutils.cpp | 4 +-- plugins/TabSRMM/src/msgdialog.cpp | 4 +-- plugins/TabSRMM/src/msglog.cpp | 12 ++++----- protocols/JabberG/src/jabber_iqid_muc.cpp | 4 +-- src/core/stdmsg/src/chat_window.cpp | 8 +++--- src/core/stdmsg/src/msgdialog.cpp | 4 +-- src/core/stdmsg/src/msglog.cpp | 4 +-- src/mir_app/src/menu_options.cpp | 4 +-- src/mir_app/src/options.cpp | 4 +-- src/mir_core/src/CCtrlBase.cpp | 5 ++++ src/mir_core/src/CDlgBase.cpp | 5 ++++ src/mir_core/src/mir_core.def | 2 ++ src/mir_core/src/mir_core64.def | 2 ++ 21 files changed, 78 insertions(+), 63 deletions(-) diff --git a/include/m_gui.h b/include/m_gui.h index 7cf7db58d9..85fba587a4 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -339,6 +339,7 @@ public: CCtrlBase* FindControl(HWND hwnd); void SetCaption(const wchar_t *ptszCaption); + void SetDraw(bool bEnable); void NotifyChange(void); // sends a notification to a parent window __forceinline HINSTANCE GetInst() const { return m_pPlugin.getInst(); } @@ -491,12 +492,13 @@ public: bool Enabled(void) const; void NotifyChange(); + void SetDraw(bool bEnable); - LRESULT SendMsg(UINT Msg, WPARAM wParam, LPARAM lParam) const; + LRESULT SendMsg(UINT Msg, WPARAM wParam, LPARAM lParam) const; - void SetText(const wchar_t *text); - void SetTextA(const char *text); - void SetInt(int value); + void SetText(const wchar_t *text); + void SetTextA(const char *text); + void SetInt(int value); wchar_t* GetText() const; char* GetTextA() const; @@ -508,18 +510,18 @@ public: int GetInt() const; - virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD /*idCode*/) { return FALSE; } - virtual BOOL OnNotify(int /*idCtrl*/, NMHDR* /*pnmh*/) { return FALSE; } - - virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT*) { return FALSE; } - virtual BOOL OnDrawItem(DRAWITEMSTRUCT*) { return FALSE; } - virtual BOOL OnDeleteItem(DELETEITEMSTRUCT*) { return FALSE; } - - virtual void OnInit(); - virtual void OnDestroy(); - - virtual bool OnApply(); - virtual void OnReset(); + virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD /*idCode*/) { return FALSE; } + virtual BOOL OnNotify(int /*idCtrl*/, NMHDR* /*pnmh*/) { return FALSE; } + + virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT*) { return FALSE; } + virtual BOOL OnDrawItem(DRAWITEMSTRUCT*) { return FALSE; } + virtual BOOL OnDeleteItem(DELETEITEMSTRUCT*) { return FALSE; } + + virtual void OnInit(); + virtual void OnDestroy(); + + virtual bool OnApply(); + virtual void OnReset(); protected: HWND m_hwnd = nullptr; // must be the first data item diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 76bba9dd4d..8778a0c4dd 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 4733b8bff4..46042a3882 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index b8f6c758d5..a9bcc83f1d 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -420,29 +420,29 @@ class CViewModeSetupDlg : public CDlgBase pageChange = 1; if (pageChange) - SendMessage(m_hwnd, WM_SETREDRAW, FALSE, 0); + SetDraw(false); switch (page) { case 0: for (auto &ctrlId : _page1Controls) - ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_SHOW); + ::ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_SHOW); for (auto &ctrlId : _page2Controls) - ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_HIDE); + ::ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_HIDE); break; case 1: for (auto &ctrlId : _page1Controls) - ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_HIDE); + ::ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_HIDE); for (auto &ctrlId : _page2Controls) - ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_SHOW); + ::ShowWindow(GetDlgItem(m_hwnd, ctrlId), SW_SHOW); break; } if (pageChange) { - SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(m_hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE); + SetDraw(true); + ::RedrawWindow(m_hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE); } } diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 03847a4f3d..a57266e6f1 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -234,7 +234,6 @@ bool FrameIsFloating() int FillList(WPARAM, LPARAM) { - if (options.logging) CallService(MODULENAME "/Log", (WPARAM)L"ping address list reload", 0); diff --git a/plugins/QuickSearch/src/window_misc.cpp b/plugins/QuickSearch/src/window_misc.cpp index 8799d6770c..a52354b884 100644 --- a/plugins/QuickSearch/src/window_misc.cpp +++ b/plugins/QuickSearch/src/window_misc.cpp @@ -77,7 +77,7 @@ void QSMainDlg::AddContactToList(MCONTACT hContact, CRowItem *pRow) void QSMainDlg::AdvancedFilter() { - m_grid.SendMsg(WM_SETREDRAW, FALSE, 0); + m_grid.SetDraw(false); for (auto &it : m_rows) { bool bShow = (szFilterProto == nullptr) || !mir_strcmp(szFilterProto, it->szProto); @@ -96,7 +96,7 @@ void QSMainDlg::AdvancedFilter() } } - m_grid.SendMsg(WM_SETREDRAW, TRUE, 0); + m_grid.SetDraw(true); InvalidateRect(m_grid.GetHwnd(), 0, false); Sort(); @@ -152,7 +152,7 @@ void QSMainDlg::DeleteByList() if (IDOK != MessageBoxW(0, TranslateT("Do you really want to delete selected contacts"), TranslateT("Warning"), MB_OKCANCEL + MB_ICONWARNING)) return; - m_grid.SendMsg(WM_SETREDRAW, FALSE, 0); + m_grid.SetDraw(false); for (int i = m_grid.GetItemCount() - 1; i >= 0; i--) if (m_grid.GetItemState(i, LVIS_SELECTED)) { @@ -160,7 +160,7 @@ void QSMainDlg::DeleteByList() m_grid.DeleteItem(i); } - m_grid.SendMsg(WM_SETREDRAW, TRUE, 0); + m_grid.SetDraw(true); } void QSMainDlg::DeleteOneContact(MCONTACT hContact) @@ -260,14 +260,14 @@ void QSMainDlg::DrawSB() void QSMainDlg::FillGrid() { - m_grid.SendMsg(WM_SETREDRAW, FALSE, 0); + m_grid.SetDraw(false); MakePattern(); for (auto &it: m_rows) ProcessLine(it); - m_grid.SendMsg(WM_SETREDRAW, TRUE, 0); + m_grid.SetDraw(true); InvalidateRect(m_grid.GetHwnd(), 0, FALSE); Sort(); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2603cfec25..c8b0f89f2e 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -877,9 +877,9 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) } if (wParam == VK_TAB && !isCtrl && !isShift) { // tab-autocomplete - m_message.SendMsg(WM_SETREDRAW, FALSE, 0); + m_message.SetDraw(false); TabAutoComplete(); - m_message.SendMsg(WM_SETREDRAW, TRUE, 0); + m_message.SetDraw(true); RedrawWindow(m_nickList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); return 0; } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 8e2e2c40ac..062657a3ac 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -740,7 +740,7 @@ void CLogWindow::Attach() void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) { CHARRANGE oldSel, sel; - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel); LogStreamData streamData = {}; @@ -779,7 +779,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); } else { - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); m_rtf.SetTextA(""); sel.cpMin = 0; sel.cpMax = m_rtf.GetRichTextLength(); @@ -819,7 +819,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre); } - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); if (bottomScroll) { ScrollToBottom(); RedrawWindow(m_rtf.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); @@ -861,7 +861,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) CHARRANGE oldsel, sel, newsel; m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel); if (oldsel.cpMax != oldsel.cpMin) - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); // set the insertion point at the bottom sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); @@ -878,7 +878,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) // get the number of pixels per logical inch bool bFlag = false; if (bRedraw) { - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); bFlag = true; } @@ -913,7 +913,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } @@ -921,7 +921,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) if (bFlag) { sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } } diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 663f5bfde8..60c89a3801 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -431,7 +431,7 @@ void CMsgDialog::UpdateIcon() void CMsgDialog::UpdateNickList() { - m_nickList.SendMsg(WM_SETREDRAW, FALSE, 0); + m_nickList.SetDraw(false); m_nickList.ResetContent(); for (auto &ui : m_si->getUserList()) { char szIndicator = SM_GetStatusIndicator(m_si, ui); @@ -442,7 +442,7 @@ void CMsgDialog::UpdateNickList() } else m_nickList.AddString(ui->pszNick); } - m_nickList.SendMsg(WM_SETREDRAW, TRUE, 0); + m_nickList.SetDraw(true); InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE); UpdateWindow(m_nickList.GetHwnd()); UpdateTitle(); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 9c5e2a4cc6..c872c9c44a 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1842,9 +1842,9 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) if (PluginConfig.m_bAllowTab) break; - m_message.SendMsg(WM_SETREDRAW, FALSE, 0); + m_message.SetDraw(false); bool fCompleted = TabAutoComplete(); - m_message.SendMsg(WM_SETREDRAW, TRUE, 0); + m_message.SetDraw(true); RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); if (!fCompleted) { if ((GetSendButtonState() != PBS_DISABLED)) diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 308729a68d..49d03fa2bd 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1281,7 +1281,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DBEVEN } // begin to draw - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); m_rtf.SendMsg(EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); m_pDlg.m_hDbEventLast = streamData.hDbEventLast; @@ -1311,7 +1311,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DBEVEN m_rtf.SendMsg(EM_HIDESELECTION, FALSE, 0); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, FALSE); EnableWindow(GetDlgItem(m_pDlg.m_hwnd, IDC_QUOTE), m_pDlg.m_hDbEventLast != 0); mir_free(streamData.buffer); @@ -1347,7 +1347,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) CHARRANGE oldsel, sel, newsel; m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel); if (oldsel.cpMax != oldsel.cpMin) - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); // set the insertion point at the bottom sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); @@ -1368,7 +1368,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(nullptr, hdc); - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); bFlag = true; } @@ -1460,7 +1460,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } @@ -1468,7 +1468,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) if (bFlag) { sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } } diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 36b83a58f4..da9d347915 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -95,7 +95,7 @@ class CJabberMucJidListDlg : public CJabberDlgBase return; ptrW filter(bFilter ? edtFilter.GetText() : nullptr); - m_list.SendMsg(WM_SETREDRAW, FALSE, 0); + m_list.SetDraw(false); FreeList(); @@ -151,7 +151,7 @@ class CJabberMucJidListDlg : public CJabberDlgBase lvi.iImage = 1; m_list.InsertItem(&lvi); - m_list.SendMsg(WM_SETREDRAW, TRUE, 0); + m_list.SetDraw(true); RedrawWindow(m_list.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 05a5ddb24d..222087d178 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -145,7 +145,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) CHARRANGE oldsel, sel; m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel); if (oldsel.cpMax != oldsel.cpMin) - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); //set the insertion point at the bottom sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); @@ -164,7 +164,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(nullptr, hdc); - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); bFlag = true; } @@ -200,7 +200,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } @@ -208,7 +208,7 @@ void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) if (bFlag) { sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); } } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 74433f6cde..a115908a84 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1250,7 +1250,7 @@ void CMsgDialog::TabAutoComplete() { LRESULT lResult = (LRESULT)m_message.SendMsg(EM_GETSEL, 0, 0); - m_message.SendMsg(WM_SETREDRAW, FALSE, 0); + m_message.SetDraw(false); m_iTabStart = LOWORD(lResult); int end = HIWORD(lResult); m_message.SendMsg(EM_SETSEL, end, end); @@ -1296,7 +1296,7 @@ void CMsgDialog::TabAutoComplete() mir_free(pszSelName); } - m_message.SendMsg(WM_SETREDRAW, TRUE, 0); + m_message.SetDraw(true); RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 61630fa198..3161dff215 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -465,7 +465,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) BOOL bottomScroll = TRUE; POINT scrollPos; - m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetDraw(false); m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel); LogStreamData streamData = {}; @@ -542,7 +542,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre); } - m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + m_rtf.SetDraw(true); if (bottomScroll) { ScrollToBottom(); RedrawWindow(m_rtf.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 3d12ade011..897902a3c4 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -252,12 +252,12 @@ class CGenMenuOptionsPage : public CDlgBase if (bReread) // no need to reread database on reset MO_RecursiveWalkMenu(pmo->m_items.first, Menu_LoadFromDatabase, szModule); - m_menuItems.SendMsg(WM_SETREDRAW, FALSE, 0); + m_menuItems.SetDraw(false); m_menuItems.DeleteAllItems(); BuildTreeInternal(szModule, bReread, pmo->m_items.first, nullptr); - m_menuItems.SendMsg(WM_SETREDRAW, TRUE, 0); + m_menuItems.SetDraw(true); m_warning.Show(!pmo->m_bUseUserDefinedItems); m_menuItems.Enable(pmo->m_bUseUserDefinedItems); diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index be2c96b67b..d4c566acf1 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -540,7 +540,7 @@ class COptionsDlg : public CDlgBase _tcslwr_locale(m_szFilterString); //all strings are stored as lowercase ... make sure filter string is lowercase too - m_pageTree.SendMsg(WM_SETREDRAW, FALSE, 0); + m_pageTree.SetDraw(false); HWND oldWnd = nullptr; HWND oldTab = nullptr; @@ -651,7 +651,7 @@ class COptionsDlg : public CDlgBase m_keywordFilter.SendMsg(CB_SETEDITSEL, 0, oldSel); //but don't select any of the text - m_pageTree.SendMsg(WM_SETREDRAW, TRUE, 0); + m_pageTree.SetDraw(true); m_pageTree.EnsureVisible(m_hCurrentPage); } diff --git a/src/mir_core/src/CCtrlBase.cpp b/src/mir_core/src/CCtrlBase.cpp index 800e8c693d..aa684707e0 100644 --- a/src/mir_core/src/CCtrlBase.cpp +++ b/src/mir_core/src/CCtrlBase.cpp @@ -116,6 +116,11 @@ void CCtrlBase::SetTextA(const char *text) ::SetWindowTextA(m_hwnd, text); } +void CCtrlBase::SetDraw(bool bEnable) +{ + ::SendMessage(m_hwnd, WM_SETREDRAW, bEnable, 0); +} + void CCtrlBase::SetInt(int value) { wchar_t buf[32] = { 0 }; diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index bc051554de..f9f5f47a06 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -137,6 +137,11 @@ void CDlgBase::SetCaption(const wchar_t *ptszCaption) SetWindowText(m_hwnd, ptszCaption); } +void CDlgBase::SetDraw(bool bEnable) +{ + ::SendMessage(m_hwnd, WM_SETREDRAW, bEnable, 0); +} + void CDlgBase::Show(int nCmdShow) { if (m_hwnd == nullptr) diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 3702d84864..b823bc88f8 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1505,3 +1505,5 @@ TimeZone_GetSystemTime @1692 ?SelectData@CCtrlCombo@@QAEHJ@Z @1728 NONAME ?SetCurSel@CCtrlListView@@QAEXH@Z @1729 NONAME ?GetCurData@CCtrlCombo@@QBEJXZ @1730 NONAME +?SetDraw@CCtrlBase@@QAEX_N@Z @1731 NONAME +?SetDraw@CDlgBase@@QAEX_N@Z @1732 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index ae7037fbdd..e4515d39d6 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1505,3 +1505,5 @@ TimeZone_GetSystemTime @1692 ?SelectData@CCtrlCombo@@QEAAH_J@Z @1728 NONAME ?SetCurSel@CCtrlListView@@QEAAXH@Z @1729 NONAME ?GetCurData@CCtrlCombo@@QEBA_JXZ @1730 NONAME +?SetDraw@CCtrlBase@@QEAAX_N@Z @1731 NONAME +?SetDraw@CDlgBase@@QEAAX_N@Z @1732 NONAME -- cgit v1.2.3