mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Window API refactor
This commit is contained in:
@@ -36,7 +36,7 @@ void BringUpDialog (Dialog **theDialog, short dialogID, const DialogTextSubstitu
|
|||||||
// CenterDialog(dialogID);
|
// CenterDialog(dialogID);
|
||||||
if (*theDialog == nil)
|
if (*theDialog == nil)
|
||||||
RedAlert(kErrDialogDidntLoad);
|
RedAlert(kErrDialogDidntLoad);
|
||||||
SetGraphicsPort(&(*theDialog)->GetWindow()->m_surface);
|
SetGraphicsPort((*theDialog)->GetWindow()->GetDrawSurface());
|
||||||
ShowWindow((*theDialog)->GetWindow());
|
ShowWindow((*theDialog)->GetWindow());
|
||||||
DrawDefaultButton(*theDialog);
|
DrawDefaultButton(*theDialog);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -454,8 +454,7 @@ void KeepWindowInBounds(Window *window)
|
|||||||
int32_t leftNudge = std::max<int32_t>(-windowRect.Left(), 0);
|
int32_t leftNudge = std::max<int32_t>(-windowRect.Left(), 0);
|
||||||
int32_t rightNudge = std::min<int32_t>(thisMac.fullScreen.right - windowRect.Right(), 0);
|
int32_t rightNudge = std::min<int32_t>(thisMac.fullScreen.right - windowRect.Right(), 0);
|
||||||
|
|
||||||
window->m_wmX += leftNudge + rightNudge;
|
window->SetPosition(window->GetPosition() + PortabilityLayer::Vec2i(leftNudge + rightNudge, topNudge + bottomNudge));
|
||||||
window->m_wmY += topNudge + bottomNudge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleEditorResolutionChange(void)
|
void HandleEditorResolutionChange(void)
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
if (mouseEvt.m_eventType == GpMouseEventTypes::kMove)
|
if (mouseEvt.m_eventType == GpMouseEventTypes::kMove)
|
||||||
{
|
{
|
||||||
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
||||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
|
||||||
if ((houseEditText1.Contains(mouseIs)) ||
|
if ((houseEditText1.Contains(mouseIs)) ||
|
||||||
(houseEditText2.Contains(mouseIs)))
|
(houseEditText2.Contains(mouseIs)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ void DoPause (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&bounds, &bounds, srcCopy);
|
&bounds, &bounds, srcCopy);
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ void HandleLinkClick (Point wherePt)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetPortWindowPort(linkWindow);
|
SetPortWindowPort(linkWindow);
|
||||||
wherePt -= linkWindow->TopLeftCoord();
|
wherePt -= linkWindow->GetTopLeftCoord();
|
||||||
|
|
||||||
part = FindControl(wherePt, linkWindow, &theControl);
|
part = FindControl(wherePt, linkWindow, &theControl);
|
||||||
if ((theControl != nil) && (part != 0))
|
if ((theControl != nil) && (part != 0))
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void RedrawSplashScreen (void)
|
|||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&workSrcRect, &workSrcRect, srcCopy);
|
&workSrcRect, &workSrcRect, srcCopy);
|
||||||
|
|
||||||
// if (quickerTransitions)
|
// if (quickerTransitions)
|
||||||
@@ -126,7 +126,7 @@ void RedrawSplashScreen (void)
|
|||||||
// DissBits(&workSrcRect);
|
// DissBits(&workSrcRect);
|
||||||
CopyRectMainToWork(&workSrcRect);
|
CopyRectMainToWork(&workSrcRect);
|
||||||
|
|
||||||
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
PortabilityLayer::MenuManager::GetInstance()->SetMenuVisible(true);
|
PortabilityLayer::MenuManager::GetInstance()->SetMenuVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void UpdateMainWindow (void)
|
|||||||
{
|
{
|
||||||
PauseMarquee();
|
PauseMarquee();
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&mainWindowRect, &mainWindowRect, srcCopy);
|
&mainWindowRect, &mainWindowRect, srcCopy);
|
||||||
ResumeMarquee();
|
ResumeMarquee();
|
||||||
}
|
}
|
||||||
@@ -155,14 +155,14 @@ void UpdateMainWindow (void)
|
|||||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||||
LoadScaledGraphic(workSrcMap, kSplash8BitPICT, &tempRect);
|
LoadScaledGraphic(workSrcMap, kSplash8BitPICT, &tempRect);
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&workSrcRect, &mainWindowRect, srcCopy);
|
&workSrcRect, &mainWindowRect, srcCopy);
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
|
|
||||||
DrawOnSplash(mainWindow->GetDrawSurface());
|
DrawOnSplash(mainWindow->GetDrawSurface());
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
|
|
||||||
splashDrawn = true;
|
splashDrawn = true;
|
||||||
}
|
}
|
||||||
@@ -279,10 +279,10 @@ void OpenMainWindow (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&mainWindowRect, &mainWindowRect, srcCopy);
|
&mainWindowRect, &mainWindowRect, srcCopy);
|
||||||
|
|
||||||
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- CloseMainWindow
|
//-------------------------------------------------------------- CloseMainWindow
|
||||||
@@ -373,7 +373,7 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
wherePt -= mainWindow->TopLeftCoord();
|
wherePt -= mainWindow->GetTopLeftCoord();
|
||||||
|
|
||||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ void RedrawMapContents (void)
|
|||||||
QSetRect(&src, 0, 0, kMapRoomWidth, kMapRoomHeight);
|
QSetRect(&src, 0, 0, kMapRoomWidth, kMapRoomHeight);
|
||||||
QOffsetRect(&src, 0, type * kMapRoomHeight);
|
QOffsetRect(&src, 0, type * kMapRoomHeight);
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(nailSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(nailSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mapWindow)),
|
GetPortBitMapForCopyBits(mapWindow->GetDrawSurface()),
|
||||||
&src, &aRoom, srcCopy);
|
&src, &aRoom, srcCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ void RedrawMapContents (void)
|
|||||||
//-------------------------------------------------------------- UpdateMapWindow
|
//-------------------------------------------------------------- UpdateMapWindow
|
||||||
void DrawMapResizeBox(void)
|
void DrawMapResizeBox(void)
|
||||||
{
|
{
|
||||||
DrawSurface *surface = &mapWindow->m_surface;
|
DrawSurface *surface = mapWindow->GetDrawSurface();
|
||||||
|
|
||||||
const Rect windowRect = surface->m_port.GetRect();
|
const Rect windowRect = surface->m_port.GetRect();
|
||||||
Rect growBoxRect = Rect::Create(windowRect.bottom - 14, windowRect.right - 14, windowRect.bottom, windowRect.right);
|
Rect growBoxRect = Rect::Create(windowRect.bottom - 14, windowRect.right - 14, windowRect.bottom, windowRect.right);
|
||||||
@@ -625,7 +625,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
|||||||
|
|
||||||
SetPortWindowPort(mapWindow);
|
SetPortWindowPort(mapWindow);
|
||||||
globalWhere = wherePt;
|
globalWhere = wherePt;
|
||||||
wherePt -= mapWindow->TopLeftCoord();
|
wherePt -= mapWindow->GetTopLeftCoord();
|
||||||
wherePt.h -= 1;
|
wherePt.h -= 1;
|
||||||
wherePt.v -= 1;
|
wherePt.v -= 1;
|
||||||
|
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ Boolean PtInMarqueeHandle (Point where)
|
|||||||
|
|
||||||
void DrawGliderMarquee (void)
|
void DrawGliderMarquee (void)
|
||||||
{
|
{
|
||||||
DrawSurface *surface = GetWindowPort(mainWindow);
|
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||||
ImageInvert(*GetGWorldPixMap(blowerMaskMap), GetPortBitMapForCopyBits(surface), leftStartGliderSrc, marqueeGliderRect);
|
ImageInvert(*GetGWorldPixMap(blowerMaskMap), GetPortBitMapForCopyBits(surface), leftStartGliderSrc, marqueeGliderRect);
|
||||||
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void NewGame (short mode)
|
|||||||
#ifdef COMPILEQT
|
#ifdef COMPILEQT
|
||||||
if ((thisMac.hasQT) && (hasMovie))
|
if ((thisMac.hasQT) && (hasMovie))
|
||||||
{
|
{
|
||||||
theMovie.m_surface = &mainWindow->m_surface;
|
theMovie.m_surface = mainWindow->GetDrawSurface();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ void HandleGameResolutionChange(void)
|
|||||||
OpenMainWindow();
|
OpenMainWindow();
|
||||||
|
|
||||||
if (hasMovie)
|
if (hasMovie)
|
||||||
theMovie.m_surface = &mainWindow->m_surface;
|
theMovie.m_surface = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
ResetLocale(true);
|
ResetLocale(true);
|
||||||
InitScoreboardMap();
|
InitScoreboardMap();
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ void CopyRectsQD (void)
|
|||||||
{
|
{
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
DrawSurface *mainWindowGraf = GetWindowPort(mainWindow);
|
DrawSurface *mainWindowGraf = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
for (i = 0; i < numWork2Main; i++)
|
for (i = 0; i < numWork2Main; i++)
|
||||||
{
|
{
|
||||||
@@ -713,7 +713,7 @@ void CopyRectWorkToBack (Rect *theRect)
|
|||||||
void CopyRectWorkToMain (Rect *theRect)
|
void CopyRectWorkToMain (Rect *theRect)
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
theRect, theRect, srcCopy);
|
theRect, theRect, srcCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ void CopyRectWorkToMain (Rect *theRect)
|
|||||||
|
|
||||||
void CopyRectMainToWork (Rect *theRect)
|
void CopyRectMainToWork (Rect *theRect)
|
||||||
{
|
{
|
||||||
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
CopyBits(GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
theRect, theRect, srcCopy);
|
theRect, theRect, srcCopy);
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ void CopyRectMainToWork (Rect *theRect)
|
|||||||
|
|
||||||
void CopyRectMainToBack (Rect *theRect)
|
void CopyRectMainToBack (Rect *theRect)
|
||||||
{
|
{
|
||||||
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
CopyBits(GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
theRect, theRect, srcCopy);
|
theRect, theRect, srcCopy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
if (evt->IsLMouseDownEvent())
|
if (evt->IsLMouseDownEvent())
|
||||||
{
|
{
|
||||||
mouseIs = Point::Create(mouseEvent.m_x, mouseEvent.m_y);
|
mouseIs = Point::Create(mouseEvent.m_x, mouseEvent.m_y);
|
||||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
|
||||||
if (tileSrc.Contains(mouseIs))
|
if (tileSrc.Contains(mouseIs))
|
||||||
{
|
{
|
||||||
if (StillDown())
|
if (StillDown())
|
||||||
@@ -681,7 +681,7 @@ int16_t OriginalArtFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
||||||
|
|
||||||
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
||||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
|
||||||
if (leftBound.Contains(mouseIs))
|
if (leftBound.Contains(mouseIs))
|
||||||
return 7;
|
return 7;
|
||||||
else if (topBound.Contains(mouseIs))
|
else if (topBound.Contains(mouseIs))
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ extern Boolean evenFrame, onePlayerLeft;
|
|||||||
|
|
||||||
void MarkScoreboardPortDirty(void)
|
void MarkScoreboardPortDirty(void)
|
||||||
{
|
{
|
||||||
GetWindowPort(boardWindow)->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
boardWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- RefreshScoreboard
|
//-------------------------------------------------------------- RefreshScoreboard
|
||||||
@@ -71,7 +71,7 @@ void RefreshScoreboard (SInt16 mode)
|
|||||||
RefreshPoints();
|
RefreshPoints();
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&boardSrcRect, &boardDestRect, srcCopy);
|
&boardSrcRect, &boardDestRect, srcCopy);
|
||||||
|
|
||||||
MarkScoreboardPortDirty();
|
MarkScoreboardPortDirty();
|
||||||
@@ -293,7 +293,7 @@ void QuickGlidersRefresh (void)
|
|||||||
surface->DrawString(textPoint, nGlidersStr, true);
|
surface->DrawString(textPoint, nGlidersStr, true);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&boardGSrcRect, &boardGQDestRect, srcCopy);
|
&boardGSrcRect, &boardGQDestRect, srcCopy);
|
||||||
|
|
||||||
MarkScoreboardPortDirty();
|
MarkScoreboardPortDirty();
|
||||||
@@ -323,7 +323,7 @@ void QuickScoreRefresh (void)
|
|||||||
surface->DrawString(textPoint, scoreStr, true);
|
surface->DrawString(textPoint, scoreStr, true);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&boardPSrcRect, &boardPQDestRect, srcCopy);
|
&boardPSrcRect, &boardPQDestRect, srcCopy);
|
||||||
|
|
||||||
MarkScoreboardPortDirty();
|
MarkScoreboardPortDirty();
|
||||||
@@ -336,7 +336,7 @@ void QuickBatteryRefresh (Boolean flash)
|
|||||||
if ((batteryTotal > 0) && (!flash))
|
if ((batteryTotal > 0) && (!flash))
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBadgesRects[kBatteryBadge],
|
&badgesBadgesRects[kBatteryBadge],
|
||||||
&badgesDestRects[kBatteryBadge],
|
&badgesDestRects[kBatteryBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -344,7 +344,7 @@ void QuickBatteryRefresh (Boolean flash)
|
|||||||
else if ((batteryTotal < 0) && (!flash))
|
else if ((batteryTotal < 0) && (!flash))
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBadgesRects[kHeliumBadge],
|
&badgesBadgesRects[kHeliumBadge],
|
||||||
&badgesDestRects[kHeliumBadge],
|
&badgesDestRects[kHeliumBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -352,7 +352,7 @@ void QuickBatteryRefresh (Boolean flash)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBlankRects[kBatteryBadge],
|
&badgesBlankRects[kBatteryBadge],
|
||||||
&badgesDestRects[kBatteryBadge],
|
&badgesDestRects[kBatteryBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -368,7 +368,7 @@ void QuickBandsRefresh (Boolean flash)
|
|||||||
if ((bandsTotal > 0) && (!flash))
|
if ((bandsTotal > 0) && (!flash))
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBadgesRects[kBandsBadge],
|
&badgesBadgesRects[kBandsBadge],
|
||||||
&badgesDestRects[kBandsBadge],
|
&badgesDestRects[kBandsBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -376,7 +376,7 @@ void QuickBandsRefresh (Boolean flash)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBlankRects[kBandsBadge],
|
&badgesBlankRects[kBandsBadge],
|
||||||
&badgesDestRects[kBandsBadge],
|
&badgesDestRects[kBandsBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -392,7 +392,7 @@ void QuickFoilRefresh (Boolean flash)
|
|||||||
if ((foilTotal > 0) && (!flash))
|
if ((foilTotal > 0) && (!flash))
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBadgesRects[kFoilBadge],
|
&badgesBadgesRects[kFoilBadge],
|
||||||
&badgesDestRects[kFoilBadge],
|
&badgesDestRects[kFoilBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
@@ -400,7 +400,7 @@ void QuickFoilRefresh (Boolean flash)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
&badgesBlankRects[kFoilBadge],
|
&badgesBlankRects[kFoilBadge],
|
||||||
&badgesDestRects[kFoilBadge],
|
&badgesDestRects[kFoilBadge],
|
||||||
srcCopy);
|
srcCopy);
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ void DoControlPrefs (void)
|
|||||||
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront, nullptr);
|
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront, nullptr);
|
||||||
if (prefDlg == nil)
|
if (prefDlg == nil)
|
||||||
RedAlert(kErrDialogDidntLoad);
|
RedAlert(kErrDialogDidntLoad);
|
||||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
GetDialogItemRect(prefDlg, i + kRightControl, &controlRects[i]);
|
GetDialogItemRect(prefDlg, i + kRightControl, &controlRects[i]);
|
||||||
@@ -1204,7 +1204,7 @@ int16_t PrefsFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
const Window *window = dial->GetWindow();
|
const Window *window = dial->GetWindow();
|
||||||
const GpMouseInputEvent &mouseEvent = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
const GpMouseInputEvent &mouseEvent = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
||||||
|
|
||||||
const Point testPt = Point::Create(mouseEvent.m_x - window->m_wmX, mouseEvent.m_y - window->m_wmY);
|
const Point testPt = window->MouseToLocal(evt->m_vosEvent.m_event.m_mouseInputEvent);
|
||||||
|
|
||||||
int16_t hitCode = -1;
|
int16_t hitCode = -1;
|
||||||
|
|
||||||
@@ -1263,20 +1263,20 @@ void DoSettingsMain (void)
|
|||||||
case kDisplayButton:
|
case kDisplayButton:
|
||||||
FlashSettingsButton(surface, 0);
|
FlashSettingsButton(surface, 0);
|
||||||
DoDisplayPrefs();
|
DoDisplayPrefs();
|
||||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSoundButton:
|
case kSoundButton:
|
||||||
FlashSettingsButton(surface, 1);
|
FlashSettingsButton(surface, 1);
|
||||||
DoSoundPrefs();
|
DoSoundPrefs();
|
||||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||||
FlushEvents(everyEvent, 0);
|
FlushEvents(everyEvent, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kControlsButton:
|
case kControlsButton:
|
||||||
FlashSettingsButton(surface, 2);
|
FlashSettingsButton(surface, 2);
|
||||||
DoControlPrefs();
|
DoControlPrefs();
|
||||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBrainsButton:
|
case kBrainsButton:
|
||||||
@@ -1288,7 +1288,7 @@ void DoSettingsMain (void)
|
|||||||
}
|
}
|
||||||
FlashSettingsButton(surface, 3);
|
FlashSettingsButton(surface, 3);
|
||||||
DoBrainsPrefs();
|
DoBrainsPrefs();
|
||||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kAllDefaultsButton:
|
case kAllDefaultsButton:
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ void DrawToolTiles (DrawSurface *surface)
|
|||||||
QOffsetRect(&destRect, toolRects[i + 1].left + 2, toolRects[i + 1].top + 2);
|
QOffsetRect(&destRect, toolRects[i + 1].left + 2, toolRects[i + 1].top + 2);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(toolSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(toolSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(toolsWindow)),
|
GetPortBitMapForCopyBits(toolsWindow->GetDrawSurface()),
|
||||||
&srcRect, &destRect, srcCopy);
|
&srcRect, &destRect, srcCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +472,7 @@ void HandleToolsClick (Point wherePt)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetPortWindowPort(toolsWindow);
|
SetPortWindowPort(toolsWindow);
|
||||||
wherePt -= toolsWindow->TopLeftCoord();
|
wherePt -= toolsWindow->GetTopLeftCoord();
|
||||||
|
|
||||||
part = FindControl(wherePt, toolsWindow, &theControl);
|
part = FindControl(wherePt, toolsWindow, &theControl);
|
||||||
if ((theControl != nil) && (part != 0))
|
if ((theControl != nil) && (part != 0))
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void PourScreenOn (Rect *theRect)
|
|||||||
columnRects[i].bottom = theRect->bottom;
|
columnRects[i].bottom = theRect->bottom;
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&columnRects[i], &columnRects[i], srcCopy);
|
&columnRects[i], &columnRects[i], srcCopy);
|
||||||
|
|
||||||
QOffsetRect(&columnRects[i], 0, kChipHigh);
|
QOffsetRect(&columnRects[i], 0, kChipHigh);
|
||||||
@@ -115,7 +115,7 @@ void WipeScreenOn (short direction, Rect *theRect)
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||||
&wipeRect, &wipeRect, srcCopy);
|
&wipeRect, &wipeRect, srcCopy);
|
||||||
|
|
||||||
QOffsetRect(&wipeRect, hOffset, vOffset);
|
QOffsetRect(&wipeRect, hOffset, vOffset);
|
||||||
@@ -135,7 +135,7 @@ void WipeScreenOn (short direction, Rect *theRect)
|
|||||||
|
|
||||||
void DumpScreenOn (Rect *theRect)
|
void DumpScreenOn (Rect *theRect)
|
||||||
{
|
{
|
||||||
DrawSurface *graf = GetWindowPort(mainWindow);
|
DrawSurface *graf = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(graf),
|
GetPortBitMapForCopyBits(graf),
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ void GetWindowLeftTop (WindowPtr theWindow, short *left, short *top)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*left = static_cast<short>(theWindow->m_wmX);
|
const Point windowPos = theWindow->GetTopLeftCoord();
|
||||||
*top = static_cast<short>(theWindow->m_wmY);
|
*left = windowPos.h;
|
||||||
|
*top = windowPos.v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ void GetWindowRect (WindowPtr theWindow, Rect *bounds)
|
|||||||
{
|
{
|
||||||
Point upperLeft;
|
Point upperLeft;
|
||||||
GetWindowLeftTop(theWindow, &upperLeft.h, &upperLeft.v);
|
GetWindowLeftTop(theWindow, &upperLeft.h, &upperLeft.v);
|
||||||
*bounds = theWindow->m_surface.m_port.GetRect() + upperLeft;
|
*bounds = theWindow->GetSurfaceRect() + upperLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ Rect BitmapImage::GetRect() const
|
|||||||
const uint32_t width = infoHeader->m_width;
|
const uint32_t width = infoHeader->m_width;
|
||||||
const uint32_t height = infoHeader->m_height;
|
const uint32_t height = infoHeader->m_height;
|
||||||
|
|
||||||
return Rect::Create(0, 0, static_cast<int16_t>(height), static_cast<int16_t>(width));
|
return Rect::Create(0, 0, static_cast<int16_t>(height), static_cast<int16_t>(width));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -511,11 +511,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
Point DialogImpl::MouseToDialog(const GpMouseInputEvent &evt)
|
Point DialogImpl::MouseToDialog(const GpMouseInputEvent &evt)
|
||||||
{
|
{
|
||||||
const Window *window = m_window;
|
return Point::Create(evt.m_x, evt.m_y) - m_window->GetTopLeftCoord();
|
||||||
const int32_t x = evt.m_x - window->m_wmX;
|
|
||||||
const int32_t y = evt.m_y - window->m_wmY;
|
|
||||||
|
|
||||||
return Point::Create(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogImpl::MakeStringSubstitutions(uint8_t *outStr, const uint8_t *inStr, const DialogTextSubstitutions *substitutions)
|
void DialogImpl::MakeStringSubstitutions(uint8_t *outStr, const uint8_t *inStr, const DialogTextSubstitutions *substitutions)
|
||||||
@@ -843,7 +839,9 @@ namespace PortabilityLayer
|
|||||||
const uint16_t dialogWidth = rect.Width();
|
const uint16_t dialogWidth = rect.Width();
|
||||||
const uint16_t dialogHeight = rect.Height();
|
const uint16_t dialogHeight = rect.Height();
|
||||||
|
|
||||||
window->m_wmX = (static_cast<int32_t>(displayWidth) - static_cast<int32_t>(dialogWidth)) / 2;
|
Vec2i newPosition;
|
||||||
|
|
||||||
|
newPosition.m_x = (static_cast<int32_t>(displayWidth) - static_cast<int32_t>(dialogWidth)) / 2;
|
||||||
|
|
||||||
// We center dialogs vertically in one of 3 ways in this priority:
|
// We center dialogs vertically in one of 3 ways in this priority:
|
||||||
// - Centered at 1/3 until the top edge is at the 1/4 mark
|
// - Centered at 1/3 until the top edge is at the 1/4 mark
|
||||||
@@ -853,13 +851,15 @@ namespace PortabilityLayer
|
|||||||
//if (displayHeight / 3 - dialogHeight / 2 >= displayHeight / 4)
|
//if (displayHeight / 3 - dialogHeight / 2 >= displayHeight / 4)
|
||||||
if (static_cast<int32_t>(displayHeight * 4) - static_cast<int32_t>(dialogHeight * 6) >= static_cast<int32_t>(displayHeight * 3))
|
if (static_cast<int32_t>(displayHeight * 4) - static_cast<int32_t>(dialogHeight * 6) >= static_cast<int32_t>(displayHeight * 3))
|
||||||
{
|
{
|
||||||
//window->m_wmY = displayHeight / 3 - dialogHeight / 2;
|
//newPosition.m_y = displayHeight / 3 - dialogHeight / 2;
|
||||||
window->m_wmY = (static_cast<int32_t>(displayHeight * 2) - static_cast<int32_t>(dialogHeight * 3)) / 6;
|
newPosition.m_y = (static_cast<int32_t>(displayHeight * 2) - static_cast<int32_t>(dialogHeight * 3)) / 6;
|
||||||
}
|
}
|
||||||
else if (dialogHeight * 2U <= displayHeight)
|
else if (dialogHeight * 2U <= displayHeight)
|
||||||
window->m_wmY = displayHeight / 4;
|
newPosition.m_y = displayHeight / 4;
|
||||||
else
|
else
|
||||||
window->m_wmY = (static_cast<int32_t>(displayHeight) - static_cast<int32_t>(dialogHeight)) / 2;
|
newPosition.m_y = (static_cast<int32_t>(displayHeight) - static_cast<int32_t>(dialogHeight)) / 2;
|
||||||
|
|
||||||
|
window->SetPosition(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogManagerImpl *DialogManagerImpl::GetInstance()
|
DialogManagerImpl *DialogManagerImpl::GetInstance()
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ namespace PortabilityLayer
|
|||||||
if (m_haveHighlightOverride != enabled)
|
if (m_haveHighlightOverride != enabled)
|
||||||
{
|
{
|
||||||
m_haveHighlightOverride = enabled;
|
m_haveHighlightOverride = enabled;
|
||||||
DrawControl(&m_window->m_surface);
|
DrawControl(m_window->GetDrawSurface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ PortabilityLayer::Vec2i TrackResize(WindowPtr window, Point start, uint16_t minW
|
|||||||
{
|
{
|
||||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
const Rect baseRect = window->m_surface.m_port.GetRect();
|
const Rect baseRect = window->GetSurfaceRect();
|
||||||
|
|
||||||
const PortabilityLayer::Vec2i baseSize = PortabilityLayer::Vec2i(baseRect.Width(), baseRect.Height());
|
const PortabilityLayer::Vec2i baseSize = PortabilityLayer::Vec2i(baseRect.Width(), baseRect.Height());
|
||||||
const PortabilityLayer::Vec2i basePoint = PortabilityLayer::Vec2i(start.h, start.v);
|
const PortabilityLayer::Vec2i basePoint = PortabilityLayer::Vec2i(start.h, start.v);
|
||||||
@@ -498,8 +498,9 @@ void DisposeDirectoryFiles(DirectoryFileListEntry *firstDFL)
|
|||||||
void GetMouse(Window *window, Point *point)
|
void GetMouse(Window *window, Point *point)
|
||||||
{
|
{
|
||||||
const PortabilityLayer::Vec2i mousePos = PortabilityLayer::InputManager::GetInstance()->GetMousePosition();
|
const PortabilityLayer::Vec2i mousePos = PortabilityLayer::InputManager::GetInstance()->GetMousePosition();
|
||||||
point->h = mousePos.m_x - window->m_wmX;
|
const PortabilityLayer::Vec2i relativePos = mousePos - window->GetPosition();
|
||||||
point->v = mousePos.m_y - window->m_wmY;
|
point->h = relativePos.m_x;
|
||||||
|
point->v = relativePos.m_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean Button()
|
Boolean Button()
|
||||||
@@ -691,9 +692,26 @@ Point Window::MouseToLocal(const GpMouseInputEvent &evt) const
|
|||||||
return Point::Create(evt.m_x - m_wmX, evt.m_y - m_wmY);
|
return Point::Create(evt.m_x - m_wmX, evt.m_y - m_wmY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Window::TopLeftCoord() const
|
Point Window::GetTopLeftCoord() const
|
||||||
{
|
{
|
||||||
return Point::Create(m_wmX, m_wmY);
|
const PortabilityLayer::Vec2i position = GetPosition();
|
||||||
|
return Point::Create(position.m_x, position.m_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect Window::GetSurfaceRect() const
|
||||||
|
{
|
||||||
|
return m_surface.m_port.GetRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::SetPosition(const PortabilityLayer::Vec2i &pos)
|
||||||
|
{
|
||||||
|
m_wmX = pos.m_x;
|
||||||
|
m_wmY = pos.m_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
PortabilityLayer::Vec2i Window::GetPosition() const
|
||||||
|
{
|
||||||
|
return PortabilityLayer::Vec2i(m_wmX, m_wmY);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::AddWidget(PortabilityLayer::Widget *widget)
|
bool Window::AddWidget(PortabilityLayer::Widget *widget)
|
||||||
|
|||||||
@@ -91,13 +91,17 @@ struct Window
|
|||||||
{
|
{
|
||||||
Window();
|
Window();
|
||||||
|
|
||||||
DrawSurface *GetDrawSurface() const;
|
void SetPosition(const PortabilityLayer::Vec2i &pos);
|
||||||
|
PortabilityLayer::Vec2i GetPosition() const;
|
||||||
|
|
||||||
// Convenience method to convert a mouse event to local point
|
// Convenience method to convert a mouse event to local point
|
||||||
Point MouseToLocal(const GpMouseInputEvent &evt) const;
|
Point MouseToLocal(const GpMouseInputEvent &evt) const;
|
||||||
|
|
||||||
// Convenience method that returns a 16-bit precision X/Y
|
// Convenience method that returns a 16-bit precision X/Y
|
||||||
Point TopLeftCoord() const;
|
Point GetTopLeftCoord() const;
|
||||||
|
|
||||||
|
// Returns the bounds rect of the draw surface (which is always 0,0 based
|
||||||
|
Rect GetSurfaceRect() const;
|
||||||
|
|
||||||
bool AddWidget(PortabilityLayer::Widget *widget);
|
bool AddWidget(PortabilityLayer::Widget *widget);
|
||||||
ArrayView<PortabilityLayer::Widget*> GetWidgets() const;
|
ArrayView<PortabilityLayer::Widget*> GetWidgets() const;
|
||||||
@@ -112,15 +116,9 @@ struct Window
|
|||||||
|
|
||||||
void OnTick();
|
void OnTick();
|
||||||
|
|
||||||
|
DrawSurface *GetDrawSurface() const;
|
||||||
DrawSurface *GetChromeSurface(WindowChromeSide_t aChromeSide) const;
|
DrawSurface *GetChromeSurface(WindowChromeSide_t aChromeSide) const;
|
||||||
|
|
||||||
DrawSurface m_surface; // Must be the first item until the immediate mode draw API is completely removed
|
|
||||||
|
|
||||||
// The port is always at 0,0
|
|
||||||
// These are the WM coordinates
|
|
||||||
int32_t m_wmX;
|
|
||||||
int32_t m_wmY;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~Window();
|
~Window();
|
||||||
|
|
||||||
@@ -130,6 +128,13 @@ protected:
|
|||||||
size_t m_numWidgets;
|
size_t m_numWidgets;
|
||||||
size_t m_numTickReceivingWidgets;
|
size_t m_numTickReceivingWidgets;
|
||||||
|
|
||||||
|
DrawSurface m_surface;
|
||||||
|
|
||||||
|
// The surface is always at 0,0
|
||||||
|
// These are the WM coordinates
|
||||||
|
int32_t m_wmX;
|
||||||
|
int32_t m_wmY;
|
||||||
|
|
||||||
PortabilityLayer::Widget *m_widgetWithFocus;
|
PortabilityLayer::Widget *m_widgetWithFocus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
const GpMouseInputEvent &mouseEvent = evt.m_vosEvent.m_event.m_mouseInputEvent;
|
const GpMouseInputEvent &mouseEvent = evt.m_vosEvent.m_event.m_mouseInputEvent;
|
||||||
const Vec2i globalPoint = Vec2i(mouseEvent.m_x, mouseEvent.m_y);
|
const Vec2i globalPoint = Vec2i(mouseEvent.m_x, mouseEvent.m_y);
|
||||||
const Vec2i localPoint = globalPoint - Vec2i(m_window->m_wmX, m_window->m_wmY);
|
const Vec2i localPoint = globalPoint - m_window->GetPosition();
|
||||||
|
|
||||||
if (this->m_rect.Contains(Point::Create(localPoint.m_x, localPoint.m_y)))
|
if (this->m_rect.Contains(Point::Create(localPoint.m_x, localPoint.m_y)))
|
||||||
{
|
{
|
||||||
@@ -60,8 +60,8 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||||
|
|
||||||
const Vec2i popupMenuPos = Vec2i(m_window->m_wmX, m_window->m_wmY) + Vec2i(m_rect.left, m_rect.top);
|
const Vec2i popupMenuPos = m_window->GetPosition() + Vec2i(m_rect.left, m_rect.top);
|
||||||
const Vec2i globalPos = Vec2i(pos.h, pos.v) + Vec2i(m_window->m_wmX, m_window->m_wmY);
|
const Vec2i globalPos = Vec2i(pos.h, pos.v) + m_window->GetPosition();
|
||||||
|
|
||||||
uint16_t item = 0;
|
uint16_t item = 0;
|
||||||
mm->PopupMenuSelect(m_menu, popupMenuPos, globalPos, m_state - 1, &item);
|
mm->PopupMenuSelect(m_menu, popupMenuPos, globalPos, m_state - 1, &item);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void SetPort(GrafPtr graf)
|
|||||||
|
|
||||||
void EndUpdate(WindowPtr graf)
|
void EndUpdate(WindowPtr graf)
|
||||||
{
|
{
|
||||||
graf->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
graf->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
||||||
@@ -65,7 +65,7 @@ void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
|||||||
void SetPortWindowPort(WindowPtr window)
|
void SetPortWindowPort(WindowPtr window)
|
||||||
{
|
{
|
||||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&window->m_surface.m_port);
|
PortabilityLayer::QDManager::GetInstance()->SetPort(&window->GetDrawSurface()->m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPortDialogPort(Dialog *dialog)
|
void SetPortDialogPort(Dialog *dialog)
|
||||||
@@ -1708,17 +1708,6 @@ PixMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr)
|
|||||||
return *grafPtr->m_port.GetPixMap();
|
return *grafPtr->m_port.GetPixMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawSurface *GetWindowPort(WindowPtr window)
|
|
||||||
{
|
|
||||||
return &window->m_surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SubPt(Point srcPoint, Point *destPoint)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection)
|
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection)
|
||||||
{
|
{
|
||||||
*outIntersection = rectA->Intersect(*rectB);
|
*outIntersection = rectA->Intersect(*rectB);
|
||||||
|
|||||||
@@ -99,10 +99,6 @@ void ImageInvert(const PixMap *invertMask, PixMap *targetBitmap, const Rect &src
|
|||||||
bool PointInScanlineMask(Point point, PortabilityLayer::ScanlineMask *scanlineMask);
|
bool PointInScanlineMask(Point point, PortabilityLayer::ScanlineMask *scanlineMask);
|
||||||
|
|
||||||
PixMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr);
|
PixMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr);
|
||||||
DrawSurface *GetWindowPort(WindowPtr window);
|
|
||||||
|
|
||||||
// Subtracts srcPoint from destPoint (reverse of DeltaPoint)
|
|
||||||
void SubPt(Point srcPoint, Point *destPoint);
|
|
||||||
|
|
||||||
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct IGpDisplayDriver;
|
|||||||
struct IGpDisplayDriverSurface;
|
struct IGpDisplayDriverSurface;
|
||||||
class PLPasStr;
|
class PLPasStr;
|
||||||
|
|
||||||
struct DrawSurface final
|
struct DrawSurface
|
||||||
{
|
{
|
||||||
DrawSurface()
|
DrawSurface()
|
||||||
: m_port(PortabilityLayer::QDPortType_DrawSurface)
|
: m_port(PortabilityLayer::QDPortType_DrawSurface)
|
||||||
|
|||||||
@@ -1059,10 +1059,11 @@ namespace PortabilityLayer
|
|||||||
WindowImpl *window = m_windowStackTop;
|
WindowImpl *window = m_windowStackTop;
|
||||||
while (window)
|
while (window)
|
||||||
{
|
{
|
||||||
const Rect windowRect = window->m_surface.m_port.GetRect();
|
const Rect windowRect = window->GetSurfaceRect();
|
||||||
|
const Vec2i windowPos = window->GetPosition();
|
||||||
|
|
||||||
const int32_t localX = point.h - window->m_wmX;
|
const int32_t localX = point.h - windowPos.m_x;
|
||||||
const int32_t localY = point.v - window->m_wmY;
|
const int32_t localY = point.v - windowPos.m_y;
|
||||||
|
|
||||||
RegionID_t chromeInteractionZone = RegionIDs::kContent;
|
RegionID_t chromeInteractionZone = RegionIDs::kContent;
|
||||||
if (window->GetChromeInteractionZone(Vec2i(localX, localY), chromeInteractionZone))
|
if (window->GetChromeInteractionZone(Vec2i(localX, localY), chromeInteractionZone))
|
||||||
@@ -1101,7 +1102,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
DetachWindow(window);
|
DetachWindow(window);
|
||||||
|
|
||||||
if (PortabilityLayer::QDManager::GetInstance()->GetPort() == &windowImpl->m_surface.m_port)
|
if (PortabilityLayer::QDManager::GetInstance()->GetPort() == &windowImpl->GetDrawSurface()->m_port)
|
||||||
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
|
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
|
||||||
|
|
||||||
windowImpl->~WindowImpl();
|
windowImpl->~WindowImpl();
|
||||||
@@ -1133,8 +1134,7 @@ namespace PortabilityLayer
|
|||||||
if (y >= constraintRect.bottom)
|
if (y >= constraintRect.bottom)
|
||||||
y = constraintRect.bottom - 1;
|
y = constraintRect.bottom - 1;
|
||||||
|
|
||||||
window->m_wmX += x - baseX;
|
window->SetPosition(window->GetPosition() + Vec2i(x - baseX, y - baseY));
|
||||||
window->m_wmY += y - baseY;
|
|
||||||
|
|
||||||
baseX = x;
|
baseX = x;
|
||||||
baseY = y;
|
baseY = y;
|
||||||
@@ -1150,7 +1150,7 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
bool isInBounds = false;
|
bool isInBounds = false;
|
||||||
|
|
||||||
const Vec2i windowCoord = Vec2i(window->m_wmX, window->m_wmY);
|
const Vec2i windowCoord = window->GetPosition();
|
||||||
|
|
||||||
Rect2i closeBoxRect;
|
Rect2i closeBoxRect;
|
||||||
if (!static_cast<WindowImpl*>(window)->GetChromeRegionRect(RegionIDs::kClose, closeBoxRect))
|
if (!static_cast<WindowImpl*>(window)->GetChromeRegionRect(RegionIDs::kClose, closeBoxRect))
|
||||||
@@ -1216,9 +1216,10 @@ namespace PortabilityLayer
|
|||||||
uint16_t padding[WindowChromeSides::kCount];
|
uint16_t padding[WindowChromeSides::kCount];
|
||||||
windowImpl->GetChromePadding(padding);
|
windowImpl->GetChromePadding(padding);
|
||||||
|
|
||||||
const Rect portRect = windowImpl->m_surface.m_port.GetRect();
|
const Rect portRect = windowImpl->GetSurfaceRect();
|
||||||
|
const Vec2i windowPos = windowImpl->GetPosition();
|
||||||
|
|
||||||
return Rect2i(window->m_wmY - padding[WindowChromeSides::kTop], window->m_wmX - padding[WindowChromeSides::kLeft], window->m_wmY + portRect.Height() + padding[WindowChromeSides::kBottom], window->m_wmX + portRect.Width() + padding[WindowChromeSides::kRight]);
|
return Rect2i(windowPos.m_y - padding[WindowChromeSides::kTop], windowPos.m_x - padding[WindowChromeSides::kLeft], windowPos.m_y + portRect.Height() + padding[WindowChromeSides::kBottom], windowPos.m_x + portRect.Width() + padding[WindowChromeSides::kRight]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowManagerImpl::GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const
|
bool WindowManagerImpl::GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const
|
||||||
@@ -1242,7 +1243,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
const Rect windowRect = window->GetDrawSurface()->m_port.GetRect();
|
const Rect windowRect = window->GetDrawSurface()->m_port.GetRect();
|
||||||
|
|
||||||
Vec2i topLeft = Vec2i(m_flickerWindow->m_wmX, m_flickerWindow->m_wmY);
|
Vec2i topLeft = m_flickerWindow->GetPosition();
|
||||||
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
||||||
|
|
||||||
m_flickerAxis = Vec2i(1, 1);
|
m_flickerAxis = Vec2i(1, 1);
|
||||||
@@ -1269,9 +1270,9 @@ namespace PortabilityLayer
|
|||||||
int32_t chromeLead = 64;
|
int32_t chromeLead = 64;
|
||||||
int32_t flickerZoneSize = 128;
|
int32_t flickerZoneSize = 128;
|
||||||
|
|
||||||
const Rect windowRect = window->GetDrawSurface()->m_port.GetRect();
|
const Rect windowRect = window->GetSurfaceRect();
|
||||||
|
|
||||||
Vec2i topLeft = Vec2i(m_flickerWindow->m_wmX, m_flickerWindow->m_wmY);
|
Vec2i topLeft = m_flickerWindow->GetPosition();
|
||||||
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
||||||
|
|
||||||
m_flickerAxis = Vec2i(-1, -1);
|
m_flickerAxis = Vec2i(-1, -1);
|
||||||
@@ -1323,7 +1324,7 @@ namespace PortabilityLayer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PortabilityLayer::Vec2i topLeft = PortabilityLayer::Vec2i(window->m_wmX, window->m_wmY);
|
const PortabilityLayer::Vec2i topLeft = window->GetPosition();
|
||||||
m_resizeInProgressRect = PortabilityLayer::Rect2i(topLeft, topLeft + size);
|
m_resizeInProgressRect = PortabilityLayer::Rect2i(topLeft, topLeft + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1379,12 +1380,13 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
uint32_t prevClearanceX = prevWidth - paddedWidth;
|
uint32_t prevClearanceX = prevWidth - paddedWidth;
|
||||||
uint32_t newClearanceX = newWidth - paddedWidth;
|
uint32_t newClearanceX = newWidth - paddedWidth;
|
||||||
newX = static_cast<int64_t>(window->m_wmX) * static_cast<int64_t>(newClearanceX) / static_cast<int64_t>(prevClearanceX);
|
newX = static_cast<int64_t>(window->GetPosition().m_x) * static_cast<int64_t>(newClearanceX) / static_cast<int64_t>(prevClearanceX);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t newY = 0;
|
int64_t newY = 0;
|
||||||
if (window->m_wmY < static_cast<int32_t>(menuBarHeight))
|
int32_t currentY = window->GetPosition().m_y;
|
||||||
newY = window->m_wmY;
|
if (currentY < static_cast<int32_t>(menuBarHeight))
|
||||||
|
newY = currentY;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (newHeight <= (paddedHeight + menuBarHeight) || prevHeight <= paddedHeight + menuBarHeight)
|
if (newHeight <= (paddedHeight + menuBarHeight) || prevHeight <= paddedHeight + menuBarHeight)
|
||||||
@@ -1393,15 +1395,14 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
uint32_t prevClearanceY = prevHeight - paddedHeight - menuBarHeight;
|
uint32_t prevClearanceY = prevHeight - paddedHeight - menuBarHeight;
|
||||||
uint32_t newClearanceY = newHeight - paddedHeight - menuBarHeight;
|
uint32_t newClearanceY = newHeight - paddedHeight - menuBarHeight;
|
||||||
newY = (static_cast<int64_t>(window->m_wmY) - static_cast<int64_t>(menuBarHeight) - chromePadding[WindowChromeSides::kTop]) * static_cast<int64_t>(newClearanceY) / static_cast<int64_t>(prevClearanceY) + menuBarHeight + chromePadding[WindowChromeSides::kTop];
|
newY = (static_cast<int64_t>(currentY) - static_cast<int64_t>(menuBarHeight) - chromePadding[WindowChromeSides::kTop]) * static_cast<int64_t>(newClearanceY) / static_cast<int64_t>(prevClearanceY) + menuBarHeight + chromePadding[WindowChromeSides::kTop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newX = std::max<int64_t>(0, std::min<int64_t>(newX, newWidth - 1));
|
newX = std::max<int64_t>(0, std::min<int64_t>(newX, newWidth - 1));
|
||||||
newY = std::max<int64_t>(0, std::min<int64_t>(newY, newHeight - 1));
|
newY = std::max<int64_t>(0, std::min<int64_t>(newY, newHeight - 1));
|
||||||
|
|
||||||
window->m_wmX = static_cast<int32_t>(newX);
|
window->SetPosition(Vec2i(newX, newY));
|
||||||
window->m_wmY = static_cast<int32_t>(newY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1412,8 +1413,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void WindowManagerImpl::MoveWindow(Window *window, int x, int y)
|
void WindowManagerImpl::MoveWindow(Window *window, int x, int y)
|
||||||
{
|
{
|
||||||
window->m_wmX = x;
|
window->SetPosition(Vec2i(x, y));
|
||||||
window->m_wmY = y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManagerImpl::DetachWindow(Window *window)
|
void WindowManagerImpl::DetachWindow(Window *window)
|
||||||
@@ -1477,7 +1477,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
bool hasFlicker = (m_flickerWindow == window);
|
bool hasFlicker = (m_flickerWindow == window);
|
||||||
|
|
||||||
DrawSurface &graf = window->m_surface;
|
DrawSurface &graf = *window->GetDrawSurface();
|
||||||
|
|
||||||
graf.PushToDDSurface(displayDriver);
|
graf.PushToDDSurface(displayDriver);
|
||||||
|
|
||||||
@@ -1485,10 +1485,12 @@ namespace PortabilityLayer
|
|||||||
const uint16_t width = pixMap->m_rect.Width();
|
const uint16_t width = pixMap->m_rect.Width();
|
||||||
const uint16_t height = pixMap->m_rect.Height();
|
const uint16_t height = pixMap->m_rect.Height();
|
||||||
|
|
||||||
if (hasFlicker)
|
const Vec2i windowPos = window->GetPosition();
|
||||||
ComputeFlickerEffects(Vec2i(window->m_wmX, window->m_wmY), 0, effects);
|
|
||||||
|
|
||||||
displayDriver->DrawSurface(graf.m_ddSurface, window->m_wmX, window->m_wmY, width, height, &effects);
|
if (hasFlicker)
|
||||||
|
ComputeFlickerEffects(windowPos, 0, effects);
|
||||||
|
|
||||||
|
displayDriver->DrawSurface(graf.m_ddSurface, windowPos.m_x, windowPos.m_y, width, height, &effects);
|
||||||
|
|
||||||
if (!window->IsBorderless())
|
if (!window->IsBorderless())
|
||||||
{
|
{
|
||||||
@@ -1496,10 +1498,10 @@ namespace PortabilityLayer
|
|||||||
window->GetChromePadding(chromePadding);
|
window->GetChromePadding(chromePadding);
|
||||||
|
|
||||||
Vec2i chromeOrigins[WindowChromeSides::kCount];
|
Vec2i chromeOrigins[WindowChromeSides::kCount];
|
||||||
chromeOrigins[WindowChromeSides::kTop] = Vec2i(window->m_wmX - chromePadding[WindowChromeSides::kLeft], window->m_wmY - chromePadding[WindowChromeSides::kTop]);
|
chromeOrigins[WindowChromeSides::kTop] = Vec2i(windowPos.m_x - chromePadding[WindowChromeSides::kLeft], windowPos.m_y - chromePadding[WindowChromeSides::kTop]);
|
||||||
chromeOrigins[WindowChromeSides::kLeft] = Vec2i(window->m_wmX - chromePadding[WindowChromeSides::kLeft], window->m_wmY);
|
chromeOrigins[WindowChromeSides::kLeft] = Vec2i(windowPos.m_x - chromePadding[WindowChromeSides::kLeft], windowPos.m_y);
|
||||||
chromeOrigins[WindowChromeSides::kRight] = Vec2i(window->m_wmX + width, window->m_wmY);
|
chromeOrigins[WindowChromeSides::kRight] = Vec2i(windowPos.m_x + width, windowPos.m_y);
|
||||||
chromeOrigins[WindowChromeSides::kBottom] = Vec2i(window->m_wmX - chromePadding[WindowChromeSides::kLeft], window->m_wmY + height);
|
chromeOrigins[WindowChromeSides::kBottom] = Vec2i(windowPos.m_x - chromePadding[WindowChromeSides::kLeft], windowPos.m_y + height);
|
||||||
|
|
||||||
Vec2i chromeDimensions[WindowChromeSides::kCount];
|
Vec2i chromeDimensions[WindowChromeSides::kCount];
|
||||||
chromeDimensions[WindowChromeSides::kTop] = Vec2i(chromePadding[WindowChromeSides::kLeft] + chromePadding[WindowChromeSides::kRight] + width, chromePadding[WindowChromeSides::kTop]);
|
chromeDimensions[WindowChromeSides::kTop] = Vec2i(chromePadding[WindowChromeSides::kLeft] + chromePadding[WindowChromeSides::kRight] + width, chromePadding[WindowChromeSides::kTop]);
|
||||||
|
|||||||
Reference in New Issue
Block a user