diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-10-12 18:14:02 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-10-12 18:14:02 +0000 |
commit | 53566f8632f56ecbaf2f3f80059a801cb1648358 (patch) | |
tree | 4e34daae490cec9670ae4f58f6b4bc3fc45118cf /plugins/MagneticWindows/src | |
parent | 6773fe45457b8ef6e87efa0b5aecc0899877b247 (diff) |
added 64 bit compilation
git-svn-id: http://svn.miranda-ng.org/main/trunk@6459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MagneticWindows/src')
-rw-r--r-- | plugins/MagneticWindows/src/MagneticWindows.cpp | 20 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/MagneticWindowsCore.cpp | 47 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/MagneticWindowsCore.h | 1 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/Options.cpp | 27 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/Options.h | 2 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/SnapToListService.cpp | 2 | ||||
-rw-r--r-- | plugins/MagneticWindows/src/SnapToListService.h | 2 |
7 files changed, 36 insertions, 65 deletions
diff --git a/plugins/MagneticWindows/src/MagneticWindows.cpp b/plugins/MagneticWindows/src/MagneticWindows.cpp index 80501cc80e..80b05731c0 100644 --- a/plugins/MagneticWindows/src/MagneticWindows.cpp +++ b/plugins/MagneticWindows/src/MagneticWindows.cpp @@ -43,25 +43,22 @@ int hLangpack; //For other Plugins to start snapping for other Windows
-int SnapPluginWindowStart(WPARAM wParam, LPARAM lParam) {
-
+INT_PTR SnapPluginWindowStart(WPARAM wParam, LPARAM) {
if (!WindowOpen((HWND)wParam)) return 1;
return 0;
}
//For other Plugins to stop snapping for other Windows
-int SnapPluginWindowStop(WPARAM wParam, LPARAM lParam) {
-
+INT_PTR SnapPluginWindowStop(WPARAM wParam, LPARAM) {
if (!WindowClose((HWND)wParam)) return 1;
return 0;
}
-int PluginMessageWindowEvent(WPARAM wParam, LPARAM lParam) {
- MessageWindowEventData* Data;
+int PluginMessageWindowEvent(WPARAM, LPARAM lParam) {
HWND hWndParent, hWnd;
- Data = (MessageWindowEventData*)(lParam);
+ MessageWindowEventData *Data = (MessageWindowEventData*) lParam;
switch (Data->uType) {
case MSG_WINDOW_EVT_OPEN:
@@ -93,8 +90,7 @@ int PluginMessageWindowEvent(WPARAM wParam, LPARAM lParam) { ///////////////////////////////////////////////////////////////////////////////////////////////////
-int SnapPluginStart(WPARAM wParam, LPARAM lParam) {
-
+int SnapPluginStart(WPARAM, LPARAM) {
LoadOptions();
hWindowEventHook = HookEvent(ME_MSG_WINDOWEVENT, PluginMessageWindowEvent);
@@ -103,7 +99,7 @@ int SnapPluginStart(WPARAM wParam, LPARAM lParam) { return 0;
}
-int SnapPluginShootDown(WPARAM wParam, LPARAM lParam) {
+int SnapPluginShootDown(WPARAM, LPARAM) {
UnhookEvent(hWindowEventHook);
UnhookEvent(hLoadedHook);
UnhookEvent(hShootDownHook);
@@ -128,7 +124,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfo;
}
-extern "C" int __declspec(dllexport) Load(void)
+extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
@@ -143,7 +139,7 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
-extern "C" int __declspec(dllexport) Unload(void)
+extern "C" int __declspec(dllexport) Unload()
{
return 0;
}
diff --git a/plugins/MagneticWindows/src/MagneticWindowsCore.cpp b/plugins/MagneticWindows/src/MagneticWindowsCore.cpp index 5af05dcd76..a3cd5f78d6 100644 --- a/plugins/MagneticWindows/src/MagneticWindowsCore.cpp +++ b/plugins/MagneticWindows/src/MagneticWindowsCore.cpp @@ -16,22 +16,18 @@ TWorkingVariables Globals = { ///////////////////////////////////////////////////////////////////////////////////////////////////
int Abs(int a) {
- if (a < 0) return (-a);
- return a;
+ return (a<0) ? -a : a;
}
PDockingWindow FindDockingWindow(HWND hWnd) {
- PDockingWindow i;
-
- i = Globals.WindowList;
+ PDockingWindow i = Globals.WindowList;
while (i != NULL) {
-
if (i->hWnd == hWnd) return i;
i = i->Next;
- };
+ }
return NULL;
}
@@ -39,24 +35,19 @@ PDockingWindow FindDockingWindow(HWND hWnd) { void DockWindowRect(HWND hWnd, bool Sizing, RECT& GivenRect, int SizingEdge, int MouseX = 0, int MouseY = 0) {
POINT p;
- int diffX, diffY;
- RECT tmpRect, frmRect;
int W, H;
int XPos, YPos;
int tmpXPos, tmpYPos;
int tmpMouseX, tmpMouseY;
- bool FoundX, FoundY;
PRectList ActRect;
- diffX = Options.SnapWidth;
- diffY = Options.SnapWidth;
+ int diffX = Options.SnapWidth, diffY = Options.SnapWidth;
- tmpRect = GivenRect;
- frmRect = GivenRect;
+ RECT tmpRect = GivenRect;
+ RECT frmRect = GivenRect;
- FoundX = false;
- FoundY = false;
+ bool FoundX = false, FoundY = false;
if (!Sizing) {
GetCursorPos(&p);
@@ -290,8 +281,8 @@ void DockWindowRect(HWND hWnd, bool Sizing, RECT& GivenRect, int SizingEdge, int void GetFrmRects(HWND ForWindow) {
-PDockingWindow i;
-PRectList Rect, l;
+ PDockingWindow i;
+ PRectList Rect, l;
Rect = Globals.Rects;
while (Rect != NULL) {
@@ -326,16 +317,12 @@ PRectList Rect, l; ///////////////////////////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
- PDockingWindow i;
-
RECT r;
POINT p;
- WNDPROC OldRun;
-
- i = FindDockingWindow(hWnd);
+ PDockingWindow i = FindDockingWindow(hWnd);
- OldRun = NULL;
+ WNDPROC OldRun = NULL;
if (i != NULL) { //else we have a problem
OldRun = i->OldWindowProc;
@@ -408,11 +395,11 @@ bool WindowOpen(HWND hWnd) { Globals.WindowList = i;
if (IsWindowUnicode(hWnd)) {
- i->OldWindowProc = (WNDPROC) GetWindowLongW(hWnd, GWL_WNDPROC);
- SetWindowLongW(hWnd, GWL_WNDPROC, (LONG)(&WindowProc));
+ i->OldWindowProc = (WNDPROC) GetWindowLongPtrW(hWnd, GWLP_WNDPROC);
+ SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)(&WindowProc));
} else {
- i->OldWindowProc = (WNDPROC) GetWindowLongA(hWnd, GWL_WNDPROC);
- SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)(&WindowProc));
+ i->OldWindowProc = (WNDPROC) GetWindowLongPtrA(hWnd, GWLP_WNDPROC);
+ SetWindowLongPtrA(hWnd, GWLP_WNDPROC, (LONG_PTR)(&WindowProc));
}
return true;
@@ -439,9 +426,9 @@ bool WindowClose(HWND hWnd) { }
if (IsWindowUnicode(hWnd)) {
- SetWindowLongW(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc));
+ SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR) (i->OldWindowProc));
} else {
- SetWindowLongA(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc));
+ SetWindowLongPtrA(hWnd, GWLP_WNDPROC, (LONG_PTR) (i->OldWindowProc));
}
mir_free(i);
diff --git a/plugins/MagneticWindows/src/MagneticWindowsCore.h b/plugins/MagneticWindows/src/MagneticWindowsCore.h index c0d6938a7f..84ebf91100 100644 --- a/plugins/MagneticWindows/src/MagneticWindowsCore.h +++ b/plugins/MagneticWindows/src/MagneticWindowsCore.h @@ -8,7 +8,6 @@ #include <m_message.h>
#include <m_system.h>
#include <m_options.h>
-// #include "../include/m_plugins.h"
#include <m_database.h>
#include <m_langpack.h>
#include <m_MagneticWindows.h>
diff --git a/plugins/MagneticWindows/src/Options.cpp b/plugins/MagneticWindows/src/Options.cpp index d070f40d56..8d986a26f5 100644 --- a/plugins/MagneticWindows/src/Options.cpp +++ b/plugins/MagneticWindows/src/Options.cpp @@ -8,10 +8,7 @@ TOptions Options = { };
-int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- TCHAR str[64];
-
+INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_INITDIALOG: {
TranslateDialogDefault(hwndDlg);
@@ -20,7 +17,8 @@ int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETRANGE, FALSE, MAKELONG(1,32));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETPOS, TRUE, Options.SnapWidth);
- wsprintf(str, TranslateT("%d pix"), Options.SnapWidth);
+ TCHAR str[64];
+ mir_sntprintf(str, SIZEOF(str),TranslateT("%d pix"), Options.SnapWidth);
SetDlgItemText(hwndDlg, IDC_TXT_SNAPWIDTH, str);
EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), Options.DoSnap);
@@ -30,8 +28,9 @@ int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam break;
}
- case WM_HSCROLL: {
- mir_snwprintf(str, 64, TranslateT("%d pix"), SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0));
+ case WM_HSCROLL: {
+ TCHAR str[64];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("%d pix"), SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0));
SetDlgItemText(hwndDlg, IDC_TXT_SNAPWIDTH, str);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -44,8 +43,6 @@ int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam switch(idCtrl) {
case IDC_CHK_SNAP: {
if (wNotifyCode == BN_CLICKED) {
-
-
EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), IsDlgButtonChecked(hwndDlg, IDC_CHK_SNAP));
EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_SNAPWIDTH), IsDlgButtonChecked(hwndDlg, IDC_CHK_SNAP));
@@ -101,20 +98,12 @@ int InitOptions(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE Opt = { 0 };
Opt.cbSize = sizeof(Opt);
-// Opt.position = 0;
Opt.pfnDlgProc = OptionsDlgProc;
Opt.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAGNETICWINDOWS);
Opt.hInstance = hInst;
-// Opt.hIcon = 0;
Opt.pszGroup = LPGEN("Customize");
Opt.pszTitle = LPGEN("Magnetic Windows");
-// Opt.groupPosition = 0;
-// Opt.hGroupIcon = 0;
Opt.flags = ODPF_BOLDGROUPS;
-// Opt.nIDBottomSimpleControl = 0;
-// Opt.nIDRightSimpleControl = 0;
-// Opt.expertOnlyControls = NULL;
-// Opt.nExpertOnlyControls = 0;
Options_AddPage(wParam, &Opt);
@@ -122,7 +111,7 @@ int InitOptions(WPARAM wParam, LPARAM) { }
void LoadOptions() {
- Options.DoSnap = db_get_b(NULL, MODULE_NAME, "DoSnap", TRUE);
+ Options.DoSnap = db_get_b(NULL, MODULE_NAME, "DoSnap", 1) != 0;
Options.SnapWidth = db_get_b(NULL, MODULE_NAME, "SnapWidth", cDefaultSnapWidth);
- Options.ScriverWorkAround = db_get_b(NULL, MODULE_NAME, "ScriverWorkAround", FALSE);
+ Options.ScriverWorkAround = db_get_b(NULL, MODULE_NAME, "ScriverWorkAround", 0) != 0;
}
\ No newline at end of file diff --git a/plugins/MagneticWindows/src/Options.h b/plugins/MagneticWindows/src/Options.h index ebb5458d4a..8eae719fcb 100644 --- a/plugins/MagneticWindows/src/Options.h +++ b/plugins/MagneticWindows/src/Options.h @@ -12,7 +12,7 @@ extern HANDLE hInitOptionsHook; extern TOptions Options;
-int CALLBACK OptionsDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK OptionsDlgProc(HWND, UINT, WPARAM, LPARAM);
int InitOptions(WPARAM, LPARAM);
void LoadOptions();
\ No newline at end of file diff --git a/plugins/MagneticWindows/src/SnapToListService.cpp b/plugins/MagneticWindows/src/SnapToListService.cpp index 5fc9f66268..df29a2cf70 100644 --- a/plugins/MagneticWindows/src/SnapToListService.cpp +++ b/plugins/MagneticWindows/src/SnapToListService.cpp @@ -4,7 +4,7 @@ HANDLE hSnapToListService;
-int SnapToList(WPARAM wParam, LPARAM Align) {
+INT_PTR SnapToList(WPARAM wParam, LPARAM Align) {
HWND hWnd, hWndList;
RECT WndRect, ListRect;
RECT AlignRect;
diff --git a/plugins/MagneticWindows/src/SnapToListService.h b/plugins/MagneticWindows/src/SnapToListService.h index 27db7246cd..6e3b9a4077 100644 --- a/plugins/MagneticWindows/src/SnapToListService.h +++ b/plugins/MagneticWindows/src/SnapToListService.h @@ -2,4 +2,4 @@ extern HANDLE hSnapToListService;
-int SnapToList(WPARAM, LPARAM);
+INT_PTR SnapToList(WPARAM, LPARAM);
|