mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Add some initial widget functionality (prefs partly working)
This commit is contained in:
@@ -46,9 +46,6 @@ void DoAbout (void)
|
||||
VersRecHndl version;
|
||||
ControlHandle itemHandle;
|
||||
short itemType, hit, wasResFile;
|
||||
ModalFilterUPP aboutFilterUPP;
|
||||
|
||||
aboutFilterUPP = NewModalFilterUPP(AboutFilter);
|
||||
|
||||
wasResFile = CurResFile();
|
||||
UseResFile(thisMac.thisResFile);
|
||||
@@ -84,14 +81,13 @@ void DoAbout (void)
|
||||
|
||||
do // Loop until user wants to exit
|
||||
{
|
||||
ModalDialog(aboutFilterUPP, &hit);
|
||||
ModalDialog(AboutFilter, &hit);
|
||||
}
|
||||
while ((hit != kOkayButton) && (okayButtScanlineMask != nil));
|
||||
|
||||
if (okayButtScanlineMask != nil)
|
||||
okayButtScanlineMask->Destroy(); // Clean up!
|
||||
DisposeDialog(aboutDialog);
|
||||
DisposeModalFilterUPP(aboutFilterUPP);
|
||||
|
||||
UseResFile(wasResFile);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ void DisplayStarsRemaining (void)
|
||||
else
|
||||
{
|
||||
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
|
||||
const Point textPoint = Point::Create(bounds.left + 102 - (StringWidth(theStr) / 2), bounds.top + 23);
|
||||
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
|
||||
ColorText(surface, textPoint, theStr, 4L);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include "DialogManager.h"
|
||||
#include "PLArrayView.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLLowMem.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLWidgets.h"
|
||||
#include "QDStandardPalette.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
@@ -33,7 +33,7 @@ void BringUpDialog (Dialog **theDialog, short dialogID)
|
||||
// CenterDialog(dialogID);
|
||||
if (*theDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)*theDialog);
|
||||
SetGraphicsPort(&(*theDialog)->GetWindow()->m_graf);
|
||||
ShowWindow((*theDialog)->GetWindow());
|
||||
DrawDefaultButton(*theDialog);
|
||||
}
|
||||
@@ -342,11 +342,12 @@ void FlashDialogButton (Dialog *theDialog, short itemNumber)
|
||||
ControlHandle itemHandle;
|
||||
UInt32 dummyLong;
|
||||
short itemType;
|
||||
|
||||
GetDialogItem(theDialog, itemNumber, &itemType, &itemHandle, &itemRect);
|
||||
HiliteControl(itemHandle, kControlButtonPart);
|
||||
|
||||
PortabilityLayer::Widget *widget = theDialog->GetItems()[itemNumber - 1].GetWidget();
|
||||
|
||||
widget->SetHighlightStyle(kControlButtonPart);
|
||||
Delay(8, &dummyLong);
|
||||
HiliteControl(itemHandle, 0);
|
||||
widget->SetHighlightStyle(0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawDefaultButton
|
||||
@@ -355,10 +356,9 @@ void FlashDialogButton (Dialog *theDialog, short itemNumber)
|
||||
|
||||
void DrawDefaultButton (Dialog *theDialog)
|
||||
{
|
||||
DialogItem *firstItem = *theDialog->GetItems().begin();
|
||||
Rect itemRect = firstItem->GetRect();
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
const PortabilityLayer::DialogItem &firstItem = *theDialog->GetItems().begin();
|
||||
Rect itemRect = firstItem.GetWidget()->GetRect();
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
InsetRect(&itemRect, -4, -4);
|
||||
|
||||
@@ -369,7 +369,7 @@ void DrawDefaultButton (Dialog *theDialog)
|
||||
for (int yOffset = 0; yOffset < 3; yOffset++)
|
||||
{
|
||||
const Rect offsetRect = itemRect + Point::Create(xOffset, yOffset);
|
||||
surface->FrameRoundRect(itemRect, 8, 8);
|
||||
surface->FrameRoundRect(offsetRect, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,12 +437,7 @@ void GetDialogItemValue (Dialog *theDialog, short item, short *theState)
|
||||
|
||||
void SetDialogItemValue (Dialog *theDialog, short item, short theState)
|
||||
{
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
short itemType;
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
SetControlValue(itemHandle, theState);
|
||||
theDialog->GetItems()[item - 1].GetWidget()->SetState(theState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ToggleDialogItemValue
|
||||
@@ -500,7 +495,7 @@ void GetDialogNumFromStr (Dialog *theDialog, short item, long *theNumber)
|
||||
|
||||
void GetDialogItemRect (Dialog *theDialog, short item, Rect *theRect)
|
||||
{
|
||||
*theRect = theDialog->GetItems()[item - 1]->GetRect();
|
||||
*theRect = theDialog->GetItems()[item - 1].GetWidget()->GetRect();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetDialogItemRect
|
||||
@@ -539,18 +534,10 @@ void OffsetDialogItemRect (Dialog *theDialog, short item, short h, short v)
|
||||
|
||||
void SelectFromRadioGroup (Dialog *dial, short which, short first, short last)
|
||||
{
|
||||
Rect iRect;
|
||||
ControlHandle iHandle;
|
||||
short iType, i;
|
||||
for (int i = first; i <= last; i++)
|
||||
dial->GetItems()[i - 1].GetWidget()->SetState(0);
|
||||
|
||||
for (i = first; i <= last; i++)
|
||||
{
|
||||
GetDialogItem(dial, i, &iType, &iHandle, &iRect);
|
||||
SetControlValue(iHandle, (short)false);
|
||||
}
|
||||
|
||||
GetDialogItem(dial, which, &iType, &iHandle, &iRect);
|
||||
SetControlValue(iHandle, (short)true);
|
||||
dial->GetItems()[which - 1].GetWidget()->SetState(1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- AddMenuToPopUp
|
||||
@@ -614,9 +601,8 @@ void MyDisableControl (Dialog *theDialog, short whichItem)
|
||||
Rect iRect;
|
||||
ControlHandle iHandle;
|
||||
short iType;
|
||||
|
||||
GetDialogItem(theDialog, whichItem, &iType, &iHandle, &iRect);
|
||||
HiliteControl(iHandle, kInactive);
|
||||
|
||||
theDialog->GetItems()[whichItem - 1].GetWidget()->SetEnabled(false);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawDialogUserText
|
||||
@@ -626,22 +612,20 @@ void MyDisableControl (Dialog *theDialog, short whichItem)
|
||||
|
||||
void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean invert)
|
||||
{
|
||||
Rect iRect;
|
||||
ControlHandle iHandle;
|
||||
Str255 newString, stringCopy;
|
||||
short iType, textLong, i, inset;
|
||||
Str255 stringCopy;
|
||||
short iType, i, inset;
|
||||
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
||||
|
||||
PasStringCopy(text, stringCopy);
|
||||
GetDialogItem(dial, item, &iType, &iHandle, &iRect);
|
||||
if ((StringWidth(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||
CollapseStringToWidth(stringCopy, iRect.right - iRect.left - 2);
|
||||
textLong = stringCopy[0];
|
||||
for (i = 0; i < textLong; i++)
|
||||
newString[i] = stringCopy[i + 1];
|
||||
|
||||
Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
|
||||
|
||||
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
|
||||
|
||||
OffsetRect(&iRect, 0, 1);
|
||||
|
||||
@@ -650,12 +634,20 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
OffsetRect(&iRect, 0, -1);
|
||||
|
||||
inset = ((iRect.right - iRect.left) - (StringWidth(stringCopy) + 2)) / 2;
|
||||
|
||||
short strWidth = surface->MeasureString(stringCopy);
|
||||
inset = ((iRect.right - iRect.left) - (strWidth + 2)) / 2;
|
||||
iRect.left += inset;
|
||||
iRect.right -= inset;
|
||||
|
||||
TETextBox(newString, textLong, &iRect, teCenter);
|
||||
|
||||
// Draw centered
|
||||
PL_NotYetImplemented_TODO("Clip to iRect");
|
||||
|
||||
const int32_t ascender = surface->MeasureFontAscender();
|
||||
|
||||
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
|
||||
surface->DrawString(centeredDrawPoint, stringCopy);
|
||||
|
||||
if (invert)
|
||||
{
|
||||
OffsetRect(&iRect, 0, 1);
|
||||
@@ -680,8 +672,8 @@ void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
|
||||
|
||||
PasStringCopy(text, stringCopy);
|
||||
GetDialogItem(dial, item, &iType, &iHandle, &iRect);
|
||||
if ((StringWidth(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||
CollapseStringToWidth(stringCopy, iRect.right - iRect.left - 2);
|
||||
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy);
|
||||
@@ -723,12 +715,8 @@ void FrameDialogItem (Dialog *theDialog, short item)
|
||||
|
||||
void FrameDialogItemC (Dialog *theDialog, short item, long color)
|
||||
{
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
short itemType;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
const Rect itemRect = theDialog->GetItems()[item - 1].GetWidget()->GetRect();
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color]);
|
||||
|
||||
@@ -183,7 +183,7 @@ void PasStringConcat (StringPtr, const PLPasStr &);
|
||||
void GetLineOfText (StringPtr, short, StringPtr);
|
||||
void WrapText (StringPtr, short);
|
||||
void GetFirstWordOfString (StringPtr, StringPtr);
|
||||
void CollapseStringToWidth (StringPtr, short);
|
||||
void CollapseStringToWidth (DrawSurface *, StringPtr, short);
|
||||
void GetChooserName (StringPtr);
|
||||
StringPtr GetLocalizedString (short, StringPtr);
|
||||
|
||||
@@ -198,7 +198,7 @@ void RedAlert (short);
|
||||
void LoadGraphic (DrawSurface *, short);
|
||||
void LoadScaledGraphic (DrawSurface *, short, Rect *);
|
||||
void LargeIconPlot (Rect *, short);
|
||||
void DrawCIcon (short, short, short);
|
||||
void DrawCIcon (DrawSurface *surface, short, short, short);
|
||||
char KeyMapOffsetFromRawKey (char);
|
||||
long LongSquareRoot (long);
|
||||
Boolean WaitForInputEvent (short);
|
||||
|
||||
@@ -141,11 +141,11 @@ void DrawHighScores (DrawSurface *surface)
|
||||
PasStringConcat(tempStr, thisHouseName);
|
||||
PasStringConcat(tempStr, PSTR(" <20>"));
|
||||
|
||||
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2) - 1, dropIt - 66);
|
||||
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2) - 1, dropIt - 66);
|
||||
surface->SetForeColor(blackColor);
|
||||
surface->DrawString(scoreShadowPoint, tempStr);
|
||||
|
||||
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2), dropIt - 65);
|
||||
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2), dropIt - 65);
|
||||
surface->SetForeColor(cyanColor);
|
||||
surface->DrawString(scoreTextPoint, tempStr);
|
||||
|
||||
@@ -154,7 +154,7 @@ void DrawHighScores (DrawSurface *surface)
|
||||
thisHousePtr = *thisHouse;
|
||||
// message for score #1
|
||||
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
|
||||
bannerWidth = StringWidth(tempStr);
|
||||
bannerWidth = surface->MeasureString(tempStr);
|
||||
surface->SetForeColor(blackColor);
|
||||
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
|
||||
surface->DrawString(topScoreShadowPoint, tempStr);
|
||||
@@ -490,9 +490,6 @@ void GetHighScoreName (short place)
|
||||
Str255 scoreStr, placeStr, tempStr;
|
||||
short item;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP nameFilterUPP;
|
||||
|
||||
nameFilterUPP = NewModalFilterUPP(NameFilter);
|
||||
|
||||
InitCursor();
|
||||
NumToString(theScore, scoreStr);
|
||||
@@ -507,7 +504,7 @@ void GetHighScoreName (short place)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(nameFilterUPP, &item);
|
||||
ModalDialog(NameFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -518,7 +515,6 @@ void GetHighScoreName (short place)
|
||||
}
|
||||
|
||||
DisposeDialog(theDial);
|
||||
DisposeModalFilterUPP(nameFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateBannerDialog
|
||||
@@ -599,9 +595,6 @@ void GetHighScoreBanner (void)
|
||||
Str255 tempStr;
|
||||
short item;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP bannerFilterUPP;
|
||||
|
||||
bannerFilterUPP = NewModalFilterUPP(BannerFilter);
|
||||
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
BringUpDialog(&theDial, kHighBannerDialogID);
|
||||
@@ -611,7 +604,7 @@ void GetHighScoreBanner (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(bannerFilterUPP, &item);
|
||||
ModalDialog(BannerFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -620,9 +613,6 @@ void GetHighScoreBanner (void)
|
||||
leaving = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(theDial);
|
||||
DisposeModalFilterUPP(bannerFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- OpenHighScoresFile
|
||||
|
||||
@@ -623,7 +623,7 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateGoToDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -651,9 +651,7 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
long tempLong;
|
||||
short item, roomToGoTo;
|
||||
Boolean leaving, canceled;
|
||||
ModalFilterUPP goToFilterUPP;
|
||||
|
||||
goToFilterUPP = NewModalFilterUPP(GoToFilter);
|
||||
|
||||
BringUpDialog(&theDialog, kGoToDialogID);
|
||||
|
||||
if (GetFirstRoomNumber() == thisRoomNumber)
|
||||
@@ -670,7 +668,7 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(goToFilterUPP, &item);
|
||||
ModalDialog(GoToFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -700,7 +698,6 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
}
|
||||
|
||||
DisposeDialog(theDialog);
|
||||
DisposeModalFilterUPP(goToFilterUPP);
|
||||
|
||||
if (!canceled)
|
||||
{
|
||||
|
||||
@@ -612,7 +612,7 @@ Boolean ReadHouse (void)
|
||||
short whichRoom;
|
||||
|
||||
// There should be no padding remaining the house type
|
||||
PL_STATIC_ASSERT(sizeof(houseType) - sizeof(roomType) == houseType::kBinaryDataSize + 2);
|
||||
GP_STATIC_ASSERT(sizeof(houseType) - sizeof(roomType) == houseType::kBinaryDataSize + 2);
|
||||
|
||||
if (!houseOpen)
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateHouseInfoDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -208,9 +208,7 @@ void DoHouseInfo (void)
|
||||
short item, numRooms, version;
|
||||
char wasState;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP houseFilterUPP;
|
||||
|
||||
houseFilterUPP = NewModalFilterUPP(HouseFilter);
|
||||
|
||||
tempPhoneBit = phoneBitSet;
|
||||
|
||||
numRooms = RealRoomNumberCount();
|
||||
@@ -246,7 +244,7 @@ void DoHouseInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(houseFilterUPP, &item);
|
||||
ModalDialog(HouseFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -290,7 +288,6 @@ void DoHouseInfo (void)
|
||||
}
|
||||
InitCursor();
|
||||
DisposeDialog(houseInfoDialog);
|
||||
DisposeModalFilterUPP(houseFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- WarnLockingHouse
|
||||
|
||||
@@ -690,7 +690,7 @@ Boolean ResumeFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
case updateEvt:
|
||||
if ((WindowPtr)event->message == dial->GetWindow())
|
||||
{
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateResumeDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -719,9 +719,6 @@ short QueryResumeGame (void)
|
||||
short hitWhat, hadGliders;
|
||||
char wasState;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP resumeFilterUPP;
|
||||
|
||||
resumeFilterUPP = NewModalFilterUPP(ResumeFilter);
|
||||
|
||||
// get score & num. gliders
|
||||
thisHousePtr = *thisHouse;
|
||||
@@ -746,14 +743,13 @@ short QueryResumeGame (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(resumeFilterUPP, &hitWhat);
|
||||
ModalDialog(ResumeFilter, &hitWhat);
|
||||
if ((hitWhat == kSheWantsNewGame) || (hitWhat == kSheWantsResumeGame))
|
||||
{
|
||||
leaving = true;
|
||||
}
|
||||
}
|
||||
DisposeDialog(theDial);
|
||||
DisposeModalFilterUPP(resumeFilterUPP);
|
||||
|
||||
return (hitWhat);
|
||||
}
|
||||
|
||||
@@ -1067,7 +1067,7 @@ void DrawCalendar (Rect *theRect)
|
||||
GetTime(&timeRec);
|
||||
GetIndString(monthStr, kMonthStringID, timeRec.month);
|
||||
|
||||
const Point textPos = Point::Create(theRect->left + ((64 - StringWidth(monthStr)) / 2), theRect->top + 55);
|
||||
const Point textPos = Point::Create(theRect->left + ((64 - backSrcMap->MeasureString(monthStr)) / 2), theRect->top + 55);
|
||||
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ Boolean BlowerFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateBlowerInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -421,7 +421,7 @@ Boolean FurnitureFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateFurnitureInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -456,7 +456,7 @@ Boolean CustPictFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateCustPictInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -497,7 +497,7 @@ Boolean SwitchFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateSwitchInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -543,7 +543,7 @@ Boolean TriggerFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateTriggerInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -592,7 +592,7 @@ Boolean LightFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateLightInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -646,7 +646,7 @@ Boolean ApplianceFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateApplianceInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -695,7 +695,7 @@ Boolean MicrowaveFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateMicrowaveInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -736,7 +736,7 @@ Boolean GreaseFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateGreaseInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -771,7 +771,7 @@ Boolean InvisBonusFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateInvisBonusInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -812,7 +812,7 @@ Boolean TransFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateTransInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -866,7 +866,7 @@ Boolean EnemyFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateEnemyInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -915,7 +915,7 @@ Boolean FlowerFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateFlowerInfo(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -936,9 +936,6 @@ void DoBlowerObjectInfo (short what)
|
||||
Str255 numberStr, kindStr, distStr;
|
||||
short item, initial;
|
||||
Boolean leaving, doReturn, leftFacing;
|
||||
ModalFilterUPP blowerFilterUPP;
|
||||
|
||||
blowerFilterUPP = NewModalFilterUPP(BlowerFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -995,7 +992,7 @@ void DoBlowerObjectInfo (short what)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(blowerFilterUPP, &item);
|
||||
ModalDialog(BlowerFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1092,7 +1089,6 @@ void DoBlowerObjectInfo (short what)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(blowerFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1109,9 +1105,6 @@ void DoFurnitureObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP furnitureFilterUPP;
|
||||
|
||||
furnitureFilterUPP = NewModalFilterUPP(FurnitureFilter);
|
||||
|
||||
if (objActive == kInitialGliderSelected)
|
||||
{
|
||||
@@ -1145,7 +1138,7 @@ void DoFurnitureObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(furnitureFilterUPP, &item);
|
||||
ModalDialog(FurnitureFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
leaving = true;
|
||||
@@ -1157,7 +1150,6 @@ void DoFurnitureObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(furnitureFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1175,9 +1167,6 @@ void DoCustPictObjectInfo (void)
|
||||
long wasPict;
|
||||
short item;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP custPictFilterUPP;
|
||||
|
||||
custPictFilterUPP = NewModalFilterUPP(CustPictFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1202,7 +1191,7 @@ void DoCustPictObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(custPictFilterUPP, &item);
|
||||
ModalDialog(CustPictFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1260,7 +1249,6 @@ void DoCustPictObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(custPictFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoSwitchObjectInfo
|
||||
@@ -1271,9 +1259,6 @@ void DoSwitchObjectInfo (void)
|
||||
Str255 numberStr, kindStr, roomStr, tempStr, objStr;
|
||||
short item, floor, suite;
|
||||
Boolean leaving, doLink, doGoTo, doReturn;
|
||||
ModalFilterUPP switchFilterUPP;
|
||||
|
||||
switchFilterUPP = NewModalFilterUPP(SwitchFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1310,7 +1295,7 @@ void DoSwitchObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(switchFilterUPP, &item);
|
||||
ModalDialog(SwitchFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1363,7 +1348,6 @@ void DoSwitchObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(switchFilterUPP);
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -1394,9 +1378,6 @@ void DoTriggerObjectInfo (void)
|
||||
long delayIs;
|
||||
short item, floor, suite;
|
||||
Boolean leaving, doLink, doGoTo, doReturn;
|
||||
ModalFilterUPP triggerFilterUPP;
|
||||
|
||||
triggerFilterUPP = NewModalFilterUPP(TriggerFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1437,7 +1418,7 @@ void DoTriggerObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(triggerFilterUPP, &item);
|
||||
ModalDialog(TriggerFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1519,7 +1500,6 @@ void DoTriggerObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(triggerFilterUPP);
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -1549,9 +1529,6 @@ void DoLightObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item, initial;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP lightFilterUPP;
|
||||
|
||||
lightFilterUPP = NewModalFilterUPP(LightFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1578,7 +1555,7 @@ void DoLightObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(lightFilterUPP, &item);
|
||||
ModalDialog(LightFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1618,7 +1595,6 @@ void DoLightObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(lightFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1636,9 +1612,6 @@ void DoApplianceObjectInfo (short what)
|
||||
long delay;
|
||||
short item, initial;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP applianceFilterUPP;
|
||||
|
||||
applianceFilterUPP = NewModalFilterUPP(ApplianceFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1670,7 +1643,7 @@ void DoApplianceObjectInfo (short what)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(applianceFilterUPP, &item);
|
||||
ModalDialog(ApplianceFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1734,7 +1707,6 @@ void DoApplianceObjectInfo (short what)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(applianceFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1751,9 +1723,6 @@ void DoMicrowaveObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item, initial, kills;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP microwaveFilterUPP;
|
||||
|
||||
microwaveFilterUPP = NewModalFilterUPP(MicrowaveFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1788,7 +1757,7 @@ void DoMicrowaveObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(microwaveFilterUPP, &item);
|
||||
ModalDialog(MicrowaveFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1858,7 +1827,6 @@ void DoMicrowaveObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(microwaveFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1875,9 +1843,6 @@ void DoGreaseObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item;
|
||||
Boolean leaving, wasSpilled, doReturn;
|
||||
ModalFilterUPP greaseFilterUPP;
|
||||
|
||||
greaseFilterUPP = NewModalFilterUPP(GreaseFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1895,7 +1860,7 @@ void DoGreaseObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(greaseFilterUPP, &item);
|
||||
ModalDialog(GreaseFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -1932,7 +1897,6 @@ void DoGreaseObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(greaseFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1949,9 +1913,6 @@ void DoInvisBonusObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP invisBonusFilterUPP;
|
||||
|
||||
invisBonusFilterUPP = NewModalFilterUPP(InvisBonusFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -1982,7 +1943,7 @@ void DoInvisBonusObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(invisBonusFilterUPP, &item);
|
||||
ModalDialog(InvisBonusFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -2045,7 +2006,6 @@ void DoInvisBonusObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(invisBonusFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -2062,9 +2022,6 @@ void DoTransObjectInfo (short what)
|
||||
Str255 numberStr, kindStr, roomStr, tempStr, objStr;
|
||||
short item, floor, suite;
|
||||
Boolean leaving, doLink, doGoTo, doReturn, wasState;
|
||||
ModalFilterUPP transFilterUPP;
|
||||
|
||||
transFilterUPP = NewModalFilterUPP(TransFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -2108,7 +2065,7 @@ void DoTransObjectInfo (short what)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(transFilterUPP, &item);
|
||||
ModalDialog(TransFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -2155,7 +2112,6 @@ void DoTransObjectInfo (short what)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(transFilterUPP);
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -2186,9 +2142,6 @@ void DoEnemyObjectInfo (short what)
|
||||
long delay;
|
||||
short item, initial;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP enemyFilterUPP;
|
||||
|
||||
enemyFilterUPP = NewModalFilterUPP(EnemyFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -2220,7 +2173,7 @@ void DoEnemyObjectInfo (short what)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(enemyFilterUPP, &item);
|
||||
ModalDialog(EnemyFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -2278,7 +2231,6 @@ void DoEnemyObjectInfo (short what)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(enemyFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -2295,9 +2247,6 @@ void DoFlowerObjectInfo (void)
|
||||
Str255 numberStr, kindStr;
|
||||
short item, flower;
|
||||
Boolean leaving, doReturn;
|
||||
ModalFilterUPP flowerFilterUPP;
|
||||
|
||||
flowerFilterUPP = NewModalFilterUPP(FlowerFilter);
|
||||
|
||||
NumToString(objActive + 1, numberStr);
|
||||
GetIndString(kindStr, kObjectNameStrings, thisRoom->objects[objActive].what);
|
||||
@@ -2316,7 +2265,7 @@ void DoFlowerObjectInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(flowerFilterUPP, &item);
|
||||
ModalDialog(FlowerFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -2377,7 +2326,6 @@ void DoFlowerObjectInfo (void)
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
DisposeModalFilterUPP(flowerFilterUPP);
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
|
||||
@@ -406,7 +406,7 @@ Boolean RoomFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateRoomInfoDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -434,11 +434,8 @@ void DoRoomInfo (void)
|
||||
short item, i, newBack;
|
||||
char wasState;
|
||||
Boolean leaving, wasFirstRoom, forceDraw;
|
||||
ModalFilterUPP roomFilterUPP;
|
||||
PLError_t theErr;
|
||||
|
||||
roomFilterUPP = NewModalFilterUPP(RoomFilter);
|
||||
|
||||
tileOver = -1;
|
||||
cursorIs = kArrowCursor;
|
||||
tempBack = thisRoom->background;
|
||||
@@ -503,7 +500,7 @@ void DoRoomInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(roomFilterUPP, &item);
|
||||
ModalDialog(RoomFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -598,7 +595,6 @@ void DoRoomInfo (void)
|
||||
|
||||
InitCursor();
|
||||
DisposeDialog(roomInfoDialog);
|
||||
DisposeModalFilterUPP(roomFilterUPP);
|
||||
|
||||
// KillOffScreenPixMap(tileSrcMap);
|
||||
DisposeGWorld(tileSrcMap);
|
||||
@@ -727,7 +723,7 @@ Boolean OriginalArtFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateOriginalArt(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -750,9 +746,6 @@ short ChooseOriginalArt (short was)
|
||||
long longID;
|
||||
short item, newPictID, tempShort, wasPictID;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP originalArtFilterUPP;
|
||||
|
||||
originalArtFilterUPP = NewModalFilterUPP(OriginalArtFilter);
|
||||
|
||||
if (was < kUserBackground)
|
||||
was = kUserBackground;
|
||||
@@ -790,7 +783,7 @@ short ChooseOriginalArt (short was)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(originalArtFilterUPP, &item);
|
||||
ModalDialog(OriginalArtFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -855,7 +848,6 @@ short ChooseOriginalArt (short was)
|
||||
}
|
||||
|
||||
DisposeDialog(theDialog);
|
||||
DisposeModalFilterUPP(originalArtFilterUPP);
|
||||
|
||||
return (newPictID);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ void PageUpHouses (Dialog *theDial)
|
||||
{
|
||||
GetDialogItemRect(theDial, kScrollUpItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollUpItem);
|
||||
DrawCIcon(kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
}
|
||||
|
||||
QSetRect(&tempRect, 8, 39, 421, 223);
|
||||
@@ -191,7 +191,7 @@ void PageDownHouses (Dialog *theDial)
|
||||
{
|
||||
GetDialogItemRect(theDial, kScrollDownItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollDownItem);
|
||||
DrawCIcon(kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
}
|
||||
|
||||
QSetRect(&tempRect, 8, 39, 421, 223);
|
||||
@@ -367,20 +367,20 @@ void DoLoadHouse (void)
|
||||
Dialog *theDial;
|
||||
short i, item, wasIndex, screenCount;
|
||||
Boolean leaving, whoCares;
|
||||
ModalFilterUPP loadFilterUPP;
|
||||
|
||||
loadFilterUPP = NewModalFilterUPP(LoadFilter);
|
||||
|
||||
BringUpDialog(&theDial, kLoadHouseDialogID);
|
||||
|
||||
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (housesFound <= kDispFiles)
|
||||
{
|
||||
GetDialogItemRect(theDial, kScrollUpItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollUpItem);
|
||||
DrawCIcon(kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
|
||||
GetDialogItemRect(theDial, kScrollDownItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollDownItem);
|
||||
DrawCIcon(kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -388,13 +388,13 @@ void DoLoadHouse (void)
|
||||
{
|
||||
GetDialogItemRect(theDial, kScrollUpItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollUpItem);
|
||||
DrawCIcon(kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutUpArrow, tempRect.left, tempRect.top);
|
||||
}
|
||||
else if (thisHouseIndex > (housesFound - kDispFiles))
|
||||
{
|
||||
GetDialogItemRect(theDial, kScrollDownItem, &tempRect);
|
||||
HideDialogItem(theDial, kScrollDownItem);
|
||||
DrawCIcon(kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, kGrayedOutDownArrow, tempRect.left, tempRect.top);
|
||||
}
|
||||
}
|
||||
wasIndex = thisHouseIndex;
|
||||
@@ -415,7 +415,7 @@ void DoLoadHouse (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(loadFilterUPP, &item);
|
||||
ModalDialog(LoadFilter, &item);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -516,7 +516,6 @@ void DoLoadHouse (void)
|
||||
}
|
||||
|
||||
DisposeDialog(theDial);
|
||||
DisposeModalFilterUPP(loadFilterUPP);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "PLSound.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
@@ -79,7 +80,7 @@ void DisplayUpdate (Dialog *);
|
||||
Boolean DisplayFilter (Dialog *, EventRecord *, short *);
|
||||
void DoDisplayPrefs (void);
|
||||
void SetAllDefaults (void);
|
||||
void FlashSettingsButton (short);
|
||||
void FlashSettingsButton (DrawSurface *, short);
|
||||
void UpdateSettingsMain (Dialog *);
|
||||
Boolean PrefsFilter (Dialog *, EventRecord *, short *);
|
||||
void BitchAboutChanges (void);
|
||||
@@ -204,7 +205,7 @@ Boolean BrainsFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateSettingsBrains(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -225,9 +226,6 @@ void DoBrainsPrefs (void)
|
||||
long tempLong;
|
||||
short itemHit, wasMaxFiles;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP brainsFilterUPP;
|
||||
|
||||
brainsFilterUPP = NewModalFilterUPP(BrainsFilter);
|
||||
|
||||
BringUpDialog(&prefDlg, kBrainsPrefsDialID);
|
||||
leaving = false;
|
||||
@@ -251,7 +249,7 @@ void DoBrainsPrefs (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(brainsFilterUPP, &itemHit);
|
||||
ModalDialog(BrainsFilter, &itemHit);
|
||||
switch (itemHit)
|
||||
{
|
||||
case kOkayButton:
|
||||
@@ -320,7 +318,6 @@ void DoBrainsPrefs (void)
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
DisposeModalFilterUPP(brainsFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetControlsToDefaults
|
||||
@@ -491,7 +488,7 @@ Boolean ControlFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateSettingsControl(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -511,9 +508,6 @@ void DoControlPrefs (void)
|
||||
Dialog *prefDlg;
|
||||
short i, itemHit;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP controlFilterUPP;
|
||||
|
||||
controlFilterUPP = NewModalFilterUPP(ControlFilter);
|
||||
|
||||
// CenterDialog(kControlPrefsDialID);
|
||||
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront);
|
||||
@@ -551,7 +545,7 @@ void DoControlPrefs (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(controlFilterUPP, &itemHit);
|
||||
ModalDialog(ControlFilter, &itemHit);
|
||||
switch (itemHit)
|
||||
{
|
||||
case kOkayButton:
|
||||
@@ -609,7 +603,6 @@ void DoControlPrefs (void)
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
DisposeModalFilterUPP(controlFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SoundDefaults
|
||||
@@ -754,7 +747,7 @@ Boolean SoundFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
SetPortDialogPort(dial);
|
||||
UpdateSettingsSound(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
@@ -777,11 +770,10 @@ void DoSoundPrefs (void)
|
||||
PLError_t theErr;
|
||||
short itemHit;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP soundFilterUPP;
|
||||
|
||||
soundFilterUPP = NewModalFilterUPP(SoundFilter);
|
||||
|
||||
BringUpDialog(&prefDlg, kSoundPrefsDialID);
|
||||
|
||||
DrawSurface *surface = prefDlg->GetWindow()->GetDrawSurface();
|
||||
|
||||
UnivGetSoundVolume(&wasLoudness, thisMac.hasSM3);
|
||||
|
||||
@@ -793,7 +785,7 @@ void DoSoundPrefs (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(soundFilterUPP, &itemHit);
|
||||
ModalDialog(SoundFilter, &itemHit);
|
||||
switch (itemHit)
|
||||
{
|
||||
case kOkayButton:
|
||||
@@ -832,7 +824,7 @@ void DoSoundPrefs (void)
|
||||
if (tempVolume > 0)
|
||||
{
|
||||
GetDialogItemRect(prefDlg, kSofterItem, &tempRect);
|
||||
DrawCIcon(1034, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, 1034, tempRect.left, tempRect.top);
|
||||
tempVolume--;
|
||||
SetDialogNumToStr(prefDlg, kVolNumberItem, (long)tempVolume);
|
||||
UnivSetSoundVolume(tempVolume, thisMac.hasSM3);
|
||||
@@ -847,7 +839,7 @@ void DoSoundPrefs (void)
|
||||
if (tempVolume < 7)
|
||||
{
|
||||
GetDialogItemRect(prefDlg, kLouderItem, &tempRect);
|
||||
DrawCIcon(1033, tempRect.left, tempRect.top);
|
||||
DrawCIcon(surface, 1033, tempRect.left, tempRect.top);
|
||||
tempVolume++;
|
||||
if (tempVolume == 7)
|
||||
SetDialogNumToStr(prefDlg, kVolNumberItem, 11L);
|
||||
@@ -892,7 +884,6 @@ void DoSoundPrefs (void)
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
DisposeModalFilterUPP(soundFilterUPP);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DisplayDefaults
|
||||
@@ -943,7 +934,6 @@ void FrameDisplayIcon (Dialog *theDialog)
|
||||
|
||||
void DisplayUpdate (Dialog *theDialog)
|
||||
{
|
||||
DrawDialog(theDialog);
|
||||
DrawDefaultButton(theDialog);
|
||||
|
||||
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
|
||||
@@ -962,155 +952,114 @@ void DisplayUpdate (Dialog *theDialog)
|
||||
|
||||
//-------------------------------------------------------------- DisplayFilter
|
||||
|
||||
Boolean DisplayFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
{
|
||||
switch (event->what)
|
||||
int16_t DisplayFilter(Dialog *dial, const TimeTaggedVOSEvent &evt)
|
||||
{
|
||||
if (evt.IsKeyDownEvent())
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
switch (PackVOSKeyCode(evt.m_vosEvent.m_event.m_keyboardInputEvent))
|
||||
{
|
||||
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(kLeftArrow):
|
||||
return kCancelButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kLeftArrow):
|
||||
switch (numNeighbors)
|
||||
{
|
||||
case 1:
|
||||
*item = kDisplay9Item;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
*item = kDisplay1Item;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
*item = kDisplay3Item;
|
||||
break;
|
||||
}
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kRightArrow):
|
||||
switch (numNeighbors)
|
||||
{
|
||||
case 1:
|
||||
*item = kDisplay3Item;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
*item = kDisplay9Item;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
*item = kDisplay1Item;
|
||||
break;
|
||||
}
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kUpArrow):
|
||||
switch (wasDepthPref)
|
||||
{
|
||||
case kSwitchIfNeeded:
|
||||
*item = k16Depth;
|
||||
break;
|
||||
|
||||
case kSwitchTo256Colors:
|
||||
*item = kCurrentDepth;
|
||||
break;
|
||||
|
||||
case kSwitchTo16Grays:
|
||||
*item = k256Depth;
|
||||
break;
|
||||
}
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kDownArrow):
|
||||
switch (wasDepthPref)
|
||||
{
|
||||
case kSwitchIfNeeded:
|
||||
*item = k256Depth;
|
||||
break;
|
||||
|
||||
case kSwitchTo256Colors:
|
||||
*item = k16Depth;
|
||||
break;
|
||||
|
||||
case kSwitchTo16Grays:
|
||||
*item = kCurrentDepth;
|
||||
break;
|
||||
}
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('1'):
|
||||
*item = kDisplay1Item;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('3'):
|
||||
*item = kDisplay3Item;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('9'):
|
||||
*item = kDisplay9Item;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('B'):
|
||||
*item = kDoColorFadeItem;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('D'):
|
||||
*item = kDispDefault;
|
||||
FlashDialogButton(dial, kDispDefault);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('R'):
|
||||
*item = kUseScreen2Item;
|
||||
FlashDialogButton(dial, kUseQDItem);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('U'):
|
||||
*item = kUseQDItem;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return kDisplay9Item;
|
||||
|
||||
case 3:
|
||||
return kDisplay1Item;
|
||||
|
||||
case 9:
|
||||
return kDisplay3Item;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kRightArrow):
|
||||
switch (numNeighbors)
|
||||
{
|
||||
case 1:
|
||||
return kDisplay3Item;
|
||||
|
||||
case 3:
|
||||
return kDisplay9Item;
|
||||
|
||||
case 9:
|
||||
return kDisplay1Item;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kUpArrow):
|
||||
switch (wasDepthPref)
|
||||
{
|
||||
case kSwitchIfNeeded:
|
||||
return k16Depth;
|
||||
|
||||
case kSwitchTo256Colors:
|
||||
return kCurrentDepth;
|
||||
|
||||
case kSwitchTo16Grays:
|
||||
return k256Depth;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kDownArrow):
|
||||
switch (wasDepthPref)
|
||||
{
|
||||
case kSwitchIfNeeded:
|
||||
return k256Depth;
|
||||
|
||||
case kSwitchTo256Colors:
|
||||
return k16Depth;
|
||||
|
||||
case kSwitchTo16Grays:
|
||||
return kCurrentDepth;
|
||||
}
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('1'):
|
||||
return kDisplay1Item;
|
||||
|
||||
case PL_KEY_ASCII('3'):
|
||||
return kDisplay3Item;
|
||||
|
||||
case PL_KEY_ASCII('9'):
|
||||
return kDisplay9Item;
|
||||
|
||||
case PL_KEY_ASCII('B'):
|
||||
return kDoColorFadeItem;
|
||||
|
||||
case PL_KEY_ASCII('D'):
|
||||
FlashDialogButton(dial, kDispDefault);
|
||||
return kDispDefault;
|
||||
|
||||
case PL_KEY_ASCII('R'):
|
||||
PL_NotYetImplemented_TODO("FixMe"); // GP: This looks like a bug
|
||||
|
||||
FlashDialogButton(dial, kUseQDItem);
|
||||
return kUseScreen2Item;
|
||||
|
||||
case PL_KEY_ASCII('U'):
|
||||
return kUseQDItem;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
DisplayUpdate(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1119,13 +1068,13 @@ Boolean DisplayFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
void DoDisplayPrefs (void)
|
||||
{
|
||||
Dialog *prefDlg;
|
||||
short itemHit, wasNeighbors;
|
||||
short wasNeighbors;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP displayFilterUPP;
|
||||
|
||||
displayFilterUPP = NewModalFilterUPP(DisplayFilter);
|
||||
|
||||
BringUpDialog(&prefDlg, kDisplayPrefsDialID);
|
||||
|
||||
DisplayUpdate(prefDlg);
|
||||
|
||||
if (!thisMac.can8Bit)
|
||||
{
|
||||
MyDisableControl(prefDlg, kDoColorFadeItem);
|
||||
@@ -1143,7 +1092,7 @@ void DoDisplayPrefs (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(displayFilterUPP, &itemHit);
|
||||
int16_t itemHit = prefDlg->ExecuteModal(DisplayFilter);
|
||||
switch (itemHit)
|
||||
{
|
||||
case kOkayButton:
|
||||
@@ -1225,8 +1174,7 @@ void DoDisplayPrefs (void)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
DisposeModalFilterUPP(displayFilterUPP);
|
||||
prefDlg->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetAllDefaults
|
||||
@@ -1282,17 +1230,17 @@ void SetAllDefaults (void)
|
||||
|
||||
//-------------------------------------------------------------- FlashSettingsButton
|
||||
|
||||
void FlashSettingsButton (short who)
|
||||
void FlashSettingsButton (DrawSurface *surface, short who)
|
||||
{
|
||||
#define kNormalSettingsIcon 1010
|
||||
#define kInvertedSettingsIcon 1014
|
||||
short theID;
|
||||
|
||||
theID = kInvertedSettingsIcon + who;
|
||||
DrawCIcon (theID, prefButton[who].left + 4, prefButton[who].top + 4);
|
||||
DrawCIcon (surface, theID, prefButton[who].left + 4, prefButton[who].top + 4);
|
||||
DelayTicks(8);
|
||||
theID = kNormalSettingsIcon + who;
|
||||
DrawCIcon (theID, prefButton[who].left + 4, prefButton[who].top + 4);
|
||||
DrawCIcon (surface, theID, prefButton[who].left + 4, prefButton[who].top + 4);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateSettingsMain
|
||||
@@ -1302,8 +1250,6 @@ void UpdateSettingsMain (Dialog *theDialog)
|
||||
Str255 theStr;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
DrawDialog(theDialog);
|
||||
|
||||
DrawDefaultButton(theDialog);
|
||||
|
||||
GetIndString(theStr, 129, 1);
|
||||
@@ -1323,86 +1269,56 @@ void UpdateSettingsMain (Dialog *theDialog)
|
||||
|
||||
//-------------------------------------------------------------- PrefsFilter
|
||||
|
||||
Boolean PrefsFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t PrefsFilter (Dialog *dial, const TimeTaggedVOSEvent &evt)
|
||||
{
|
||||
Point testPt;
|
||||
short i;
|
||||
Boolean foundHit;
|
||||
|
||||
switch (event->what)
|
||||
|
||||
if (evt.IsKeyDownEvent())
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
intptr_t packedKey = PackVOSKeyCode(evt.m_vosEvent.m_event.m_keyboardInputEvent);
|
||||
|
||||
switch (packedKey)
|
||||
{
|
||||
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_ASCII('B'):
|
||||
*item = kBrainsButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('C'):
|
||||
*item = kControlsButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('d'):
|
||||
*item = kDisplayButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_ASCII('S'):
|
||||
*item = kSoundButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
return kOkayButton;
|
||||
|
||||
case PL_KEY_ASCII('B'):
|
||||
return kBrainsButton;
|
||||
|
||||
case PL_KEY_ASCII('C'):
|
||||
return kControlsButton;
|
||||
|
||||
case PL_KEY_ASCII('d'):
|
||||
return kDisplayButton;
|
||||
|
||||
case PL_KEY_ASCII('S'):
|
||||
return kSoundButton;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
testPt = event->where;
|
||||
GlobalToLocal(&testPt);
|
||||
foundHit = false;
|
||||
}
|
||||
else if (evt.IsLMouseDownEvent())
|
||||
{
|
||||
const Window *window = dial->GetWindow();
|
||||
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);
|
||||
|
||||
int16_t hitCode = -1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (PtInRect(testPt, &prefButton[i]))
|
||||
{
|
||||
*item = kDisplayButton + i;
|
||||
foundHit = true;
|
||||
}
|
||||
if (prefButton[i].Contains(testPt))
|
||||
hitCode = kDisplayButton + i;
|
||||
}
|
||||
return(foundHit);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
if ((WindowPtr)event->message == (WindowPtr)mainWindow)
|
||||
{
|
||||
SetPortWindowPort(mainWindow);
|
||||
UpdateMainWindow();
|
||||
EndUpdate(mainWindow);
|
||||
SetPort((GrafPtr)dial);
|
||||
}
|
||||
else if ((WindowPtr)event->message == dial->GetWindow())
|
||||
{
|
||||
SetPortDialogPort(dial);
|
||||
UpdateSettingsMain(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
}
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
return hitCode;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoSettingsMain
|
||||
@@ -1411,13 +1327,12 @@ void DoSettingsMain (void)
|
||||
{
|
||||
#define kAllDefaultsButton 11
|
||||
Dialog *prefDlg;
|
||||
short itemHit;
|
||||
int16_t itemHit;
|
||||
Boolean leaving;
|
||||
ModalFilterUPP prefsFilterUPP;
|
||||
|
||||
prefsFilterUPP = NewModalFilterUPP(PrefsFilter);
|
||||
|
||||
BringUpDialog(&prefDlg, kMainPrefsDialID);
|
||||
|
||||
DrawSurface *surface = prefDlg->GetWindow()->GetDrawSurface();
|
||||
|
||||
GetDialogItemRect(prefDlg, kDisplayButton, &prefButton[0]);
|
||||
InsetRect(&prefButton[0], -4, -4);
|
||||
@@ -1427,36 +1342,39 @@ void DoSettingsMain (void)
|
||||
InsetRect(&prefButton[2], -4, -4);
|
||||
GetDialogItemRect(prefDlg, 6, &prefButton[3]);
|
||||
InsetRect(&prefButton[3], -4, -4);
|
||||
|
||||
UpdateSettingsMain(prefDlg);
|
||||
|
||||
leaving = false;
|
||||
nextRestartChange = false;
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(prefsFilterUPP, &itemHit);
|
||||
switch (itemHit)
|
||||
int16_t selectedItem = prefDlg->ExecuteModal(PrefsFilter);
|
||||
|
||||
switch (selectedItem)
|
||||
{
|
||||
case kOkayButton:
|
||||
leaving = true;
|
||||
break;
|
||||
|
||||
case kDisplayButton:
|
||||
FlashSettingsButton(0);
|
||||
FlashSettingsButton(surface, 0);
|
||||
DoDisplayPrefs();
|
||||
SetPort((GrafPtr)prefDlg);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
break;
|
||||
|
||||
case kSoundButton:
|
||||
FlashSettingsButton(1);
|
||||
FlashSettingsButton(surface, 1);
|
||||
DoSoundPrefs();
|
||||
SetPort((GrafPtr)prefDlg);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
FlushEvents(everyEvent, 0);
|
||||
break;
|
||||
|
||||
case kControlsButton:
|
||||
FlashSettingsButton(2);
|
||||
FlashSettingsButton(surface, 2);
|
||||
DoControlPrefs();
|
||||
SetPort((GrafPtr)prefDlg);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
break;
|
||||
|
||||
case kBrainsButton:
|
||||
@@ -1466,9 +1384,9 @@ void DoSettingsMain (void)
|
||||
changeLockStateOfHouse = true;
|
||||
saveHouseLocked = false;
|
||||
}
|
||||
FlashSettingsButton(3);
|
||||
FlashSettingsButton(surface, 3);
|
||||
DoBrainsPrefs();
|
||||
SetPort((GrafPtr)prefDlg);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
break;
|
||||
|
||||
case kAllDefaultsButton:
|
||||
@@ -1478,7 +1396,6 @@ void DoSettingsMain (void)
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
DisposeModalFilterUPP(prefsFilterUPP);
|
||||
|
||||
if (nextRestartChange)
|
||||
BitchAboutChanges();
|
||||
|
||||
@@ -275,17 +275,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
|
||||
// font. If the text would exceed our width limit, characters<72>
|
||||
// are dropped off the end of the string and "<22>" appended.
|
||||
|
||||
void CollapseStringToWidth (StringPtr theStr, short wide)
|
||||
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
|
||||
{
|
||||
short dotsWide;
|
||||
Boolean tooWide;
|
||||
|
||||
dotsWide = StringWidth(PSTR("<EFBFBD>"));
|
||||
tooWide = StringWidth(theStr) > wide;
|
||||
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
|
||||
tooWide = surface->MeasureString(theStr) > wide;
|
||||
while (tooWide)
|
||||
{
|
||||
theStr[0]--;
|
||||
tooWide = ((StringWidth(theStr) + dotsWide) > wide);
|
||||
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
|
||||
if (!tooWide)
|
||||
PasStringConcat(theStr, PSTR("<EFBFBD>"));
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void CreatePointers (void)
|
||||
RedAlert(kErrNoMemory);
|
||||
else
|
||||
{
|
||||
PL_STATIC_ASSERT(sizeof(demoType) == 6);
|
||||
GP_STATIC_ASSERT(sizeof(demoType) == 6);
|
||||
|
||||
BlockMove(*tempHandle, demoData, kDemoLength);
|
||||
tempHandle.Dispose();
|
||||
|
||||
@@ -54,7 +54,7 @@ void CreateToolsOffscreen (void);
|
||||
void KillToolsOffscreen (void);
|
||||
void FrameSelectedTool (DrawSurface *);
|
||||
void DrawToolName (DrawSurface *);
|
||||
void DrawToolTiles (void);
|
||||
void DrawToolTiles (DrawSurface *);
|
||||
void SwitchToolModes (short);
|
||||
|
||||
|
||||
@@ -161,12 +161,12 @@ void DrawToolName (DrawSurface *surface)
|
||||
//-------------------------------------------------------------- DrawToolTiles
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DrawToolTiles (void)
|
||||
void DrawToolTiles (DrawSurface *surface)
|
||||
{
|
||||
Rect srcRect, destRect;
|
||||
short i;
|
||||
|
||||
DrawCIcon(2000, toolRects[0].left, toolRects[0].top); // Selection Tool
|
||||
DrawCIcon(surface, 2000, toolRects[0].left, toolRects[0].top); // Selection Tool
|
||||
|
||||
for (i = 0; i < 15; i++) // Other tools
|
||||
{
|
||||
@@ -271,7 +271,7 @@ void UpdateToolsWindow (void)
|
||||
surface->DrawLine(Point::Create(4, 25), Point::Create(112, 25));
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
DrawToolTiles();
|
||||
DrawToolTiles(surface);
|
||||
FrameSelectedTool(surface);
|
||||
DrawToolName(surface);
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
#include "PLResources.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "Externs.h"
|
||||
#include "IconLoader.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
|
||||
@@ -326,18 +328,25 @@ void LargeIconPlot (Rect *theRect, short theID)
|
||||
|
||||
// Draws a standard color icon (32 x 32) - resource is a 'CICN'.
|
||||
|
||||
void DrawCIcon (short theID, short h, short v)
|
||||
void DrawCIcon (DrawSurface *surface, short theID, short h, short v)
|
||||
{
|
||||
CIconHandle theIcon;
|
||||
Rect theRect;
|
||||
|
||||
theIcon = GetCIcon(theID);
|
||||
if (theIcon != nil)
|
||||
THandle<PortabilityLayer::PixMapImpl> colorImage;
|
||||
THandle<PortabilityLayer::PixMapImpl> bwImage;
|
||||
THandle<PortabilityLayer::PixMapImpl> maskImage;
|
||||
|
||||
if (PortabilityLayer::IconLoader::GetInstance()->LoadColorIcon(theID, colorImage, bwImage, maskImage))
|
||||
{
|
||||
Rect theRect;
|
||||
|
||||
SetRect(&theRect, 0, 0, 32, 32);
|
||||
OffsetRect(&theRect, h, v);
|
||||
PlotCIcon(&theRect, theIcon);
|
||||
DisposeCIcon(theIcon);
|
||||
|
||||
CopyMask(*colorImage, *maskImage, *surface->m_port.GetPixMap(), &(*colorImage)->m_rect, &(*maskImage)->m_rect, &theRect);
|
||||
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
|
||||
bwImage.Dispose();
|
||||
colorImage.Dispose();
|
||||
maskImage.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user