mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Fix up some level editor dialog behavior
This commit is contained in:
@@ -435,18 +435,17 @@ void SetDialogItemValue (Dialog *theDialog, short item, short theState)
|
||||
|
||||
void ToggleDialogItemValue (Dialog *theDialog, short item)
|
||||
{
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
int16_t itemType, theState;
|
||||
|
||||
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
|
||||
int16_t theState;
|
||||
|
||||
theState = itemRef.GetWidget()->GetState();
|
||||
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
|
||||
|
||||
theState = widget->GetState();
|
||||
if (theState == 0)
|
||||
theState = 1;
|
||||
else
|
||||
theState = 0;
|
||||
SetControlValue(itemHandle, theState);
|
||||
widget->SetState(theState);
|
||||
widget->DrawControl(theDialog->GetWindow()->GetDrawSurface());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetDialogNumToStr
|
||||
|
||||
@@ -173,10 +173,10 @@ void StartMarqueeHandled (Rect *, SInt16, SInt16);
|
||||
void StopMarquee (void);
|
||||
void PauseMarquee (void);
|
||||
void ResumeMarquee (void);
|
||||
void DragOutMarqueeRect (Point, Rect *);
|
||||
void DragMarqueeRect (DrawSurface *, Point, Rect *, Boolean, Boolean);
|
||||
void DragMarqueeHandle (DrawSurface *, Point, SInt16 *);
|
||||
void DragMarqueeCorner (DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
|
||||
void DragOutMarqueeRect (Window *, Point, Rect *);
|
||||
void DragMarqueeRect (Window *, DrawSurface *, Point, Rect *, Boolean, Boolean);
|
||||
void DragMarqueeHandle (Window *, DrawSurface *, Point, SInt16 *);
|
||||
void DragMarqueeCorner (Window *, DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
|
||||
Boolean MarqueeHasHandles (SInt16 *, SInt16 *);
|
||||
Boolean PtInMarqueeHandle (Point);
|
||||
void SetMarqueeGliderRect (SInt16, SInt16);
|
||||
@@ -306,7 +306,7 @@ void DrawCustPictSansWhite (SInt16, Rect *);
|
||||
|
||||
void DrawARoomsObjects (SInt16, Boolean); // --- ObjectDrawAll.c
|
||||
|
||||
void DoSelectionClick (DrawSurface *, Point, Boolean); // --- ObjectEdit.c
|
||||
void DoSelectionClick (Window *, DrawSurface *, Point, Boolean); // --- ObjectEdit.c
|
||||
void DoNewObjectClick (Point);
|
||||
void DeleteObject (void);
|
||||
void DuplicateObject (void);
|
||||
|
||||
@@ -389,7 +389,7 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
if (toolSelected == kSelectTool)
|
||||
DoSelectionClick(mainWindowSurface, wherePt, isDoubleClick);
|
||||
DoSelectionClick(mainWindow, mainWindowSurface, wherePt, isDoubleClick);
|
||||
else
|
||||
DoNewObjectClick(wherePt);
|
||||
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
#include "Externs.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "InputManager.h"
|
||||
#include "Marquee.h"
|
||||
#include "Objects.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#define kMarqueePatListID 128
|
||||
@@ -186,7 +188,7 @@ void ResumeMarquee (void)
|
||||
|
||||
//-------------------------------------------------------------- DragOutMarqueeRect
|
||||
|
||||
void DragOutMarqueeRect (Point start, Rect *theRect)
|
||||
void DragOutMarqueeRect (Window *window, Point start, Rect *theRect)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
@@ -200,8 +202,8 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
|
||||
|
||||
while (WaitMouseUp())
|
||||
{
|
||||
GetMouse(&newPt);
|
||||
if (DeltaPoint(wasPt, newPt))
|
||||
GetMouse(window, &newPt);
|
||||
if (wasPt != newPt)
|
||||
{
|
||||
surface->InvertFrameRect(*theRect, pattern);
|
||||
QSetRect(theRect, start.h, start.v, newPt.h, newPt.v);
|
||||
@@ -215,7 +217,7 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeRect
|
||||
|
||||
void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
||||
void DragMarqueeRect (Window *window, DrawSurface *surface, Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
@@ -230,8 +232,8 @@ void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
{
|
||||
GetMouse(&newPt);
|
||||
if (DeltaPoint(wasPt, newPt))
|
||||
GetMouse(window, &newPt);
|
||||
if (wasPt != newPt)
|
||||
{
|
||||
if (lockV)
|
||||
deltaH = 0;
|
||||
@@ -257,7 +259,7 @@ void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeHandle
|
||||
|
||||
void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
|
||||
void DragMarqueeHandle (Window *window, DrawSurface *surface, Point start, short *dragged)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
@@ -275,8 +277,8 @@ void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
{
|
||||
GetMouse(&newPt);
|
||||
if (DeltaPoint(wasPt, newPt))
|
||||
GetMouse(window, &newPt);
|
||||
if (wasPt != newPt)
|
||||
{
|
||||
switch (theMarquee.direction)
|
||||
{
|
||||
@@ -343,7 +345,7 @@ void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeCorner
|
||||
|
||||
void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, short *vDragged, Boolean isTop)
|
||||
void DragMarqueeCorner (Window *window, DrawSurface *surface, Point start, short *hDragged, short *vDragged, Boolean isTop)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
@@ -358,8 +360,8 @@ void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, shor
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
{
|
||||
GetMouse(&newPt);
|
||||
if (DeltaPoint(wasPt, newPt))
|
||||
GetMouse(window, &newPt);
|
||||
if (wasPt != newPt)
|
||||
{
|
||||
deltaH = newPt.h - wasPt.h;
|
||||
if (isTop)
|
||||
@@ -490,7 +492,12 @@ void DrawMarquee (DrawSurface *surface, const uint8_t *pattern)
|
||||
break;
|
||||
}
|
||||
|
||||
surface->InvertFillRect(Rect::Create(points[0].v, points[0].h, points[1].v, points[1].h), pattern);
|
||||
if (points[1].h < points[0].h)
|
||||
std::swap(points[0].h, points[1].h);
|
||||
if (points[1].v < points[0].v)
|
||||
std::swap(points[0].v, points[1].v);
|
||||
|
||||
surface->InvertFillRect(Rect::Create(points[0].v, points[0].h, points[1].v + 1, points[1].h + 1), pattern);
|
||||
}
|
||||
|
||||
if (gliderMarqueeUp)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
|
||||
short FindObjectSelected (Point);
|
||||
void DragHandle (DrawSurface *, Point);
|
||||
void DragObject (DrawSurface *, Point);
|
||||
void DragHandle (Window *, DrawSurface *, Point);
|
||||
void DragObject (Window *, DrawSurface *, Point);
|
||||
void AddObjectPairing (void);
|
||||
Boolean ObjectIsUpBlower (objectType *);
|
||||
|
||||
@@ -74,7 +74,7 @@ short FindObjectSelected (Point where)
|
||||
|
||||
//-------------------------------------------------------------- DoSelectionClick
|
||||
|
||||
void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
void DoSelectionClick (Window *window, DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
short direction, dist;
|
||||
@@ -84,7 +84,7 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
if ((PtInMarqueeHandle(where)) && (objActive != kNoObjectSelected))
|
||||
{
|
||||
if (StillDown())
|
||||
DragHandle(surface, where);
|
||||
DragHandle(window, surface, where);
|
||||
if (ObjectHasHandle(&direction, &dist))
|
||||
{
|
||||
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
|
||||
@@ -117,7 +117,7 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
else
|
||||
{
|
||||
if (StillDown())
|
||||
DragObject(surface, where);
|
||||
DragObject(window, surface, where);
|
||||
if (ObjectHasHandle(&direction, &dist))
|
||||
{
|
||||
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
|
||||
@@ -144,7 +144,7 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
//-------------------------------------------------------------- DragHandle
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragHandle (DrawSurface *surface, Point where)
|
||||
void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
{
|
||||
short hDelta, vDelta;
|
||||
Boolean whoCares;
|
||||
@@ -164,7 +164,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kGrecoVent:
|
||||
case kSewerBlower:
|
||||
vDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -172,7 +172,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kLiftArea:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
vDelta = thisRoom->objects[objActive].data.a.tall * 2;
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
thisRoom->objects[objActive].data.a.tall = vDelta / 2;
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -185,7 +185,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kLeftFan:
|
||||
case kRightFan:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -195,13 +195,13 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
((thisRoom->objects[objActive].data.a.vector & 0x0F) == 4))
|
||||
{
|
||||
vDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = vDelta;
|
||||
}
|
||||
else
|
||||
{
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
}
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -211,7 +211,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kShelf:
|
||||
case kDeckTable:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -226,7 +226,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kInvisBounce:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.b.bounds.bottom =
|
||||
@@ -242,7 +242,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kDresser:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, true);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, true);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.b.bounds.top =
|
||||
@@ -258,7 +258,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kGreaseLf:
|
||||
case kSlider:
|
||||
hDelta = thisRoom->objects[objActive].data.c.length;
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.c.length = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
@@ -270,7 +270,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kInvisTrans:
|
||||
hDelta = thisRoom->objects[objActive].data.d.wide;
|
||||
vDelta = thisRoom->objects[objActive].data.d.tall;
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
if (hDelta > 127)
|
||||
hDelta = 127;
|
||||
thisRoom->objects[objActive].data.d.wide = (Byte)hDelta;
|
||||
@@ -285,7 +285,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kDeluxeTrans:
|
||||
hDelta = ((thisRoom->objects[objActive].data.d.tall & 0xFF00) >> 8) * 4;
|
||||
vDelta = (thisRoom->objects[objActive].data.d.tall & 0x00FF) * 4;
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
if (hDelta < 64)
|
||||
hDelta = 64;
|
||||
if (vDelta < 32)
|
||||
@@ -301,7 +301,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kFlourescent:
|
||||
case kTrackLight:
|
||||
hDelta = thisRoom->objects[objActive].data.f.length;
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.f.length = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
@@ -312,7 +312,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
|
||||
case kToaster:
|
||||
vDelta = thisRoom->objects[objActive].data.g.height;
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.g.height = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -321,7 +321,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kDrip:
|
||||
case kFish:
|
||||
vDelta = thisRoom->objects[objActive].data.h.length;
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.h.length = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -330,7 +330,7 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
case kWallWindow:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.i.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.i.bounds);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.i.bounds.right =
|
||||
thisRoom->objects[objActive].data.i.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.i.bounds.bottom =
|
||||
@@ -352,30 +352,30 @@ void DragHandle (DrawSurface *surface, Point where)
|
||||
//-------------------------------------------------------------- DragObject
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragObject (DrawSurface *surface, Point where)
|
||||
void DragObject (Window *window, DrawSurface *surface, Point where)
|
||||
{
|
||||
Rect newRect, wasRect;
|
||||
short deltaH, deltaV, increment;
|
||||
char wasState;
|
||||
Boolean invalAll;
|
||||
Boolean invalAll = false;
|
||||
|
||||
if (objActive == kInitialGliderSelected)
|
||||
{
|
||||
wasRect = initialGliderRect;
|
||||
newRect = initialGliderRect;
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, false);
|
||||
}
|
||||
else if (objActive == kLeftGliderSelected)
|
||||
{
|
||||
wasRect = leftStartGliderDest;
|
||||
newRect = leftStartGliderDest;
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, true);
|
||||
}
|
||||
else if (objActive == kRightGliderSelected)
|
||||
{
|
||||
wasRect = rightStartGliderDest;
|
||||
newRect = rightStartGliderDest;
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -412,13 +412,13 @@ void DragObject (DrawSurface *surface, Point where)
|
||||
case kCopterRt:
|
||||
case kMousehole:
|
||||
case kFireplace:
|
||||
DragMarqueeRect(surface, where, &newRect, true, false);
|
||||
DragMarqueeRect(window, surface, where, &newRect, true, false);
|
||||
invalAll = false;
|
||||
break;
|
||||
|
||||
case kDartLf:
|
||||
case kDartRt:
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, true);
|
||||
invalAll = false;
|
||||
break;
|
||||
|
||||
@@ -439,14 +439,14 @@ void DragObject (DrawSurface *surface, Point where)
|
||||
case kDeluxeTrans:
|
||||
case kMirror:
|
||||
case kWallWindow:
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, false);
|
||||
invalAll = true;
|
||||
break;
|
||||
|
||||
case kCounter:
|
||||
case kDresser:
|
||||
case kTrackLight:
|
||||
DragMarqueeRect(surface, where, &newRect, true, false);
|
||||
DragMarqueeRect(window, surface, where, &newRect, true, false);
|
||||
invalAll = true;
|
||||
break;
|
||||
|
||||
@@ -516,7 +516,7 @@ void DragObject (DrawSurface *surface, Point where)
|
||||
case kFaucet:
|
||||
case kRug:
|
||||
case kChimes:
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
DragMarqueeRect(window, surface, where, &newRect, false, false);
|
||||
invalAll = false;
|
||||
break;
|
||||
}
|
||||
@@ -749,23 +749,11 @@ void DragObject (DrawSurface *surface, Point where)
|
||||
{
|
||||
}
|
||||
GetThisRoomsObjRects();
|
||||
if (invalAll)
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
else
|
||||
{
|
||||
InvalWindowRect(mainWindow, &wasRect);
|
||||
if (objActive == kInitialGliderSelected)
|
||||
InvalWindowRect(mainWindow, &initialGliderRect);
|
||||
else if (objActive == kLeftGliderSelected)
|
||||
InvalWindowRect(mainWindow, &leftStartGliderDest);
|
||||
else if (objActive == kRightGliderSelected)
|
||||
InvalWindowRect(mainWindow, &rightStartGliderDest);
|
||||
else
|
||||
InvalWindowRect(mainWindow, &roomObjectRects[objActive]);
|
||||
}
|
||||
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
|
||||
UpdateMainWindow();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1140,11 +1128,12 @@ void DeleteObject (void)
|
||||
thisRoom->numObjects--;
|
||||
fileDirty = true;
|
||||
UpdateMenus(false);
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
QSetRect(&roomObjectRects[objActive], -1, -1, 0, 0);
|
||||
DeselectObject();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
|
||||
UpdateMainWindow();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "Externs.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -78,7 +80,7 @@ void UpdateInvisBonusInfo (Dialog *);
|
||||
void UpdateTransInfo (Dialog *);
|
||||
void UpdateEnemyInfo (Dialog *);
|
||||
void UpdateFlowerInfo (Dialog *);
|
||||
Boolean BlowerFilter (Dialog *, EventRecord *, short *);
|
||||
int16_t BlowerFilter (Dialog *, const TimeTaggedVOSEvent *evt);
|
||||
Boolean FurnitureFilter (Dialog *, EventRecord *, short *);
|
||||
Boolean CustPictFilter (Dialog *, EventRecord *, short *);
|
||||
Boolean SwitchFilter (Dialog *, EventRecord *, short *);
|
||||
@@ -124,12 +126,16 @@ void UpdateBlowerInfo (Dialog *theDialog)
|
||||
{
|
||||
#define kArrowheadLength 4
|
||||
Rect bounds;
|
||||
|
||||
Window *window = theDialog->GetWindow();
|
||||
DrawSurface *surface = window->GetDrawSurface();
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect((*surface->m_port.GetPixMap())->m_rect);
|
||||
|
||||
window->DrawControls();
|
||||
|
||||
DrawDialog(theDialog);
|
||||
DrawDefaultButton(theDialog);
|
||||
FrameDialogItemC(theDialog, 5, kRedOrangeColor8);
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
if ((thisRoom->objects[objActive].what != kLeftFan) &&
|
||||
(thisRoom->objects[objActive].what != kRightFan))
|
||||
@@ -143,6 +149,8 @@ void UpdateBlowerInfo (Dialog *theDialog)
|
||||
bounds.right -= 2;
|
||||
bounds.bottom -= 2;
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
for (int16_t offsetChunk = 0; offsetChunk < 4; offsetChunk++)
|
||||
{
|
||||
const int16_t xOffset = offsetChunk & 1;
|
||||
@@ -153,39 +161,39 @@ void UpdateBlowerInfo (Dialog *theDialog)
|
||||
switch (newDirection)
|
||||
{
|
||||
case 1: // up
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(0, RectTall(&bounds)));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
{
|
||||
const Point basePoint = offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top);
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(0, RectTall(&bounds)));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // right
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-RectWide(&bounds), 0));
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
{
|
||||
const Point basePoint = offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(-RectWide(&bounds), 0));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // down
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(0, RectTall(&bounds)));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom),
|
||||
offset + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom),
|
||||
offset + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
{
|
||||
const Point basePoint = offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom);
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(0, -RectTall(&bounds)));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // left
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(RectWide(&bounds), 0));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
{
|
||||
const Point basePoint = offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(RectWide(&bounds), 0));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -347,56 +355,36 @@ void UpdateFlowerInfo (Dialog *theDialog)
|
||||
|
||||
//-------------------------------------------------------------- BlowerFilter
|
||||
|
||||
Boolean BlowerFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t BlowerFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
switch (event->what)
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
if (evt->IsKeyDownEvent())
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
const GpKeyboardInputEvent &keyboardEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
||||
|
||||
switch (PackVOSKeyCode(keyboardEvent))
|
||||
{
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
FlashDialogButton(dial, kOkayButton);
|
||||
*item = kOkayButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
return kOkayButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
FlashDialogButton(dial, kCancelButton);
|
||||
*item = kCancelButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kTab):
|
||||
// SelectDialogItemText(dial, kRoomNameItem, 0, 1024);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case mouseUp:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPortDialogPort(dial);
|
||||
UpdateBlowerInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
return kCancelButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kTab):
|
||||
// SelectDialogItemText(dial, kRoomNameItem, 0, 1024);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FurnitureFilter
|
||||
@@ -985,7 +973,9 @@ void DoBlowerObjectInfo (short what)
|
||||
|
||||
if (retroLinkList[objActive].room == -1)
|
||||
HideDialogItem(infoDial, 15);
|
||||
|
||||
|
||||
UpdateBlowerInfo(infoDial);
|
||||
|
||||
ShowWindow(infoDial->GetWindow());
|
||||
|
||||
leaving = false;
|
||||
@@ -993,7 +983,7 @@ void DoBlowerObjectInfo (short what)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(BlowerFilter, &item);
|
||||
item = infoDial->ExecuteModal(BlowerFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1012,10 +1002,10 @@ void DoBlowerObjectInfo (short what)
|
||||
if (KeepObjectLegal())
|
||||
{
|
||||
}
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
UpdateMainWindow();
|
||||
}
|
||||
fileDirty = true;
|
||||
UpdateMenus(false);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
void UpdateRoomInfoDialog (Dialog *);
|
||||
void DragMiniTile (DrawSurface *, Point, short *);
|
||||
void DragMiniTile (Window *, DrawSurface *, Point, short *);
|
||||
void HiliteTileOver (DrawSurface *, Point);
|
||||
int16_t RoomFilter (Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
@@ -125,7 +125,7 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
|
||||
//-------------------------------------------------------------- DragMiniTile
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragMiniTile (DrawSurface *surface, Point mouseIs, short *newTileOver)
|
||||
void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *newTileOver)
|
||||
{
|
||||
Rect dragRect;
|
||||
Point mouseWas;
|
||||
@@ -146,8 +146,8 @@ void DragMiniTile (DrawSurface *surface, Point mouseIs, short *newTileOver)
|
||||
mouseWas = mouseIs;
|
||||
while (WaitMouseUp()) // loop until mouse button let up
|
||||
{
|
||||
GetMouse(&mouseIs); // get mouse coords
|
||||
if (DeltaPoint(mouseWas, mouseIs) != 0L) // the mouse has moved
|
||||
GetMouse(window, &mouseIs); // get mouse coords
|
||||
if (mouseWas != mouseIs) // the mouse has moved
|
||||
{
|
||||
surface->InvertFrameRect(dragRect, pattern);
|
||||
QOffsetRect(&dragRect, mouseIs.h - mouseWas.h, 0);
|
||||
@@ -358,6 +358,7 @@ int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
Window *window = dial->GetWindow();
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (evt->IsKeyDownEvent())
|
||||
@@ -393,7 +394,7 @@ int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
if (StillDown())
|
||||
{
|
||||
DragMiniTile(surface, mouseIs, &newTileOver);
|
||||
DragMiniTile(window, surface, mouseIs, &newTileOver);
|
||||
if ((newTileOver >= 0) && (newTileOver < kNumTiles))
|
||||
{
|
||||
tempTiles[newTileOver] = tileOver;
|
||||
|
||||
@@ -108,9 +108,14 @@ void OpenMessageWindow (const PLPasStr &title)
|
||||
|
||||
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
||||
|
||||
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mssgWindowRect, windowStyle, false, 0, 0, title);
|
||||
Rect placementRect = mssgWindowRect;
|
||||
CenterRectInRect(&placementRect, &thisMac.screen);
|
||||
|
||||
mssgWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(wdef);
|
||||
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(placementRect, windowStyle, false, 0, 0, title);
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
mssgWindow = wm->CreateWindow(wdef);
|
||||
wm->PutWindowBehind(mssgWindow, wm->GetPutInFrontSentinel());
|
||||
|
||||
if (mssgWindow != nil)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user