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 --- include/delphi/m_utils.inc | 23 +++-------------- include/m_utils.h | 62 ++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 54 deletions(-) (limited to 'include') 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 -- cgit v1.2.3