mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Refactor some dialog handling, enforce proper port disposal
This commit is contained in:
@@ -87,7 +87,7 @@ void DoAbout (void)
|
||||
|
||||
if (okayButtScanlineMask != nil)
|
||||
okayButtScanlineMask->Destroy(); // Clean up!
|
||||
DisposeDialog(aboutDialog);
|
||||
aboutDialog->Destroy();
|
||||
|
||||
UseResFile(wasResFile);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void BringUpDialog (Dialog **theDialog, short dialogID)
|
||||
// CenterDialog(dialogID);
|
||||
if (*theDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetGraphicsPort(&(*theDialog)->GetWindow()->m_graf);
|
||||
SetGraphicsPort(&(*theDialog)->GetWindow()->m_surface);
|
||||
ShowWindow((*theDialog)->GetWindow());
|
||||
DrawDefaultButton(*theDialog);
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ void GetHighScoreName (short place)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(theDial);
|
||||
theDial->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateBannerDialog
|
||||
|
||||
@@ -697,7 +697,7 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(theDialog);
|
||||
theDialog->Destroy();
|
||||
|
||||
if (!canceled)
|
||||
{
|
||||
|
||||
@@ -287,7 +287,7 @@ void DoHouseInfo (void)
|
||||
}
|
||||
}
|
||||
InitCursor();
|
||||
DisposeDialog(houseInfoDialog);
|
||||
houseInfoDialog->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- WarnLockingHouse
|
||||
|
||||
@@ -124,7 +124,7 @@ void RedrawSplashScreen (void)
|
||||
// DissBits(&workSrcRect);
|
||||
CopyRectMainToWork(&workSrcRect);
|
||||
|
||||
mainWindow->m_graf.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
PortabilityLayer::MenuManager::GetInstance()->SetMenuVisible(true);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ void UpdateMainWindow (void)
|
||||
DrawOnSplash(mainWindow->GetDrawSurface());
|
||||
}
|
||||
|
||||
mainWindow->m_graf.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
|
||||
splashDrawn = true;
|
||||
}
|
||||
|
||||
@@ -749,7 +749,7 @@ short QueryResumeGame (void)
|
||||
leaving = true;
|
||||
}
|
||||
}
|
||||
DisposeDialog(theDial);
|
||||
theDial->Destroy();
|
||||
|
||||
return (hitWhat);
|
||||
}
|
||||
|
||||
@@ -1088,7 +1088,7 @@ void DoBlowerObjectInfo (short what)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1149,7 +1149,7 @@ void DoFurnitureObjectInfo (void)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1247,8 +1247,8 @@ void DoCustPictObjectInfo (void)
|
||||
leaving = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoSwitchObjectInfo
|
||||
@@ -1346,8 +1346,8 @@ void DoSwitchObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -1498,8 +1498,8 @@ void DoTriggerObjectInfo (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -1593,8 +1593,8 @@ void DoLightObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1705,8 +1705,8 @@ void DoApplianceObjectInfo (short what)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1825,8 +1825,8 @@ void DoMicrowaveObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -1895,8 +1895,8 @@ void DoGreaseObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -2004,8 +2004,8 @@ void DoInvisBonusObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -2110,8 +2110,8 @@ void DoTransObjectInfo (short what)
|
||||
SetDialogItemValue(infoDial, kInitialStateCheckbox3, (short)wasState);
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doLink)
|
||||
{
|
||||
@@ -2229,8 +2229,8 @@ void DoEnemyObjectInfo (short what)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
@@ -2324,8 +2324,8 @@ void DoFlowerObjectInfo (void)
|
||||
doReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(infoDial);
|
||||
|
||||
infoDial->Destroy();
|
||||
|
||||
if (doReturn)
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ void NewGame (short mode)
|
||||
#ifdef COMPILEQT
|
||||
if ((thisMac.hasQT) && (hasMovie))
|
||||
{
|
||||
SetMovieGWorld(theMovie, &mainWindow->m_graf, nil);
|
||||
SetMovieGWorld(theMovie, &mainWindow->m_surface, nil);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -594,7 +594,7 @@ void DoRoomInfo (void)
|
||||
}
|
||||
|
||||
InitCursor();
|
||||
DisposeDialog(roomInfoDialog);
|
||||
roomInfoDialog->Destroy();
|
||||
|
||||
// KillOffScreenPixMap(tileSrcMap);
|
||||
DisposeGWorld(tileSrcMap);
|
||||
@@ -847,7 +847,7 @@ short ChooseOriginalArt (short was)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(theDialog);
|
||||
theDialog->Destroy();
|
||||
|
||||
return (newPictID);
|
||||
}
|
||||
|
||||
@@ -514,8 +514,8 @@ void DoLoadHouse (void)
|
||||
PageDownHouses(theDial);
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(theDial);
|
||||
|
||||
theDial->Destroy();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void HandleSoundMusicChange (short, Boolean);
|
||||
Boolean SoundFilter (Dialog *, EventRecord *, short *);
|
||||
void DoSoundPrefs (void);
|
||||
void DisplayDefaults (void);
|
||||
void FrameDisplayIcon (Dialog *);
|
||||
void FrameDisplayIcon (Dialog *, const PortabilityLayer::RGBAColor &color);
|
||||
void DisplayUpdate (Dialog *);
|
||||
Boolean DisplayFilter (Dialog *, EventRecord *, short *);
|
||||
void DoDisplayPrefs (void);
|
||||
@@ -317,7 +317,7 @@ void DoBrainsPrefs (void)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
prefDlg->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetControlsToDefaults
|
||||
@@ -601,8 +601,8 @@ void DoControlPrefs (void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
|
||||
prefDlg->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SoundDefaults
|
||||
@@ -882,8 +882,8 @@ void DoSoundPrefs (void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
|
||||
prefDlg->Destroy();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DisplayDefaults
|
||||
@@ -898,7 +898,7 @@ void DisplayDefaults (void)
|
||||
|
||||
//-------------------------------------------------------------- FrameDisplayIcon
|
||||
|
||||
void FrameDisplayIcon (Dialog *theDialog)
|
||||
void FrameDisplayIcon (Dialog *theDialog, const PortabilityLayer::RGBAColor &color)
|
||||
{
|
||||
Rect theRect;
|
||||
|
||||
@@ -919,7 +919,7 @@ void FrameDisplayIcon (Dialog *theDialog)
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->SetForeColor(color);
|
||||
|
||||
theRect.left -= 3;
|
||||
theRect.top += 0;
|
||||
@@ -943,7 +943,7 @@ void DisplayUpdate (Dialog *theDialog)
|
||||
SetDialogItemValue(theDialog, kUseScreen2Item, (short)wasScreen2);
|
||||
|
||||
ForeColor(redColor);
|
||||
FrameDisplayIcon(theDialog);
|
||||
FrameDisplayIcon(theDialog, StdColors::Red());
|
||||
ForeColor(blackColor);
|
||||
FrameDialogItemC(theDialog, 8, kRedOrangeColor8);
|
||||
FrameDialogItemC(theDialog, 13, kRedOrangeColor8);
|
||||
@@ -1058,9 +1058,11 @@ int16_t DisplayFilter(Dialog *dial, const TimeTaggedVOSEvent &evt)
|
||||
return kUseQDItem;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoDisplayPrefs
|
||||
@@ -1110,35 +1112,26 @@ void DoDisplayPrefs (void)
|
||||
break;
|
||||
|
||||
case kDisplay1Item:
|
||||
ForeColor(whiteColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||
numNeighbors = 1;
|
||||
ForeColor(redColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
ForeColor(blackColor);
|
||||
FrameDisplayIcon(prefDlg, StdColors::Red());
|
||||
break;
|
||||
|
||||
case kDisplay3Item:
|
||||
if (thisMac.screen.right > 512)
|
||||
{
|
||||
ForeColor(whiteColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||
numNeighbors = 3;
|
||||
ForeColor(redColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
ForeColor(blackColor);
|
||||
FrameDisplayIcon(prefDlg, StdColors::Red());
|
||||
}
|
||||
break;
|
||||
|
||||
case kDisplay9Item:
|
||||
if (thisMac.screen.right > 512)
|
||||
{
|
||||
ForeColor(whiteColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||
numNeighbors = 9;
|
||||
ForeColor(redColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
ForeColor(blackColor);
|
||||
FrameDisplayIcon(prefDlg, StdColors::Red());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1155,8 +1148,7 @@ void DoDisplayPrefs (void)
|
||||
break;
|
||||
|
||||
case kDispDefault:
|
||||
ForeColor(whiteColor);
|
||||
FrameDisplayIcon(prefDlg);
|
||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||
ForeColor(blackColor);
|
||||
DisplayDefaults();
|
||||
DisplayUpdate(prefDlg);
|
||||
@@ -1361,20 +1353,20 @@ void DoSettingsMain (void)
|
||||
case kDisplayButton:
|
||||
FlashSettingsButton(surface, 0);
|
||||
DoDisplayPrefs();
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
||||
break;
|
||||
|
||||
case kSoundButton:
|
||||
FlashSettingsButton(surface, 1);
|
||||
DoSoundPrefs();
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
||||
FlushEvents(everyEvent, 0);
|
||||
break;
|
||||
|
||||
case kControlsButton:
|
||||
FlashSettingsButton(surface, 2);
|
||||
DoControlPrefs();
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
||||
break;
|
||||
|
||||
case kBrainsButton:
|
||||
@@ -1386,7 +1378,7 @@ void DoSettingsMain (void)
|
||||
}
|
||||
FlashSettingsButton(surface, 3);
|
||||
DoBrainsPrefs();
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_graf);
|
||||
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
|
||||
break;
|
||||
|
||||
case kAllDefaultsButton:
|
||||
@@ -1395,7 +1387,7 @@ void DoSettingsMain (void)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeDialog(prefDlg);
|
||||
prefDlg->Destroy();
|
||||
|
||||
if (nextRestartChange)
|
||||
BitchAboutChanges();
|
||||
|
||||
Reference in New Issue
Block a user