summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/StartPosition/res/resource.rc12
-rw-r--r--plugins/StartPosition/src/main.cpp239
-rw-r--r--plugins/StartPosition/src/options.cpp140
-rw-r--r--plugins/StartPosition/src/options.h93
-rw-r--r--plugins/StartPosition/src/stdafx.h27
-rw-r--r--plugins/StartPosition/src/version.h4
6 files changed, 294 insertions, 221 deletions
diff --git a/plugins/StartPosition/res/resource.rc b/plugins/StartPosition/res/resource.rc
index 9d92ff8ef1..7f17fe12d3 100644
--- a/plugins/StartPosition/res/resource.rc
+++ b/plugins/StartPosition/res/resource.rc
@@ -56,16 +56,16 @@ EXSTYLE WS_EX_CONTROLPARENT
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_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
CONTROL "Pixels from Top",IDC_CLTOPENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,59,98,10
+ EDITTEXT IDC_CLTOP,128,57,26,12,ES_AUTOHSCROLL
CONTROL "Pixels from Bottom",IDC_CLBOTTOMENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,75,100,10
+ EDITTEXT IDC_CLBOTTOM,128,73,26,12,ES_AUTOHSCROLL
CONTROL "Pixels from Side",IDC_CLSIDEENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,91,100,10
+ EDITTEXT IDC_CLSIDE,128,89,26,12,ES_AUTOHSCROLL
+ 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
CONTROL "Width",IDC_CLWIDTHENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,131,99,10
+ EDITTEXT IDC_CLWIDTH,128,130,26,12,ES_AUTOHSCROLL
CONTROL "Always start...",IDC_CLSTATEENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,148,273,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
diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp
index c9a01ead3f..8965ccffdb 100644
--- a/plugins/StartPosition/src/main.cpp
+++ b/plugins/StartPosition/src/main.cpp
@@ -1,30 +1,32 @@
/*
-
StartPosition plugin for Miranda NG
Copyright (C) 2005-2008 Felipe Brahm - souFrag
ICQ#50566818
http://www.soufrag.cl
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+Copyright (C) 2012-17 Miranda NG project (https://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
-HINSTANCE hInst;
+HINSTANCE g_hInst;
int hLangpack;
+StartPositionOptions spOptions;
+ClistOptions clOptions;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -42,7 +44,7 @@ PLUGININFOEX pluginInfo = {
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- hInst = hinstDLL;
+ g_hInst = hinstDLL;
return TRUE;
}
@@ -51,213 +53,42 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
-INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- if(db_get_b(NULL, MODULE_NAME, "CLState", 2))
- CheckRadioButton(hwndDlg, IDC_CLSTATETRAY, IDC_CLSTATEOPENED, IDC_CLSTATEOPENED);
- else
- CheckRadioButton(hwndDlg, IDC_CLSTATETRAY, IDC_CLSTATEOPENED, IDC_CLSTATETRAY);
-
- 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_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", 0) ? 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:
- 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)
- {
- case PSN_APPLY:
- {
- /*begin uninstall old settings*/
- if(db_get_b(NULL, MODULE_NAME, "CLEnableTop", dbERROR) == dbERROR) {
- db_unset(NULL, MODULE_NAME, "CLEnable");
- db_unset(NULL, MODULE_NAME, "CLuseLastWidth");
- }
- /*end uninstall old settings*/
-
- if(IsDlgButtonChecked(hwndDlg, IDC_CLSTATEOPENED))
- db_set_b(NULL, MODULE_NAME, "CLState", 2);
- else
- db_set_b(NULL, MODULE_NAME, "CLState", 0);
-
- if(IsDlgButtonChecked(hwndDlg, IDC_CLALIGNLEFT))
- db_set_b(NULL, MODULE_NAME, "CLAlign", LEFT);
- else
- db_set_b(NULL, MODULE_NAME, "CLAlign", RIGHT);
-
- db_set_b(NULL, MODULE_NAME, "CLEnableState", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE));
-
- db_set_b(NULL, MODULE_NAME, "CLEnableTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLTOPENABLE));
- db_set_b(NULL, MODULE_NAME, "CLEnableBottom", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLBOTTOMENABLE));
- db_set_b(NULL, MODULE_NAME, "CLEnableSide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE));
- db_set_b(NULL, MODULE_NAME, "CLEnableWidth", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLWIDTHENABLE));
- db_set_dw(NULL, MODULE_NAME, "CLWidth", GetDlgItemInt(hwndDlg, IDC_CLWIDTH, NULL, FALSE));
- db_set_dw(NULL, MODULE_NAME, "CLpixelsTop", GetDlgItemInt(hwndDlg, IDC_CLTOP, NULL, TRUE));
- db_set_dw(NULL, MODULE_NAME, "CLpixelsBottom", GetDlgItemInt(hwndDlg, IDC_CLBOTTOM, NULL, TRUE));
- db_set_dw(NULL, MODULE_NAME, "CLpixelsSide", GetDlgItemInt(hwndDlg, IDC_CLSIDE, NULL, TRUE));
-
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-int OptInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.szGroup.a = LPGEN("Contact list");
- odp.szTitle.a = LPGEN("Start position");
- odp.pfnDlgProc = OptionsDlgProc;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
- return 0;
-}
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
RECT WorkArea;
-
SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0);
- BYTE clEnableTop = db_get_b(NULL, MODULE_NAME, "CLEnableTop", 1);
- BYTE clEnableBottom = db_get_b(NULL, MODULE_NAME, "CLEnableBottom", 0);
- BYTE clEnableSide = db_get_b(NULL, MODULE_NAME, "CLEnableSide", 1);
- BYTE clEnableWidth = db_get_b(NULL, MODULE_NAME, "CLEnableWidth", 0);
-
- DWORD clTop = db_get_dw(NULL, MODULE_NAME, "CLpixelsTop", 3);
- DWORD clBottom = db_get_dw(NULL, MODULE_NAME, "CLpixelsBottom", 3);
- DWORD clSide = db_get_dw(NULL, MODULE_NAME, "CLpixelsSide", 3);
- BYTE clAlign = db_get_b(NULL, MODULE_NAME, "CLAlign", RIGHT);
- 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);
-
- if(clEnableState)
- db_set_b(NULL,"CList", "State", (BYTE)clState);
+ if (spOptions.setClistStartState)
+ clOptions.state = static_cast<BYTE>(spOptions.clistState);
- if(clEnableWidth) {
- if(clWidth > 0)
- db_set_dw(NULL, "CList", "Width", clWidth);
- } else {
- clWidth = db_get_dw(NULL, "CList", "Width", 180);
- }
+ if (spOptions.setClistWidth && spOptions.clistWidth > 0)
+ clOptions.width = static_cast<DWORD>(spOptions.clistWidth);
+ else
+ spOptions.clistWidth = static_cast<DWORD>(clOptions.width);
- if(clEnableTop || clEnableBottom || clEnableSide)
- db_set_b(NULL,"CList", "Docked", 0);
+ if (spOptions.setTopPosition || spOptions.setBottomPosition || spOptions.setSidePosition)
+ clOptions.isDocked = false;
- if(clEnableTop)
- db_set_dw(NULL, "CList", "y", clTop);
+ if (spOptions.setTopPosition)
+ clOptions.y = static_cast<DWORD>(spOptions.pixelsFromTop);
- //thx ValeraVi
- 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 - clBottom - (int)db_get_dw(NULL, "CList", "Height", 0)));
- }
+ if (spOptions.setBottomPosition) {
+ if (spOptions.setTopPosition)
+ clOptions.height = WorkArea.bottom - WorkArea.top - spOptions.pixelsFromTop - spOptions.pixelsFromBottom;
+ else
+ clOptions.y = WorkArea.bottom - spOptions.pixelsFromBottom - clOptions.height;
+ }
- 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));
- }
+ if (spOptions.setSidePosition) {
+ if (spOptions.clistAlign == ClistAlign::right)
+ clOptions.x = WorkArea.right - spOptions.clistWidth - spOptions.pixelsFromSide;
+ else
+ clOptions.x = WorkArea.left + spOptions.pixelsFromSide;
+ }
- HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
return 0;
}
diff --git a/plugins/StartPosition/src/options.cpp b/plugins/StartPosition/src/options.cpp
new file mode 100644
index 0000000000..66dc633ea9
--- /dev/null
+++ b/plugins/StartPosition/src/options.cpp
@@ -0,0 +1,140 @@
+#include "stdafx.h"
+
+
+StartPositionOptions::StartPositionOptions() :
+ setTopPosition(MODULE_NAME, "CLEnableTop", 1),
+ setBottomPosition(MODULE_NAME, "CLEnableBottom", 0),
+ setSidePosition(MODULE_NAME, "CLEnableSide", 1),
+ clistAlign(MODULE_NAME, "CLAlign", ClistAlign::right),
+ setClistWidth(MODULE_NAME, "CLEnableWidth", 0),
+ setClistStartState(MODULE_NAME, "CLEnableState", 0),
+ clistState(MODULE_NAME, "CLState", ClistState::normal),
+ pixelsFromTop(MODULE_NAME, "CLpixelsTop", 3),
+ pixelsFromBottom(MODULE_NAME, "CLpixelsBottom", 3),
+ pixelsFromSide(MODULE_NAME, "CLpixelsSide", 3),
+ clistWidth(MODULE_NAME, "CLWidth", 180)
+{}
+
+extern StartPositionOptions spOptions;
+
+COptionsDlg::COptionsDlg() :
+ CPluginDlgBase(g_hInst, IDD_OPTIONS, MODULE_NAME),
+ chkPositionTop(this, IDC_CLTOPENABLE),
+ edtPositionTop(this, IDC_CLTOP),
+ chkPositionBottom(this, IDC_CLBOTTOMENABLE),
+ edtPositionBottom(this, IDC_CLBOTTOM),
+ chkPositionSide(this, IDC_CLSIDEENABLE),
+ edtPositionSide(this, IDC_CLSIDE),
+ chkFromLeft(this, IDC_CLALIGNLEFT),
+ chkFromRight(this, IDC_CLALIGNRIGHT),
+ chkWidth(this, IDC_CLWIDTHENABLE),
+ edtWidth(this, IDC_CLWIDTH),
+ chkStartState(this, IDC_CLSTATEENABLE),
+ chkStartHidden(this, IDC_CLSTATETRAY),
+ chkStartNormal(this, IDC_CLSTATEOPENED)
+{
+ CreateLink(chkPositionTop, spOptions.setTopPosition);
+ CreateLink(chkPositionBottom, spOptions.setBottomPosition);
+ CreateLink(chkPositionSide, spOptions.setSidePosition);
+ CreateLink(chkWidth, spOptions.setClistWidth);
+ CreateLink(chkStartState, spOptions.setClistStartState);
+
+ CreateLink(edtPositionTop, spOptions.pixelsFromTop);
+ CreateLink(edtPositionBottom, spOptions.pixelsFromBottom);
+ CreateLink(edtPositionSide, spOptions.pixelsFromSide);
+ CreateLink(edtWidth, spOptions.clistWidth);
+
+ chkPositionTop.OnChange = Callback(this, &COptionsDlg::onCheck_PositionTop);
+ chkPositionBottom.OnChange = Callback(this, &COptionsDlg::onCheck_PositionBottom);
+ chkPositionSide.OnChange = Callback(this, &COptionsDlg::onCheck_PositionSide);
+ chkWidth.OnChange = Callback(this, &COptionsDlg::onCheck_Width);
+ chkStartState.OnChange = Callback(this, &COptionsDlg::onCheck_StartState);
+}
+
+void COptionsDlg::OnInitDialog()
+{
+ if (spOptions.clistState == ClistState::normal)
+ chkStartNormal.SetState(true);
+ else
+ chkStartHidden.SetState(true);
+
+ chkStartHidden.Enable(chkStartState.GetState());
+ chkStartNormal.Enable(chkStartState.GetState());
+
+ if (spOptions.clistAlign == ClistAlign::right)
+ chkFromRight.SetState(true);
+ else
+ chkFromLeft.SetState(true);
+
+ chkFromLeft.Enable(chkPositionSide.GetState());
+ chkFromRight.Enable(chkPositionSide.GetState());
+
+ edtPositionTop.Enable(chkPositionTop.GetState());
+ edtPositionBottom.Enable(chkPositionBottom.GetState());
+ edtPositionSide.Enable(chkPositionSide.GetState());
+ edtWidth.Enable(chkWidth.GetState());
+}
+
+void COptionsDlg::OnApply()
+{
+ removeOldSettings();
+
+ if (chkStartNormal.GetState())
+ spOptions.clistState = ClistState::normal;
+ else
+ spOptions.clistState = ClistState::hidden;
+
+ if (chkFromRight.GetState())
+ spOptions.clistAlign = ClistAlign::right;
+ else
+ spOptions.clistAlign = ClistAlign::left;
+}
+
+void COptionsDlg::removeOldSettings()
+{
+ if (db_get_b(0, MODULE_NAME, "CLEnableTop", dbERROR) == dbERROR)
+ {
+ db_unset(0, MODULE_NAME, "CLEnable");
+ db_unset(0, MODULE_NAME, "CLuseLastWidth");
+ }
+}
+
+void COptionsDlg::onCheck_PositionTop(CCtrlCheck*)
+{
+ edtPositionTop.Enable(chkPositionTop.GetState());
+}
+
+void COptionsDlg::onCheck_PositionBottom(CCtrlCheck*)
+{
+ edtPositionBottom.Enable(chkPositionBottom.GetState());
+}
+
+void COptionsDlg::onCheck_PositionSide(CCtrlCheck*)
+{
+ edtPositionSide.Enable(chkPositionSide.GetState());
+ chkFromLeft.Enable(chkPositionSide.GetState());
+ chkFromRight.Enable(chkPositionSide.GetState());
+}
+
+void COptionsDlg::onCheck_Width(CCtrlCheck*)
+{
+ edtWidth.Enable(chkWidth.GetState());
+}
+
+void COptionsDlg::onCheck_StartState(CCtrlCheck*)
+{
+ chkStartHidden.Enable(chkStartState.GetState());
+ chkStartNormal.Enable(chkStartState.GetState());
+}
+
+int OptInitialise(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.hInstance = g_hInst;
+ odp.szGroup.a = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Start position");
+ odp.pDialog = new COptionsDlg;
+ odp.flags = ODPF_BOLDGROUPS;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/StartPosition/src/options.h b/plugins/StartPosition/src/options.h
new file mode 100644
index 0000000000..8066cddbf7
--- /dev/null
+++ b/plugins/StartPosition/src/options.h
@@ -0,0 +1,93 @@
+/*
+Copyright (C) 2012-17 Miranda NG project (https://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#include "stdafx.h"
+
+enum ClistAlign : BYTE
+{
+ left,
+ right
+};
+
+enum ClistState : BYTE
+{
+ hidden,
+ minimized,
+ normal
+};
+
+struct ClistOptions
+{
+ CMOption<BYTE> isDocked;
+ CMOption<BYTE> state;
+
+ CMOption<DWORD> x;
+ CMOption<DWORD> y;
+ CMOption<DWORD> width;
+ CMOption<DWORD> height;
+
+ ClistOptions() :
+ isDocked(CLIST_MODULE_NAME, "Docked", 0),
+ state(CLIST_MODULE_NAME, "State", ClistState::normal),
+ x(CLIST_MODULE_NAME, "x", 0),
+ y(CLIST_MODULE_NAME, "y", 0),
+ width(CLIST_MODULE_NAME, "Width", 150),
+ height(CLIST_MODULE_NAME, "Height", 350)
+ { }
+};
+
+struct StartPositionOptions
+{
+ CMOption<BYTE> setTopPosition;
+ CMOption<BYTE> setBottomPosition;
+ CMOption<BYTE> setSidePosition;
+ CMOption<BYTE> clistAlign;
+ CMOption<BYTE> setClistWidth;
+ CMOption<BYTE> setClistStartState;
+ CMOption<BYTE> clistState;
+
+ CMOption<DWORD> pixelsFromTop;
+ CMOption<DWORD> pixelsFromBottom;
+ CMOption<DWORD> pixelsFromSide;
+ CMOption<DWORD> clistWidth;
+
+ StartPositionOptions();
+};
+
+class COptionsDlg : public CPluginDlgBase
+{
+ CCtrlCheck chkPositionTop, chkPositionBottom, chkPositionSide, chkFromLeft, chkFromRight, chkWidth;
+ CCtrlEdit edtPositionTop, edtPositionBottom, edtPositionSide, edtWidth;
+ CCtrlCheck chkStartState, chkStartHidden, chkStartNormal;
+
+public:
+ COptionsDlg();
+
+ virtual void OnInitDialog() override;
+ virtual void OnApply() override;
+
+private:
+ void removeOldSettings();
+
+ void onCheck_PositionTop(CCtrlCheck*);
+ void onCheck_PositionBottom(CCtrlCheck*);
+ void onCheck_PositionSide(CCtrlCheck*);
+ void onCheck_Width(CCtrlCheck*);
+ void onCheck_StartState(CCtrlCheck*);
+};
diff --git a/plugins/StartPosition/src/stdafx.h b/plugins/StartPosition/src/stdafx.h
index b962157adc..27bef6bf2c 100644
--- a/plugins/StartPosition/src/stdafx.h
+++ b/plugins/StartPosition/src/stdafx.h
@@ -1,39 +1,48 @@
/*
-
StartPosition plugin for Miranda NG
Copyright (C) 2005-2008 Felipe Brahm - souFrag
ICQ#50566818
http://www.soufrag.cl
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+Copyright (C) 2012-17 Miranda NG project (https://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#pragma once
#include <windows.h>
#include <newpluginapi.h>
#include <m_database.h>
+#include <m_gui.h>
#include <m_langpack.h>
-#include <m_utils.h>
#include <m_options.h>
+#include <m_utils.h>
#include "resource.h"
#include "version.h"
+extern HINSTANCE g_hInst;
+
#define MODULE_NAME "StartPosition"
+#define CLIST_MODULE_NAME "CList"
#define dbERROR -999999
#define RIGHT 1
#define LEFT 0
+
+#include "options.h"
+
+extern int OptInitialise(WPARAM wParam, LPARAM);
diff --git a/plugins/StartPosition/src/version.h b/plugins/StartPosition/src/version.h
index 877e6d0e47..4fd0f5a272 100644
--- a/plugins/StartPosition/src/version.h
+++ b/plugins/StartPosition/src/version.h
@@ -1,5 +1,5 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 2
+#define __MINOR_VERSION 3
#define __RELEASE_NUM 0
#define __BUILD_NUM 3
@@ -11,4 +11,4 @@
#define __AUTHOR "Felipe Brahm - souFrag"
#define __AUTHOREMAIL "felipebrahm@gmail.com"
#define __AUTHORWEB "https://miranda-ng.org/p/StartPosition/"
-#define __COPYRIGHT "© 2005-2008 Felipe Brahm - souFrag"
+#define __COPYRIGHT "© 2005-2008 Felipe Brahm - souFrag, © 2012-17 Miranda NG project"