diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-17 17:03:45 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-17 17:03:45 +0000 |
commit | a75ce08f5ea46237b73e5052a956829c0e272678 (patch) | |
tree | 60a238c3b4c0487317f3836d83acbe022c865115 /include | |
parent | d6964f7bb1c2afc8d67905fa38ac9a3df766b807 (diff) |
minus MS_UTILS_SAVEWINDOWPOSITION & MS_UTILS_RESTOREWINDOWPOSITION
git-svn-id: http://svn.miranda-ng.org/main/trunk@14238 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_helpers.inc | 26 | ||||
-rw-r--r-- | include/delphi/m_utils.inc | 142 | ||||
-rw-r--r-- | include/m_utils.h | 54 |
3 files changed, 85 insertions, 137 deletions
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 86bee1a2d6..f21a2c3f08 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -28,9 +28,6 @@ function Netlib_Send(hConn: THANDLE; const buf: PAnsiChar; len: int; flags: int) function Netlib_Recv(hConn: THANDLE; const buf: PAnsiChar; len: int; flags: int): int_ptr;
procedure Netlib_Log(hNetLib: THANDLE; const sz: PAnsiChar);
-function Utils_SaveWindowPosition (hWnd:HWND; hContact:TMCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr;
-function Utils_RestoreWindowPosition(hWnd:HWND; hContact:TMCONTACT; Flags: int; const szModule, szNamePrefix: PAnsiChar): int_ptr;
-
function mir_hashstr (const key:PAnsiChar):uint; {inline;}
function mir_hashstrW(const key:PWideChar):uint; {inline;}
function lrtrim (str:PAnsiChar):PAnsiChar; {inline}
@@ -242,29 +239,6 @@ begin end;
-function Utils_SaveWindowPosition(hWnd:HWND; hContact:TMCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr;
-var
- swp: TSAVEWINDOWPOS;
-begin
- swp.hWnd := hWnd;
- swp.hContact := hContact;
- swp.szModule := szModule;
- swp.szNamePrefix := szNamePrefix;
- Result := CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, lParam(@swp));
-end;
-
-function Utils_RestoreWindowPosition(hWnd:HWND; hContact:TMCONTACT; Flags:int; const szModule, szNamePrefix: PAnsiChar): int_ptr;
-var
- swp: TSAVEWINDOWPOS;
-begin
- swp.hWnd := hWnd;
- swp.hContact := hContact;
- swp.szModule := szModule;
- swp.szNamePrefix := szNamePrefix;
- Result := CallService(MS_UTILS_RESTOREWINDOWPOSITION, Flags, lParam(@swp));
-end;
-
-
function mir_hashstr(const key:PAnsiChar):uint; {inline;}
var
len:int;
diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index dea6497f48..23e4d240b7 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -154,10 +154,10 @@ const //******************************* Window lists *******************************
- {
- Affect : Allocate a window list
- Returns: A handle to the new window list
- }
+{
+ Affect : Allocate a window list
+ Returns: A handle to the new window list
+}
function WindowList_Create() : Thandle; stdcall;
external CoreDLL name 'WindowList_Create';
@@ -165,109 +165,105 @@ function WindowList_Create() : Thandle; stdcall; procedure WindowList_Destroy(hList:Thandle); stdcall;
external CoreDLL name 'WindowList_Destroy';
- {
- Affect : Add a window to a given window list handle
- Returns: 0 on success, [non zero] on failure
- }
+{
+ Affect : Add a window to a given window list handle
+ Returns: 0 on success, [non zero] on failure
+}
function WindowList_Add(hList:Thandle; hwnd:HWND; hContact:TMCONTACT) : int; stdcall;
external CoreDLL name 'WindowList_Add';
- {
- Affect : Remove a window from the specified window list
- Returns: 0 on success, [non zero] on failure
- }
+{
+ Affect : Remove a window from the specified window list
+ Returns: 0 on success, [non zero] on failure
+}
function WindowList_Remove(hList:Thandle; hwnd:HWND) : int; stdcall;
external CoreDLL name 'WindowList_Remove';
- {
- Affect : Find a window handle given the hContact
- Returns: The found window handle or NULL(0) on failure
- }
+{
+ Affect : Find a window handle given the hContact
+ Returns: The found window handle or NULL(0) on failure
+}
function WindowList_Find(hList:Thandle; hContact:TMCONTACT) : HWND; stdcall;
external CoreDLL name 'WindowList_Find';
- {
- Affect : sends a message to all windows in a list using SendMessage
- Returns: 0 on success, [non zero] on failure
- }
+{
+ Affect : sends a message to all windows in a list using SendMessage
+ Returns: 0 on success, [non zero] on failure
+}
function WindowList_Broadcast(hList:Thandle; message:UINT; wParam:TWPARAM; lParam:TLPARAM) : int; stdcall;
external CoreDLL name 'WindowList_Broadcast';
- {
- Affect : Sends a message to all windows in a list using PostMessage
- Returns: 0 on success, nonzero on failure, this service does not fail,
- even if PostMessage() fails for whatever reason
- }
+{
+ Affect : Sends a message to all windows in a list using PostMessage
+ Returns: 0 on success, nonzero on failure, this service does not fail,
+ even if PostMessage() fails for whatever reason
+}
function WindowList_BroadcastAsync(hList:Thandle; message:UINT; wParam:TWPARAM; lParam:TLPARAM) : int; stdcall;
external CoreDLL name 'WindowList_BroadcastAsync';
- {
- There aren't any services here, there's no need for them, the control class
- will obey the SS_LEFT (0), SS_CENTER (1), SS_RIGHT(2) styles
- the control will send STN_CLICKED via WM_COMMAND when the link itself is clicked
- -
- These are defined by STATIC controls and STN_CLICKED is sent to standard
- STATIC classes when they're clicked -- look at WINAPI docs for more info
- }
+{
+ There aren't any services here, there's no need for them, the control class
+ will obey the SS_LEFT (0), SS_CENTER (1), SS_RIGHT(2) styles
+ the control will send STN_CLICKED via WM_COMMAND when the link itself is clicked
+ -
+ These are defined by STATIC controls and STN_CLICKED is sent to standard
+ STATIC classes when they're clicked -- look at WINAPI docs for more info
+}
const
WNDCLASS_HYPERLINK = 'Hyperlink';
- {
- wParam : 0
- lParam : Pointer to a initialised TSAVEWINDOWPOS structure
- Affect :
- Returns: 0 on success, [non zero] on failure
- Notes :
- Version: v0.1.1.0+
- }
- MS_UTILS_SAVEWINDOWPOSITION:PAnsiChar = 'Utils/SaveWindowPos';
+{
+ Returns: 0 on success, [non zero] on failure
+}
- {
- wParam : see RWPF_* flags
- lParam : Pointer to a initalised TSAVEWINDOWPOS
- Affect : Restores the position of a window from the database, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : If no position info was found, the service will return 1.
- The NoSize version won't use stored information size, the window
- is left the same size
- -
- See Utils_RestoreWindowPosition() Helper function, this function is
- a bit different from the C function (which can be inlined too! dammit)
- that there's only one function and not three (which just passed different flags)
- Version: v0.1.1.0+
- }
- MS_UTILS_RESTOREWINDOWPOSITION:PAnsiChar = 'Utils/RestoreWindowPos';
+function Utils_SaveWindowPosition(hwnd:HWND; hContact:TMCONTACT; const szModule,szNamePrefix:PAnsiChar) : int; stdcall;
+ external CoreDLL name 'Utils_SaveWindowPosition';
+
+{
+ Affect : Restores the position of a window from the database, see notes
+ Returns: 0 on success, [non zero] on failure
+ Notes : If no position info was found, the service will return 1.
+ The NoSize version won't use stored information size, the window
+ is left the same size
+ -
+ See Utils_RestoreWindowPosition() Helper function, this function is
+ a bit different from the C function (which can be inlined too! dammit)
+ that there's only one function and not three (which just passed different flags)
+}
+
+function Utils_RestoreWindowPosition(hwnd:HWND; hContact:TMCONTACT; const szModule,szNamePrefix:PAnsiChar; flags:int) : int; stdcall;
+ external CoreDLL name 'Utils_RestoreWindowPosition';
{
- wParam : pointer to RECT
- lParam : 0
Affect : Moves a RECT inside screen if it is outside.It works with multiple monitors (v0.9.0.4+)
Returns: <0 on error, 0 if not changed the rect, 1 if changed the rect
}
- MS_UTILS_ASSERTINSIDESCREEN:PAnsiChar = 'Utils/AssertInsideScreen';
- {
- wParam : 0
- lParam : Pointer to a null terminated string containing filename
- Affect : Loads a bitmap (or other graphic type, see Notes
- Returns: HBITMAP on success, NULL(0) on failure
- Notes : This function also supports JPEG, GIF (and maybe PNG too)
- For speed, if the file extention is .bmp or .rle it will use LoadImage()
- and not load OLE for the extra image support
- -
- Remember to delete the returned handle with DeleteObject (see GDI documentation for WINAPI)
- Version: v0.1.2.1+
- }
+function Utils_AssertInsideScreen(var rc:RECT) : int; stdcall;
+ external CoreDLL name 'Utils_AssertInsideScreen';
+
+{
+ wParam : 0
+ lParam : Pointer to a null terminated string containing filename
+ Affect : Loads a bitmap (or other graphic type, see Notes
+ Returns: HBITMAP on success, NULL(0) on failure
+ Notes : This function also supports JPEG, GIF (and maybe PNG too)
+ For speed, if the file extention is .bmp or .rle it will use LoadImage()
+ and not load OLE for the extra image support
+ -
+ Remember to delete the returned handle with DeleteObject (see GDI documentation for WINAPI)
+}
+
+const
MS_UTILS_LOADBITMAP :PAnsiChar = 'Utils/LoadBitmap';
MS_UTILS_LOADBITMAPW:PAnsiChar = 'Utils/LoadBitmapW';
-
{
Affect : Saves a path to a relative path (from the miranda directory)
Only saves as a relative path if the file is in the miranda
diff --git a/include/m_utils.h b/include/m_utils.h index 9d9d689e3a..72508724ee 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -207,25 +207,14 @@ EXTERN_C MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT mes // lParam = not used
#define HLK_SETDISABLECOLOUR (WM_USER+102) // added in 0.3.1
-/***************************** Window Position Saving ***************************/
+/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////// Window Position Saving ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
-// saves the position of a window in the database v0.1.1.0+
-// wParam = 0
-// lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
+// saves the position of a window in the database
// returns 0 on success, nonzero on failure
-typedef struct {
- HWND hwnd;
- MCONTACT hContact;
- const char *szModule; //module name to store the setting in
- const char *szNamePrefix; //text to prefix on "x", "width", etc, to form setting names
-} SAVEWINDOWPOS;
-#define MS_UTILS_SAVEWINDOWPOSITION "Utils/SaveWindowPos"
-__forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- SAVEWINDOWPOS swp;
- swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix;
- return CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, (LPARAM)&swp);
-}
+
+EXTERN_C MIR_CORE_DLL(int) Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix);
/////////////////////////////////////////////////////////////////////////////////////////
// restores the position of a window from the database v0.1.1.0+
@@ -240,32 +229,21 @@ __forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, con #define RWPF_NOMOVE 2 //don't use stored position
#define RWPF_NOACTIVATE 4 //show but don't activate v0.3.3.0+
#define RWPF_HIDDEN 8 //make it hidden
-#define MS_UTILS_RESTOREWINDOWPOSITION "Utils/RestoreWindowPos"
-__forceinline INT_PTR Utils_RestoreWindowPositionEx(HWND hwnd, int flags, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- SAVEWINDOWPOS swp;
- swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix;
- return CallService(MS_UTILS_RESTOREWINDOWPOSITION, flags, (LPARAM)&swp);
-}
-__forceinline INT_PTR Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, 0, hContact, szModule, szNamePrefix);
-}
-__forceinline INT_PTR Utils_RestoreWindowPositionNoSize(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOSIZE, hContact, szModule, szNamePrefix);
+
+EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix, int flags = 0);
+
+__forceinline int Utils_RestoreWindowPositionNoSize(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix)
+{ return Utils_RestoreWindowPosition(hwnd, hContact, szModule, szNamePrefix, RWPF_NOSIZE);
}
-__forceinline INT_PTR Utils_RestoreWindowPositionNoMove(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOMOVE, hContact, szModule, szNamePrefix);
+__forceinline int Utils_RestoreWindowPositionNoMove(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix)
+{ return Utils_RestoreWindowPosition(hwnd, hContact, szModule, szNamePrefix, RWPF_NOMOVE);
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Moves a RECT inside screen if it is outside.It works with multiple monitors v0.9.0.4+
-// wParam = RECT *
-// lParam = 0
-// returns <0 on error, 0 if not changed the rect, 1 if changed the rect
-
-#define MS_UTILS_ASSERTINSIDESCREEN "Utils/AssertInsideScreen"
-__forceinline INT_PTR Utils_AssertInsideScreen(RECT *rc) {
- return CallService(MS_UTILS_ASSERTINSIDESCREEN, (WPARAM)rc, 0);
-}
+// Moves a RECT inside screen if it is outside. It works with multiple monitors
+// returns < 0 on error, 0 if not changed the rect, 1 if changed the rect
+
+EXTERN_C MIR_CORE_DLL(int) Utils_AssertInsideScreen(RECT *rc);
/************************ Colour Picker Control (0.1.2.1+) **********************/
|