diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/StartPosition/res/resource.rc | 8 | ||||
-rw-r--r-- | plugins/StartPosition/src/Common.h | 4 | ||||
-rw-r--r-- | plugins/StartPosition/src/Version.h | 2 | ||||
-rw-r--r-- | plugins/StartPosition/src/main.cpp | 151 | ||||
-rw-r--r-- | plugins/StartPosition/src/resource.h | 8 |
5 files changed, 113 insertions, 60 deletions
diff --git a/plugins/StartPosition/res/resource.rc b/plugins/StartPosition/res/resource.rc index 9a6b7526a3..6f01860a9a 100644 --- a/plugins/StartPosition/res/resource.rc +++ b/plugins/StartPosition/res/resource.rc @@ -57,8 +57,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN
GROUPBOX "Contact List Window Start Position",IDC_STATIC,6,37,298,165,WS_TABSTOP
EDITTEXT IDC_CLTOP,128,57,26,12,ES_AUTOHSCROLL
- CONTROL "Left",IDC_CLALIGN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,27,104,95,10
- CONTROL "Right",IDC_CLALIGN2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,117,94,10
+ CONTROL "Left",IDC_CLALIGNLEFT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,27,104,95,10
+ CONTROL "Right",IDC_CLALIGNRIGHT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,117,94,10
EDITTEXT IDC_CLBOTTOM,128,73,26,12,ES_AUTOHSCROLL
EDITTEXT IDC_CLSIDE,128,89,26,12,ES_AUTOHSCROLL
EDITTEXT IDC_CLWIDTH,128,130,26,12,ES_AUTOHSCROLL
@@ -67,8 +67,8 @@ BEGIN CONTROL "Pixels from Side",IDC_CLSIDEENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,91,100,10
CONTROL "Width",IDC_CLWIDTHENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,131,99,10
CONTROL "Always start...",IDC_CLSTATEENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,148,273,10
- CONTROL "Minimized to System Tray",IDC_CLSTATE0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,27,162,262,10
- CONTROL "Opened",IDC_CLSTATE2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,175,261,10
+ CONTROL "Minimized to System Tray",IDC_CLSTATETRAY,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,27,162,262,10
+ CONTROL "Opened",IDC_CLSTATEOPENED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,27,175,261,10
END
diff --git a/plugins/StartPosition/src/Common.h b/plugins/StartPosition/src/Common.h index cceb16c79b..5acc8e8b09 100644 --- a/plugins/StartPosition/src/Common.h +++ b/plugins/StartPosition/src/Common.h @@ -32,8 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "resource.h"
#include "version.h"
-#define MODULE_NAME "WindowStartPosition"
+#define MODULE_NAME "StartPosition"
#define dbERROR -999999
#define RIGHT 1
-#define LEFT 0
\ No newline at end of file +#define LEFT 0
diff --git a/plugins/StartPosition/src/Version.h b/plugins/StartPosition/src/Version.h index 17b44ffa61..60969e74e7 100644 --- a/plugins/StartPosition/src/Version.h +++ b/plugins/StartPosition/src/Version.h @@ -10,7 +10,7 @@ #define __STRINGIFY(x) __STRINGIFY_IMPL(x)
#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS)
-#define __PLUGIN_NAME "Window Start Position"
+#define __PLUGIN_NAME "Start Position"
#define __INTERNAL_NAME "StartPosition"
#define __FILENAME "StartPosition.dll"
#define __DESCRIPTION "Plugin supports starting position of Contact List relative to the the taskbar and screen side."
diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp index 418323828a..08816274a4 100644 --- a/plugins/StartPosition/src/main.cpp +++ b/plugins/StartPosition/src/main.cpp @@ -22,8 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., */
#include "Common.h"
-#include "m_clui.h"
-#include "m_clist.h"
HINSTANCE hInst;
int hLangpack;
@@ -53,7 +51,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo;
}
-static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
@@ -62,31 +60,95 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg);
if(db_get_b(NULL, MODULE_NAME, "CLState", 2))
- CheckRadioButton(hwndDlg, IDC_CLSTATE0, IDC_CLSTATE2, IDC_CLSTATE2);
+ CheckRadioButton(hwndDlg, IDC_CLSTATETRAY, IDC_CLSTATEOPENED, IDC_CLSTATEOPENED);
else
- CheckRadioButton(hwndDlg, IDC_CLSTATE0, IDC_CLSTATE2, IDC_CLSTATE0);
+ CheckRadioButton(hwndDlg, IDC_CLSTATETRAY, IDC_CLSTATEOPENED, IDC_CLSTATETRAY);
- if(db_get_b(NULL, MODULE_NAME, "CLAlign", 1))
- CheckRadioButton(hwndDlg, IDC_CLALIGN1, IDC_CLALIGN2, IDC_CLALIGN2);
+ CheckDlgButton(hwndDlg, IDC_CLSTATEENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableState", 0) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSTATETRAY), IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSTATEOPENED), IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE));
+
+ if(db_get_b(NULL, MODULE_NAME, "CLAlign", RIGHT))
+ CheckRadioButton(hwndDlg, IDC_CLALIGNLEFT, IDC_CLALIGNRIGHT, IDC_CLALIGNRIGHT);
else
- CheckRadioButton(hwndDlg, IDC_CLALIGN1, IDC_CLALIGN2, IDC_CLALIGN1);
-
- CheckDlgButton(hwndDlg, IDC_CLSTATEENABLE, DBGetContactSettingByte(NULL, MODULE_NAME, "CLEnableState", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_CLTOPENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableTop", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLBOTTOMENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableBottom", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckRadioButton(hwndDlg, IDC_CLALIGNLEFT, IDC_CLALIGNRIGHT, IDC_CLALIGNLEFT);
CheckDlgButton(hwndDlg, IDC_CLSIDEENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableSide", 1) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLALIGNLEFT), IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLALIGNRIGHT), IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE));
+
+ CheckDlgButton(hwndDlg, IDC_CLTOPENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableTop", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLBOTTOMENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableBottom", 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLWIDTHENABLE, db_get_b(NULL, MODULE_NAME, "CLEnableWidth", 0) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hwndDlg, IDC_CLTOP, db_get_dw(NULL, MODULE_NAME, "CLpixelsTop", 3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLTOP), IsDlgButtonChecked(hwndDlg, IDC_CLTOPENABLE));
SetDlgItemInt(hwndDlg, IDC_CLBOTTOM, db_get_dw(NULL, MODULE_NAME, "CLpixelsBottom", 3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLBOTTOM), IsDlgButtonChecked(hwndDlg, IDC_CLBOTTOMENABLE));
SetDlgItemInt(hwndDlg, IDC_CLSIDE, db_get_dw(NULL, MODULE_NAME, "CLpixelsSide", 3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSIDE), IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE));
SetDlgItemInt(hwndDlg, IDC_CLWIDTH, db_get_dw(NULL, MODULE_NAME, "CLWidth", 180), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLWIDTH), IsDlgButtonChecked(hwndDlg, IDC_CLWIDTHENABLE));
return TRUE;
}
case WM_COMMAND:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ switch (LOWORD(wParam)) {
+ case IDC_CLALIGNLEFT:
+ case IDC_CLALIGNRIGHT:
+ case IDC_CLSTATETRAY:
+ case IDC_CLSTATEOPENED:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_CLWIDTHENABLE:
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLWIDTH), IsDlgButtonChecked(hwndDlg, IDC_CLWIDTHENABLE));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CLBOTTOMENABLE:
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLBOTTOM), IsDlgButtonChecked(hwndDlg, IDC_CLBOTTOMENABLE));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CLTOPENABLE:
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLTOP), IsDlgButtonChecked(hwndDlg, IDC_CLTOPENABLE));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CLSIDEENABLE:
+ {
+ BOOL value = IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSIDE), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLALIGNLEFT), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLALIGNRIGHT), value);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CLSTATEENABLE:
+ {
+ BOOL value = IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSTATETRAY), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLSTATEOPENED), value);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CLTOP:
+ case IDC_CLBOTTOM:
+ case IDC_CLSIDE:
+ case IDC_CLWIDTH:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return FALSE;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
@@ -100,15 +162,15 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
/*end uninstall old settings*/
- if(IsDlgButtonChecked(hwndDlg, IDC_CLSTATE2))
- db_set_b(NULL, MODULE_NAME, "CLState", 2);
+ if(IsDlgButtonChecked(hwndDlg, IDC_CLSTATEOPENED))
+ db_set_b(NULL, MODULE_NAME, "CLState", 1);
else
db_set_b(NULL, MODULE_NAME, "CLState", 0);
- if(IsDlgButtonChecked(hwndDlg, IDC_CLALIGN1))
- db_set_b(NULL, MODULE_NAME, "CLAlign", 0);
+ if(IsDlgButtonChecked(hwndDlg, IDC_CLALIGNLEFT))
+ db_set_b(NULL, MODULE_NAME, "CLAlign", LEFT);
else
- db_set_b(NULL, MODULE_NAME, "CLAlign", 1);
+ db_set_b(NULL, MODULE_NAME, "CLAlign", RIGHT);
db_set_b(NULL, MODULE_NAME, "CLEnableState", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE));
@@ -137,16 +199,18 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pszGroup = LPGEN("Contact List");
- odp.pszTitle = LPGEN("Start Position");
+ odp.pszTitle = LPGEN("Start position");
odp.pfnDlgProc = OptionsDlgProc;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
-
+
return 0;
}
-int onModulesLoaded(WPARAM wParam, LPARAM lParam)
+extern "C" __declspec(dllexport) int Load(void)
{
+ mir_getLP(&pluginInfo);
+
RECT WorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0);
@@ -163,51 +227,40 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) DWORD clWidth = db_get_dw(NULL, MODULE_NAME, "CLWidth", 180);
BYTE clEnableState = db_get_b(NULL, MODULE_NAME, "CLEnableState", 0);
- BYTE clState = db_get_b(NULL, MODULE_NAME, "CLState", 2);
+ BYTE clState = db_get_b(NULL, MODULE_NAME, "CLState", 1);
- if(clEnableState == 1)
- db_set_b(NULL,"CList", "State", clState);
+ if(clEnableState)
+ db_set_b(NULL,"CList", "State", (BYTE)clState);
- if(clEnableWidth == 1 && clWidth > 0)
- db_set_dw(NULL, "CList", "Width", clWidth);
- else
+ if(clEnableWidth) {
+ if(clWidth > 0)
+ db_set_dw(NULL, "CList", "Width", clWidth);
+ } else {
clWidth = db_get_dw(NULL, "CList", "Width", 180);
+ }
- if(clEnableTop == 1 || clEnableBottom == 1 || clEnableSide == 1)
+ if(clEnableTop || clEnableBottom || clEnableSide)
db_set_b(NULL,"CList", "Docked", 0);
- db_set_b(NULL,"CLUI", "AutoSize", 0);
- db_set_b(NULL,"CLUI", "DockToSides", 0);
- if(clEnableTop == 1)
+ if(clEnableTop)
db_set_dw(NULL, "CList", "y", clTop);
//thx ValeraVi
- if(clEnableBottom == 1) {
- if(clEnableTop == 1)
- db_set_dw(NULL, "CList", "Height", (WorkArea.bottom - WorkArea.top - (LONG)clTop - (LONG)clBottom));
+ if(clEnableBottom) {
+ if(clEnableTop)
+ db_set_dw(NULL, "CList", "Height", (WorkArea.bottom - WorkArea.top - clTop - clBottom));
else
- db_set_dw(NULL, "CList", "y", (WorkArea.bottom - (LONG)clBottom - (LONG)db_get_dw(NULL, "CList", "Height", 0)));
+ db_set_dw(NULL, "CList", "y", (WorkArea.bottom - clBottom - (int)db_get_dw(NULL, "CList", "Height", 0)));
}
- if(clEnableSide == 1 ) {
+ if(clEnableSide) {
if(clAlign == LEFT)
db_set_dw(NULL, "CList", "x", (WorkArea.left + clSide));
else
db_set_dw(NULL, "CList", "x", (WorkArea.right - clWidth - clSide));
}
- HWND hClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
- MoveWindow(hClist, (int)db_get_dw(NULL, "CList", "x", 100), (int)db_get_dw(NULL, "CList", "y", 100), (int)clWidth, (int)db_get_dw(NULL, "CList", "Height", 0), 0);
- if(clEnableState == 1 && clState == 0)
- CallService(MS_CLIST_SHOWHIDE, 0, 0);
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
HookEvent(ME_OPT_INITIALISE, OptInit);
- HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
return 0;
}
@@ -215,4 +268,4 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/StartPosition/src/resource.h b/plugins/StartPosition/src/resource.h index 0b9dea9479..f04a61f4f1 100644 --- a/plugins/StartPosition/src/resource.h +++ b/plugins/StartPosition/src/resource.h @@ -7,15 +7,15 @@ #define IDC_CLBOTTOM 1002
#define IDC_CLSIDE 1003
#define IDC_CLWIDTH 1004
-#define IDC_CLALIGN1 1005
-#define IDC_CLALIGN2 1006
+#define IDC_CLALIGNLEFT 1005
+#define IDC_CLALIGNRIGHT 1006
#define IDC_CLTOPENABLE 1007
-#define IDC_CLSTATE0 1008
+#define IDC_CLSTATETRAY 1008
#define IDC_CLBOTTOMENABLE 1009
#define IDC_CLSIDEENABLE 1010
#define IDC_CLWIDTHENABLE 1011
#define IDC_CLSTATEENABLE 1012
-#define IDC_CLSTATE2 1013
+#define IDC_CLSTATEOPENED 1013
// Next default values for new objects
//
|