diff options
-rw-r--r-- | plugins/StartPosition/StartPosition_10.vcxproj | 1 | ||||
-rw-r--r-- | plugins/StartPosition/StartPosition_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/StartPosition/StartPosition_11.vcxproj | 1 | ||||
-rw-r--r-- | plugins/StartPosition/StartPosition_11.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/StartPosition/res/Version.rc | 2 | ||||
-rw-r--r-- | plugins/StartPosition/res/resource.rc | 19 | ||||
-rw-r--r-- | plugins/StartPosition/src/Common.h | 37 | ||||
-rw-r--r-- | plugins/StartPosition/src/main.cpp | 141 |
8 files changed, 113 insertions, 94 deletions
diff --git a/plugins/StartPosition/StartPosition_10.vcxproj b/plugins/StartPosition/StartPosition_10.vcxproj index 606598a13a..42819b41a3 100644 --- a/plugins/StartPosition/StartPosition_10.vcxproj +++ b/plugins/StartPosition/StartPosition_10.vcxproj @@ -180,6 +180,7 @@ <ItemGroup>
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\Version.h" />
+ <ClInclude Include="src\Common.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/StartPosition/StartPosition_10.vcxproj.filters b/plugins/StartPosition/StartPosition_10.vcxproj.filters index f94ffb1214..6e5aa9f3d0 100644 --- a/plugins/StartPosition/StartPosition_10.vcxproj.filters +++ b/plugins/StartPosition/StartPosition_10.vcxproj.filters @@ -34,5 +34,8 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\Common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/StartPosition/StartPosition_11.vcxproj b/plugins/StartPosition/StartPosition_11.vcxproj index ca6e632498..f88033ddf1 100644 --- a/plugins/StartPosition/StartPosition_11.vcxproj +++ b/plugins/StartPosition/StartPosition_11.vcxproj @@ -184,6 +184,7 @@ <ItemGroup>
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\Version.h" />
+ <ClInclude Include="src\Common.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/StartPosition/StartPosition_11.vcxproj.filters b/plugins/StartPosition/StartPosition_11.vcxproj.filters index f94ffb1214..6e5aa9f3d0 100644 --- a/plugins/StartPosition/StartPosition_11.vcxproj.filters +++ b/plugins/StartPosition/StartPosition_11.vcxproj.filters @@ -34,5 +34,8 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\Common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/StartPosition/res/Version.rc b/plugins/StartPosition/res/Version.rc index 5bfbab4754..c969d635bf 100644 --- a/plugins/StartPosition/res/Version.rc +++ b/plugins/StartPosition/res/Version.rc @@ -4,7 +4,7 @@ #error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
-#include "afxres.h"
+#include "winres.h"
#include "..\src\version.h"
VS_VERSION_INFO VERSIONINFO
diff --git a/plugins/StartPosition/res/resource.rc b/plugins/StartPosition/res/resource.rc index c54009e6ed..06724aec48 100644 --- a/plugins/StartPosition/res/resource.rc +++ b/plugins/StartPosition/res/resource.rc @@ -18,18 +18,18 @@ // TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"..\\src\\resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -74,7 +74,6 @@ BEGIN WS_TABSTOP,117,156,180,10
END
-
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -90,14 +89,4 @@ BEGIN TOPMARGIN, 2
END
END
-#endif // APSTUDIO_INVOKED
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
\ No newline at end of file +#endif // APSTUDIO_INVOKED
\ No newline at end of file diff --git a/plugins/StartPosition/src/Common.h b/plugins/StartPosition/src/Common.h new file mode 100644 index 0000000000..01448f7f88 --- /dev/null +++ b/plugins/StartPosition/src/Common.h @@ -0,0 +1,37 @@ +/*
+
+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.
+
+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.
+*/
+
+#include <windows.h>
+#include <stdio.h>
+
+#include <newpluginapi.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_options.h>
+
+#include "resource.h"
+#include "version.h"
+
+#define dbERROR -999999
+#define RIGHT 1
+#define LEFT 0
\ No newline at end of file diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp index 934d92236f..538d05e115 100644 --- a/plugins/StartPosition/src/main.cpp +++ b/plugins/StartPosition/src/main.cpp @@ -1,29 +1,27 @@ /*
-PLEASE CONTACT ME FIRST IF YOU WANT TO USE PART OF MY CODE IN YOUR OWN WORK :-)
+StartPosition plugin for Miranda NG
-Felipe Brahm - souFrag
+Copyright (C) 2005-2008 Felipe Brahm - souFrag
ICQ#50566818
http://www.soufrag.cl
-You cand send me an e-mail from my webpage :-)
+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.
-*/
-
-#include <windows.h>
-#include <stdio.h>
+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.
-#include <newpluginapi.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_options.h>
-
-#include "resource.h"
-#include "version.h"
+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.
+*/
-#define dbERROR -999999
-#define RIGHT 1
-#define LEFT 0
+#include "Common.h"
HINSTANCE hInst;
int hLangpack;
@@ -61,27 +59,27 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
TranslateDialogDefault(hwndDlg);
- if(DBGetContactSettingByte(NULL,"WindowStartPosition","CLState",2))
+ if(DBGetContactSettingByte(NULL, "WindowStartPosition", "CLState", 2))
CheckRadioButton(hwndDlg, IDC_CLSTATE0, IDC_CLSTATE2, IDC_CLSTATE2);
else
CheckRadioButton(hwndDlg, IDC_CLSTATE0, IDC_CLSTATE2, IDC_CLSTATE0);
- if(DBGetContactSettingByte(NULL,"WindowStartPosition","CLAlign",1))
+ if(DBGetContactSettingByte(NULL, "WindowStartPosition", "CLAlign", 1))
CheckRadioButton(hwndDlg, IDC_CLALIGN1, IDC_CLALIGN2, IDC_CLALIGN2);
else
CheckRadioButton(hwndDlg, IDC_CLALIGN1, IDC_CLALIGN2, IDC_CLALIGN1);
- CheckDlgButton(hwndDlg, IDC_CLSTATEENABLE, DBGetContactSettingByte(NULL,"WindowStartPosition","CLEnableState",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLSTATEENABLE, DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableState", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLTOPENABLE, DBGetContactSettingByte(NULL,"WindowStartPosition","CLEnableTop",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLBOTTOMENABLE, DBGetContactSettingByte(NULL,"WindowStartPosition","CLEnableBottom",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLSIDEENABLE, DBGetContactSettingByte(NULL,"WindowStartPosition","CLEnableSide",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLWIDTHENABLE, DBGetContactSettingByte(NULL,"WindowStartPosition","CLEnableWidth",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLTOPENABLE, DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableTop", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLBOTTOMENABLE, DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableBottom", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLSIDEENABLE, DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableSide", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLWIDTHENABLE, DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableWidth", 0) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg,IDC_CLTOP,DBGetContactSettingDword(NULL,"WindowStartPosition","CLpixelsTop",3),TRUE);
- SetDlgItemInt(hwndDlg,IDC_CLBOTTOM,DBGetContactSettingDword(NULL,"WindowStartPosition","CLpixelsBottom",3),TRUE);
- SetDlgItemInt(hwndDlg,IDC_CLSIDE,DBGetContactSettingDword(NULL,"WindowStartPosition","CLpixelsSide",3),TRUE);
- SetDlgItemInt(hwndDlg,IDC_CLWIDTH,DBGetContactSettingDword(NULL,"WindowStartPosition","CLWidth",180),FALSE);
+ SetDlgItemInt(hwndDlg, IDC_CLTOP, DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsTop", 3), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_CLBOTTOM, DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsBottom", 3), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_CLSIDE, DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsSide", 3), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_CLWIDTH, DBGetContactSettingDword(NULL, "WindowStartPosition", "CLWidth", 180), FALSE);
return TRUE;
}
@@ -93,35 +91,33 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
case PSN_APPLY:
{
-
/*begin uninstall old settings*/
if(DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableTop", dbERROR) == dbERROR) {
-
- DBDeleteContactSetting(NULL,"WindowStartPosition","CLEnable");
- DBDeleteContactSetting(NULL,"WindowStartPosition","CLuseLastWidth");
+ DBDeleteContactSetting(NULL, "WindowStartPosition", "CLEnable");
+ DBDeleteContactSetting(NULL, "WindowStartPosition", "CLuseLastWidth");
}
/*end uninstall old settings*/
if(IsDlgButtonChecked(hwndDlg, IDC_CLSTATE2))
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLState",2);
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLState", 2);
else
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLState",0);
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLState", 0);
if(IsDlgButtonChecked(hwndDlg, IDC_CLALIGN1))
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLAlign",0);
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLAlign", 0);
else
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLAlign",1);
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLAlign", 1);
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLEnableState",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLSTATEENABLE));
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLEnableState", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLSTATEENABLE));
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLEnableTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLTOPENABLE));
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLEnableBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLBOTTOMENABLE));
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLEnableSide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLSIDEENABLE));
- DBWriteContactSettingByte(NULL,"WindowStartPosition","CLEnableWidth",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLWIDTHENABLE));
- DBWriteContactSettingDword(NULL,"WindowStartPosition","CLWidth",GetDlgItemInt(hwndDlg,IDC_CLWIDTH,NULL,FALSE));
- DBWriteContactSettingDword(NULL,"WindowStartPosition","CLpixelsTop",GetDlgItemInt(hwndDlg,IDC_CLTOP,NULL,TRUE));
- DBWriteContactSettingDword(NULL,"WindowStartPosition","CLpixelsBottom",GetDlgItemInt(hwndDlg,IDC_CLBOTTOM,NULL,TRUE));
- DBWriteContactSettingDword(NULL,"WindowStartPosition","CLpixelsSide",GetDlgItemInt(hwndDlg,IDC_CLSIDE,NULL,TRUE));
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLEnableTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLTOPENABLE));
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLEnableBottom", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLBOTTOMENABLE));
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLEnableSide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLSIDEENABLE));
+ DBWriteContactSettingByte(NULL, "WindowStartPosition", "CLEnableWidth", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLWIDTHENABLE));
+ DBWriteContactSettingDword(NULL, "WindowStartPosition", "CLWidth", GetDlgItemInt(hwndDlg, IDC_CLWIDTH, NULL, FALSE));
+ DBWriteContactSettingDword(NULL, "WindowStartPosition", "CLpixelsTop", GetDlgItemInt(hwndDlg, IDC_CLTOP, NULL, TRUE));
+ DBWriteContactSettingDword(NULL, "WindowStartPosition", "CLpixelsBottom", GetDlgItemInt(hwndDlg, IDC_CLBOTTOM, NULL, TRUE));
+ DBWriteContactSettingDword(NULL, "WindowStartPosition", "CLpixelsSide", GetDlgItemInt(hwndDlg, IDC_CLSIDE, NULL, TRUE));
return TRUE;
}
@@ -147,48 +143,34 @@ int OptInit(WPARAM wParam, LPARAM lParam) return 0;
}
-extern "C" __declspec(dllexport) int Load(void)
+int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- mir_getLP(&pluginInfo);
-
RECT WorkArea;
- int clWidth=0;
- int clTop, clBottom, clSide; //pixels from top, bottom, side
- int clAlign;
- int clEnableTop, clEnableBottom, clEnableSide, clEnableWidth, clEnableState;
- int clState;
-
- HookEvent(ME_OPT_INITIALISE,OptInit);
-
SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0);
- clEnableTop = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableTop", 1);
- clEnableBottom = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableBottom", 1);
- clEnableSide = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableSide", 1);
- clEnableWidth = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableWidth", 0);
+ int clEnableTop = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableTop", 1);
+ int clEnableBottom = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableBottom", 1);
+ int clEnableSide = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableSide", 1);
+ int clEnableWidth = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableWidth", 0);
- clTop = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsTop", 3);
- clBottom = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsBottom", 3);
- clSide = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsSide", 3);
- clAlign = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLAlign", RIGHT);
- clWidth = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLWidth", 180);
+ int clTop = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsTop", 3);
+ int clBottom = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsBottom", 3);
+ int clSide = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLpixelsSide", 3);
+ int clAlign = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLAlign", RIGHT);
+ int clWidth = DBGetContactSettingDword(NULL, "WindowStartPosition", "CLWidth", 180);
- clEnableState = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableState", 0);
- clState = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLState", 2);
+ int clEnableState = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLEnableState", 0);
+ int clState = DBGetContactSettingByte(NULL, "WindowStartPosition", "CLState", 2);
if(clEnableState)
DBWriteContactSettingByte(NULL,"CList", "State", (BYTE)clState);
if(clEnableWidth) {
-
if(clWidth > 0)
DBWriteContactSettingDword(NULL, "CList", "Width", clWidth);
-
} else {
-
clWidth = DBGetContactSettingDword(NULL, "CList", "Width", 180);
-
}
if(clEnableTop || clEnableBottom || clEnableSide)
@@ -199,29 +181,32 @@ extern "C" __declspec(dllexport) int Load(void) //thx ValeraVi
if(clEnableBottom) {
-
if(clEnableTop)
-
DBWriteContactSettingDword(NULL, "CList", "Height", (WorkArea.bottom - WorkArea.top - clTop - clBottom));
-
else
-
DBWriteContactSettingDword(NULL, "CList", "y", (WorkArea.bottom - clBottom - (int)DBGetContactSettingDword(NULL, "CList", "Height", 0)));
-
}
if(clEnableSide) {
-
if(clAlign == LEFT)
DBWriteContactSettingDword(NULL, "CList", "x", (WorkArea.left + clSide));
else
DBWriteContactSettingDword(NULL, "CList", "x", (WorkArea.right - clWidth - clSide));
-
}
return 0;
}
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfo);
+
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+
+ return 0;
+}
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
|