From f1d7e1f52f9c567a21353541b8bca8c590004017 Mon Sep 17 00:00:00 2001 From: elasota Date: Wed, 26 Feb 2020 12:26:19 -0500 Subject: [PATCH] Fix constant IDs, remove ZoomWindow --- GpApp/Events.cpp | 16 +++++----------- PortabilityLayer/PLCore.cpp | 5 ----- PortabilityLayer/PLCore.h | 24 ++++++++++++++---------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/GpApp/Events.cpp b/GpApp/Events.cpp index bf69bf9..93d5cb8 100644 --- a/GpApp/Events.cpp +++ b/GpApp/Events.cpp @@ -75,12 +75,12 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick) switch (thePart) { - case inMenuBar: + case RegionIDs::kMenuBar: menuChoice = MenuSelect(evtPoint); DoMenuChoice(menuChoice); break; - case inDrag: + case RegionIDs::kTitleBar: PortabilityLayer::WindowManager::GetInstance()->DragWindow(whichWindow, evtPoint, thisMac.screen); if (whichWindow == mainWindow) GetWindowLeftTop(whichWindow, &isEditH, &isEditV); @@ -95,7 +95,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick) HiliteAllWindows(); break; - case inGoAway: + case RegionIDs::kClose: if (TrackGoAway(whichWindow, evtPoint)) { if (whichWindow == mapWindow) @@ -109,7 +109,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick) } break; - case inGrow: + case RegionIDs::kExpand: if (whichWindow == mapWindow) { newSize = GrowWindow(mapWindow, evtPoint, &thisMac.gray); @@ -117,13 +117,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick) } break; - case inZoomIn: - case inZoomOut: - if (TrackBox(whichWindow, evtPoint, thePart)) - ZoomWindow(whichWindow, thePart, true); - break; - - case inContent: + case RegionIDs::kContent: if (whichWindow == mainWindow) { hDelta = evtPoint.h - lastWhere.h; diff --git a/PortabilityLayer/PLCore.cpp b/PortabilityLayer/PLCore.cpp index af4f22b..8ac508a 100644 --- a/PortabilityLayer/PLCore.cpp +++ b/PortabilityLayer/PLCore.cpp @@ -131,11 +131,6 @@ bool TrackBox(WindowPtr window, Point point, int part) return false; } -void ZoomWindow(WindowPtr window, int part, bool bringToFront) -{ - PL_NotYetImplemented(); -} - void HiliteWindow(WindowPtr window, bool highlighted) { PL_NotYetImplemented(); diff --git a/PortabilityLayer/PLCore.h b/PortabilityLayer/PLCore.h index b45994f..c71cd1a 100644 --- a/PortabilityLayer/PLCore.h +++ b/PortabilityLayer/PLCore.h @@ -197,16 +197,21 @@ typedef WindowPtr WindowRef; // wtf? struct KeyDownStates; -enum RegionID +namespace RegionIDs { - inMenuBar = 1, - inContent, - inDrag, - inGrow, - inGoAway, - inZoomIn, - inZoomOut, -}; + enum RegionID + { + kNone, + + kMenuBar = 1, + kContent, + kTitleBar, + kClose, + kExpand, + }; +} + +typedef RegionIDs::RegionID RegionID_t; enum WindowRegionType { @@ -251,7 +256,6 @@ void BringToFront(WindowPtr window); bool TrackGoAway(WindowPtr window, Point point); // Returns true if the close box was actually clicked (?) Int32 GrowWindow(WindowPtr window, Point start, Rect *size); bool TrackBox(WindowPtr window, Point point, int part); // Returns true if grow/shrink box was clicked (part corresponds to type) -void ZoomWindow(WindowPtr window, int part, bool bringToFront); void HiliteWindow(WindowPtr window, bool highlighted); void DisposeWindow(WindowPtr window); void GetWindowBounds(WindowPtr window, WindowRegionType windowRegion, Rect *rect);