From 53566f8632f56ecbaf2f3f80059a801cb1648358 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 12 Oct 2013 18:14:02 +0000 Subject: added 64 bit compilation git-svn-id: http://svn.miranda-ng.org/main/trunk@6459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MagneticWindows/MagneticWindows_10.vcxproj | 98 ++++++++++++++++++++++ plugins/MagneticWindows/src/MagneticWindows.cpp | 20 ++--- .../MagneticWindows/src/MagneticWindowsCore.cpp | 47 ++++------- plugins/MagneticWindows/src/MagneticWindowsCore.h | 1 - plugins/MagneticWindows/src/Options.cpp | 27 ++---- plugins/MagneticWindows/src/Options.h | 2 +- plugins/MagneticWindows/src/SnapToListService.cpp | 2 +- plugins/MagneticWindows/src/SnapToListService.h | 2 +- 8 files changed, 134 insertions(+), 65 deletions(-) diff --git a/plugins/MagneticWindows/MagneticWindows_10.vcxproj b/plugins/MagneticWindows/MagneticWindows_10.vcxproj index 6e91f33f2a..c0b03c9b68 100644 --- a/plugins/MagneticWindows/MagneticWindows_10.vcxproj +++ b/plugins/MagneticWindows/MagneticWindows_10.vcxproj @@ -5,15 +5,24 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {7DC23E4E-2448-4811-AABD-F5D069F6E74A} Win32Proj MagneticWindows + MagneticWindows @@ -21,21 +30,38 @@ true Unicode + + DynamicLibrary + true + Unicode + DynamicLibrary false false Unicode + + DynamicLibrary + false + false + Unicode + + + + + + + false @@ -43,12 +69,24 @@ $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ true + + false + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + false $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ $(SolutionDir)$(Configuration)\Plugins\ true + + false + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Plugins\ + true + Create @@ -82,6 +120,39 @@ ..\..\include\msapi + + + Create + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) + false + false + + + + + MagneticWindowsCore.h + + + Windows + true + $(ProfileDir)..\..\bin10\lib + comctl32.lib;%(AdditionalDependencies) + + + false + $(IntDir)$(TargetName).lib + false + + + _DEBUG;%(PreprocessorDefinitions) + + + ..\..\include\msapi + + Level3 @@ -109,6 +180,33 @@ ..\..\include\msapi + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;MAGNETICWINDOWS_EXPORTS;%(PreprocessorDefinitions) + MagneticWindowsCore.h + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + comctl32.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin10\lib + false + $(IntDir)$(TargetName).lib + false + + + ..\..\include\msapi + + 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 #include #include -// #include "../include/m_plugins.h" #include #include #include 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); -- cgit v1.2.3