From 9b8ec8aeeb593644b053dc491818f37587293eae Mon Sep 17 00:00:00 2001 From: Goraf Date: Fri, 11 Oct 2013 20:53:23 +0000 Subject: * adopted * compilable version git-svn-id: http://svn.miranda-ng.org/main/trunk@6450 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../MagneticWindows/MagneticWindows.cpp | 184 -------- .../MagneticWindows/MagneticWindows.dsp | 146 ------- .../MagneticWindows/MagneticWindows.dsw | 29 -- .../MagneticWindows/MagneticWindowsCore.cpp | 464 --------------------- .../MagneticWindows/MagneticWindowsCore.h | 45 -- plugins/!NotAdopted/MagneticWindows/Options.cpp | 128 ------ plugins/!NotAdopted/MagneticWindows/Options.h | 18 - plugins/!NotAdopted/MagneticWindows/Options.rc | 113 ----- .../MagneticWindows/SnapToListService.cpp | 64 --- .../MagneticWindows/SnapToListService.h | 5 - .../MagneticWindows/m_MagneticWindows.h | 86 ---- plugins/!NotAdopted/MagneticWindows/resource.h | 25 -- plugins/ExternalAPI/m_MagneticWindows.h | 86 ++++ plugins/MagneticWindows/MagneticWindows_10.vcxproj | 132 ++++++ .../MagneticWindows_10.vcxproj.filters | 56 +++ plugins/MagneticWindows/res/Options.rc | 113 +++++ plugins/MagneticWindows/res/Version.rc | 38 ++ plugins/MagneticWindows/src/MagneticWindows.cpp | 161 +++++++ .../MagneticWindows/src/MagneticWindowsCore.cpp | 464 +++++++++++++++++++++ plugins/MagneticWindows/src/MagneticWindowsCore.h | 48 +++ plugins/MagneticWindows/src/Options.cpp | 128 ++++++ plugins/MagneticWindows/src/Options.h | 18 + plugins/MagneticWindows/src/SnapToListService.cpp | 64 +++ plugins/MagneticWindows/src/SnapToListService.h | 5 + plugins/MagneticWindows/src/Version.h | 14 + plugins/MagneticWindows/src/resource.h | 25 ++ 26 files changed, 1352 insertions(+), 1307 deletions(-) delete mode 100644 plugins/!NotAdopted/MagneticWindows/MagneticWindows.cpp delete mode 100644 plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsp delete mode 100644 plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsw delete mode 100644 plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.cpp delete mode 100644 plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.h delete mode 100644 plugins/!NotAdopted/MagneticWindows/Options.cpp delete mode 100644 plugins/!NotAdopted/MagneticWindows/Options.h delete mode 100644 plugins/!NotAdopted/MagneticWindows/Options.rc delete mode 100644 plugins/!NotAdopted/MagneticWindows/SnapToListService.cpp delete mode 100644 plugins/!NotAdopted/MagneticWindows/SnapToListService.h delete mode 100644 plugins/!NotAdopted/MagneticWindows/m_MagneticWindows.h delete mode 100644 plugins/!NotAdopted/MagneticWindows/resource.h create mode 100644 plugins/ExternalAPI/m_MagneticWindows.h create mode 100644 plugins/MagneticWindows/MagneticWindows_10.vcxproj create mode 100644 plugins/MagneticWindows/MagneticWindows_10.vcxproj.filters create mode 100644 plugins/MagneticWindows/res/Options.rc create mode 100644 plugins/MagneticWindows/res/Version.rc create mode 100644 plugins/MagneticWindows/src/MagneticWindows.cpp create mode 100644 plugins/MagneticWindows/src/MagneticWindowsCore.cpp create mode 100644 plugins/MagneticWindows/src/MagneticWindowsCore.h create mode 100644 plugins/MagneticWindows/src/Options.cpp create mode 100644 plugins/MagneticWindows/src/Options.h create mode 100644 plugins/MagneticWindows/src/SnapToListService.cpp create mode 100644 plugins/MagneticWindows/src/SnapToListService.h create mode 100644 plugins/MagneticWindows/src/Version.h create mode 100644 plugins/MagneticWindows/src/resource.h (limited to 'plugins') diff --git a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.cpp b/plugins/!NotAdopted/MagneticWindows/MagneticWindows.cpp deleted file mode 100644 index 153289166f..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "MagneticWindowsCore.h" - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Magnetic Windows -// -// Autor: Michael Kunz -// EMail: Michael.Kunz@s2005.tu-chemnitz.de -// -// -// thanks to: pescuma -// -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Variables -/////////////////////////////////////////////////////////////////////////////////////////////////// - -PLUGININFO pluginInfo = { - sizeof(PLUGININFO), - "Magnetic Windows", - PLUGIN_MAKE_VERSION(0,0,3,2), - "Makes the main contactlist and the chat windows snapping to the desktop border and to each other.", - "Michael Kunz", - "Michael.Kunz@s2005.TU-Cemnitz.de", - "(c) 2006 Michael Kunz", - "http://addons.miranda-im.org/details.php?action=viewfile&id=2871", - 0, - 0 -}; - -PLUGINLINK * pluginLink; - -HANDLE hLoadedHook, hShootDownHook, hAddService, hRemService, hWindowEventHook; - -HINSTANCE hInst; -//char ModuleName[256]; -char ModuleName[] = "MagneticWindows"; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Plugin Functions -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -//For other Plugins to start snapping for other Windows -int SnapPluginWindowStart(WPARAM wParam, LPARAM lParam) { - - if (!WindowOpen((HWND)wParam)) return 1; - - return 0; -} -//For other Plugins to stop snapping for other Windows -int SnapPluginWindowStop(WPARAM wParam, LPARAM lParam) { - - if (!WindowClose((HWND)wParam)) return 1; - - return 0; -} - -int PluginMessageWindowEvent(WPARAM wParam, LPARAM lParam) { - MessageWindowEventData* Data; - HWND hWndParent, hWnd; - - Data = (MessageWindowEventData*)(lParam); - - switch (Data->uType) { - case MSG_WINDOW_EVT_OPEN: - hWnd = Data->hwndWindow; - //WindowOpen(hWnd); - hWndParent = GetParent(hWnd); - while ((hWndParent != 0) && (hWndParent != GetDesktopWindow()) && (IsWindowVisible(hWndParent))) { - hWnd = hWndParent; - hWndParent = GetParent(hWnd); - } - - WindowOpen(hWnd); - break; - - case MSG_WINDOW_EVT_CLOSING: - WindowClose(Data->hwndWindow); - break; - - default: - break; - } - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Main Functions -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -int SnapPluginStart(WPARAM wParam, LPARAM lParam) { - - LoadOptions(); - - hWindowEventHook = HookEvent(ME_MSG_WINDOWEVENT, PluginMessageWindowEvent); - - WindowOpen((HWND)CallService(MS_CLUI_GETHWND,0,0)); - return 0; -} - -int SnapPluginShootDown(WPARAM wParam, LPARAM lParam) { - UnhookEvent(hWindowEventHook); - UnhookEvent(hLoadedHook); - UnhookEvent(hShootDownHook); - UnhookEvent(hInitOptionsHook); - - WindowCloseAll(); - - DestroyServiceFunction(hAddService); - DestroyServiceFunction(hRemService); - DestroyServiceFunction(hSnapToListService); - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Exportet Functions -/////////////////////////////////////////////////////////////////////////////////////////////////// - -extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) -{ - pluginLink = link; - - hLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SnapPluginStart); - hShootDownHook = HookEvent(ME_SYSTEM_PRESHUTDOWN, SnapPluginShootDown); - hInitOptionsHook = HookEvent(ME_OPT_INITIALISE, InitOptions); - - hAddService = CreateServiceFunction(MS_MW_ADDWINDOW, SnapPluginWindowStart); - hRemService = CreateServiceFunction(MS_MW_REMWINDOW, SnapPluginWindowStop); - hSnapToListService = CreateServiceFunction(MS_MW_SNAPTOLIST, SnapToList); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - return 0; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// DLL MAIN -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -extern "C" bool APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - hInst = hModule; - - -/* char * Temp; - char * l,i; - - Temp = (char*) malloc(2048); - GetModuleFileName(hModule, Temp, 2048); - - l = Temp; - i = Temp; - - while (i != 0) { - if ((*i) == '\') l = i + 1; - i++; - } - - memcpy(ModuleName, l, i-l); - free(Temp); - */ - - return true; -} diff --git a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsp b/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsp deleted file mode 100644 index 6f4a4e3dcf..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsp +++ /dev/null @@ -1,146 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MagneticWindows" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=MagneticWindows - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "MagneticWindows.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "MagneticWindows.mak" CFG="MagneticWindows - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "MagneticWindows - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MagneticWindows - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MagneticWindows - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAGNETICWINDOWS_EXPORTS" /YX /FD /c -# ADD CPP /nologo /GB /Zp4 /MT /W4 /GR- /GX /O2 /Oy- /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAGNETICWINDOWS_EXPORTS" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "MagneticWindows - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAGNETICWINDOWS_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAGNETICWINDOWS_EXPORTS" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "MagneticWindows - Win32 Release" -# Name "MagneticWindows - Win32 Debug" -# Begin Group "Quellcodedateien" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\MagneticWindows.cpp -# End Source File -# Begin Source File - -SOURCE=.\MagneticWindowsCore.cpp -# End Source File -# Begin Source File - -SOURCE=.\Options.cpp -# End Source File -# Begin Source File - -SOURCE=.\Options.rc -# End Source File -# Begin Source File - -SOURCE=.\SnapToListService.cpp -# End Source File -# End Group -# Begin Group "Header-Dateien" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\m_MagneticWindows.h -# End Source File -# Begin Source File - -SOURCE=.\MagneticWindowsCore.h -# End Source File -# Begin Source File - -SOURCE=.\Options.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\SnapToListService.h -# End Source File -# End Group -# Begin Group "Ressourcendateien" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsw b/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsw deleted file mode 100644 index 36019647d8..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/MagneticWindows.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! - -############################################################################### - -Project: "MagneticWindows"=".\MagneticWindows.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.cpp b/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.cpp deleted file mode 100644 index 044dcc098e..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.cpp +++ /dev/null @@ -1,464 +0,0 @@ -#include "MagneticWindowsCore.h" - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Variables -/////////////////////////////////////////////////////////////////////////////////////////////////// - -TWorkingVariables Globals = { - NULL, - NULL, - 0,0, - false,false -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Functions -/////////////////////////////////////////////////////////////////////////////////////////////////// - -int Abs(int a) { - if (a < 0) return (-a); - return a; -} - - -PDockingWindow FindDockingWindow(HWND hWnd) { - PDockingWindow i; - - i = Globals.WindowList; - - while (i != NULL) { - - if (i->hWnd == hWnd) return i; - - i = i->Next; - }; - - return NULL; -} - - -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; - - tmpRect = GivenRect; - frmRect = GivenRect; - - FoundX = false; - FoundY = false; - - if (!Sizing) { - GetCursorPos(&p); - if (Globals.SnappedX) { - tmpMouseX = p.x - tmpRect.left; - OffsetRect(&tmpRect, tmpMouseX - MouseX, 0); - OffsetRect(&GivenRect, tmpMouseX - MouseX, 0); - } else { - MouseX = p.x - tmpRect.left; - } - if (Globals.SnappedY) { - tmpMouseY = p.y - tmpRect.top; - OffsetRect(&tmpRect, 0, tmpMouseY - MouseY); - OffsetRect(&GivenRect, 0, tmpMouseY - MouseY); - } else { - MouseY = p.y - tmpRect.top; - } - } - - W = tmpRect.right - tmpRect.left; - H = tmpRect.bottom - tmpRect.top; - - if (!Sizing) { - ActRect = Globals.Rects; - while (ActRect != NULL) { - if ((tmpRect.left >= (ActRect->Rect.left - Options.SnapWidth)) && - (tmpRect.left <= (ActRect->Rect.left + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) & - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpRect.left - ActRect->Rect.left) < diffX)) - { - GivenRect.left = ActRect->Rect.left; - GivenRect.right = GivenRect.left + W; - - diffX = Abs(tmpRect.left - ActRect->Rect.left); - - FoundX = true; - } else - if ((ActRect != Globals.Rects) && - (tmpRect.left >= (ActRect->Rect.right - Options.SnapWidth)) && - (tmpRect.left <= (ActRect->Rect.right + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpRect.left - ActRect->Rect.right) < diffX)) - { - GivenRect.left = ActRect->Rect.right; - GivenRect.right = GivenRect.left + W; - - diffX = Abs(tmpRect.left - ActRect->Rect.right); - - FoundX = true; - } else - if ((ActRect != Globals.Rects) && - (tmpRect.right >= (ActRect->Rect.left - Options.SnapWidth)) && - (tmpRect.right <= (ActRect->Rect.left + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpRect.right - ActRect->Rect.left) < diffX)) - { - GivenRect.right = ActRect->Rect.left; - GivenRect.left = GivenRect.right - W; - - diffX = Abs(tmpRect.right - ActRect->Rect.left); - - FoundX = true; - } else - if ((tmpRect.right >= (ActRect->Rect.right - Options.SnapWidth)) && - (tmpRect.right <= (ActRect->Rect.right + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpRect.right - ActRect->Rect.right) < diffX)) - { - GivenRect.right = ActRect->Rect.right; - GivenRect.left = GivenRect.right - W; - - diffX = Abs(tmpRect.right - ActRect->Rect.right); - - FoundX = true; - } - - - if ((tmpRect.top >= (ActRect->Rect.top - Options.SnapWidth)) && - (tmpRect.top <= (ActRect->Rect.top + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpRect.top - ActRect->Rect.top) < diffY)) - { - GivenRect.top = ActRect->Rect.top; - GivenRect.bottom = GivenRect.top + H; - - diffY = Abs(tmpRect.top - ActRect->Rect.top); - - FoundY = true; - } else - if ((ActRect != Globals.Rects) && - (tmpRect.top >= (ActRect->Rect.bottom - Options.SnapWidth)) && - (tmpRect.top <= (ActRect->Rect.bottom + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpRect.top - ActRect->Rect.bottom) < diffY)) - { - GivenRect.top = ActRect->Rect.bottom; - GivenRect.bottom = GivenRect.top + H; - - diffY = Abs(tmpRect.top - ActRect->Rect.bottom); - - FoundY = true; - } else - if ((ActRect != Globals.Rects) && - (tmpRect.bottom >= (ActRect->Rect.top - Options.SnapWidth)) && - (tmpRect.bottom <= (ActRect->Rect.top + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpRect.bottom - ActRect->Rect.top) < diffY)) - { - GivenRect.bottom = ActRect->Rect.top; - GivenRect.top = GivenRect.bottom - H; - - diffY = Abs(tmpRect.bottom - ActRect->Rect.top); - - FoundY = true; - } else - if ((tmpRect.bottom >= (ActRect->Rect.bottom - Options.SnapWidth)) && - (tmpRect.bottom <= (ActRect->Rect.bottom + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpRect.bottom - ActRect->Rect.bottom) < diffY)) - { - GivenRect.bottom = ActRect->Rect.bottom; - GivenRect.top = GivenRect.bottom - H; - - diffY = Abs(tmpRect.bottom - ActRect->Rect.bottom); - - FoundY = true; - } - - ActRect = ActRect->Next; - } //next rect - - Globals.SnappedX = FoundX; - Globals.SnappedY = FoundY; - } - else //Sizing - { - if ((SizingEdge == WMSZ_LEFT) || - (SizingEdge == WMSZ_TOPLEFT) || - (SizingEdge == WMSZ_BOTTOMLEFT)) - { - XPos = GivenRect.left; - } else { - XPos = GivenRect.right; - } - - if ((SizingEdge == WMSZ_TOP) || - (SizingEdge == WMSZ_TOPLEFT) || - (SizingEdge == WMSZ_TOPRIGHT)) - { - YPos = GivenRect.top; - } else { - YPos = GivenRect.bottom; - } - - tmpXPos = XPos; - tmpYPos = YPos; - - ActRect = Globals.Rects; - while (ActRect != NULL) { - if ((tmpXPos >= (ActRect->Rect.left - Options.SnapWidth)) && - (tmpXPos <= (ActRect->Rect.left + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpXPos - ActRect->Rect.left) < diffX)) - { - XPos = ActRect->Rect.left; - - diffX = Abs(tmpXPos - ActRect->Rect.left); - } else - if ((tmpXPos >= (ActRect->Rect.right - Options.SnapWidth)) && - (tmpXPos <= (ActRect->Rect.right + Options.SnapWidth)) && - ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && - ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && - (Abs(tmpXPos - ActRect->Rect.right) < diffX)) - { - XPos = ActRect->Rect.right; - - diffX = Abs(tmpXPos - ActRect->Rect.right); - } - - if ((tmpYPos >= (ActRect->Rect.top - Options.SnapWidth)) && - (tmpYPos <= (ActRect->Rect.top + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpYPos - ActRect->Rect.top) < diffY)) - { - YPos = ActRect->Rect.top; - - diffY = Abs(tmpYPos - ActRect->Rect.top); - } else - if ((tmpYPos >= (ActRect->Rect.bottom - Options.SnapWidth)) && - (tmpYPos <= (ActRect->Rect.bottom + Options.SnapWidth)) && - ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && - ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && - (Abs(tmpYPos - ActRect->Rect.bottom) < diffY)) - { - YPos = ActRect->Rect.bottom; - - diffY = Abs(tmpYPos - ActRect->Rect.bottom); - } - - ActRect = ActRect->Next; - } //Next rect - - if ((SizingEdge == WMSZ_LEFT) || - (SizingEdge == WMSZ_TOPLEFT) || - (SizingEdge == WMSZ_BOTTOMLEFT)) - { - GivenRect.left = XPos; - } else { - GivenRect.right = XPos; - } - if ((SizingEdge == WMSZ_TOP) || - (SizingEdge == WMSZ_TOPLEFT) || - (SizingEdge == WMSZ_TOPRIGHT)) - { - GivenRect.top = YPos; - } else { - GivenRect.bottom = YPos; - } - } -} - - -void GetFrmRects(HWND ForWindow) { -PDockingWindow i; -PRectList Rect, l; - - Rect = Globals.Rects; - while (Rect != NULL) { - l = Rect; - Rect = Rect->Next; - free(l); - } - - Rect = (PRectList)malloc(sizeof(TRectList)); - Rect->Next = NULL; - Globals.Rects = Rect; - - SystemParametersInfo(SPI_GETWORKAREA, 0, &(Rect->Rect), 0); - i = Globals.WindowList; - - while (i != NULL) { - if ((i->hWnd != ForWindow) && IsWindowVisible(i->hWnd)) { - l = Rect; - Rect = (PRectList)malloc(sizeof(TRectList)); - Rect->Next = NULL; - l->Next = Rect; - - GetWindowRect(i->hWnd, &(Rect->Rect)); - } - - i = i->Next; - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Subclass Window Proc -/////////////////////////////////////////////////////////////////////////////////////////////////// - -LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - PDockingWindow i; - - RECT r; - POINT p; - - WNDPROC OldRun; - - i = FindDockingWindow(hWnd); - - OldRun = NULL; - - if (i != NULL) { //else we have a problem - OldRun = i->OldWindowProc; - - if (Options.DoSnap) { - switch (Msg) { - case WM_ENTERSIZEMOVE: { - if (Options.ScriverWorkAround) - keybd_event(VK_CONTROL, 0, 0, 0); - - GetWindowRect(hWnd, &r); - GetCursorPos(&p); - Globals.MouseX = p.x - r.left; - Globals.MouseY = p.y - r.top; - - GetFrmRects(hWnd); - - break; - } - case WM_EXITSIZEMOVE: { - if (Options.ScriverWorkAround) - keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); - - break; - } - case WM_SIZING: - case WM_MOVING: { - r = *((PRECT)lParam); - if (Msg == WM_SIZING) { - DockWindowRect(hWnd, true, r, wParam); - } else { - DockWindowRect(hWnd, false, r, wParam, Globals.MouseX, Globals.MouseY); - } - - (*(PRECT)lParam) = r; - - if (Msg == WM_SIZING) { - return 1; - } - - break; - } - } //switch - } //if dosnap - - if (OldRun != NULL) { - if (IsWindowUnicode(hWnd)) { - return CallWindowProcW(OldRun, hWnd, Msg, wParam, lParam); - } else { - return CallWindowProcA(OldRun, hWnd, Msg, wParam, lParam); - } - } - } - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// exportet Functions -/////////////////////////////////////////////////////////////////////////////////////////////////// - -bool WindowOpen(HWND hWnd) { - PDockingWindow i; - - if ((hWnd != 0) && (FindDockingWindow(hWnd) == NULL)) { - i = (PDockingWindow)malloc(sizeof(TDockingWindow)); - i->Next = Globals.WindowList; - i->hWnd = hWnd; - Globals.WindowList = i; - - if (IsWindowUnicode(hWnd)) { - i->OldWindowProc = (WNDPROC) GetWindowLongW(hWnd, GWL_WNDPROC); - SetWindowLongW(hWnd, GWL_WNDPROC, (LONG)(&WindowProc)); - } else { - i->OldWindowProc = (WNDPROC) GetWindowLongA(hWnd, GWL_WNDPROC); - SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)(&WindowProc)); - } - - return true; - } - return false; -} - -bool WindowClose(HWND hWnd) { - PDockingWindow i, l; - - l = NULL; - i = Globals.WindowList; - - while ((i != NULL) && (i->hWnd != hWnd)) { - l = i; - i = i->Next; - } - - if (i != NULL) { - if (l == NULL) { - Globals.WindowList = i->Next; - } else { - l->Next = i->Next; - } - - if (IsWindowUnicode(hWnd)) { - SetWindowLongW(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc)); - } else { - SetWindowLongA(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc)); - } - - free(i); - - return true; - } - - return false; -} -bool WindowCloseAll() { - PDockingWindow i, l; - i = Globals.WindowList; - while (i != NULL) { - l = i; - WindowClose(i->hWnd); - i = i->Next; - free(l); - } - return true; -} \ No newline at end of file diff --git a/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.h b/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.h deleted file mode 100644 index 63d9b6a5e3..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/MagneticWindowsCore.h +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include "../include/newpluginapi.h" -#include "../include/m_clist.h" -#include "../include/m_clui.h" -#include "../include/m_message.h" -#include "../include/m_system.h" -#include "../include/m_options.h" -#include "../include/m_plugins.h" -#include "../include/m_database.h" -#include "../include/m_langpack.h" -#include "m_MagneticWindows.h" -#include "SnapToListService.h" -#include "Options.h" -#include "resource.h" - - -typedef - struct TDockingWindow { - HWND hWnd; - WNDPROC OldWindowProc; - TDockingWindow* Next; - } TDockingWindow, *PDockingWindow; -typedef - struct TRectList { - RECT Rect; - TRectList* Next; - } TRectList, *PRectList; -typedef - struct { - PDockingWindow WindowList; - PRectList Rects; - int MouseX, MouseY; - bool SnappedX, SnappedY; - } TWorkingVariables; - - - -extern HINSTANCE hInst; -extern char ModuleName []; - -bool WindowOpen(HWND); -bool WindowClose(HWND); -bool WindowCloseAll(); \ No newline at end of file diff --git a/plugins/!NotAdopted/MagneticWindows/Options.cpp b/plugins/!NotAdopted/MagneticWindows/Options.cpp deleted file mode 100644 index 163c39f34c..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/Options.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "MagneticWindowsCore.h" - -HANDLE hInitOptionsHook; -TOptions Options = { - true, - cDefaultSnapWidth, - false -}; - - -int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - - char str[64]; - - switch (msg) { - case WM_INITDIALOG: { - TranslateDialogDefault(hwndDlg); - - CheckDlgButton(hwndDlg, IDC_CHK_SNAP, Options.DoSnap?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETRANGE, FALSE, MAKELONG(1,32)); - SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_SETPOS, TRUE, Options.SnapWidth); - - wsprintf(str, Translate("%d pix"), Options.SnapWidth); - SetDlgItemText(hwndDlg, IDC_TXT_SNAPWIDTH, str); - - EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), Options.DoSnap); - EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_SNAPWIDTH), Options.DoSnap); - - CheckDlgButton(hwndDlg, IDC_CHK_SCRIVERWORKAROUND, Options.ScriverWorkAround?BST_CHECKED:BST_UNCHECKED); - - break; - } - case WM_HSCROLL: { - _snprintf(str, 64, Translate("%d pix"), SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0)); - SetDlgItemText(hwndDlg, IDC_TXT_SNAPWIDTH, str); - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_COMMAND: { - WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam); - - 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)); - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - break; - } - case IDC_CHK_SCRIVERWORKAROUND: { - if (wNotifyCode == BN_CLICKED) { - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - break; - } - } - break; - } - - case WM_NOTIFY: { //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_RESET: - LoadOptions(); - break; - - case PSN_APPLY: { - Options.DoSnap = (IsDlgButtonChecked(hwndDlg, IDC_CHK_SNAP) == TRUE); - Options.SnapWidth = SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0); - Options.ScriverWorkAround = (IsDlgButtonChecked(hwndDlg, IDC_CHK_SCRIVERWORKAROUND) == TRUE); - - DBWriteContactSettingByte(NULL, ModuleName, "DoSnap", Options.DoSnap); - DBWriteContactSettingByte(NULL, ModuleName, "SnapWidth", Options.SnapWidth); - DBWriteContactSettingByte(NULL, ModuleName, "ScriverWorkAround", Options.ScriverWorkAround); - - break; - } - } - break; - } - - break; - - } - default: - - break; - } - return 0; - -} - -int InitOptions(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE Opt = { 0 }; - - Opt.cbSize = sizeof(Opt); -// Opt.position = 0; - Opt.pszTitle = "Magnetic Windows"; - Opt.pfnDlgProc = &OptionsDlgProc; - Opt.pszTemplate = (char *) MAKEINTRESOURCE(IDD_OPT_MAGNETICWINDOWS); - Opt.hInstance = hInst; -// Opt.hIcon = 0; - Opt.pszGroup = "Customize"; -// Opt.groupPosition = 0; -// Opt.hGroupIcon = 0; - Opt.flags = ODPF_BOLDGROUPS; -// Opt.nIDBottomSimpleControl = 0; -// Opt.nIDRightSimpleControl = 0; -// Opt.expertOnlyControls = NULL; -// Opt.nExpertOnlyControls = 0; - - CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)(&Opt)); - - return 0; -} - -void LoadOptions() { - Options.DoSnap = DBGetContactSettingByte(NULL, ModuleName, "DoSnap", TRUE); - Options.SnapWidth = DBGetContactSettingByte(NULL, ModuleName, "SnapWidth", cDefaultSnapWidth); - Options.ScriverWorkAround = DBGetContactSettingByte(NULL, ModuleName, "ScriverWorkAround", FALSE); -} \ No newline at end of file diff --git a/plugins/!NotAdopted/MagneticWindows/Options.h b/plugins/!NotAdopted/MagneticWindows/Options.h deleted file mode 100644 index ebb5458d4a..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/Options.h +++ /dev/null @@ -1,18 +0,0 @@ - -#define cDefaultSnapWidth 12 - -typedef - struct TOptions { - bool DoSnap; - int SnapWidth; - bool ScriverWorkAround; -} TOptions; - -extern HANDLE hInitOptionsHook; -extern TOptions Options; - - -int CALLBACK OptionsDlgProc(HWND, UINT, WPARAM, LPARAM); - -int InitOptions(WPARAM, LPARAM); -void LoadOptions(); \ No newline at end of file diff --git a/plugins/!NotAdopted/MagneticWindows/Options.rc b/plugins/!NotAdopted/MagneticWindows/Options.rc deleted file mode 100644 index 5968a21cb7..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/Options.rc +++ /dev/null @@ -1,113 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Deutsch (Deutschland) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Englisch (USA) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_MAGNETICWINDOWS DIALOGEX 0, 0, 275, 80 -STYLE DS_FIXEDSYS | WS_CHILD -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX "Magnetic Windows",IDC_MAINFRAME,8,8,258,64,WS_GROUP - CONTROL "",IDC_SLIDER_SNAPWIDTH,"msctls_trackbar32",TBS_BOTH | - TBS_NOTICKS | WS_TABSTOP,108,24,96,12 - CONTROL "Snap windows",IDC_CHK_SNAP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,18,24,84,12 - LTEXT "15 pix",IDC_TXT_SNAPWIDTH,216,24,42,12,SS_CENTERIMAGE - CONTROL "For Scriver users: automatically hold down the CTRL key while moving/sizing. (make sure you use Scriver!)", - IDC_CHK_SCRIVERWORKAROUND,"Button",BS_AUTOCHECKBOX | - BS_MULTILINE | WS_TABSTOP,18,44,239,20,WS_EX_TRANSPARENT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_OPT_MAGNETICWINDOWS, DIALOG - BEGIN - RIGHTMARGIN, 273 - BOTTOMMARGIN, 79 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Englisch (USA) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/!NotAdopted/MagneticWindows/SnapToListService.cpp b/plugins/!NotAdopted/MagneticWindows/SnapToListService.cpp deleted file mode 100644 index 5fc9f66268..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/SnapToListService.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "MagneticWindowsCore.h" - - -HANDLE hSnapToListService; - - -int SnapToList(WPARAM wParam, LPARAM Align) { - HWND hWnd, hWndList; - RECT WndRect, ListRect; - RECT AlignRect; - RECT ResultRect; - - hWnd = (HWND)wParam; - - hWndList = (HWND)CallService(MS_CLUI_GETHWND,0,0); - GetWindowRect(hWnd, &WndRect); - GetWindowRect(hWndList, &ListRect); - - AlignRect = ListRect; - if ((!(MS_MW_STL_List_Left & Align)) && (MS_MW_STL_List_Right & Align)) { - AlignRect.left = AlignRect.right; - } else - if ((MS_MW_STL_List_Left & Align) && (!(MS_MW_STL_List_Right & Align))) { - AlignRect.right = AlignRect.left; - } - - if ((!(MS_MW_STL_List_Top & Align)) && (MS_MW_STL_List_Bottom & Align)) { - AlignRect.top = AlignRect.bottom; - } else - if ((MS_MW_STL_List_Top & Align) && (!(MS_MW_STL_List_Bottom & Align))) { - AlignRect.bottom = AlignRect.top; - } - - ResultRect = WndRect; - if ((MS_MW_STL_Wnd_Left & Align) && (MS_MW_STL_Wnd_Right & Align)) { - ResultRect.left = AlignRect.left; - ResultRect.right = AlignRect.right; - } else - if ((!(MS_MW_STL_Wnd_Left & Align)) && (MS_MW_STL_Wnd_Right & Align)) { - ResultRect.left = AlignRect.right - (WndRect.right - WndRect.left); - ResultRect.right = AlignRect.right; - } else - if ((MS_MW_STL_Wnd_Left & Align) && (!(MS_MW_STL_Wnd_Right & Align))) { - ResultRect.left = AlignRect.left; - ResultRect.right = AlignRect.left + (WndRect.right - WndRect.left); - } - - if ((MS_MW_STL_Wnd_Top & Align) && (MS_MW_STL_Wnd_Bottom & Align)) { - ResultRect.top = AlignRect.top; - ResultRect.bottom = AlignRect.bottom; - } else - if ((!(MS_MW_STL_Wnd_Top & Align)) && (MS_MW_STL_Wnd_Bottom & Align)) { - ResultRect.top = AlignRect.bottom - (WndRect.bottom - WndRect.top); - ResultRect.bottom = AlignRect.bottom; - } else - if ((MS_MW_STL_Wnd_Top & Align) && (!(MS_MW_STL_Wnd_Bottom & Align))) { - ResultRect.top = AlignRect.top; - ResultRect.bottom = AlignRect.top + (WndRect.bottom - WndRect.top); - } - - MoveWindow(hWnd, ResultRect.left, ResultRect.top, ResultRect.right-ResultRect.left, ResultRect.bottom-ResultRect.top, true); - - return 0; -} \ No newline at end of file diff --git a/plugins/!NotAdopted/MagneticWindows/SnapToListService.h b/plugins/!NotAdopted/MagneticWindows/SnapToListService.h deleted file mode 100644 index 27db7246cd..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/SnapToListService.h +++ /dev/null @@ -1,5 +0,0 @@ - - -extern HANDLE hSnapToListService; - -int SnapToList(WPARAM, LPARAM); diff --git a/plugins/!NotAdopted/MagneticWindows/m_MagneticWindows.h b/plugins/!NotAdopted/MagneticWindows/m_MagneticWindows.h deleted file mode 100644 index e011c773fd..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/m_MagneticWindows.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __M_MAGNETICWINDOWS_H__ -#define __M_MAGNETICWINDOWS_H__ - -//#include "../include/newpluginapi.h" - -// For other Plugins to start snapping for their windows -// wparam: hwnd of window -// lparam: 0 -// return: 0 on success, 1 on error -#define MS_MW_ADDWINDOW "Utils/MagneticWindows/Add" - -// For other Plugins to stop snapping for their windows -// wparam: hwnd of window -// lparam: 0 -// return: 0 on success, 1 on error -#define MS_MW_REMWINDOW "Utils/MagneticWindows/Rem" - -//decide where to align on the list: -#define MS_MW_STL_List_Left 0x00000001 //Snaps the window to the left border of the list -#define MS_MW_STL_List_Top 0x00000002 //Snaps the window to the top border of the list -#define MS_MW_STL_List_Right 0x00000004 //Snaps the window to the right border of the list -#define MS_MW_STL_List_Bottom 0x00000008 //Snaps the window to the bottom border of the list -//decide with what side (of the window you want to snap) to snap to the list -#define MS_MW_STL_Wnd_Left 0x00000010 //Snaps the window with the left border to the left/right side of the list -#define MS_MW_STL_Wnd_Top 0x00000020 //Snaps the window with the top border to the top/bottom side of the list -#define MS_MW_STL_Wnd_Right 0x00000040 //Snaps the window with the right border to the left/right side of the list -#define MS_MW_STL_Wnd_Bottom 0x00000080 //Snaps the window with the bottom border to the top/bottom side of the list - -#define MS_MW_STL_Wnd_FullWidth (MS_MW_STL_Wnd_Left | MS_MW_STL_Wnd_Right) - //Snaps to the top/bottom of the list and spans over the full width - -#define MS_MW_STL_Wnd_FullHeight (MS_MW_STL_Wnd_Top | MS_MW_STL_Wnd_Bottom) - //Snaps to the left/right of the list and spans over the full height - -// to place the window in the list combine f.e. MS_MW_STL_List_Left | MS_MW_STL_Wnd_Right | *vetical alignment* - -//For other Plugins to snap a window to the list for other Plugins -// wparam: hwnd of window -// lparam: combination of the above constants MS_MW_STL_* -// return: 0 on success, 1 on error -#define MS_MW_SNAPTOLIST "Utils/MagneticWindows/SnapToList" - -// Helper functions -#ifndef _MW_NO_HELPPER_FUNCTIONS - - -static inline int MagneticWindows_AddWindow(HWND hWnd) -{ - if (ServiceExists(MS_MW_ADDWINDOW)) - { - return CallService(MS_MW_ADDWINDOW, (WPARAM) hWnd, 0); - } - else - { - return -1; - } -} - -static inline int MagneticWindows_RemoveWindow(HWND hWnd) -{ - if (ServiceExists(MS_MW_REMWINDOW)) - { - return CallService(MS_MW_REMWINDOW, (WPARAM) hWnd, 0); - } - else - { - return -1; - } -} - -static inline int MagneticWindows_SnapWindowToList(HWND hWnd, int MS_MW_STL_Options) -{ - if (ServiceExists(MS_MW_SNAPTOLIST)) - { - return CallService(MS_MW_SNAPTOLIST, (WPARAM) hWnd, (LPARAM) MS_MW_STL_Options); - } - else - { - return -1; - } -} - -#endif - - -#endif // __M_MAGNETICWINDOWS_H__ diff --git a/plugins/!NotAdopted/MagneticWindows/resource.h b/plugins/!NotAdopted/MagneticWindows/resource.h deleted file mode 100644 index a651a69a50..0000000000 --- a/plugins/!NotAdopted/MagneticWindows/resource.h +++ /dev/null @@ -1,25 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Options.rc -// - -#define IDD_OPT_MAGNETICWINDOWS 101 - - -#define IDC_MAINFRAME 1001 -#define IDC_SLIDER_SNAPWIDTH 1002 -#define IDC_CHK_SNAP 1003 -#define IDC_TXT_SNAPWIDTH 1004 -#define IDC_CHK_SCRIVERWORKAROUND 1005 - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1006 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/ExternalAPI/m_MagneticWindows.h b/plugins/ExternalAPI/m_MagneticWindows.h new file mode 100644 index 0000000000..e011c773fd --- /dev/null +++ b/plugins/ExternalAPI/m_MagneticWindows.h @@ -0,0 +1,86 @@ +#ifndef __M_MAGNETICWINDOWS_H__ +#define __M_MAGNETICWINDOWS_H__ + +//#include "../include/newpluginapi.h" + +// For other Plugins to start snapping for their windows +// wparam: hwnd of window +// lparam: 0 +// return: 0 on success, 1 on error +#define MS_MW_ADDWINDOW "Utils/MagneticWindows/Add" + +// For other Plugins to stop snapping for their windows +// wparam: hwnd of window +// lparam: 0 +// return: 0 on success, 1 on error +#define MS_MW_REMWINDOW "Utils/MagneticWindows/Rem" + +//decide where to align on the list: +#define MS_MW_STL_List_Left 0x00000001 //Snaps the window to the left border of the list +#define MS_MW_STL_List_Top 0x00000002 //Snaps the window to the top border of the list +#define MS_MW_STL_List_Right 0x00000004 //Snaps the window to the right border of the list +#define MS_MW_STL_List_Bottom 0x00000008 //Snaps the window to the bottom border of the list +//decide with what side (of the window you want to snap) to snap to the list +#define MS_MW_STL_Wnd_Left 0x00000010 //Snaps the window with the left border to the left/right side of the list +#define MS_MW_STL_Wnd_Top 0x00000020 //Snaps the window with the top border to the top/bottom side of the list +#define MS_MW_STL_Wnd_Right 0x00000040 //Snaps the window with the right border to the left/right side of the list +#define MS_MW_STL_Wnd_Bottom 0x00000080 //Snaps the window with the bottom border to the top/bottom side of the list + +#define MS_MW_STL_Wnd_FullWidth (MS_MW_STL_Wnd_Left | MS_MW_STL_Wnd_Right) + //Snaps to the top/bottom of the list and spans over the full width + +#define MS_MW_STL_Wnd_FullHeight (MS_MW_STL_Wnd_Top | MS_MW_STL_Wnd_Bottom) + //Snaps to the left/right of the list and spans over the full height + +// to place the window in the list combine f.e. MS_MW_STL_List_Left | MS_MW_STL_Wnd_Right | *vetical alignment* + +//For other Plugins to snap a window to the list for other Plugins +// wparam: hwnd of window +// lparam: combination of the above constants MS_MW_STL_* +// return: 0 on success, 1 on error +#define MS_MW_SNAPTOLIST "Utils/MagneticWindows/SnapToList" + +// Helper functions +#ifndef _MW_NO_HELPPER_FUNCTIONS + + +static inline int MagneticWindows_AddWindow(HWND hWnd) +{ + if (ServiceExists(MS_MW_ADDWINDOW)) + { + return CallService(MS_MW_ADDWINDOW, (WPARAM) hWnd, 0); + } + else + { + return -1; + } +} + +static inline int MagneticWindows_RemoveWindow(HWND hWnd) +{ + if (ServiceExists(MS_MW_REMWINDOW)) + { + return CallService(MS_MW_REMWINDOW, (WPARAM) hWnd, 0); + } + else + { + return -1; + } +} + +static inline int MagneticWindows_SnapWindowToList(HWND hWnd, int MS_MW_STL_Options) +{ + if (ServiceExists(MS_MW_SNAPTOLIST)) + { + return CallService(MS_MW_SNAPTOLIST, (WPARAM) hWnd, (LPARAM) MS_MW_STL_Options); + } + else + { + return -1; + } +} + +#endif + + +#endif // __M_MAGNETICWINDOWS_H__ diff --git a/plugins/MagneticWindows/MagneticWindows_10.vcxproj b/plugins/MagneticWindows/MagneticWindows_10.vcxproj new file mode 100644 index 0000000000..6e91f33f2a --- /dev/null +++ b/plugins/MagneticWindows/MagneticWindows_10.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {7DC23E4E-2448-4811-AABD-F5D069F6E74A} + Win32Proj + MagneticWindows + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + false + Unicode + + + + + + + + + + + + + false + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + true + + + false + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + true + + + + 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 + + + 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 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/MagneticWindows/MagneticWindows_10.vcxproj.filters b/plugins/MagneticWindows/MagneticWindows_10.vcxproj.filters new file mode 100644 index 0000000000..83ec0caf55 --- /dev/null +++ b/plugins/MagneticWindows/MagneticWindows_10.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/plugins/MagneticWindows/res/Options.rc b/plugins/MagneticWindows/res/Options.rc new file mode 100644 index 0000000000..079050ae36 --- /dev/null +++ b/plugins/MagneticWindows/res/Options.rc @@ -0,0 +1,113 @@ +//Microsoft Developer Studio generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Deutsch (Deutschland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Deutsch (Deutschland) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Englisch (USA) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_MAGNETICWINDOWS DIALOGEX 0, 0, 275, 80 +STYLE DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Magnetic Windows",IDC_MAINFRAME,8,8,258,64,WS_GROUP + CONTROL "",IDC_SLIDER_SNAPWIDTH,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,108,24,96,12 + CONTROL "Snap windows",IDC_CHK_SNAP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,18,24,84,12 + LTEXT "15 pix",IDC_TXT_SNAPWIDTH,216,24,42,12,SS_CENTERIMAGE + CONTROL "For Scriver users: automatically hold down the CTRL key while moving/sizing. (make sure you use Scriver!)", + IDC_CHK_SCRIVERWORKAROUND,"Button",BS_AUTOCHECKBOX | + BS_MULTILINE | WS_TABSTOP,18,44,239,20,WS_EX_TRANSPARENT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_OPT_MAGNETICWINDOWS, DIALOG + BEGIN + RIGHTMARGIN, 273 + BOTTOMMARGIN, 79 + END +END +#endif // APSTUDIO_INVOKED + +#endif // Englisch (USA) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/MagneticWindows/res/Version.rc b/plugins/MagneticWindows/res/Version.rc new file mode 100644 index 0000000000..f4dbfc80e2 --- /dev/null +++ b/plugins/MagneticWindows/res/Version.rc @@ -0,0 +1,38 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include "afxres.h" +#include "..\src\Version.h" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __FILEVERSION_STRING + PRODUCTVERSION __FILEVERSION_STRING + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "FileDescription", __DESCRIPTION + VALUE "InternalName", __PLUGIN_NAME + VALUE "LegalCopyright", __COPYRIGHT + VALUE "OriginalFilename", __FILENAME + VALUE "ProductName", __PLUGIN_NAME + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/plugins/MagneticWindows/src/MagneticWindows.cpp b/plugins/MagneticWindows/src/MagneticWindows.cpp new file mode 100644 index 0000000000..80501cc80e --- /dev/null +++ b/plugins/MagneticWindows/src/MagneticWindows.cpp @@ -0,0 +1,161 @@ +#include "MagneticWindowsCore.h" + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Magnetic Windows +// +// Autor: Michael Kunz +// EMail: Michael.Kunz@s2005.tu-chemnitz.de +// +// +// thanks to: pescuma +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Variables +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {08C01613-24C8-486F-BDAE-2C3DDCAF9347} + {0x8c01613, 0x24c8, 0x486f, { 0xbd, 0xae, 0x2c, 0x3d, 0xdc, 0xaf, 0x93, 0x47 }} +}; + + +HANDLE hLoadedHook, hShootDownHook, hAddService, hRemService, hWindowEventHook; + +HINSTANCE hInst; +int hLangpack; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Plugin Functions +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +//For other Plugins to start snapping for other Windows +int SnapPluginWindowStart(WPARAM wParam, LPARAM lParam) { + + if (!WindowOpen((HWND)wParam)) return 1; + + return 0; +} +//For other Plugins to stop snapping for other Windows +int SnapPluginWindowStop(WPARAM wParam, LPARAM lParam) { + + if (!WindowClose((HWND)wParam)) return 1; + + return 0; +} + +int PluginMessageWindowEvent(WPARAM wParam, LPARAM lParam) { + MessageWindowEventData* Data; + HWND hWndParent, hWnd; + + Data = (MessageWindowEventData*)(lParam); + + switch (Data->uType) { + case MSG_WINDOW_EVT_OPEN: + hWnd = Data->hwndWindow; + //WindowOpen(hWnd); + hWndParent = GetParent(hWnd); + while ((hWndParent != 0) && (hWndParent != GetDesktopWindow()) && (IsWindowVisible(hWndParent))) { + hWnd = hWndParent; + hWndParent = GetParent(hWnd); + } + + WindowOpen(hWnd); + break; + + case MSG_WINDOW_EVT_CLOSING: + WindowClose(Data->hwndWindow); + break; + + default: + break; + } + + return 0; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Main Functions +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +int SnapPluginStart(WPARAM wParam, LPARAM lParam) { + + LoadOptions(); + + hWindowEventHook = HookEvent(ME_MSG_WINDOWEVENT, PluginMessageWindowEvent); + + WindowOpen((HWND)CallService(MS_CLUI_GETHWND,0,0)); + return 0; +} + +int SnapPluginShootDown(WPARAM wParam, LPARAM lParam) { + UnhookEvent(hWindowEventHook); + UnhookEvent(hLoadedHook); + UnhookEvent(hShootDownHook); + UnhookEvent(hInitOptionsHook); + + WindowCloseAll(); + + DestroyServiceFunction(hAddService); + DestroyServiceFunction(hRemService); + DestroyServiceFunction(hSnapToListService); + + return 0; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Exportet Functions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) +{ + return &pluginInfo; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + + hLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SnapPluginStart); + hShootDownHook = HookEvent(ME_SYSTEM_PRESHUTDOWN, SnapPluginShootDown); + hInitOptionsHook = HookEvent(ME_OPT_INITIALISE, InitOptions); + + hAddService = CreateServiceFunction(MS_MW_ADDWINDOW, SnapPluginWindowStart); + hRemService = CreateServiceFunction(MS_MW_REMWINDOW, SnapPluginWindowStop); + hSnapToListService = CreateServiceFunction(MS_MW_SNAPTOLIST, SnapToList); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + return 0; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// DLL MAIN +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + hInst = hinstDLL; + + return TRUE; +} diff --git a/plugins/MagneticWindows/src/MagneticWindowsCore.cpp b/plugins/MagneticWindows/src/MagneticWindowsCore.cpp new file mode 100644 index 0000000000..5af05dcd76 --- /dev/null +++ b/plugins/MagneticWindows/src/MagneticWindowsCore.cpp @@ -0,0 +1,464 @@ +#include "MagneticWindowsCore.h" + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Variables +/////////////////////////////////////////////////////////////////////////////////////////////////// + +TWorkingVariables Globals = { + NULL, + NULL, + 0,0, + false,false +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Functions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +int Abs(int a) { + if (a < 0) return (-a); + return a; +} + + +PDockingWindow FindDockingWindow(HWND hWnd) { + PDockingWindow i; + + i = Globals.WindowList; + + while (i != NULL) { + + if (i->hWnd == hWnd) return i; + + i = i->Next; + }; + + return NULL; +} + + +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; + + tmpRect = GivenRect; + frmRect = GivenRect; + + FoundX = false; + FoundY = false; + + if (!Sizing) { + GetCursorPos(&p); + if (Globals.SnappedX) { + tmpMouseX = p.x - tmpRect.left; + OffsetRect(&tmpRect, tmpMouseX - MouseX, 0); + OffsetRect(&GivenRect, tmpMouseX - MouseX, 0); + } else { + MouseX = p.x - tmpRect.left; + } + if (Globals.SnappedY) { + tmpMouseY = p.y - tmpRect.top; + OffsetRect(&tmpRect, 0, tmpMouseY - MouseY); + OffsetRect(&GivenRect, 0, tmpMouseY - MouseY); + } else { + MouseY = p.y - tmpRect.top; + } + } + + W = tmpRect.right - tmpRect.left; + H = tmpRect.bottom - tmpRect.top; + + if (!Sizing) { + ActRect = Globals.Rects; + while (ActRect != NULL) { + if ((tmpRect.left >= (ActRect->Rect.left - Options.SnapWidth)) && + (tmpRect.left <= (ActRect->Rect.left + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) & + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpRect.left - ActRect->Rect.left) < diffX)) + { + GivenRect.left = ActRect->Rect.left; + GivenRect.right = GivenRect.left + W; + + diffX = Abs(tmpRect.left - ActRect->Rect.left); + + FoundX = true; + } else + if ((ActRect != Globals.Rects) && + (tmpRect.left >= (ActRect->Rect.right - Options.SnapWidth)) && + (tmpRect.left <= (ActRect->Rect.right + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpRect.left - ActRect->Rect.right) < diffX)) + { + GivenRect.left = ActRect->Rect.right; + GivenRect.right = GivenRect.left + W; + + diffX = Abs(tmpRect.left - ActRect->Rect.right); + + FoundX = true; + } else + if ((ActRect != Globals.Rects) && + (tmpRect.right >= (ActRect->Rect.left - Options.SnapWidth)) && + (tmpRect.right <= (ActRect->Rect.left + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpRect.right - ActRect->Rect.left) < diffX)) + { + GivenRect.right = ActRect->Rect.left; + GivenRect.left = GivenRect.right - W; + + diffX = Abs(tmpRect.right - ActRect->Rect.left); + + FoundX = true; + } else + if ((tmpRect.right >= (ActRect->Rect.right - Options.SnapWidth)) && + (tmpRect.right <= (ActRect->Rect.right + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpRect.right - ActRect->Rect.right) < diffX)) + { + GivenRect.right = ActRect->Rect.right; + GivenRect.left = GivenRect.right - W; + + diffX = Abs(tmpRect.right - ActRect->Rect.right); + + FoundX = true; + } + + + if ((tmpRect.top >= (ActRect->Rect.top - Options.SnapWidth)) && + (tmpRect.top <= (ActRect->Rect.top + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpRect.top - ActRect->Rect.top) < diffY)) + { + GivenRect.top = ActRect->Rect.top; + GivenRect.bottom = GivenRect.top + H; + + diffY = Abs(tmpRect.top - ActRect->Rect.top); + + FoundY = true; + } else + if ((ActRect != Globals.Rects) && + (tmpRect.top >= (ActRect->Rect.bottom - Options.SnapWidth)) && + (tmpRect.top <= (ActRect->Rect.bottom + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpRect.top - ActRect->Rect.bottom) < diffY)) + { + GivenRect.top = ActRect->Rect.bottom; + GivenRect.bottom = GivenRect.top + H; + + diffY = Abs(tmpRect.top - ActRect->Rect.bottom); + + FoundY = true; + } else + if ((ActRect != Globals.Rects) && + (tmpRect.bottom >= (ActRect->Rect.top - Options.SnapWidth)) && + (tmpRect.bottom <= (ActRect->Rect.top + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpRect.bottom - ActRect->Rect.top) < diffY)) + { + GivenRect.bottom = ActRect->Rect.top; + GivenRect.top = GivenRect.bottom - H; + + diffY = Abs(tmpRect.bottom - ActRect->Rect.top); + + FoundY = true; + } else + if ((tmpRect.bottom >= (ActRect->Rect.bottom - Options.SnapWidth)) && + (tmpRect.bottom <= (ActRect->Rect.bottom + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpRect.bottom - ActRect->Rect.bottom) < diffY)) + { + GivenRect.bottom = ActRect->Rect.bottom; + GivenRect.top = GivenRect.bottom - H; + + diffY = Abs(tmpRect.bottom - ActRect->Rect.bottom); + + FoundY = true; + } + + ActRect = ActRect->Next; + } //next rect + + Globals.SnappedX = FoundX; + Globals.SnappedY = FoundY; + } + else //Sizing + { + if ((SizingEdge == WMSZ_LEFT) || + (SizingEdge == WMSZ_TOPLEFT) || + (SizingEdge == WMSZ_BOTTOMLEFT)) + { + XPos = GivenRect.left; + } else { + XPos = GivenRect.right; + } + + if ((SizingEdge == WMSZ_TOP) || + (SizingEdge == WMSZ_TOPLEFT) || + (SizingEdge == WMSZ_TOPRIGHT)) + { + YPos = GivenRect.top; + } else { + YPos = GivenRect.bottom; + } + + tmpXPos = XPos; + tmpYPos = YPos; + + ActRect = Globals.Rects; + while (ActRect != NULL) { + if ((tmpXPos >= (ActRect->Rect.left - Options.SnapWidth)) && + (tmpXPos <= (ActRect->Rect.left + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpXPos - ActRect->Rect.left) < diffX)) + { + XPos = ActRect->Rect.left; + + diffX = Abs(tmpXPos - ActRect->Rect.left); + } else + if ((tmpXPos >= (ActRect->Rect.right - Options.SnapWidth)) && + (tmpXPos <= (ActRect->Rect.right + Options.SnapWidth)) && + ((tmpRect.top - Options.SnapWidth) < ActRect->Rect.bottom) && + ((tmpRect.bottom + Options.SnapWidth) > ActRect->Rect.top) && + (Abs(tmpXPos - ActRect->Rect.right) < diffX)) + { + XPos = ActRect->Rect.right; + + diffX = Abs(tmpXPos - ActRect->Rect.right); + } + + if ((tmpYPos >= (ActRect->Rect.top - Options.SnapWidth)) && + (tmpYPos <= (ActRect->Rect.top + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpYPos - ActRect->Rect.top) < diffY)) + { + YPos = ActRect->Rect.top; + + diffY = Abs(tmpYPos - ActRect->Rect.top); + } else + if ((tmpYPos >= (ActRect->Rect.bottom - Options.SnapWidth)) && + (tmpYPos <= (ActRect->Rect.bottom + Options.SnapWidth)) && + ((tmpRect.left - Options.SnapWidth) < ActRect->Rect.right) && + ((tmpRect.right + Options.SnapWidth) > ActRect->Rect.left) && + (Abs(tmpYPos - ActRect->Rect.bottom) < diffY)) + { + YPos = ActRect->Rect.bottom; + + diffY = Abs(tmpYPos - ActRect->Rect.bottom); + } + + ActRect = ActRect->Next; + } //Next rect + + if ((SizingEdge == WMSZ_LEFT) || + (SizingEdge == WMSZ_TOPLEFT) || + (SizingEdge == WMSZ_BOTTOMLEFT)) + { + GivenRect.left = XPos; + } else { + GivenRect.right = XPos; + } + if ((SizingEdge == WMSZ_TOP) || + (SizingEdge == WMSZ_TOPLEFT) || + (SizingEdge == WMSZ_TOPRIGHT)) + { + GivenRect.top = YPos; + } else { + GivenRect.bottom = YPos; + } + } +} + + +void GetFrmRects(HWND ForWindow) { +PDockingWindow i; +PRectList Rect, l; + + Rect = Globals.Rects; + while (Rect != NULL) { + l = Rect; + Rect = Rect->Next; + free(l); + } + + Rect = (PRectList)malloc(sizeof(TRectList)); + Rect->Next = NULL; + Globals.Rects = Rect; + + SystemParametersInfo(SPI_GETWORKAREA, 0, &(Rect->Rect), 0); + i = Globals.WindowList; + + while (i != NULL) { + if ((i->hWnd != ForWindow) && IsWindowVisible(i->hWnd)) { + l = Rect; + Rect = (PRectList)malloc(sizeof(TRectList)); + Rect->Next = NULL; + l->Next = Rect; + + GetWindowRect(i->hWnd, &(Rect->Rect)); + } + + i = i->Next; + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Subclass Window Proc +/////////////////////////////////////////////////////////////////////////////////////////////////// + +LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { + PDockingWindow i; + + RECT r; + POINT p; + + WNDPROC OldRun; + + i = FindDockingWindow(hWnd); + + OldRun = NULL; + + if (i != NULL) { //else we have a problem + OldRun = i->OldWindowProc; + + if (Options.DoSnap) { + switch (Msg) { + case WM_ENTERSIZEMOVE: { + if (Options.ScriverWorkAround) + keybd_event(VK_CONTROL, 0, 0, 0); + + GetWindowRect(hWnd, &r); + GetCursorPos(&p); + Globals.MouseX = p.x - r.left; + Globals.MouseY = p.y - r.top; + + GetFrmRects(hWnd); + + break; + } + case WM_EXITSIZEMOVE: { + if (Options.ScriverWorkAround) + keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); + + break; + } + case WM_SIZING: + case WM_MOVING: { + r = *((PRECT)lParam); + if (Msg == WM_SIZING) { + DockWindowRect(hWnd, true, r, wParam); + } else { + DockWindowRect(hWnd, false, r, wParam, Globals.MouseX, Globals.MouseY); + } + + (*(PRECT)lParam) = r; + + if (Msg == WM_SIZING) { + return 1; + } + + break; + } + } //switch + } //if dosnap + + if (OldRun != NULL) { + if (IsWindowUnicode(hWnd)) { + return CallWindowProcW(OldRun, hWnd, Msg, wParam, lParam); + } else { + return CallWindowProcA(OldRun, hWnd, Msg, wParam, lParam); + } + } + } + + return 0; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// exportet Functions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +bool WindowOpen(HWND hWnd) { + PDockingWindow i; + + if ((hWnd != 0) && (FindDockingWindow(hWnd) == NULL)) { + i = (PDockingWindow)mir_alloc(sizeof(TDockingWindow)); + i->Next = Globals.WindowList; + i->hWnd = hWnd; + Globals.WindowList = i; + + if (IsWindowUnicode(hWnd)) { + i->OldWindowProc = (WNDPROC) GetWindowLongW(hWnd, GWL_WNDPROC); + SetWindowLongW(hWnd, GWL_WNDPROC, (LONG)(&WindowProc)); + } else { + i->OldWindowProc = (WNDPROC) GetWindowLongA(hWnd, GWL_WNDPROC); + SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)(&WindowProc)); + } + + return true; + } + return false; +} + +bool WindowClose(HWND hWnd) { + PDockingWindow i, l; + + l = NULL; + i = Globals.WindowList; + + while ((i != NULL) && (i->hWnd != hWnd)) { + l = i; + i = i->Next; + } + + if (i != NULL) { + if (l == NULL) { + Globals.WindowList = i->Next; + } else { + l->Next = i->Next; + } + + if (IsWindowUnicode(hWnd)) { + SetWindowLongW(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc)); + } else { + SetWindowLongA(hWnd, GWL_WNDPROC, (LONG) (i->OldWindowProc)); + } + + mir_free(i); + + return true; + } + + return false; +} +bool WindowCloseAll() { + PDockingWindow i, l; + i = Globals.WindowList; + while (i != NULL) { + l = i; + WindowClose(i->hWnd); + i = i->Next; + mir_free(l); + } + return true; +} \ No newline at end of file diff --git a/plugins/MagneticWindows/src/MagneticWindowsCore.h b/plugins/MagneticWindows/src/MagneticWindowsCore.h new file mode 100644 index 0000000000..c0d6938a7f --- /dev/null +++ b/plugins/MagneticWindows/src/MagneticWindowsCore.h @@ -0,0 +1,48 @@ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +// #include "../include/m_plugins.h" +#include +#include +#include + +#include "SnapToListService.h" +#include "Options.h" + +#include "resource.h" +#include "Version.h" + +typedef + struct TDockingWindow { + HWND hWnd; + WNDPROC OldWindowProc; + TDockingWindow* Next; + } TDockingWindow, *PDockingWindow; +typedef + struct TRectList { + RECT Rect; + TRectList* Next; + } TRectList, *PRectList; +typedef + struct { + PDockingWindow WindowList; + PRectList Rects; + int MouseX, MouseY; + bool SnappedX, SnappedY; + } TWorkingVariables; + + + +#define MODULE_NAME "MagneticWindows" +extern HINSTANCE hInst; + +bool WindowOpen(HWND); +bool WindowClose(HWND); +bool WindowCloseAll(); \ No newline at end of file diff --git a/plugins/MagneticWindows/src/Options.cpp b/plugins/MagneticWindows/src/Options.cpp new file mode 100644 index 0000000000..d070f40d56 --- /dev/null +++ b/plugins/MagneticWindows/src/Options.cpp @@ -0,0 +1,128 @@ +#include "MagneticWindowsCore.h" + +HANDLE hInitOptionsHook; +TOptions Options = { + true, + cDefaultSnapWidth, + false +}; + + +int CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + + TCHAR str[64]; + + switch (msg) { + case WM_INITDIALOG: { + TranslateDialogDefault(hwndDlg); + + CheckDlgButton(hwndDlg, IDC_CHK_SNAP, Options.DoSnap?BST_CHECKED:BST_UNCHECKED); + 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); + SetDlgItemText(hwndDlg, IDC_TXT_SNAPWIDTH, str); + + EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_SNAPWIDTH), Options.DoSnap); + EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_SNAPWIDTH), Options.DoSnap); + + CheckDlgButton(hwndDlg, IDC_CHK_SCRIVERWORKAROUND, Options.ScriverWorkAround?BST_CHECKED:BST_UNCHECKED); + + break; + } + case WM_HSCROLL: { + mir_snwprintf(str, 64, 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); + break; + } + + case WM_COMMAND: { + WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam); + + 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)); + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + } + case IDC_CHK_SCRIVERWORKAROUND: { + if (wNotifyCode == BN_CLICKED) { + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + } + } + break; + } + + case WM_NOTIFY: { //Here we have pressed either the OK or the APPLY button. + switch(((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_RESET: + LoadOptions(); + break; + + case PSN_APPLY: { + Options.DoSnap = (IsDlgButtonChecked(hwndDlg, IDC_CHK_SNAP) == TRUE); + Options.SnapWidth = SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0); + Options.ScriverWorkAround = (IsDlgButtonChecked(hwndDlg, IDC_CHK_SCRIVERWORKAROUND) == TRUE); + + db_set_b(NULL, MODULE_NAME, "DoSnap", Options.DoSnap); + db_set_b(NULL, MODULE_NAME, "SnapWidth", Options.SnapWidth); + db_set_b(NULL, MODULE_NAME, "ScriverWorkAround", Options.ScriverWorkAround); + + break; + } + } + break; + } + + break; + + } + default: + + break; + } + return 0; + +} + +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); + + return 0; +} + +void LoadOptions() { + Options.DoSnap = db_get_b(NULL, MODULE_NAME, "DoSnap", TRUE); + Options.SnapWidth = db_get_b(NULL, MODULE_NAME, "SnapWidth", cDefaultSnapWidth); + Options.ScriverWorkAround = db_get_b(NULL, MODULE_NAME, "ScriverWorkAround", FALSE); +} \ No newline at end of file diff --git a/plugins/MagneticWindows/src/Options.h b/plugins/MagneticWindows/src/Options.h new file mode 100644 index 0000000000..ebb5458d4a --- /dev/null +++ b/plugins/MagneticWindows/src/Options.h @@ -0,0 +1,18 @@ + +#define cDefaultSnapWidth 12 + +typedef + struct TOptions { + bool DoSnap; + int SnapWidth; + bool ScriverWorkAround; +} TOptions; + +extern HANDLE hInitOptionsHook; +extern TOptions Options; + + +int 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 new file mode 100644 index 0000000000..5fc9f66268 --- /dev/null +++ b/plugins/MagneticWindows/src/SnapToListService.cpp @@ -0,0 +1,64 @@ +#include "MagneticWindowsCore.h" + + +HANDLE hSnapToListService; + + +int SnapToList(WPARAM wParam, LPARAM Align) { + HWND hWnd, hWndList; + RECT WndRect, ListRect; + RECT AlignRect; + RECT ResultRect; + + hWnd = (HWND)wParam; + + hWndList = (HWND)CallService(MS_CLUI_GETHWND,0,0); + GetWindowRect(hWnd, &WndRect); + GetWindowRect(hWndList, &ListRect); + + AlignRect = ListRect; + if ((!(MS_MW_STL_List_Left & Align)) && (MS_MW_STL_List_Right & Align)) { + AlignRect.left = AlignRect.right; + } else + if ((MS_MW_STL_List_Left & Align) && (!(MS_MW_STL_List_Right & Align))) { + AlignRect.right = AlignRect.left; + } + + if ((!(MS_MW_STL_List_Top & Align)) && (MS_MW_STL_List_Bottom & Align)) { + AlignRect.top = AlignRect.bottom; + } else + if ((MS_MW_STL_List_Top & Align) && (!(MS_MW_STL_List_Bottom & Align))) { + AlignRect.bottom = AlignRect.top; + } + + ResultRect = WndRect; + if ((MS_MW_STL_Wnd_Left & Align) && (MS_MW_STL_Wnd_Right & Align)) { + ResultRect.left = AlignRect.left; + ResultRect.right = AlignRect.right; + } else + if ((!(MS_MW_STL_Wnd_Left & Align)) && (MS_MW_STL_Wnd_Right & Align)) { + ResultRect.left = AlignRect.right - (WndRect.right - WndRect.left); + ResultRect.right = AlignRect.right; + } else + if ((MS_MW_STL_Wnd_Left & Align) && (!(MS_MW_STL_Wnd_Right & Align))) { + ResultRect.left = AlignRect.left; + ResultRect.right = AlignRect.left + (WndRect.right - WndRect.left); + } + + if ((MS_MW_STL_Wnd_Top & Align) && (MS_MW_STL_Wnd_Bottom & Align)) { + ResultRect.top = AlignRect.top; + ResultRect.bottom = AlignRect.bottom; + } else + if ((!(MS_MW_STL_Wnd_Top & Align)) && (MS_MW_STL_Wnd_Bottom & Align)) { + ResultRect.top = AlignRect.bottom - (WndRect.bottom - WndRect.top); + ResultRect.bottom = AlignRect.bottom; + } else + if ((MS_MW_STL_Wnd_Top & Align) && (!(MS_MW_STL_Wnd_Bottom & Align))) { + ResultRect.top = AlignRect.top; + ResultRect.bottom = AlignRect.top + (WndRect.bottom - WndRect.top); + } + + MoveWindow(hWnd, ResultRect.left, ResultRect.top, ResultRect.right-ResultRect.left, ResultRect.bottom-ResultRect.top, true); + + return 0; +} \ No newline at end of file diff --git a/plugins/MagneticWindows/src/SnapToListService.h b/plugins/MagneticWindows/src/SnapToListService.h new file mode 100644 index 0000000000..27db7246cd --- /dev/null +++ b/plugins/MagneticWindows/src/SnapToListService.h @@ -0,0 +1,5 @@ + + +extern HANDLE hSnapToListService; + +int SnapToList(WPARAM, LPARAM); diff --git a/plugins/MagneticWindows/src/Version.h b/plugins/MagneticWindows/src/Version.h new file mode 100644 index 0000000000..681fda66a6 --- /dev/null +++ b/plugins/MagneticWindows/src/Version.h @@ -0,0 +1,14 @@ +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 3 +#define __BUILD_NUM 2 + +#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM + +#define __PLUGIN_NAME "Magnetic Windows" +#define __FILENAME "MagneticWindows.dll" +#define __DESCRIPTION "Makes the main contactlist and the chat windows snapping to the desktop border and to each other." +#define __AUTHOR "Michael Kunz" +#define __AUTHOREMAIL "Michael.Kunz@s2005.TU-Cemnitz.de" +#define __AUTHORWEB "http://miranda-ng.org/p/MagneticWindows/" +#define __COPYRIGHT "© 2006 Michael Kunz" diff --git a/plugins/MagneticWindows/src/resource.h b/plugins/MagneticWindows/src/resource.h new file mode 100644 index 0000000000..a651a69a50 --- /dev/null +++ b/plugins/MagneticWindows/src/resource.h @@ -0,0 +1,25 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Options.rc +// + +#define IDD_OPT_MAGNETICWINDOWS 101 + + +#define IDC_MAINFRAME 1001 +#define IDC_SLIDER_SNAPWIDTH 1002 +#define IDC_CHK_SNAP 1003 +#define IDC_TXT_SNAPWIDTH 1004 +#define IDC_CHK_SCRIVERWORKAROUND 1005 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1006 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3