summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-21 12:01:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-21 12:01:49 +0000
commite865872b4ef16b6e40cfe868843f1070fa3a239b (patch)
tree0710f76e005c25ce151c46015c0853af6101d2cc
parent87cf54594168e5579bbb852bcb4aaae3fefa3b89 (diff)
- 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
-rw-r--r--bin10/lib/mir_core.libbin296626 -> 296866 bytes
-rw-r--r--bin10/lib/mir_core64.libbin298108 -> 298324 bytes
-rw-r--r--bin12/lib/mir_core.libbin296626 -> 296866 bytes
-rw-r--r--bin12/lib/mir_core64.libbin298108 -> 298324 bytes
-rw-r--r--include/delphi/m_utils.inc23
-rw-r--r--include/m_utils.h62
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp11
-rw-r--r--plugins/Console/src/Console.cpp23
-rw-r--r--plugins/ContactsPlus/src/receive.cpp11
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp26
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp91
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp72
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_dlg.cpp15
-rw-r--r--plugins/NewAwaySysMod/src/ReadAwayMsg.cpp9
-rw-r--r--plugins/NewAwaySysMod/src/SetAwayMsg.cpp48
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp10
-rw-r--r--plugins/QuickSearch/sr_frame.pas10
-rw-r--r--plugins/QuickSearch/sr_window.pas12
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp8
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp8
-rw-r--r--plugins/Utils.pas/editwrapper.pas20
-rw-r--r--plugins/Utils.pas/sedit.pas10
-rw-r--r--plugins/Variables/src/help.cpp62
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp12
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp27
-rw-r--r--plugins/WhoUsesMyFiles/src/wumf.cpp10
-rw-r--r--plugins/mRadio/rframeapi.pas11
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp12
-rw-r--r--protocols/IcqOscarJ/src/dlgproc.cpp30
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp33
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp10
-rw-r--r--src/core/stdchat/src/window.cpp8
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp11
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp8
-rw-r--r--src/core/stduihist/src/history.cpp11
-rw-r--r--src/mir_app/src/enterstring.cpp10
-rw-r--r--src/mir_app/src/findadd.cpp9
-rw-r--r--src/mir_app/src/resizer.cpp158
-rw-r--r--src/mir_app/src/skin2opts.cpp12
-rw-r--r--src/mir_app/src/utils.cpp7
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/resizer.cpp151
-rw-r--r--src/mir_core/src/ui_utils.cpp12
45 files changed, 368 insertions, 723 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index b2fcebaf83..a972175503 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 8556ecc62e..2cbed0f879 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index b2fcebaf83..a972175503 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index 8556ecc62e..2cbed0f879 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc
index 97f3143b37..d420a05c7b 100644
--- a/include/delphi/m_utils.inc
+++ b/include/delphi/m_utils.inc
@@ -57,16 +57,6 @@ type
TDIALOGRESIZERPROC = function(hwndDlg: THANDLE; lParam: LPARAM; urc: PUTILRESIZECONTROL): int; cdecl;
- PUTILRESIZEDIALOG = ^TUTILRESIZEDIALOG;
- TUTILRESIZEDIALOG = record
- cbSize : int;
- hwndDlg : HWND;
- hInstance : HINST;
- lpTemplate: PAnsiChar;
- lParam : LPARAM;
- pfnResizer: TDIALOGRESIZERPROC;
- end;
-
PCountryListEntry = ^TCountryListEntry;
TCountryListEntry = record
id : int;
@@ -74,14 +64,6 @@ type
ISOcode: array [0..2] of AnsiChar;
end;
- PSAVEWINDOWPOS = ^TSAVEWINDOWPOS;
- TSAVEWINDOWPOS = record
- hWnd : HWND;
- hContact : TMCONTACT;
- szModule : PAnsiChar; // module name eto store the settings in
- szNamePrefix: PAnsiChar; // text to prefix on 'x', 'width', etc
- end;
-
const
OUF_NEWWINDOW = 1;
OUF_UNICODE = 2;
@@ -109,7 +91,9 @@ const
.pfnResizer should return a combination of one RD_ANCHORx_ and one RD_ANCHORy constant
Version: v0.1.0.1+
}
- MS_UTILS_RESIZEDIALOG:PAnsiChar = 'Utils/ResizeDialog';
+
+function Utils_ResizeDialog(hwndDlg:THANDLE; hInst:HINST; pTemplate:PAnsiChar; pFunc:TDIALOGRESIZERPROC; lParam:LPARAM=0) : int; stdcall;
+ external CoreDLL name 'Utils_ResizeDialog';
{
wParam : countryID
@@ -119,6 +103,7 @@ const
NULL(0) on failure
Version: v0.1.2.0+
}
+const
MS_UTILS_GETCOUNTRYBYNUMBER:PAnsiChar = 'Utils/GetCountryByNumber';
{
diff --git a/include/m_utils.h b/include/m_utils.h
index 72508724ee..843685e2ac 100644
--- a/include/m_utils.h
+++ b/include/m_utils.h
@@ -66,46 +66,38 @@ running, one will be opened to show the URL.
#define MS_UTILS_OPENURL "Utils/OpenURL"
-/* Resizes a dialog by calling a custom routine to move the individual
-controls v0.1.0.1+
-wParam = 0
-lParam = (LPARAM)(UTILRESIZEDIALOG*)&urd
-Returns 0 on success, or nonzero on failure
-Does not support dialogtemplateex dialog boxes, and will return failure if you
-try to resize one
-The dialog itself should have been resized prior to calling this service
-pfnResizer is called once for each control in the dialog
-pfnResizer should return a combination of one rd_anchorx_ and one rd_anchory
-constant
-*/
-typedef struct {
- int cbSize;
- UINT wId; //control ID
- RECT rcItem; //original control rectangle, relative to dialog
- //modify in-place to specify the new position
- SIZE dlgOriginalSize; //size of dialog client area in template
- SIZE dlgNewSize; //current size of dialog client area
-} UTILRESIZECONTROL;
-typedef int (*DIALOGRESIZERPROC)(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc);
-typedef struct {
- int cbSize;
- HWND hwndDlg;
- HINSTANCE hInstance; //module containing the dialog template
- LPCSTR lpTemplate; //dialog template
- LPARAM lParam; //caller-defined
- DIALOGRESIZERPROC pfnResizer;
-} UTILRESIZEDIALOG;
-#define RD_ANCHORX_CUSTOM 0 //function did everything required to the x axis, do no more processing
-#define RD_ANCHORX_LEFT 0 //move the control to keep it constant distance from the left edge of the dialog
-#define RD_ANCHORX_RIGHT 1 //move the control to keep it constant distance from the right edge of the dialog
-#define RD_ANCHORX_WIDTH 2 //size the control to keep it constant distance from both edges of the dialog
-#define RD_ANCHORX_CENTRE 4 //move the control to keep it constant distance from the centre of the dialog
+/////////////////////////////////////////////////////////////////////////////////////////
+// Resizes a dialog by calling a custom routine to move the individual
+// Returns 0 on success, or nonzero on failure
+// Does not support dialogtemplateex dialog boxes, and will return failure if you try to resize one
+// The dialog itself should have been resized prior to calling this service
+// pfnResizer is called once for each control in the dialog
+// pfnResizer should return a combination of one rd_anchorx_ and one rd_anchory constant
+
+#define RD_ANCHORX_CUSTOM 0 // function did everything required to the x axis, do no more processing
+#define RD_ANCHORX_LEFT 0 // move the control to keep it constant distance from the left edge of the dialog
+#define RD_ANCHORX_RIGHT 1 // move the control to keep it constant distance from the right edge of the dialog
+#define RD_ANCHORX_WIDTH 2 // size the control to keep it constant distance from both edges of the dialog
+#define RD_ANCHORX_CENTRE 4 // move the control to keep it constant distance from the centre of the dialog
#define RD_ANCHORY_CUSTOM 0
#define RD_ANCHORY_TOP 0
#define RD_ANCHORY_BOTTOM 8
#define RD_ANCHORY_HEIGHT 16
#define RD_ANCHORY_CENTRE 32
-#define MS_UTILS_RESIZEDIALOG "Utils/ResizeDialog"
+
+struct UTILRESIZECONTROL
+{
+ int cbSize;
+ UINT wId; // control ID
+ RECT rcItem; // original control rectangle, relative to dialog
+ // modify in-place to specify the new position
+ SIZE dlgOriginalSize; // size of dialog client area in template
+ SIZE dlgNewSize; // current size of dialog client area
+};
+
+typedef int (*DIALOGRESIZERPROC)(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc);
+
+EXTERN_C MIR_CORE_DLL(int) Utils_ResizeDialog(HWND hwndDlg, HINSTANCE hInstance, LPCSTR lpTemplate, DIALOGRESIZERPROC pfnResizer, LPARAM lParam = 0);
/* Gets the name of a country given its number v0.1.2.0+
wParam = countryId
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 215aedd623..e0dd0ff8bc 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -612,15 +612,8 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
((MINMAXINFO*)lParam)->ptMinTrackSize.y = 380;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hwndDlg = hwndDlg;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_HISTORY);
- urd.pfnResizer = HistoryWindow::HistoryDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- ListView_SetColumnWidth(GetDlgItem(hwndDlg,IDC_LIST), 0, LVSCW_AUTOSIZE_USEHEADER);
- }
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HISTORY), HistoryWindow::HistoryDlgResizer);
+ ListView_SetColumnWidth(GetDlgItem(hwndDlg,IDC_LIST), 0, LVSCW_AUTOSIZE_USEHEADER);
DlgReturn(TRUE);
case WM_COMMAND:
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp
index 12ee46ef68..237f6ad276 100644
--- a/plugins/Console/src/Console.cpp
+++ b/plugins/Console/src/Console.cpp
@@ -450,16 +450,9 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP
return TRUE;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_LOG);
- urd.pfnResizer = LogResize;
SetWindowPos(hwndDlg, HWND_TOP, rcTabs.left, rcTabs.top, rcTabs.right - rcTabs.left, rcTabs.bottom - rcTabs.top, SWP_SHOWWINDOW);
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
- break;
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_LOG), LogResize);
+ break;
case WM_COMMAND:
if (!dat)
@@ -868,22 +861,14 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
}
break;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CONSOLE);
- urd.pfnResizer = ConsoleResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_CONSOLE), ConsoleResize);
GetClientRect(hTabs, &rcTabs);
TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs);
if (pActive)
SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
break;
- }
+
case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO *)lParam;
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp
index 49729cfcf2..798d3d44d0 100644
--- a/plugins/ContactsPlus/src/receive.cpp
+++ b/plugins/ContactsPlus/src/receive.cpp
@@ -473,15 +473,8 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_SIZE:
- if (!IsIconic(hwndDlg)) {
- // make the dlg resizeable
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_RECEIVE);
- urd.pfnResizer = RecvDlg_Resize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) & urd);
- }
+ if (!IsIconic(hwndDlg)) // make the dlg resizeable
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_RECEIVE), RecvDlg_Resize);
break;
case WM_GETMINMAXINFO:
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index 496d78fe81..92144dcb05 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -154,24 +154,16 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
break;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = 610;
- mmi->ptMinTrackSize.y = 300;
- }
- return 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 610;
+ mmi->ptMinTrackSize.y = 300;
+ }
+ return 0;
+
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd;
- memset(&urd, 0, sizeof(urd));
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwnd;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_FIND);
- urd.pfnResizer = FindDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
- break;
+ Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_FIND), FindDialogResize);
+ break;
case WM_NOTIFY:
if (LOWORD(wParam) != IDC_LIST) break;
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 74723eb983..f8f3826db9 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -263,54 +263,43 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case GC_SPLITTERMOVED:
- {
- int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
-
- RECT rc2;
- GetWindowRect(hwnd, &rc2);
-
- if ((HWND)lParam == GetDlgItem(hwnd, IDC_SPLITTER)) {
- RECT rc;
- GetClientRect(hwnd, &rc);
- POINT pt = { wParam, 0 };
- ScreenToClient(hwnd, &pt);
-
- splitterPos = rc.left + pt.x + 1;
- if (splitterPos < 150)
- splitterPos = 150;
- if (splitterPos > rc2.right - rc2.left - 150)
- splitterPos = rc2.right - rc2.left - 150;
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
- db_set_w(NULL, modname, "Splitter", (WORD)splitterPos);
+ {
+ int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
+
+ RECT rc2;
+ GetWindowRect(hwnd, &rc2);
+
+ if ((HWND)lParam == GetDlgItem(hwnd, IDC_SPLITTER)) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ POINT pt = { wParam, 0 };
+ ScreenToClient(hwnd, &pt);
+
+ splitterPos = rc.left + pt.x + 1;
+ if (splitterPos < 150)
+ splitterPos = 150;
+ if (splitterPos > rc2.right - rc2.left - 150)
+ splitterPos = rc2.right - rc2.left - 150;
+ SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
+ db_set_w(NULL, modname, "Splitter", (WORD)splitterPos);
+ }
+ PostMessage(hwnd, WM_SIZE, 0, 0);
}
- PostMessage(hwnd, WM_SIZE, 0, 0);
- }
- break;
+ break;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO *)lParam;
- int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
- mmi->ptMinTrackSize.x = splitterPos + 150;
- mmi->ptMinTrackSize.y = 300;
- }
- return 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO *)lParam;
+ int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
+ mmi->ptMinTrackSize.x = splitterPos + 150;
+ mmi->ptMinTrackSize.y = 300;
+ }
+ return 0;
case WM_MOVE:
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd;
-
- memset(&urd, 0, sizeof(urd));
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwnd;
- urd.lParam = (LPARAM)GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MAIN);
- urd.pfnResizer = DialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
- break;
+ Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_MAIN), DialogResize, GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA));
+ break;
case WM_DESTROY: // free our shit!
if (db_get_b(NULL, modname, "RestoreOnOpen", 1)) {
@@ -402,7 +391,6 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case MENU_REFRESH_SETS:
- {
TVITEM tvi;
TCHAR text[FLD_SIZE];
@@ -410,14 +398,15 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
tvi.hItem = TreeView_GetSelection(hwnd2Tree);
tvi.pszText = text; // modulename
tvi.cchTextMax = _countof(text);
- if (!TreeView_GetItem(hwnd2Tree, &tvi)) break;
- ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
- if (mtis && (mtis->type == MODULE))
- PopulateSettings(mtis->hContact, _T2A(text));
- else
- ClearListView();
- }
- break;
+ if (TreeView_GetItem(hwnd2Tree, &tvi)) {
+ ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
+ if (mtis && (mtis->type == MODULE))
+ PopulateSettings(mtis->hContact, _T2A(text));
+ else
+ ClearListView();
+ }
+ break;
+
///////////////////////// // watches
case MENU_VIEW_WATCHES:
openWatchedVarWindow();
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index a43c1e46c3..0fa41b0532 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -238,18 +238,16 @@ LRESULT CALLBACK WatchSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
- hwnd2watchedVarsWindow = hwnd;
+ hwnd2watchedVarsWindow = hwnd;
// do the icon
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)));
TranslateMenu(GetMenu(hwnd));
TranslateMenu(GetSubMenu(GetMenu(hwnd), 0));
TranslateDialogDefault(hwnd);
-
- SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); // taskbar icon
+
+ SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); // taskbar icon
ListView_SetExtendedListViewStyle(GetDlgItem(hwnd, IDC_VARS), 32 | LVS_EX_LABELTIP); // LVS_EX_GRIDLINES
@@ -259,33 +257,23 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
mir_subclassWindow(GetDlgItem(hwnd, IDC_VARS), WatchSubclassProc);
PopulateWatchedWindow();
- }
- return TRUE;
+ return TRUE;
+
// for the resize
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = 500;
- mmi->ptMinTrackSize.y = 300;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 500;
+ mmi->ptMinTrackSize.y = 300;
+ }
return 0;
- }
+
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd;
- memset(&urd, 0, sizeof(urd));
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwnd;
- urd.lParam = 0;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_WATCH_DIAG);
- urd.pfnResizer = WatchDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_WATCH_DIAG), WatchDialogResize);
break;
- }
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case MENU_REMALL_WATCHES:
freeAllWatches();
break;
@@ -300,14 +288,13 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_NOTIFY:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_VARS:
switch (((NMHDR*)lParam)->code) {
case NM_DBLCLK:
+ LVHITTESTINFO hti;
+ LVITEM lvi;
{
- LVHITTESTINFO hti;
- LVITEM lvi;
HWND hwndVars = GetDlgItem(hwnd, IDC_VARS);
hti.pt = ((NMLISTVIEW*)lParam)->ptAction;
if (ListView_SubItemHitTest(hwndVars, &hti) > -1)
@@ -330,21 +317,21 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
break;
+
case LVN_COLUMNCLICK:
- {
- LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
- ColumnsSortParams params;
- params.hList = GetDlgItem(hwnd, IDC_VARS);
- params.column = lv->iSubItem;
- params.last = lastColumn;
- ListView_SortItemsEx(params.hList, ColumnsCompare, (LPARAM)&params);
- lastColumn = (params.column == lastColumn) ? -1 : params.column;
- break;
- }
+ LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
+ ColumnsSortParams params;
+ params.hList = GetDlgItem(hwnd, IDC_VARS);
+ params.column = lv->iSubItem;
+ params.last = lastColumn;
+ ListView_SortItemsEx(params.hList, ColumnsCompare, (LPARAM)&params);
+ lastColumn = (params.column == lastColumn) ? -1 : params.column;
+ break;
}
break;
}
break;
+
case WM_DESTROY:
ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS));
saveListSettings(GetDlgItem(hwnd, IDC_VARS), csWatchList);
@@ -355,9 +342,8 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
-
-void openWatchedVarWindow() {
-
+void openWatchedVarWindow()
+{
if (!hwnd2watchedVarsWindow)
CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), NULL, WatchDlgProc);
else
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
index 5a3ef9fd49..b42543771d 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
@@ -302,20 +302,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
mmi->ptMinTrackSize.x = rcWindow.right - rcWindow.left - ((rcMain.right - rcMain.left) - DlgParam->minSize.cx);
mmi->ptMinTrackSize.y = rcWindow.bottom - rcWindow.top - ((rcMain.bottom - rcMain.top) - DlgParam->minSize.cy);
} break;
- case WM_SIZE: {
- UTILRESIZEDIALOG urd = {0};
-
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = hDlg;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MAIN_DLG);
- urd.pfnResizer = LinklistResizer;
- urd.lParam = (LPARAM)DlgParam;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ case WM_SIZE:
+ Utils_ResizeDialog(hDlg, hInst, MAKEINTRESOURCEA(IDD_MAIN_DLG), LinklistResizer, (LPARAM)DlgParam);
// To get some scrollbars if needed...
RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
- } break;
+ break;
+
case DM_LINKSPLITTER: {
POINT pt;
RECT rc;
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
index 2988164015..8f539219e7 100644
--- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
@@ -113,14 +113,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInstance;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_READAWAYMSG);
- urd.pfnResizer = ReadAwayMsgDlgResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_READAWAYMSG), ReadAwayMsgDlgResize);
break;
case WM_CLOSE:
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
index d91cae662f..b3824c66a9 100644
--- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
@@ -1273,34 +1273,28 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
return true;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInstance;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)&g_SetAwayMsgPage;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_SETAWAYMSG);
- urd.pfnResizer = SetAwayMsgDlgResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_SETAWAYMSG), SetAwayMsgDlgResize, (LPARAM)&g_SetAwayMsgPage);
- // means that we sent WM_SIZE message to apply new settings to the dialog; probably it's somewhat a misuse, but who cares ;-P
- if (!wParam && !lParam) {
- int bShow;
- bShow = g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWMSGTREE) ? SW_SHOW : SW_HIDE;
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_TREE), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SAVEMSG), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SAVEASNEW), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_NEWCATEGORY), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_DELETE), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_MSGSPLITTER), bShow);
- bShow = g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWCONTACTTREE) ? SW_SHOW : SW_HIDE;
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSTREE), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_IGNOREREQ), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SENDMSG), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSPLITTER), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON), bShow);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_STATIC_REPLYICON), bShow);
- }
- } // go through
+ // means that we sent WM_SIZE message to apply new settings to the dialog; probably it's somewhat a misuse, but who cares ;-P
+ if (!wParam && !lParam) {
+ int bShow;
+ bShow = g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWMSGTREE) ? SW_SHOW : SW_HIDE;
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_TREE), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SAVEMSG), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SAVEASNEW), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_NEWCATEGORY), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_DELETE), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_MSGSPLITTER), bShow);
+ bShow = g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_SHOWCONTACTTREE) ? SW_SHOW : SW_HIDE;
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSTREE), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_IGNOREREQ), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_SENDMSG), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSPLITTER), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON), bShow);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_STATIC_REPLYICON), bShow);
+ }
+ // go through
+
case UM_SAM_KILLTIMER:
case WM_LBUTTONDOWN:
case WM_MOUSEACTIVATE:
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 05abb46ee7..cd8f86a4ee 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -297,14 +297,8 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_SIZE: // make the dlg resizeable
- if (!IsIconic(hDlg)) {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = hInst;
- urd.hwndDlg = hDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_LIST);
- urd.pfnResizer = ListDlg_Resize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ if (!IsIconic(hDlg))
+ Utils_ResizeDialog(hDlg, hInst, MAKEINTRESOURCEA(IDD_LIST), ListDlg_Resize);
break;
case WM_GETMINMAXINFO:
diff --git a/plugins/QuickSearch/sr_frame.pas b/plugins/QuickSearch/sr_frame.pas
index 63def5d015..2ab6803c66 100644
--- a/plugins/QuickSearch/sr_frame.pas
+++ b/plugins/QuickSearch/sr_frame.pas
@@ -62,7 +62,6 @@ end;
function QSFrameProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
var
- urd:TUTILRESIZEDIALOG;
rc:TRECT;
TI:TTOOLINFOW;
hwndTooltip:HWND;
@@ -96,14 +95,7 @@ begin
end;
WM_SIZE: begin
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:=MAKEINTRESOURCEA(IDD_FRAME);
- urd.lParam :=0;
- urd.pfnResizer:=@QSDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, MAKEINTRESOURCEA(IDD_FRAME), @QSDlgResizer);
end;
WM_ERASEBKGND: begin
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas
index 17fbc25e57..70287137f5 100644
--- a/plugins/QuickSearch/sr_window.pas
+++ b/plugins/QuickSearch/sr_window.pas
@@ -1897,7 +1897,6 @@ var
rc:TRECT;
pt:TPOINT;
TI:tToolInfoW;
- urd:TUTILRESIZEDIALOG;
begin
result:=0;
case hMessage of
@@ -1908,8 +1907,6 @@ begin
UnhookEvent(hAdd);
UnhookEvent(hDelete);
UnhookEvent(hChange);
-// UnhookEvent(hAccount);
-
UnhookEvent(colorhook);
mainwnd:=0;
@@ -2068,14 +2065,7 @@ begin
WM_SIZE: begin
SendMessage(StatusBar,WM_SIZE,0,0);
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:=MAKEINTRESOURCEA(IDD_MAIN);
- urd.lParam :=0;
- urd.pfnResizer:=@FindAddDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, MAKEINTRESOURCEA(IDD_MAIN), @FindAddDlgResizer);
end;
WM_SYSCOMMAND: begin
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 4d5835d9d6..05a476ec16 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -2012,13 +2012,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
GetClientRect(hwndDlg, &rc);
int cx = rc.right;
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)si;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CHANNEL);
- urd.pfnResizer = RoomWndResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si);
BB_SetButtonsPos(dat);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 3393c283e5..a280a1b173 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1557,13 +1557,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
GetClientRect(hwndDlg, &rc);
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)dat;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MSGSPLITNEW);
- urd.pfnResizer = MessageDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSGSPLITNEW), MessageDialogResize, (LPARAM)dat);
BB_SetButtonsPos(dat);
diff --git a/plugins/Utils.pas/editwrapper.pas b/plugins/Utils.pas/editwrapper.pas
index 6572db56e4..034a45e15b 100644
--- a/plugins/Utils.pas/editwrapper.pas
+++ b/plugins/Utils.pas/editwrapper.pas
@@ -89,7 +89,6 @@ var
vhi:TVARHELPINFO;
cr:integer;
idshow,idhide:integer;
- urd:TUTILRESIZEDIALOG;
begin
result:=0;
@@ -154,14 +153,7 @@ begin
end;
WM_SIZE: begin
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:='IDD_EDITCONTROL';
- urd.lParam :=0;
- urd.pfnResizer:=@EditDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, 'IDD_EDITCONTROL', @EditDlgResizer);
end;
WM_COMMAND: begin
@@ -403,7 +395,6 @@ var
p:pResultText;
cr:integer;
idshow,idhide:integer;
- urd:TUTILRESIZEDIALOG;
begin
result:=0;
@@ -449,14 +440,7 @@ begin
end;
WM_SIZE: begin
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:='IDD_EDITCONTROL';
- urd.lParam :=0;
- urd.pfnResizer:=@EditDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, 'IDD_EDITCONTROL', @EditDlgResizer);
end;
WM_COMMAND: begin
diff --git a/plugins/Utils.pas/sedit.pas b/plugins/Utils.pas/sedit.pas
index a935f9f71b..6c57c7e976 100644
--- a/plugins/Utils.pas/sedit.pas
+++ b/plugins/Utils.pas/sedit.pas
@@ -1003,7 +1003,6 @@ var
idchide,idcshow,csize:integer;
{$IFDEF Miranda}
pc:PAnsiChar;
- urd:TUTILRESIZEDIALOG;
{$ELSE}
rc,rc1:TRECT;
{$ENDIF}
@@ -1056,14 +1055,7 @@ begin
WM_SIZE: begin
{$IFDEF Miranda}
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:='IDD_STRUCTURE';//MAKEINTRESOURCEA(IDD_STRUCTURE);
- urd.lParam :=0;
- urd.pfnResizer:=@StructEditDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,TLPARAM(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, 'IDD_STRUCTURE', @StructEditDlgResizer);
{$ELSE}
GetWindowRect(Dialog,rc);
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index ffdaa361e0..b17d9ddbd9 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -73,14 +73,7 @@ static INT_PTR CALLBACK extratextDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPA
case WM_SIZE:
if (!IsIconic( hwndDlg )) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_EXTRATEXT_DIALOG);
- urd.pfnResizer = defaultHelpDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_EXTRATEXT_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -170,15 +163,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = 0;
- /* ! uses ANSI version ! */
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CLIST_DIALOG);
- urd.pfnResizer = clistDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_CLIST_DIALOG), clistDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -512,14 +497,7 @@ static INT_PTR CALLBACK tokenHelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_TOKENS_DIALOG);
- urd.pfnResizer = defaultHelpDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_TOKENS_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -684,16 +662,9 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
break;
case WM_SIZE:
- if (!IsIconic(hwndDlg)) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)dat;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_INPUT_DIALOG);
- urd.pfnResizer = inputDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ if (!IsIconic(hwndDlg))
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_INPUT_DIALOG), inputDialogResize, (LPARAM)dat);
+
SendMessage(hwndDlg, WM_MOVE, 0, 0);
break;
@@ -774,15 +745,7 @@ static INT_PTR CALLBACK helpInfoDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case WM_SIZE:
if (!IsIconic( hwndDlg )) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = 0;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_HELPINFO_DIALOG);
- urd.pfnResizer = defaultHelpDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HELPINFO_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -1082,16 +1045,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = 0;
- // ! uses ANSI version !
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_HELP_DIALOG);
- urd.pfnResizer = helpDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HELP_DIALOG), helpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
RECT rcTabs, rcParent;
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index d5e57c977f..aac6aa426e 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -224,15 +224,9 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
RECT rc;
HWND hList = GetDlgItem(hwndDlg, IDC_DATALIST);
GetWindowRect(hList, &rc);
- ListView_SetColumnWidth(hList, 1, ListView_GetColumnWidth(hList, 1) +
- (int)LOWORD(lParam) - (rc.right - rc.left));
-
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hwndDlg = hwndDlg;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_BRIEF);
- urd.pfnResizer = BriefDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ ListView_SetColumnWidth(hList, 1, ListView_GetColumnWidth(hList, 1) + (int)LOWORD(lParam) - (rc.right - rc.left));
+
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
}
break;
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index 08c5d32ecd..4c0113f045 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -431,24 +431,15 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return 0;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = 0;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_DISPLAY_DATA);
- urd.pfnResizer = DataDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) & urd);
- InvalidateRect(hwndDlg, NULL, TRUE);
-
- GetWindowRect(hwndDlg, &rc);
-
- // global
- Xposition = rc.left;
- Yposition = rc.top;
- WindowHeight = rc.bottom - rc.top;
- WindowWidth = rc.right - rc.left;
- }
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
+ InvalidateRect(hwndDlg, NULL, TRUE);
+
+ // global
+ GetWindowRect(hwndDlg, &rc);
+ Xposition = rc.left;
+ Yposition = rc.top;
+ WindowHeight = rc.bottom - rc.top;
+ WindowWidth = rc.right - rc.left;
break;
case WM_MOVE:
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp
index 3eb22eb46d..cf9999d83d 100644
--- a/plugins/WhoUsesMyFiles/src/wumf.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumf.cpp
@@ -108,15 +108,7 @@ INT_PTR CALLBACK ConnDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
break;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hwndDlg = hWnd;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CONNLIST);
- urd.lParam = (LPARAM)NULL;
- urd.pfnResizer = DlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ Utils_ResizeDialog(hWnd, hInst, MAKEINTRESOURCEA(IDD_CONNLIST), DlgResizer);
Utils_SaveWindowPosition(hWnd, NULL, MODULENAME,"conn");
return TRUE;
diff --git a/plugins/mRadio/rframeapi.pas b/plugins/mRadio/rframeapi.pas
index b875ab7ca9..6888c3965d 100644
--- a/plugins/mRadio/rframeapi.pas
+++ b/plugins/mRadio/rframeapi.pas
@@ -74,7 +74,6 @@ end;
function RadioFrameProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
var
- urd:TUTILRESIZEDIALOG;
rc:TRECT;
tmp:pAnsiChar;
begin
@@ -103,14 +102,7 @@ begin
end;
WM_SIZE: begin
- FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
- urd.cbSize :=SizeOf(urd);
- urd.hwndDlg :=Dialog;
- urd.hInstance :=hInstance;
- urd.lpTemplate:=MAKEINTRESOURCEA(IDD_FRAME);
- urd.lParam :=0;
- urd.pfnResizer:=@QSDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ Utils_ResizeDialog(Dialog, hInstance, MAKEINTRESOURCEA(IDD_FRAME), @QSDlgResizer);
end;
WM_ERASEBKGND: begin
@@ -179,7 +171,6 @@ begin
end;
WM_HSCROLL: begin
-// gVolume:=SendMessage(lParam,TBM_GETPOS,0,0);
CallService(MS_RADIO_SETVOL,SendMessage(lParam,TBM_GETPOS,0,0){gVolume},2)
end;
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:
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 8bc99cbc52..13dc4c0497 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -1426,13 +1426,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
if (!IsIconic(hwndDlg)) {
SendMessage(si->hwndStatus, WM_SIZE, 0, 0);
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)si;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CHANNEL);
- urd.pfnResizer = RoomWndResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si);
InvalidateRect(si->hwndStatus, NULL, TRUE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 3e5976e08a..a256f7316e 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -711,15 +711,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = hwndDlg;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_FILETRANSFERINFO);
- urd.pfnResizer = FileTransferDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_FILETRANSFERINFO), FileTransferDlgResizer);
+
RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_CONTACTNAME), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index eaa26e309d..583f6acd8d 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -1151,13 +1151,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
bottomScroll = (si.nPos + (int)si.nPage + 5) >= si.nMax;
}
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)dat;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MSG);
- urd.pfnResizer = MessageDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)& urd);
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSG), MessageDialogResize, (LPARAM)dat);
// The statusbar sometimes draws over these 2 controls so
// redraw them
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index 78ed1a68e8..12add45b25 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -237,16 +237,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = hwndDlg;
- urd.hInstance = hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_HISTORY);
- urd.lParam = 0;
- urd.pfnResizer = HistoryDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HISTORY), HistoryDlgResizer);
return TRUE;
case WM_COMMAND:
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp
index 4179741bbb..d1d42ab4cc 100644
--- a/src/mir_app/src/enterstring.cpp
+++ b/src/mir_app/src/enterstring.cpp
@@ -173,15 +173,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
return TRUE;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_ENTER_STRING);
- urd.pfnResizer = sttEnterStringResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_ENTER_STRING), sttEnterStringResizer);
break;
case WM_GETMINMAXINFO:
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index db81e02da2..5186f627c7 100644
--- a/src/mir_app/src/findadd.cpp
+++ b/src/mir_app/src/findadd.cpp
@@ -436,14 +436,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_SIZE:
{
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = hwndDlg;
- urd.hInstance = g_hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_FINDADD);
- urd.lParam = (LPARAM)dat;
- urd.pfnResizer = FindAddDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_FINDADD), FindAddDlgResizer, (LPARAM)dat);
ReposTinySearchDlg(hwndDlg, dat);
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_SIZE, 0, 0);
if (dat->notSearchedYet) {
diff --git a/src/mir_app/src/resizer.cpp b/src/mir_app/src/resizer.cpp
deleted file mode 100644
index ce27ee8079..0000000000
--- a/src/mir_app/src/resizer.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-#pragma pack(2)
-
-typedef struct {
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- short x;
- short y;
- short cx;
- short cy;
- DWORD id;
-} START_OF_DLGITEMTEMPLATEEX;
-
-typedef struct {
- WORD dlgVer;
- WORD signature;
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- WORD cDlgItems;
- short x;
- short y;
- short cx;
- short cy;
-} START_OF_DLGTEMPLATEEX;
-
-INT_PTR ResizeDialog(WPARAM, LPARAM lParam)
-{
- UTILRESIZEDIALOG *urd = (UTILRESIZEDIALOG*)lParam;
- HDWP hDwp;
- int i;
- DLGITEMTEMPLATE *pItem = NULL;
- START_OF_DLGITEMTEMPLATEEX *pItemEx = NULL;
- RECT rc;
- PWORD pWord;
- DLGTEMPLATE *pTemplate;
- START_OF_DLGTEMPLATEEX *pTemplateEx;
- UTILRESIZECONTROL urc;
- int procResult;
- int extendedDlg, itemCount;
-
- if (urd == NULL || urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
- pTemplate = (DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5))));
- pTemplateEx = (START_OF_DLGTEMPLATEEX*)pTemplate;
- extendedDlg = pTemplateEx->signature == 0xFFFF;
- if (extendedDlg && pTemplateEx->dlgVer != 1)
- return 1;
-
- if (extendedDlg) pWord = (PWORD)(pTemplateEx+1);
- else pWord = (PWORD)(pTemplate+1);
- if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
- if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
- while (*pWord++); //title
- if (extendedDlg) {
- if (pTemplateEx->style&DS_SETFONT) {
- pWord+=3; //font size, weight, italic
- while (*pWord++); //font name
- }
- }
- else {
- if (pTemplate->style&DS_SETFONT) {
- pWord++; //font size
- while (*pWord++); //font name
- }
- }
-
- urc.cbSize = sizeof(UTILRESIZECONTROL);
- rc.left = 0; rc.top = 0;
- if (extendedDlg) {rc.right = pTemplateEx->cx; rc.bottom = pTemplateEx->cy;}
- else {rc.right = pTemplate->cx; rc.bottom = pTemplate->cy;}
- MapDialogRect(urd->hwndDlg, &rc);
- urc.dlgOriginalSize.cx = rc.right; urc.dlgOriginalSize.cy = rc.bottom;
- GetClientRect(urd->hwndDlg, &rc);
- urc.dlgNewSize.cx = rc.right; urc.dlgNewSize.cy = rc.bottom;
-
- if (extendedDlg) itemCount = pTemplateEx->cDlgItems;
- else itemCount = pTemplate->cdit;
- hDwp = BeginDeferWindowPos(itemCount);
- for (i=0;i<itemCount;i++) {
- if ((UINT_PTR)pWord&2) pWord++; //dword align
-
- if (extendedDlg) {
- pItemEx = (START_OF_DLGITEMTEMPLATEEX*)pWord;
- pWord = (PWORD)(pItemEx+1);
-
- urc.wId = pItemEx->id;
- urc.rcItem.left = pItemEx->x; urc.rcItem.top = pItemEx->y;
- urc.rcItem.right = urc.rcItem.left+pItemEx->cx; urc.rcItem.bottom = urc.rcItem.top+pItemEx->cy;
- }
- else {
- pItem = (DLGITEMTEMPLATE*)pWord;
- pWord = (PWORD)(pItem+1);
-
- urc.wId = pItem->id;
- urc.rcItem.left = pItem->x; urc.rcItem.top = pItem->y;
- urc.rcItem.right = urc.rcItem.left+pItem->cx; urc.rcItem.bottom = urc.rcItem.top+pItem->cy;
- }
- if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
- if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
- pWord+=1+(1+*pWord)/2; //creation data
-
- if (urc.wId == 65535) continue; //using this breaks the dwp, so just ignore it
-
- MapDialogRect(urd->hwndDlg, &urc.rcItem);
- procResult = (urd->pfnResizer)(urd->hwndDlg, urd->lParam, &urc);
- if (procResult&RD_ANCHORX_RIGHT) {
- urc.rcItem.left+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
- urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
- }
- else if (procResult&RD_ANCHORX_WIDTH)
- urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
- else if (procResult&RD_ANCHORX_CENTRE) {
- urc.rcItem.left+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2;
- urc.rcItem.right+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2;
- }
- if (procResult&RD_ANCHORY_BOTTOM) {
- urc.rcItem.top+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
- urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
- }
- else if (procResult&RD_ANCHORY_HEIGHT)
- urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
- else if (procResult&RD_ANCHORY_CENTRE) {
- urc.rcItem.top+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2;
- urc.rcItem.bottom+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2;
- }
- HWND hCtrl = GetDlgItem(urd->hwndDlg, extendedDlg ? pItemEx->id : pItem->id);
- if (NULL != hCtrl) /* Wine fix. */
- hDwp = DeferWindowPos(hDwp, hCtrl, 0, urc.rcItem.left, urc.rcItem.top, urc.rcItem.right-urc.rcItem.left, urc.rcItem.bottom-urc.rcItem.top, SWP_NOZORDER);
- }
- EndDeferWindowPos(hDwp);
- return 0;
-}
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index b33c2fc876..194a2a7696 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -553,16 +553,8 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
case WM_SIZE: // make the dlg resizeable
- if (!IsIconic(hwndDlg)) {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = 0; // user-defined
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_ICOLIB_IMPORT);
- urd.pfnResizer = IconDlg_Resize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ if (!IsIconic(hwndDlg))
+ Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_ICOLIB_IMPORT), IconDlg_Resize);
break;
case WM_CLOSE:
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp
index a383bbaf2f..6022c3e87f 100644
--- a/src/mir_app/src/utils.cpp
+++ b/src/mir_app/src/utils.cpp
@@ -349,11 +349,9 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam)
PGENRANDOM pfnRtlGenRandom = NULL;
HMODULE hModule = GetModuleHandleA("advapi32");
- if (hModule)
- {
+ if (hModule) {
pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036");
- if (pfnRtlGenRandom)
- {
+ if (pfnRtlGenRandom) {
if (!pfnRtlGenRandom((PVOID)lParam, wParam))
pfnRtlGenRandom = NULL;
}
@@ -367,7 +365,6 @@ int LoadUtilsModule(void)
{
bModuleInitialized = TRUE;
- CreateServiceFunction(MS_UTILS_RESIZEDIALOG, ResizeDialog);
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER, GetCountryByNumber);
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYISOCODE, GetCountryByISOCode);
CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index de7e3dba81..a86369bacb 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -969,3 +969,4 @@ TimeZone_ToLocal @1126
TimeZone_ToString @1127
TimeZone_ToStringW @1128
TimeZone_UtcToLocal @1129
+Utils_ResizeDialog @1130
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index d827389424..0bf6458503 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -969,3 +969,4 @@ TimeZone_ToLocal @1126
TimeZone_ToString @1127
TimeZone_ToStringW @1128
TimeZone_UtcToLocal @1129
+Utils_ResizeDialog @1130
diff --git a/src/mir_core/src/resizer.cpp b/src/mir_core/src/resizer.cpp
new file mode 100644
index 0000000000..cd212fdb4a
--- /dev/null
+++ b/src/mir_core/src/resizer.cpp
@@ -0,0 +1,151 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+#pragma pack(2)
+
+struct START_OF_DLGITEMTEMPLATEEX
+{
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ short x, y, cx, cy;
+ DWORD id;
+};
+
+struct START_OF_DLGTEMPLATEEX
+{
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x, y, cx, cy;
+};
+
+MIR_CORE_DLL(int) Utils_ResizeDialog(HWND hwndDlg, HINSTANCE hInstance, LPCSTR lpTemplate, DIALOGRESIZERPROC pfnResizer, LPARAM lParam)
+{
+ DLGTEMPLATE *pTemplate = (DLGTEMPLATE*)LockResource(LoadResource(hInstance, FindResourceA(hInstance, lpTemplate, MAKEINTRESOURCEA(5))));
+ START_OF_DLGTEMPLATEEX *pTemplateEx = (START_OF_DLGTEMPLATEEX*)pTemplate;
+ int extendedDlg = pTemplateEx->signature == 0xFFFF;
+ if (extendedDlg && pTemplateEx->dlgVer != 1)
+ return 1;
+
+ PWORD pWord = (extendedDlg) ? (PWORD)(pTemplateEx + 1) : (PWORD)(pTemplate + 1);
+ if (*pWord == 0xFFFF) pWord += 2; else while (*pWord++); // menu
+ if (*pWord == 0xFFFF) pWord += 2; else while (*pWord++); // class
+ while (*pWord++); // skip title
+ if (extendedDlg) {
+ if (pTemplateEx->style & DS_SETFONT) {
+ pWord += 3; // font size, weight, italic
+ while (*pWord++); // font name
+ }
+ }
+ else {
+ if (pTemplate->style & DS_SETFONT) {
+ pWord++; // font size
+ while (*pWord++); // font name
+ }
+ }
+
+ UTILRESIZECONTROL urc;
+ urc.cbSize = sizeof(UTILRESIZECONTROL);
+
+ RECT rc;
+ rc.left = 0; rc.top = 0;
+ if (extendedDlg) {
+ rc.right = pTemplateEx->cx;
+ rc.bottom = pTemplateEx->cy;
+ }
+ else {
+ rc.right = pTemplate->cx;
+ rc.bottom = pTemplate->cy;
+ }
+
+ MapDialogRect(hwndDlg, &rc);
+ urc.dlgOriginalSize.cx = rc.right; urc.dlgOriginalSize.cy = rc.bottom;
+ GetClientRect(hwndDlg, &rc);
+ urc.dlgNewSize.cx = rc.right; urc.dlgNewSize.cy = rc.bottom;
+
+ int itemCount = (extendedDlg) ? pTemplateEx->cDlgItems : pTemplate->cdit;
+
+ HDWP hDwp = BeginDeferWindowPos(itemCount);
+ for (int i = 0; i < itemCount; i++) {
+ if ((UINT_PTR)pWord & 2) pWord++; //dword align
+
+ if (extendedDlg) {
+ START_OF_DLGITEMTEMPLATEEX *pItemEx = (START_OF_DLGITEMTEMPLATEEX*)pWord;
+ pWord = (PWORD)(pItemEx + 1);
+
+ urc.wId = pItemEx->id;
+ urc.rcItem.left = pItemEx->x; urc.rcItem.top = pItemEx->y;
+ urc.rcItem.right = urc.rcItem.left + pItemEx->cx; urc.rcItem.bottom = urc.rcItem.top + pItemEx->cy;
+ }
+ else {
+ DLGITEMTEMPLATE *pItem = (DLGITEMTEMPLATE*)pWord;
+ pWord = (PWORD)(pItem + 1);
+
+ urc.wId = pItem->id;
+ urc.rcItem.left = pItem->x; urc.rcItem.top = pItem->y;
+ urc.rcItem.right = urc.rcItem.left + pItem->cx; urc.rcItem.bottom = urc.rcItem.top + pItem->cy;
+ }
+ if (*pWord == 0xFFFF) pWord += 2; else while (*pWord++); // menu
+ if (*pWord == 0xFFFF) pWord += 2; else while (*pWord++); // class
+ pWord += 1 + (1 + *pWord) / 2; //creation data
+
+ if (urc.wId == 65535) // using this breaks the dwp, so just ignore it
+ continue;
+
+ MapDialogRect(hwndDlg, &urc.rcItem);
+ int procResult = (pfnResizer)(hwndDlg, lParam, &urc);
+ if (procResult & RD_ANCHORX_RIGHT) {
+ urc.rcItem.left += urc.dlgNewSize.cx - urc.dlgOriginalSize.cx;
+ urc.rcItem.right += urc.dlgNewSize.cx - urc.dlgOriginalSize.cx;
+ }
+ else if (procResult & RD_ANCHORX_WIDTH)
+ urc.rcItem.right += urc.dlgNewSize.cx - urc.dlgOriginalSize.cx;
+ else if (procResult & RD_ANCHORX_CENTRE) {
+ urc.rcItem.left += (urc.dlgNewSize.cx - urc.dlgOriginalSize.cx) / 2;
+ urc.rcItem.right += (urc.dlgNewSize.cx - urc.dlgOriginalSize.cx) / 2;
+ }
+ if (procResult & RD_ANCHORY_BOTTOM) {
+ urc.rcItem.top += urc.dlgNewSize.cy - urc.dlgOriginalSize.cy;
+ urc.rcItem.bottom += urc.dlgNewSize.cy - urc.dlgOriginalSize.cy;
+ }
+ else if (procResult & RD_ANCHORY_HEIGHT)
+ urc.rcItem.bottom += urc.dlgNewSize.cy - urc.dlgOriginalSize.cy;
+ else if (procResult & RD_ANCHORY_CENTRE) {
+ urc.rcItem.top += (urc.dlgNewSize.cy - urc.dlgOriginalSize.cy) / 2;
+ urc.rcItem.bottom += (urc.dlgNewSize.cy - urc.dlgOriginalSize.cy) / 2;
+ }
+
+ HWND hCtrl = GetDlgItem(hwndDlg, urc.wId);
+ if (hCtrl != NULL)
+ hDwp = DeferWindowPos(hDwp, hCtrl, 0, urc.rcItem.left, urc.rcItem.top, urc.rcItem.right - urc.rcItem.left, urc.rcItem.bottom - urc.rcItem.top, SWP_NOZORDER);
+ }
+ EndDeferWindowPos(hDwp);
+ return 0;
+}
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index f786afe73a..8074461f26 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -189,16 +189,8 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
case WM_SIZE:
- if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_SIZEBOX)) {
- UTILRESIZEDIALOG urd;
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = m_hwnd;
- urd.hInstance = m_hInst;
- urd.lpTemplate = MAKEINTRESOURCEA(m_idDialog);
- urd.lParam = 0;
- urd.pfnResizer = GlobalDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
+ if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_SIZEBOX))
+ Utils_ResizeDialog(m_hwnd, m_hInst, MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
return TRUE;
case WM_CLOSE: