summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-06-20 14:58:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-06-20 14:58:04 +0300
commitb52aae1e9c6355d1725e000dcf8824fc2fe40383 (patch)
treebbc1ef23af3de05a59038145e1b36db6ca8cf2b4
parent5fb505e97bca59badf137b524c54629fa51a8d65 (diff)
time to get rid of some DlgProc defined just to handle WM_SIZE issues
-rw-r--r--include/m_gui.h3
-rw-r--r--libs/win32/mir_core.libbin487906 -> 488182 bytes
-rw-r--r--libs/win64/mir_core.libbin493062 -> 493348 bytes
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp13
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp10
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp16
-rw-r--r--src/core/stdmsg/src/stdafx.h1
-rw-r--r--src/core/stdmsg/src/tabs.cpp27
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp35
-rw-r--r--src/mir_core/src/Windows/CCtrlTreeView.cpp4
-rw-r--r--src/mir_core/src/Windows/CDlgBase.cpp21
-rw-r--r--src/mir_core/src/mir_core.def3
-rw-r--r--src/mir_core/src/mir_core64.def3
13 files changed, 72 insertions, 64 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index de696094bd..05baab4b0b 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -510,6 +510,7 @@ protected:
// miranda-related stuff
virtual int Resizer(UTILRESIZECONTROL *urc);
+ virtual void OnResize();
virtual void OnReset();
virtual void OnChange();
@@ -1256,7 +1257,7 @@ public:
void SelectSetFirstVisible(HTREEITEM hItem);
COLORREF SetBkColor(COLORREF clBack);
void SetCheckState(HTREEITEM hItem, uint32_t state);
- void SetImageList(HIMAGELIST hIml, int iImage);
+ HIMAGELIST SetImageList(HIMAGELIST hIml, int iImage);
void SetIndent(int iIndent);
void SetInsertMark(HTREEITEM hItem, BOOL fAfter);
COLORREF SetInsertMarkColor(COLORREF clMark);
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index b982ae5fcc..2833d2279c 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index b82abfe59c..d3b3b804a0 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 86fc5ab511..72deebab0f 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -225,16 +225,13 @@ public:
m_proto->GetMucDlg(m_info->type) = nullptr;
}
- INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override
+ void OnResize() override
{
- INT_PTR ret = CSuper::DlgProc(uMsg, wParam, lParam);
- if (uMsg == WM_SIZE) {
- RECT rc;
- GetClientRect(m_list.GetHeader(), &rc);
- m_list.SetColumnWidth(0, rc.right - rc.left);
- }
+ CSuper::OnResize();
- return ret;
+ RECT rc;
+ GetClientRect(m_list.GetHeader(), &rc);
+ m_list.SetColumnWidth(0, rc.right - rc.left);
}
int Resizer(UTILRESIZECONTROL *urc) override
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 49ca3d8010..5986fc701e 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -239,8 +239,8 @@ class CCtrlNotebookList : public CCtrlListBox
HFONT m_hfntNormal, m_hfntSmall, m_hfntBold;
public:
- CCtrlNotebookList(CDlgBase* dlg, int ctrlId)
- : CCtrlListBox(dlg, ctrlId),
+ CCtrlNotebookList(CDlgBase* dlg, int ctrlId) :
+ CCtrlListBox(dlg, ctrlId),
m_adding(false)
{
m_hfntNormal = m_hfntSmall = m_hfntBold = nullptr;
@@ -266,7 +266,8 @@ public:
mis.itemID = idx;
mis.itemData = data;
OnMeasureItem(&mis);
- if (mis.itemHeight) SendMessage(m_hwnd, LB_SETITEMHEIGHT, idx, mis.itemHeight);
+ if (mis.itemHeight)
+ SendMessage(m_hwnd, LB_SETITEMHEIGHT, idx, mis.itemHeight);
return idx;
}
@@ -288,7 +289,8 @@ public:
mis.itemID = idx;
mis.itemData = GetItemData(idx);
OnMeasureItem(&mis);
- if (mis.itemHeight) SendMessage(m_hwnd, LB_SETITEMHEIGHT, idx, mis.itemHeight);
+ if (mis.itemHeight)
+ SendMessage(m_hwnd, LB_SETITEMHEIGHT, idx, mis.itemHeight);
}
SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index d7ebc6af0e..cf07268ba8 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -79,7 +79,6 @@ class JabberUserInfoDlg : public CUserInfoPageDlg
UI_MESSAGE_MAP(JabberUserInfoDlg, CUserInfoPageDlg);
UI_MESSAGE(WM_PROTO_CHECK_ONLINE, OnCheckOnline);
- UI_MESSAGE(WM_SIZE, OnSize);
UI_MESSAGE_MAP_END();
INT_PTR OnCheckOnline(UINT, WPARAM, LPARAM)
@@ -91,12 +90,6 @@ class JabberUserInfoDlg : public CUserInfoPageDlg
return 0;
}
- INT_PTR OnSize(UINT, WPARAM, LPARAM lParam)
- {
- MoveWindow(GetDlgItem(m_hwnd, IDC_TV_INFO), 5, 5, LOWORD(lParam) - 10, HIWORD(lParam) - 10, TRUE);
- return 0;
- }
-
////////////////////////////////////////////////////////////////////////////////////////
// User information block
@@ -400,11 +393,11 @@ public:
RECT rc;
GetClientRect(m_hwnd, &rc);
- MoveWindow(GetDlgItem(m_hwnd, IDC_TV_INFO), 5, 5, rc.right - 10, rc.bottom - 10, TRUE);
+ MoveWindow(m_tree.GetHwnd(), 5, 5, rc.right - 10, rc.bottom - 10, TRUE);
HIMAGELIST himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, 1);
ImageList_AddSkinIcon(himl, SKINICON_OTHER_SMALLDOT);
- TreeView_SetImageList(GetDlgItem(m_hwnd, IDC_TV_INFO), himl, TVSIL_NORMAL);
+ TreeView_SetImageList(m_tree.GetHwnd(), himl, TVSIL_NORMAL);
WindowList_Add(hUserInfoList, m_hwnd, m_hContact);
return true;
@@ -414,7 +407,7 @@ public:
{
ppro->WindowUnsubscribe(m_hwnd);
WindowList_Remove(hUserInfoList, m_hwnd);
- ImageList_Destroy(TreeView_SetImageList(GetDlgItem(m_hwnd, IDC_TV_INFO), nullptr, TVSIL_NORMAL));
+ ImageList_Destroy(m_tree.SetImageList(nullptr, TVSIL_NORMAL));
Window_FreeIcon_IcoLib(m_hwnd);
}
@@ -435,8 +428,7 @@ public:
item = ppro->ListGetItemPtr(LIST_ROSTER, jid);
if (item == nullptr) {
- HWND hwndTree = GetDlgItem(m_hwnd, IDC_TV_INFO);
- TreeView_DeleteAllItems(hwndTree);
+ m_tree.DeleteAllItems();
HTREEITEM htiRoot = FillInfoLine(nullptr, IcoLib_GetIconByHandle(ppro->m_hProtoIcon), L"JID", jid, sttInfoLineId(0, INFOLINE_NAME), true);
FillInfoLine(htiRoot, g_plugin.getIcon(IDI_VCARD), nullptr, TranslateU("Please switch online to see more details."));
return false;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index ef484f4f68..6dd1a92181 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -117,6 +117,7 @@ public:
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
+ void OnResize() override;
};
extern CTabbedWindow *g_pTabDialog;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index ad11e2afa9..61c2426641 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -188,6 +188,21 @@ void CTabbedWindow::OnDestroy()
g_pTabDialog = nullptr;
}
+void CTabbedWindow::OnResize()
+{
+ CDlgBase::OnResize();
+
+ SendMessage(m_hwndStatus, WM_SIZE, 0, 0);
+
+ if (m_pEmbed) {
+ RECT rc;
+ GetClientRect(m_tab.GetHwnd(), &rc);
+ MoveWindow(m_pEmbed->GetHwnd(), 0, 0, rc.right - rc.left, rc.bottom - rc.top, FALSE);
+ }
+
+ SaveWindowPosition(false);
+}
+
int CTabbedWindow::Resizer(UTILRESIZECONTROL *urc)
{
if (urc->wId == IDC_TAB) {
@@ -639,17 +654,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
}
- LRESULT res = CDlgBase::DlgProc(msg, wParam, lParam);
- if (msg == WM_SIZE) {
- SendMessage(m_hwndStatus, WM_SIZE, 0, 0);
- if (m_pEmbed) {
- GetClientRect(m_tab.GetHwnd(), &rc);
- MoveWindow(m_pEmbed->GetHwnd(), 0, 0, rc.right - rc.left, rc.bottom - rc.top, FALSE);
- }
- SaveWindowPosition(false);
- }
-
- return res;
+ return CDlgBase::DlgProc(msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index 475c0d3de0..a66401ea6d 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -216,11 +216,13 @@ static int IsOverEmail(HWND hwndDlg, wchar_t *szEmail, int cchEmail)
class CContactPage : public CUserInfoPageDlg
{
+ typedef CUserInfoPageDlg CSuper;
+
CCtrlListView m_emails, m_phones;
public:
CContactPage() :
- CUserInfoPageDlg(g_plugin, IDD_INFO_CONTACT),
+ CSuper(g_plugin, IDD_INFO_CONTACT),
m_emails(this, IDC_EMAILS),
m_phones(this, IDC_PHONES)
{
@@ -259,6 +261,21 @@ public:
return true;
}
+ void OnResize() override
+ {
+ CSuper::OnResize();
+
+ RECT rc;
+ GetClientRect(m_emails.GetHwnd(), &rc);
+ rc.right -= GetSystemMetrics(SM_CXVSCROLL);
+
+ m_emails.SetColumnWidth(0, rc.right / 4);
+ m_emails.SetColumnWidth(1, rc.right - rc.right / 4 - 40);
+
+ m_phones.SetColumnWidth(0, rc.right / 4);
+ m_phones.SetColumnWidth(1, rc.right - rc.right / 4 - 90);
+ }
+
int Resizer(UTILRESIZECONTROL *urc) override
{
switch (urc->wId) {
@@ -528,21 +545,7 @@ public:
}
}
- INT_PTR res = CDlgBase::DlgProc(msg, wParam, lParam);
-
- if (msg == WM_SIZE) {
- RECT rc;
- GetClientRect(m_emails.GetHwnd(), &rc);
- rc.right -= GetSystemMetrics(SM_CXVSCROLL);
-
- m_emails.SetColumnWidth(0, rc.right / 4);
- m_emails.SetColumnWidth(1, rc.right - rc.right / 4 - 40);
-
- m_phones.SetColumnWidth(0, rc.right / 4);
- m_phones.SetColumnWidth(1, rc.right - rc.right / 4 - 90);
- }
-
- return res;
+ return CDlgBase::DlgProc(msg, wParam, lParam);
}
};
diff --git a/src/mir_core/src/Windows/CCtrlTreeView.cpp b/src/mir_core/src/Windows/CCtrlTreeView.cpp
index 390f1618fc..e5e97e8cd4 100644
--- a/src/mir_core/src/Windows/CCtrlTreeView.cpp
+++ b/src/mir_core/src/Windows/CCtrlTreeView.cpp
@@ -760,8 +760,8 @@ void CCtrlTreeView::SetCheckState(HTREEITEM hItem, uint32_t state)
{ TreeView_SetCheckState(m_hwnd, hItem, state);
}
-void CCtrlTreeView::SetImageList(HIMAGELIST hIml, int iImage)
-{ TreeView_SetImageList(m_hwnd, hIml, iImage);
+HIMAGELIST CCtrlTreeView::SetImageList(HIMAGELIST hIml, int iImage)
+{ return TreeView_SetImageList(m_hwnd, hIml, iImage);
}
void CCtrlTreeView::SetIndent(int iIndent)
diff --git a/src/mir_core/src/Windows/CDlgBase.cpp b/src/mir_core/src/Windows/CDlgBase.cpp
index 6eca57b417..84066de414 100644
--- a/src/mir_core/src/Windows/CDlgBase.cpp
+++ b/src/mir_core/src/Windows/CDlgBase.cpp
@@ -180,6 +180,18 @@ void CDlgBase::CreateLink(CCtrlData& ctrl, const char *szSetting, wchar_t *szVal
/////////////////////////////////////////////////////////////////////////////////////////
// virtual methods
+int CDlgBase::GlobalDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
+{
+ CDlgBase *wnd = CDlgBase::Find(hwnd);
+ return (wnd == nullptr) ? 0 : wnd->Resizer(urc);
+}
+
+void CDlgBase::OnResize()
+{
+ if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_THICKFRAME))
+ Utils_ResizeDialog(m_hwnd, m_pPlugin.getInst(), MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
+}
+
int CDlgBase::Resizer(UTILRESIZECONTROL*)
{
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
@@ -383,8 +395,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_SIZE:
- if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_THICKFRAME))
- Utils_ResizeDialog(m_hwnd, m_pPlugin.getInst(), MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
+ OnResize();
return TRUE;
case WM_TIMER:
@@ -441,12 +452,6 @@ INT_PTR CALLBACK CDlgBase::GlobalDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
return (wnd == nullptr) ? FALSE : wnd->DlgProc(msg, wParam, lParam);
}
-int CDlgBase::GlobalDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
-{
- CDlgBase *wnd = CDlgBase::Find(hwnd);
- return (wnd == nullptr) ? 0 : wnd->Resizer(urc);
-}
-
void CDlgBase::ThemeDialogBackground(BOOL tabbed)
{
EnableThemeDialogTexture(m_hwnd, (tabbed ? ETDT_ENABLE : ETDT_DISABLE) | ETDT_USETABTEXTURE);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 558e90dc3e..9409e6d133 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -808,7 +808,7 @@ mir_wstrcmpi @280
?SetHoverTime@CCtrlListView@@QAEXI@Z @1000 NONAME
?SetIconSpacing@CCtrlListView@@QAEIHH@Z @1001 NONAME
?SetImageList@CCtrlListView@@QAEPAU_IMAGELIST@@PAU2@H@Z @1002 NONAME
-?SetImageList@CCtrlTreeView@@QAEXPAU_IMAGELIST@@H@Z @1003 NONAME
+?SetImageList@CCtrlTreeView@@QAEPAU_IMAGELIST@@PAU2@H@Z @1003 NONAME
?SetIndent@CCtrlTreeView@@QAEXH@Z @1005 NONAME
?SetInfoTip@CCtrlListView@@QAEHPAUtagLVSETINFOTIP@@@Z @1006 NONAME
?SetInsertMark@CCtrlListView@@QAEHPAULVINSERTMARK@@@Z @1007 NONAME
@@ -1540,3 +1540,4 @@ Miranda_SetTerminated @1759
Miranda_WaitOnHandle @1760
Miranda_WaitOnHandleEx @1761
_Utils_CorrectFontSize@4 @1762 NONAME
+?OnResize@CDlgBase@@MAEXXZ @1763 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index a3f03dab57..94e8c1d2a9 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -808,7 +808,7 @@ mir_wstrcmpi @280
?SetHoverTime@CCtrlListView@@QEAAXI@Z @1000 NONAME
?SetIconSpacing@CCtrlListView@@QEAAIHH@Z @1001 NONAME
?SetImageList@CCtrlListView@@QEAAPEAU_IMAGELIST@@PEAU2@H@Z @1002 NONAME
-?SetImageList@CCtrlTreeView@@QEAAXPEAU_IMAGELIST@@H@Z @1003 NONAME
+?SetImageList@CCtrlTreeView@@QEAAPEAU_IMAGELIST@@PEAU2@H@Z @1003 NONAME
?SetIndent@CCtrlTreeView@@QEAAXH@Z @1005 NONAME
?SetInfoTip@CCtrlListView@@QEAAHPEAUtagLVSETINFOTIP@@@Z @1006 NONAME
?SetInsertMark@CCtrlListView@@QEAAHPEAULVINSERTMARK@@@Z @1007 NONAME
@@ -1540,3 +1540,4 @@ Miranda_SetTerminated @1759
Miranda_WaitOnHandle @1760
Miranda_WaitOnHandleEx @1761
Utils_CorrectFontSize @1762 NONAME
+?OnResize@CDlgBase@@MEAAXXZ @1763 NONAME