summaryrefslogtreecommitdiff
path: root/plugins/RecentContacts/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/RecentContacts/src')
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp51
-rw-r--r--plugins/RecentContacts/src/RecentContacts.h3
-rw-r--r--plugins/RecentContacts/src/Version.h2
-rw-r--r--plugins/RecentContacts/src/options.cpp20
-rw-r--r--plugins/RecentContacts/src/resource.h1
5 files changed, 61 insertions, 16 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();
diff --git a/plugins/RecentContacts/src/RecentContacts.h b/plugins/RecentContacts/src/RecentContacts.h
index 4cd9209dd5..fcce1fe640 100644
--- a/plugins/RecentContacts/src/RecentContacts.h
+++ b/plugins/RecentContacts/src/RecentContacts.h
@@ -10,6 +10,7 @@
#include <newpluginapi.h>
#include <m_clist.h>
+#include <m_clistint.h>
#include <m_langpack.h>
#include <m_database.h>
#include <m_message.h>
@@ -41,6 +42,7 @@ static char dbLastUC_DateTimeFormatDefault[] = "(%Y-%m-%d %H:%M) ";
static char dbLastUC_MaxShownContacts[] = "MaxShownContacts";
static char dbLastUC_IgnoreContact[] = "Ignore";
static char dbLastUC_HideOfflineContacts[] = "HideOfflineContacts";
+static char dbLastUC_WindowAutosize[] = "WindowAutoSize";
static char msLastUC_ShowList[] = "RecentContacts/ShowList";
static char msLastUC_IgnoreOff[] = "RecentContacts/SetIgnoreOff";
@@ -52,6 +54,7 @@ typedef struct _LastUCOptions
{
int MaxShownContacts;
int HideOffline;
+ int WindowAutoSize;
string DateTimeFormat;
}
LastUCOptions;
diff --git a/plugins/RecentContacts/src/Version.h b/plugins/RecentContacts/src/Version.h
index d7a9eb4586..7ce8154b7d 100644
--- a/plugins/RecentContacts/src/Version.h
+++ b/plugins/RecentContacts/src/Version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 2
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp
index e3905cff99..e5c587613d 100644
--- a/plugins/RecentContacts/src/options.cpp
+++ b/plugins/RecentContacts/src/options.cpp
@@ -12,6 +12,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, (LastUCOpt.HideOffline ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_WINDOWAUTOSIZE, (LastUCOpt.WindowAutoSize ? BST_CHECKED : BST_UNCHECKED));
mir_snprintf(str, SIZEOF(str), "%d", LastUCOpt.MaxShownContacts);
SetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str);
@@ -41,6 +42,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LastUCOpt.HideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE);
db_set_b(NULL, dbLastUC_ModuleName, dbLastUC_HideOfflineContacts, (BYTE)LastUCOpt.HideOffline);
+ LastUCOpt.WindowAutoSize = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_WINDOWAUTOSIZE);
+ db_set_b(NULL, dbLastUC_ModuleName, dbLastUC_WindowAutosize, (BYTE)LastUCOpt.WindowAutoSize);
+
GetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str, SIZEOF(str));
LastUCOpt.MaxShownContacts= atoi(str);
db_set_b(0,dbLastUC_ModuleName, dbLastUC_MaxShownContacts, LastUCOpt.MaxShownContacts);
@@ -60,12 +64,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int onOptInitialise(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.hInstance = hInst;
- odp.pszGroup = LPGEN("Contacts");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_LASTUC_OPT);
- odp.pszTitle = msLastUC_ShowListName;
- odp.pfnDlgProc = DlgProcOptions;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
- return 0;
+ odp.hInstance = hInst;
+ odp.pszGroup = LPGEN("Contacts");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_LASTUC_OPT);
+ odp.pszTitle = msLastUC_ShowListName;
+ odp.pfnDlgProc = DlgProcOptions;
+ odp.flags = ODPF_BOLDGROUPS;
+ Options_AddPage(wParam, &odp);
+ return 0;
}
diff --git a/plugins/RecentContacts/src/resource.h b/plugins/RecentContacts/src/resource.h
index c5252215eb..df81b25ef0 100644
--- a/plugins/RecentContacts/src/resource.h
+++ b/plugins/RecentContacts/src/resource.h
@@ -12,6 +12,7 @@
#define IDC_SHOWNCONTACTS 1002
#define IDC_HIDEOFFLINE 1004
#define IDC_DATETIME 1005
+#define IDC_WINDOWAUTOSIZE 1006
// Next default values for new objects
//