From e865872b4ef16b6e40cfe868843f1070fa3a239b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 Jun 2015 12:01:49 +0000 Subject: - resizer moved to mir_core, because it uses hard-coded windows structures; - MS_UTILS_RESIZEDIALOG replaced with a short call of Utils_ResizeDialog; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/image.cpp | 16 ++++----------- protocols/Gadu-Gadu/src/sessions.cpp | 12 ++--------- protocols/IcqOscarJ/src/dlgproc.cpp | 30 ++++++++++------------------ protocols/JabberG/src/jabber_iqid_muc.cpp | 33 +++++++++++-------------------- protocols/JabberG/src/jabber_opt.cpp | 10 +--------- 5 files changed, 28 insertions(+), 73 deletions(-) (limited to 'protocols') diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 8d6e02cc90..f138aeecb1 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -435,18 +435,10 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; case WM_SIZE: - { - UTILRESIZEDIALOG urd = {0}; - urd.cbSize = sizeof(urd); - urd.hInstance = hInstance; - urd.hwndDlg = hwndDlg; - urd.lpTemplate = dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND); - urd.pfnResizer = sttImageDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); - if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) - InvalidateRect(hwndDlg, NULL, FALSE); - return 0; - } + Utils_ResizeDialog(hwndDlg, hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer); + if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) + InvalidateRect(hwndDlg, NULL, FALSE); + return 0; case WM_SIZING: { diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 7b74a24c66..90cf3cb757 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -362,16 +362,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w return 0; case WM_SIZE: - { - UTILRESIZEDIALOG urd = {0}; - urd.cbSize = sizeof(urd); - urd.hInstance = hInstance; - urd.hwndDlg = hwndDlg; - urd.lpTemplate = MAKEINTRESOURCEA(IDD_SESSIONS); - urd.pfnResizer = sttSessionsDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); - return 0; - } + Utils_ResizeDialog(hwndDlg, hInstance, MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer); + return 0; case WM_SETCURSOR: if (LOWORD(lParam) == HTCLIENT && IsOverAction(hwndDlg)) diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index 3b0cc7f6ab..d6cb25f816 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -437,26 +437,16 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_SIZE: - { // make the dlg resizeable - UTILRESIZEDIALOG urd = { 0 }; - - if (IsIconic(hwndDlg)) break; - urd.cbSize = sizeof(urd); - urd.hInstance = hInst; - urd.hwndDlg = hwndDlg; - urd.lParam = 0; // user-defined - urd.lpTemplate = MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO); - urd.pfnResizer = ChangeInfoDlg_Resize; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); - - { // update listview column widths - RECT rc; - - GetClientRect(dat->hwndList, &rc); - rc.right -= GetSystemMetrics(SM_CXVSCROLL); - ListView_SetColumnWidth(dat->hwndList, 0, rc.right / 3); - ListView_SetColumnWidth(dat->hwndList, 1, rc.right - rc.right / 3); - } + if (IsIconic(hwndDlg)) + break; + + Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize); + { + RECT rc; // update listview column widths + GetClientRect(dat->hwndList, &rc); + rc.right -= GetSystemMetrics(SM_CXVSCROLL); + ListView_SetColumnWidth(dat->hwndList, 0, rc.right / 3); + ListView_SetColumnWidth(dat->hwndList, 1, rc.right - rc.right / 3); } break; diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index cd982c3515..17307fbbc6 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -167,7 +167,8 @@ static int sttJidListResizer(HWND, LPARAM, UTILRESIZECONTROL *urc) static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - JABBER_MUC_JIDLIST_INFO* dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + JABBER_MUC_JIDLIST_INFO *dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); switch(msg) { case WM_INITDIALOG: @@ -177,7 +178,6 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w TranslateDialogDefault(hwndDlg); - HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); GetClientRect(hwndList, &rc); //rc.right -= GetSystemMetrics(SM_CXVSCROLL); @@ -212,26 +212,16 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w Utils_RestoreWindowPosition(hwndDlg, NULL, dat->ppro->m_szModuleName, "jidListWnd_"); } return TRUE; + case WM_SIZE: - { - UTILRESIZEDIALOG urd = {0}; - urd.cbSize = sizeof(urd); - urd.hInstance = hInst; - urd.hwndDlg = hwndDlg; - urd.lpTemplate = MAKEINTRESOURCEA(IDD_JIDLIST); - urd.pfnResizer = sttJidListResizer; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); - - RECT listrc; - LVCOLUMN lvc; - HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); - GetClientRect(hwndList, &listrc); - lvc.mask = LVCF_WIDTH; - //listrc.right -= GetSystemMetrics(SM_CXVSCROLL); - lvc.cx = listrc.right - 20; - SendMessage(hwndList, LVM_SETCOLUMN, 0, (LPARAM)&lvc); - break; - } + Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_JIDLIST), sttJidListResizer); + + RECT listrc; + LVCOLUMN lvc; + GetClientRect(hwndList, &listrc); + lvc.mask = LVCF_WIDTH; + lvc.cx = listrc.right - 20; + SendMessage(hwndList, LVM_SETCOLUMN, 0, (LPARAM)&lvc); break; case WM_JABBER_REFRESH: @@ -388,7 +378,6 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w LVITEM lvi; // Free lParam of the displayed list items - HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); int count = ListView_GetItemCount(hwndList); lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 88a03769e6..7755e0bfca 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1447,15 +1447,7 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } case WM_SIZE: - { - UTILRESIZEDIALOG urd = {0}; - urd.cbSize = sizeof(urd); - urd.hInstance = hInst; - urd.hwndDlg = hwndDlg; - urd.lpTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER3); - urd.pfnResizer = sttRosterEditorResizer; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); - } + Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_OPT_JABBER3), sttRosterEditorResizer); break; case WM_COMMAND: -- cgit v1.2.3