diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-11-18 20:07:43 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-11-18 20:07:43 +0000 |
commit | 4f4b39e3e0c9b1906af739cf85311e7ca0388fe4 (patch) | |
tree | 8eeb84203862443316c015fae726e94d3e58fdbf /plugins/RecentContacts/src/RecentContacts.cpp | |
parent | f5220435e21a209d91116819bf0305ed79b29116 (diff) |
RecentContacts: Add option "Resize window according to contact list" (patch by Vojtěch Kinkor, thanks); version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11017 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/RecentContacts/src/RecentContacts.cpp')
-rw-r--r-- | plugins/RecentContacts/src/RecentContacts.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index a90c9da616..5b9b26005b 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -10,7 +10,7 @@ char *szProto; HINSTANCE hInst = NULL;
int hLangpack = 0;
-
+CLIST_INTERFACE *pcli;
HANDLE hTopToolbarButtonShowList;
HANDLE hMsgWndEvent;
HANDLE hWindowList;
@@ -61,6 +61,7 @@ void LoadDBSettings() ZeroMemory(&LastUCOpt, sizeof(LastUCOpt));
LastUCOpt.MaxShownContacts = (INT)db_get_b( NULL, dbLastUC_ModuleName, dbLastUC_MaxShownContacts, 0 );
LastUCOpt.HideOffline = db_get_b( NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, 0 );
+ LastUCOpt.WindowAutoSize = db_get_b( NULL, dbLastUC_ModuleName, dbLastUC_WindowAutosize, 0 );
DBVARIANT dbv;
dbv.type = DBVT_ASCIIZ;
@@ -264,12 +265,47 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM break;
}
- SAVEWINDOWPOS pos;
- pos.hContact = NULL;
- pos.hwnd = hDlg;
- pos.szModule = dbLastUC_ModuleName;
- pos.szNamePrefix = dbLastUC_WindowPosPrefix;
- CallService(MS_UTILS_RESTOREWINDOWPOSITION, 0, (LPARAM)(SAVEWINDOWPOS*)&pos);
+
+ // window autosize/autopos - ike blaster
+ bool restorePos = !LastUCOpt.WindowAutoSize;
+
+ if (!restorePos) {
+ RECT rect;
+ if (GetWindowRect(pcli->hwndContactList, &rect)) {
+ WINDOWPLACEMENT wp;
+
+ wp.length = sizeof(wp);
+ GetWindowPlacement(hDlg, &wp);
+
+ char szSettingName[64];
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", dbLastUC_WindowPosPrefix);
+ int width = db_get_dw(NULL, dbLastUC_ModuleName, szSettingName, -1);
+
+ int right = rect.left - 6;
+ if(!IsWindowVisible(pcli->hwndContactList)) right = rect.right;
+
+ wp.rcNormalPosition.left = right - width;
+ wp.rcNormalPosition.top = rect.top;
+ wp.rcNormalPosition.right = right;
+ wp.rcNormalPosition.bottom = rect.bottom;
+ wp.flags = 0;
+
+ SetWindowPlacement(hDlg, &wp);
+ } else {
+ restorePos = true;
+ }
+ }
+
+ if (restorePos) {
+ SAVEWINDOWPOS pos;
+ pos.hContact = NULL;
+ pos.hwnd = hDlg;
+ pos.szModule = dbLastUC_ModuleName;
+ pos.szNamePrefix = dbLastUC_WindowPosPrefix;
+
+ CallService(MS_UTILS_RESTOREWINDOWPOSITION, 0, (LPARAM)(SAVEWINDOWPOS*)&pos);
+ }
+
SendMessage(hDlg, WM_SIZE, 0, 0);
WindowList_Add(hWindowList, hDlg, NULL);
return TRUE;
@@ -526,6 +562,7 @@ INT_PTR ToggleIgnore (WPARAM hContact, LPARAM lParam) extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP( &pluginInfo );
+ mir_getCLI();
CoInitialize(NULL);
hWindowList = WindowList_Create();
|