Refactoring, dialog work

This commit is contained in:
elasota
2019-12-31 02:42:20 -05:00
parent 04a955213c
commit 84e4f9fb0b
26 changed files with 817 additions and 271 deletions

View File

@@ -60,21 +60,25 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" /> <Import Project="..\PortabilityLayer.props" />
<Import Project="..\GpCommon.props" /> <Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" /> <Import Project="..\PortabilityLayer.props" />
<Import Project="..\GpCommon.props" /> <Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" /> <Import Project="..\PortabilityLayer.props" />
<Import Project="..\GpCommon.props" /> <Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" /> <Import Project="..\PortabilityLayer.props" />
<Import Project="..\GpCommon.props" /> <Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup /> <PropertyGroup />

View File

@@ -21,8 +21,8 @@
static void HiLiteOkayButton (DrawSurface *surface); static void HiLiteOkayButton (DrawSurface *surface);
static void UnHiLiteOkayButton (DrawSurface *surface); static void UnHiLiteOkayButton (DrawSurface *surface);
static void UpdateMainPict (DialogPtr); static void UpdateMainPict (Dialog *);
static Boolean AboutFilter (DialogPtr, EventRecord *theEvent, short *hit); static Boolean AboutFilter (Dialog *, EventRecord *theEvent, short *hit);
static PortabilityLayer::ScanlineMask *okayButtScanlineMask; static PortabilityLayer::ScanlineMask *okayButtScanlineMask;
@@ -40,7 +40,7 @@ void DoAbout (void)
#define kTextItemVers 2 // item number of version text #define kTextItemVers 2 // item number of version text
#define kPictItemMain 4 // item number of main PICT #define kPictItemMain 4 // item number of main PICT
DialogPtr aboutDialog; Dialog *aboutDialog;
Str255 longVersion; Str255 longVersion;
StringPtr messagePtr; StringPtr messagePtr;
VersRecHndl version; VersRecHndl version;
@@ -143,7 +143,7 @@ static void UnHiLiteOkayButton (DrawSurface *surface)
//-------------------------------------------------------------- UpdateMainPict //-------------------------------------------------------------- UpdateMainPict
// Redraws the main graphic in the dialog (in response to an update event). // Redraws the main graphic in the dialog (in response to an update event).
static void UpdateMainPict (DialogPtr theDial) static void UpdateMainPict (Dialog *theDial)
{ {
Str255 theStr, theStr2; Str255 theStr, theStr2;
uint64_t freeMemory; uint64_t freeMemory;
@@ -175,7 +175,7 @@ static void UpdateMainPict (DialogPtr theDial)
//-------------------------------------------------------------- AboutFilter //-------------------------------------------------------------- AboutFilter
// Dialog filter for the About dialog. // Dialog filter for the About dialog.
static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit) static Boolean AboutFilter (Dialog *theDial, EventRecord *theEvent, short *hit)
{ {
Point mousePt; Point mousePt;
UInt32 dummyLong; UInt32 dummyLong;

View File

@@ -5,6 +5,7 @@
//============================================================================ //============================================================================
#include "DialogManager.h" #include "DialogManager.h"
#include "PLArrayView.h"
#include "PLControlDefinitions.h" #include "PLControlDefinitions.h"
#include "PLLowMem.h" #include "PLLowMem.h"
#include "PLNumberFormatting.h" #include "PLNumberFormatting.h"
@@ -25,7 +26,7 @@
// Given a dialog pointer and a resource ID, this function brings it up<75> // Given a dialog pointer and a resource ID, this function brings it up<75>
// centered, visible, and with the default button outlined. // centered, visible, and with the default button outlined.
void BringUpDialog (DialogPtr *theDialog, short dialogID) void BringUpDialog (Dialog **theDialog, short dialogID)
{ {
*theDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(dialogID, kPutInFront); *theDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(dialogID, kPutInFront);
@@ -141,13 +142,15 @@ void CenterDialog (SInt16 dialogID)
void GetDialogRect (Rect *bounds, short dialogID) void GetDialogRect (Rect *bounds, short dialogID)
{ {
DialogTHndl dlogHandle;
Byte wasState; Byte wasState;
dlogHandle = GetResource('DLOG', dialogID).StaticCast<DialogTemplate>(); Handle dlogHandle = GetResource('DLOG', dialogID).StaticCast<void>();
if (dlogHandle != nil) if (dlogHandle != nil)
{ {
*bounds = (**dlogHandle).boundsRect; BERect dataRect = **dlogHandle.StaticCast<BERect>();
*bounds = dataRect.ToRect();
dlogHandle.Dispose();
} }
} }
@@ -333,7 +336,7 @@ void ZoomOutAlertRect (short alertID)
// Flashes the default dialog button (item = 1) so as to make it appear<61> // Flashes the default dialog button (item = 1) so as to make it appear<61>
// as though the user clicked on it. // as though the user clicked on it.
void FlashDialogButton (DialogPtr theDialog, short itemNumber) void FlashDialogButton (Dialog *theDialog, short itemNumber)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -350,23 +353,33 @@ void FlashDialogButton (DialogPtr theDialog, short itemNumber)
// Draws a fat outline around the default item (item = 1). This is the<68> // Draws a fat outline around the default item (item = 1). This is the<68>
// item that is selected if the user hits the Return key. // item that is selected if the user hits the Return key.
void DrawDefaultButton (DialogPtr theDialog) void DrawDefaultButton (Dialog *theDialog)
{ {
Rect itemRect; DialogItem *firstItem = *theDialog->GetItems().begin();
ControlHandle itemHandle; Rect itemRect = firstItem->GetRect();
short itemType;
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
GetDialogItem(theDialog, 1, &itemType, &itemHandle, &itemRect);
InsetRect(&itemRect, -4, -4); InsetRect(&itemRect, -4, -4);
PenSize(3, 3);
FrameRoundRect(&itemRect, 16, 16); surface->SetForeColor(StdColors::Black());
for (int xOffset = 0; xOffset < 3; xOffset++)
{
for (int yOffset = 0; yOffset < 3; yOffset++)
{
const Rect offsetRect = itemRect + Point::Create(xOffset, yOffset);
surface->FrameRoundRect(itemRect, 8, 8);
}
}
PenNormal(); PenNormal();
} }
//-------------------------------------------------------------- GetDialogString //-------------------------------------------------------------- GetDialogString
// Returns a string from a specific dialog item. // Returns a string from a specific dialog item.
void GetDialogString (DialogPtr theDialog, short item, StringPtr theString) void GetDialogString (Dialog *theDialog, short item, StringPtr theString)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -379,7 +392,7 @@ void GetDialogString (DialogPtr theDialog, short item, StringPtr theString)
//-------------------------------------------------------------- SetDialogString //-------------------------------------------------------------- SetDialogString
// Sets a specific string to a specific dialog item. // Sets a specific string to a specific dialog item.
void SetDialogString (DialogPtr theDialog, short item, const PLPasStr &theString) void SetDialogString (Dialog *theDialog, short item, const PLPasStr &theString)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -392,7 +405,7 @@ void SetDialogString (DialogPtr theDialog, short item, const PLPasStr &theString
//-------------------------------------------------------------- GetDialogStringLen //-------------------------------------------------------------- GetDialogStringLen
// Returns the length of a dialog item string (text). // Returns the length of a dialog item string (text).
short GetDialogStringLen (DialogPtr theDialog, short item) short GetDialogStringLen (Dialog *theDialog, short item)
{ {
Rect itemRect; Rect itemRect;
Str255 theString; Str255 theString;
@@ -408,7 +421,7 @@ short GetDialogStringLen (DialogPtr theDialog, short item)
// Returns the value or "state" of a dialog item. For checkboxes and<6E> // Returns the value or "state" of a dialog item. For checkboxes and<6E>
// radio buttons, this may be a 1 or 0. // radio buttons, this may be a 1 or 0.
void GetDialogItemValue (DialogPtr theDialog, short item, short *theState) void GetDialogItemValue (Dialog *theDialog, short item, short *theState)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -422,7 +435,7 @@ void GetDialogItemValue (DialogPtr theDialog, short item, short *theState)
// Sets a specific dialogf items value or state (can set or clear<61> // Sets a specific dialogf items value or state (can set or clear<61>
// checkboxes, radio buttons, etc.). // checkboxes, radio buttons, etc.).
void SetDialogItemValue (DialogPtr theDialog, short item, short theState) void SetDialogItemValue (Dialog *theDialog, short item, short theState)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -435,7 +448,7 @@ void SetDialogItemValue (DialogPtr theDialog, short item, short theState)
//-------------------------------------------------------------- ToggleDialogItemValue //-------------------------------------------------------------- ToggleDialogItemValue
// If item is a checkbox or radio button, its state is toggled. // If item is a checkbox or radio button, its state is toggled.
void ToggleDialogItemValue (DialogPtr theDialog, short item) void ToggleDialogItemValue (Dialog *theDialog, short item)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -454,7 +467,7 @@ void ToggleDialogItemValue (DialogPtr theDialog, short item)
// Function accepts an integer, converts it to a string and sets a<> // Function accepts an integer, converts it to a string and sets a<>
// dialog items text to this string. // dialog items text to this string.
void SetDialogNumToStr (DialogPtr theDialog, short item, long theNumber) void SetDialogNumToStr (Dialog *theDialog, short item, long theNumber)
{ {
Str255 theString; Str255 theString;
Rect itemRect; Rect itemRect;
@@ -470,7 +483,7 @@ void SetDialogNumToStr (DialogPtr theDialog, short item, long theNumber)
// Function extracts the text from a dialog item and converts it to an<61> // Function extracts the text from a dialog item and converts it to an<61>
// integer for returning. // integer for returning.
void GetDialogNumFromStr (DialogPtr theDialog, short item, long *theNumber) void GetDialogNumFromStr (Dialog *theDialog, short item, long *theNumber)
{ {
Str255 theString; Str255 theString;
Rect itemRect; Rect itemRect;
@@ -485,19 +498,16 @@ void GetDialogNumFromStr (DialogPtr theDialog, short item, long *theNumber)
//-------------------------------------------------------------- GetDialogItemRect //-------------------------------------------------------------- GetDialogItemRect
// Returns the bounding rectangle of the specified dialog item. // Returns the bounding rectangle of the specified dialog item.
void GetDialogItemRect (DialogPtr theDialog, short item, Rect *theRect) void GetDialogItemRect (Dialog *theDialog, short item, Rect *theRect)
{ {
ControlHandle itemHandle; *theRect = theDialog->GetItems()[item - 1]->GetRect();
short itemType;
GetDialogItem(theDialog, item, &itemType, &itemHandle, theRect);
} }
//-------------------------------------------------------------- SetDialogItemRect //-------------------------------------------------------------- SetDialogItemRect
// Sets the bounding rectangle of the specified dialog item. Used to<74> // Sets the bounding rectangle of the specified dialog item. Used to<74>
// resize or move a control. // resize or move a control.
void SetDialogItemRect (DialogPtr theDialog, short item, Rect *theRect) void SetDialogItemRect (Dialog *theDialog, short item, Rect *theRect)
{ {
Rect oldRect; Rect oldRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -511,7 +521,7 @@ void SetDialogItemRect (DialogPtr theDialog, short item, Rect *theRect)
//-------------------------------------------------------------- OffsetDialogItemRect //-------------------------------------------------------------- OffsetDialogItemRect
// Moves a dialog item by h and v. // Moves a dialog item by h and v.
void OffsetDialogItemRect (DialogPtr theDialog, short item, short h, short v) void OffsetDialogItemRect (Dialog *theDialog, short item, short h, short v)
{ {
Rect oldRect; Rect oldRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -527,7 +537,7 @@ void OffsetDialogItemRect (DialogPtr theDialog, short item, short h, short v)
// clears the whole range of them but sets the one specified (as though<67> // clears the whole range of them but sets the one specified (as though<67>
// the radio buttons are linked and only one can be set at a time). // the radio buttons are linked and only one can be set at a time).
void SelectFromRadioGroup (DialogPtr dial, short which, short first, short last) void SelectFromRadioGroup (Dialog *dial, short which, short first, short last)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -547,7 +557,7 @@ void SelectFromRadioGroup (DialogPtr dial, short which, short first, short last)
// Assigns a menu handle to a pop-up dialog item - thus, giving that<61> // Assigns a menu handle to a pop-up dialog item - thus, giving that<61>
// pop-up item something to pop up. // pop-up item something to pop up.
/* /*
void AddMenuToPopUp (DialogPtr theDialog, short whichItem, MenuHandle theMenu) void AddMenuToPopUp (Dialog *theDialog, short whichItem, MenuHandle theMenu)
{ {
Rect iRect; Rect iRect;
Handle iHandle; Handle iHandle;
@@ -560,7 +570,7 @@ void AddMenuToPopUp (DialogPtr theDialog, short whichItem, MenuHandle theMenu)
//-------------------------------------------------------------- GetPopUpMenuValu //-------------------------------------------------------------- GetPopUpMenuValu
// Returns which item is currently selected in a pop-up menu. // Returns which item is currently selected in a pop-up menu.
void GetPopUpMenuValue (DialogPtr theDialog, short whichItem, short *value) void GetPopUpMenuValue (Dialog *theDialog, short whichItem, short *value)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -573,7 +583,7 @@ void GetPopUpMenuValue (DialogPtr theDialog, short whichItem, short *value)
//-------------------------------------------------------------- SetPopUpMenuValue //-------------------------------------------------------------- SetPopUpMenuValue
// Forces a specific item to be set (as though selected) in a pop-up menu. // Forces a specific item to be set (as though selected) in a pop-up menu.
void SetPopUpMenuValue (DialogPtr theDialog, short whichItem, short value) void SetPopUpMenuValue (Dialog *theDialog, short whichItem, short value)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -586,7 +596,7 @@ void SetPopUpMenuValue (DialogPtr theDialog, short whichItem, short value)
//-------------------------------------------------------------- MyEnableControl //-------------------------------------------------------------- MyEnableControl
// "Un-grays" or enables a dialog item (usually a button). // "Un-grays" or enables a dialog item (usually a button).
void MyEnableControl (DialogPtr theDialog, short whichItem) void MyEnableControl (Dialog *theDialog, short whichItem)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -599,7 +609,7 @@ void MyEnableControl (DialogPtr theDialog, short whichItem)
//-------------------------------------------------------------- MyDisableControl //-------------------------------------------------------------- MyDisableControl
// "Grays out" or disables a dialog item (usually a button). // "Grays out" or disables a dialog item (usually a button).
void MyDisableControl (DialogPtr theDialog, short whichItem) void MyDisableControl (Dialog *theDialog, short whichItem)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -614,7 +624,7 @@ void MyDisableControl (DialogPtr theDialog, short whichItem)
// within the bounding rect of the item. Dialog item assumed to be<62> // within the bounding rect of the item. Dialog item assumed to be<62>
// a "user item" (invisible item with only bounds). // a "user item" (invisible item with only bounds).
void DrawDialogUserText (DialogPtr dial, short item, StringPtr text, Boolean invert) void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean invert)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -658,7 +668,7 @@ void DrawDialogUserText (DialogPtr dial, short item, StringPtr text, Boolean inv
// it truncates the string (and appends "<22>") to the end in order that<61> // it truncates the string (and appends "<22>") to the end in order that<61>
// the string fits within the dialog item's bounds. // the string fits within the dialog item's bounds.
void DrawDialogUserText2 (DialogPtr dial, short item, StringPtr text) void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -681,7 +691,7 @@ void DrawDialogUserText2 (DialogPtr dial, short item, StringPtr text)
// Draws a 'PICT' specified by ID within the bounds of the specified<65> // Draws a 'PICT' specified by ID within the bounds of the specified<65>
// dialog item. // dialog item.
void LoadDialogPICT (DialogPtr theDialog, short item, short theID) void LoadDialogPICT (Dialog *theDialog, short item, short theID)
{ {
Rect iRect; Rect iRect;
ControlHandle iHandle; ControlHandle iHandle;
@@ -697,7 +707,7 @@ void LoadDialogPICT (DialogPtr theDialog, short item, short theID)
//-------------------------------------------------------------- FrameDialogItem //-------------------------------------------------------------- FrameDialogItem
// Given a dialog item, this function draws a box around it. // Given a dialog item, this function draws a box around it.
void FrameDialogItem (DialogPtr theDialog, short item) void FrameDialogItem (Dialog *theDialog, short item)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -711,7 +721,7 @@ void FrameDialogItem (DialogPtr theDialog, short item)
//-------------------------------------------------------------- FrameDialogItemC //-------------------------------------------------------------- FrameDialogItemC
// Given a dialog item, this function draws a color (specified) box around it. // Given a dialog item, this function draws a color (specified) box around it.
void FrameDialogItemC (DialogPtr theDialog, short item, long color) void FrameDialogItemC (Dialog *theDialog, short item, long color)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -729,7 +739,7 @@ void FrameDialogItemC (DialogPtr theDialog, short item, long color)
//-------------------------------------------------------------- FrameOvalDialogItem //-------------------------------------------------------------- FrameOvalDialogItem
// Given a dialog item, this function draws an oval around it. // Given a dialog item, this function draws an oval around it.
void FrameOvalDialogItem (DialogPtr theDialog, short item) void FrameOvalDialogItem (Dialog *theDialog, short item)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -744,7 +754,7 @@ void FrameOvalDialogItem (DialogPtr theDialog, short item)
// Given a dialog item, this function draws any combination of 4 sides<65> // Given a dialog item, this function draws any combination of 4 sides<65>
// of a box around it. Which sides get drawn is encoded in "sides". // of a box around it. Which sides get drawn is encoded in "sides".
void BorderDialogItem (DialogPtr theDialog, short item, short sides) void BorderDialogItem (Dialog *theDialog, short item, short sides)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -791,7 +801,7 @@ void BorderDialogItem (DialogPtr theDialog, short item, short sides)
//-------------------------------------------------------------- ShadowDialogItem //-------------------------------------------------------------- ShadowDialogItem
// Draws a drop shadow to the right and below a specified dialog item. // Draws a drop shadow to the right and below a specified dialog item.
void ShadowDialogItem (DialogPtr theDialog, short item, short thickness) void ShadowDialogItem (Dialog *theDialog, short item, short thickness)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;
@@ -813,7 +823,7 @@ void ShadowDialogItem (DialogPtr theDialog, short item, short thickness)
//-------------------------------------------------------------- EraseDialogItem //-------------------------------------------------------------- EraseDialogItem
// Erases (but doesn't physically remove) a dialog item. // Erases (but doesn't physically remove) a dialog item.
void EraseDialogItem (DialogPtr theDialog, short item) void EraseDialogItem (Dialog *theDialog, short item)
{ {
Rect itemRect; Rect itemRect;
ControlHandle itemHandle; ControlHandle itemHandle;

View File

@@ -8,7 +8,7 @@
#include "PLDialogs.h" #include "PLDialogs.h"
void BringUpDialog (DialogPtr *theDialog, short dialogID); void BringUpDialog (Dialog **theDialog, short dialogID);
//void GetPutDialogCorner (Point *); //void GetPutDialogCorner (Point *);
//void GetGetDialogCorner (Point *); //void GetGetDialogCorner (Point *);
//void CenterDialog (short); //void CenterDialog (short);
@@ -17,31 +17,31 @@ void GetDialogRect (Rect *, short);
//void CenterAlert (short); //void CenterAlert (short);
//void ZoomOutDialogRect (short); //void ZoomOutDialogRect (short);
//void ZoomOutAlertRect (short); //void ZoomOutAlertRect (short);
void FlashDialogButton (DialogPtr, short); void FlashDialogButton (Dialog *, short);
void DrawDefaultButton (DialogPtr); void DrawDefaultButton (Dialog *);
void GetDialogString (DialogPtr, short, StringPtr); void GetDialogString (Dialog *, short, StringPtr);
void SetDialogString (DialogPtr, short, const PLPasStr&); void SetDialogString (Dialog *, short, const PLPasStr&);
short GetDialogStringLen (DialogPtr, short); short GetDialogStringLen (Dialog *, short);
void GetDialogItemValue (DialogPtr, short, short *); void GetDialogItemValue (Dialog *, short, short *);
void SetDialogItemValue (DialogPtr, short, short); void SetDialogItemValue (Dialog *, short, short);
void ToggleDialogItemValue (DialogPtr, short); void ToggleDialogItemValue (Dialog *, short);
void SetDialogNumToStr (DialogPtr, short, long); void SetDialogNumToStr (Dialog *, short, long);
void GetDialogNumFromStr (DialogPtr, short, long *); void GetDialogNumFromStr (Dialog *, short, long *);
void GetDialogItemRect (DialogPtr, short, Rect *); void GetDialogItemRect (Dialog *, short, Rect *);
void SetDialogItemRect (DialogPtr, short, Rect *); void SetDialogItemRect (Dialog *, short, Rect *);
void OffsetDialogItemRect (DialogPtr, short, short, short); void OffsetDialogItemRect (Dialog *, short, short, short);
void SelectFromRadioGroup (DialogPtr, short, short, short); void SelectFromRadioGroup (Dialog *, short, short, short);
//void AddMenuToPopUp (DialogPtr, short, MenuHandle); //void AddMenuToPopUp (Dialog *, short, MenuHandle);
void GetPopUpMenuValue (DialogPtr, short, short *); void GetPopUpMenuValue (Dialog *, short, short *);
void SetPopUpMenuValue (DialogPtr, short, short); void SetPopUpMenuValue (Dialog *, short, short);
void MyEnableControl(DialogPtr, short); void MyEnableControl(Dialog *, short);
void MyDisableControl(DialogPtr, short); void MyDisableControl(Dialog *, short);
void DrawDialogUserText (DialogPtr, short, StringPtr, Boolean); void DrawDialogUserText (Dialog *, short, StringPtr, Boolean);
void DrawDialogUserText2 (DialogPtr, short, StringPtr); void DrawDialogUserText2 (Dialog *, short, StringPtr);
void LoadDialogPICT (DialogPtr, short, short); void LoadDialogPICT (Dialog *, short, short);
void FrameDialogItem (DialogPtr, short); void FrameDialogItem (Dialog *, short);
void FrameDialogItemC (DialogPtr, short, long); void FrameDialogItemC (Dialog *, short, long);
void FrameOvalDialogItem (DialogPtr, short); void FrameOvalDialogItem (Dialog *, short);
void BorderDialogItem (DialogPtr, short, short); void BorderDialogItem (Dialog *, short, short);
void ShadowDialogItem (DialogPtr, short, short); void ShadowDialogItem (Dialog *, short, short);
void EraseDialogItem (DialogPtr, short); void EraseDialogItem (Dialog *, short);

View File

@@ -41,11 +41,11 @@ namespace PortabilityLayer
void DrawHighScores (DrawSurface *); void DrawHighScores (DrawSurface *);
void UpdateNameDialog (DialogPtr); void UpdateNameDialog (Dialog *);
Boolean NameFilter (DialogPtr, EventRecord *, short *); Boolean NameFilter (Dialog *, EventRecord *, short *);
void GetHighScoreName (short); void GetHighScoreName (short);
void UpdateBannerDialog (DialogPtr); void UpdateBannerDialog (Dialog *);
Boolean BannerFilter (DialogPtr, EventRecord *, short *); Boolean BannerFilter (Dialog *, EventRecord *, short *);
void GetHighScoreBanner (void); void GetHighScoreBanner (void);
Boolean OpenHighScoresFile (const VFileSpec &spec, PortabilityLayer::IOStream *&outStream); Boolean OpenHighScoresFile (const VFileSpec &spec, PortabilityLayer::IOStream *&outStream);
@@ -419,7 +419,7 @@ Boolean TestHighScore (void)
//-------------------------------------------------------------- UpdateNameDialog //-------------------------------------------------------------- UpdateNameDialog
// Redraws the "Enter High Score Name" dialog. // Redraws the "Enter High Score Name" dialog.
void UpdateNameDialog (DialogPtr theDialog) void UpdateNameDialog (Dialog *theDialog)
{ {
short nChars; short nChars;
@@ -433,7 +433,7 @@ void UpdateNameDialog (DialogPtr theDialog)
//-------------------------------------------------------------- NameFilter //-------------------------------------------------------------- NameFilter
// Dialog filter for the "Enter High Score Name" dialog. // Dialog filter for the "Enter High Score Name" dialog.
Boolean NameFilter (DialogPtr dial, EventRecord *event, short *item) Boolean NameFilter (Dialog *dial, EventRecord *event, short *item)
{ {
short nChars; short nChars;
@@ -487,7 +487,7 @@ Boolean NameFilter (DialogPtr dial, EventRecord *event, short *item)
void GetHighScoreName (short place) void GetHighScoreName (short place)
{ {
DialogPtr theDial; Dialog *theDial;
Str255 scoreStr, placeStr, tempStr; Str255 scoreStr, placeStr, tempStr;
short item; short item;
Boolean leaving; Boolean leaving;
@@ -525,7 +525,7 @@ void GetHighScoreName (short place)
//-------------------------------------------------------------- UpdateBannerDialog //-------------------------------------------------------------- UpdateBannerDialog
// Redraws the "Enter Message" dialog. // Redraws the "Enter Message" dialog.
void UpdateBannerDialog (DialogPtr theDialog) void UpdateBannerDialog (Dialog *theDialog)
{ {
short nChars; short nChars;
@@ -539,7 +539,7 @@ void UpdateBannerDialog (DialogPtr theDialog)
//-------------------------------------------------------------- BannerFilter //-------------------------------------------------------------- BannerFilter
// Dialog filter for the "Enter Message" dialog. // Dialog filter for the "Enter Message" dialog.
Boolean BannerFilter (DialogPtr dial, EventRecord *event, short *item) Boolean BannerFilter (Dialog *dial, EventRecord *event, short *item)
{ {
short nChars; short nChars;
@@ -596,7 +596,7 @@ Boolean BannerFilter (DialogPtr dial, EventRecord *event, short *item)
void GetHighScoreBanner (void) void GetHighScoreBanner (void)
{ {
DialogPtr theDial; Dialog *theDial;
Str255 tempStr; Str255 tempStr;
short item; short item;
Boolean leaving; Boolean leaving;

View File

@@ -21,8 +21,8 @@
#define kGoToDialogID 1043 #define kGoToDialogID 1043
void UpdateGoToDialog (DialogPtr); void UpdateGoToDialog (Dialog *);
Boolean GoToFilter (DialogPtr, EventRecord *, short *); Boolean GoToFilter (Dialog *, EventRecord *, short *);
houseHand thisHouse; houseHand thisHouse;
@@ -593,7 +593,7 @@ void GenerateRetroLinks (void)
//-------------------------------------------------------------- UpdateGoToDialog //-------------------------------------------------------------- UpdateGoToDialog
// Redraws the "Go To Room..." dialog. // Redraws the "Go To Room..." dialog.
void UpdateGoToDialog (DialogPtr theDialog) void UpdateGoToDialog (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -603,7 +603,7 @@ void UpdateGoToDialog (DialogPtr theDialog)
//-------------------------------------------------------------- GoToFilter //-------------------------------------------------------------- GoToFilter
// Dialog filter for the "Go To Room..." dialog. // Dialog filter for the "Go To Room..." dialog.
Boolean GoToFilter (DialogPtr dial, EventRecord *event, short *item) Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -647,7 +647,7 @@ Boolean GoToFilter (DialogPtr dial, EventRecord *event, short *item)
#define kGoToFSButt 4 #define kGoToFSButt 4
#define kFloorEditText 5 #define kFloorEditText 5
#define kSuiteEditText 6 #define kSuiteEditText 6
DialogPtr theDialog; Dialog *theDialog;
long tempLong; long tempLong;
short item, roomToGoTo; short item, roomToGoTo;
Boolean leaving, canceled; Boolean leaving, canceled;

View File

@@ -28,8 +28,8 @@
long CountTotalHousePoints (void); long CountTotalHousePoints (void);
void UpdateHouseInfoDialog (DialogPtr); void UpdateHouseInfoDialog (Dialog *);
Boolean HouseFilter (DialogPtr, EventRecord *, short *); Boolean HouseFilter (Dialog *, EventRecord *, short *);
Boolean WarnLockingHouse (void); Boolean WarnLockingHouse (void);
void HowToZeroScores (void); void HowToZeroScores (void);
@@ -103,7 +103,7 @@ long CountTotalHousePoints (void)
//-------------------------------------------------------------- UpdateHouseInfoDialog //-------------------------------------------------------------- UpdateHouseInfoDialog
void UpdateHouseInfoDialog (DialogPtr theDialog) void UpdateHouseInfoDialog (Dialog *theDialog)
{ {
short nChars; short nChars;
@@ -119,7 +119,7 @@ void UpdateHouseInfoDialog (DialogPtr theDialog)
//-------------------------------------------------------------- HouseFilter //-------------------------------------------------------------- HouseFilter
Boolean HouseFilter (DialogPtr dial, EventRecord *event, short *item) Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
{ {
Point mouseIs; Point mouseIs;
short nChars; short nChars;
@@ -202,7 +202,7 @@ Boolean HouseFilter (DialogPtr dial, EventRecord *event, short *item)
void DoHouseInfo (void) void DoHouseInfo (void)
{ {
DialogPtr houseInfoDialog; Dialog *houseInfoDialog;
Str255 versStr, loVers, nRoomsStr; Str255 versStr, loVers, nRoomsStr;
long h, v; long h, v;
short item, numRooms, version; short item, numRooms, version;

View File

@@ -32,7 +32,7 @@ Boolean QuerySaveGame (void);
demoPtr demoData; demoPtr demoData;
KeyMap theKeys; KeyMap theKeys;
DialogPtr saveDial; Dialog *saveDial;
short demoIndex, batteryFrame; short demoIndex, batteryFrame;
Boolean isEscPauseKey, paused, batteryWasEngaged; Boolean isEscPauseKey, paused, batteryWasEngaged;

View File

@@ -26,8 +26,8 @@ void UpdateMenusEditMode (void);
void UpdateMenusNonEditMode (void); void UpdateMenusNonEditMode (void);
void UpdateMenusHouseOpen (void); void UpdateMenusHouseOpen (void);
void UpdateMenusHouseClosed (void); void UpdateMenusHouseClosed (void);
void UpdateResumeDialog (DialogPtr); void UpdateResumeDialog (Dialog *);
Boolean ResumeFilter (DialogPtr, EventRecord *, short *); Boolean ResumeFilter (Dialog *, EventRecord *, short *);
short QueryResumeGame (void); short QueryResumeGame (void);
void HeyYourPissingAHighScore (void); void HeyYourPissingAHighScore (void);
@@ -659,7 +659,7 @@ void UpdateCoordinateCheckmark (Boolean checkIt)
//-------------------------------------------------------------- UpdateResumeDialog //-------------------------------------------------------------- UpdateResumeDialog
// Update function for Resume dialog (below). // Update function for Resume dialog (below).
void UpdateResumeDialog (DialogPtr theDialog) void UpdateResumeDialog (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -668,7 +668,7 @@ void UpdateResumeDialog (DialogPtr theDialog)
//-------------------------------------------------------------- ResumeFilter //-------------------------------------------------------------- ResumeFilter
// Dialog filter for the Resume dialog (below). // Dialog filter for the Resume dialog (below).
Boolean ResumeFilter (DialogPtr dial, EventRecord *event, short *item) Boolean ResumeFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -712,7 +712,7 @@ Boolean ResumeFilter (DialogPtr dial, EventRecord *event, short *item)
short QueryResumeGame (void) short QueryResumeGame (void)
{ {
#define kResumeGameDial 1025 #define kResumeGameDial 1025
DialogPtr theDial; Dialog *theDial;
houseType *thisHousePtr; houseType *thisHousePtr;
Str255 scoreStr, glidStr; Str255 scoreStr, glidStr;
long hadPoints; long hadPoints;

View File

@@ -65,32 +65,32 @@
#define kGotoButton2 14 #define kGotoButton2 14
void UpdateBlowerInfo (DialogPtr); void UpdateBlowerInfo (Dialog *);
void UpdateFurnitureInfo (DialogPtr); void UpdateFurnitureInfo (Dialog *);
void UpdateCustPictInfo (DialogPtr); void UpdateCustPictInfo (Dialog *);
void UpdateSwitchInfo (DialogPtr); void UpdateSwitchInfo (Dialog *);
void UpdateTriggerInfo (DialogPtr); void UpdateTriggerInfo (Dialog *);
void UpdateLightInfo (DialogPtr); void UpdateLightInfo (Dialog *);
void UpdateApplianceInfo (DialogPtr); void UpdateApplianceInfo (Dialog *);
void UpdateMicrowaveInfo (DialogPtr); void UpdateMicrowaveInfo (Dialog *);
void UpdateGreaseInfo (DialogPtr); void UpdateGreaseInfo (Dialog *);
void UpdateInvisBonusInfo (DialogPtr); void UpdateInvisBonusInfo (Dialog *);
void UpdateTransInfo (DialogPtr); void UpdateTransInfo (Dialog *);
void UpdateEnemyInfo (DialogPtr); void UpdateEnemyInfo (Dialog *);
void UpdateFlowerInfo (DialogPtr); void UpdateFlowerInfo (Dialog *);
Boolean BlowerFilter (DialogPtr, EventRecord *, short *); Boolean BlowerFilter (Dialog *, EventRecord *, short *);
Boolean FurnitureFilter (DialogPtr, EventRecord *, short *); Boolean FurnitureFilter (Dialog *, EventRecord *, short *);
Boolean CustPictFilter (DialogPtr, EventRecord *, short *); Boolean CustPictFilter (Dialog *, EventRecord *, short *);
Boolean SwitchFilter (DialogPtr, EventRecord *, short *); Boolean SwitchFilter (Dialog *, EventRecord *, short *);
Boolean TriggerFilter (DialogPtr, EventRecord *, short *); Boolean TriggerFilter (Dialog *, EventRecord *, short *);
Boolean LightFilter (DialogPtr, EventRecord *, short *); Boolean LightFilter (Dialog *, EventRecord *, short *);
Boolean ApplianceFilter (DialogPtr, EventRecord *, short *); Boolean ApplianceFilter (Dialog *, EventRecord *, short *);
Boolean MicrowaveFilter (DialogPtr, EventRecord *, short *); Boolean MicrowaveFilter (Dialog *, EventRecord *, short *);
Boolean GreaseFilter (DialogPtr, EventRecord *, short *); Boolean GreaseFilter (Dialog *, EventRecord *, short *);
Boolean InvisBonusFilter (DialogPtr, EventRecord *, short *); Boolean InvisBonusFilter (Dialog *, EventRecord *, short *);
Boolean TransFilter (DialogPtr, EventRecord *, short *); Boolean TransFilter (Dialog *, EventRecord *, short *);
Boolean EnemyFilter (DialogPtr, EventRecord *, short *); Boolean EnemyFilter (Dialog *, EventRecord *, short *);
Boolean FlowerFilter (DialogPtr, EventRecord *, short *); Boolean FlowerFilter (Dialog *, EventRecord *, short *);
void DoBlowerObjectInfo (short); void DoBlowerObjectInfo (short);
void DoFurnitureObjectInfo (void); void DoFurnitureObjectInfo (void);
void DoCustPictObjectInfo (void); void DoCustPictObjectInfo (void);
@@ -120,7 +120,7 @@ extern Boolean linkerIsSwitch;
//============================================================== Functions //============================================================== Functions
//-------------------------------------------------------------- UpdateBlowerInfo //-------------------------------------------------------------- UpdateBlowerInfo
void UpdateBlowerInfo (DialogPtr theDialog) void UpdateBlowerInfo (Dialog *theDialog)
{ {
#define kArrowheadLength 4 #define kArrowheadLength 4
Rect bounds; Rect bounds;
@@ -232,7 +232,7 @@ void UpdateBlowerInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateFurnitureInfo //-------------------------------------------------------------- UpdateFurnitureInfo
void UpdateFurnitureInfo (DialogPtr theDialog) void UpdateFurnitureInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -241,7 +241,7 @@ void UpdateFurnitureInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateCustPictInfo //-------------------------------------------------------------- UpdateCustPictInfo
void UpdateCustPictInfo (DialogPtr theDialog) void UpdateCustPictInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -250,7 +250,7 @@ void UpdateCustPictInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateSwitchInfo //-------------------------------------------------------------- UpdateSwitchInfo
void UpdateSwitchInfo (DialogPtr theDialog) void UpdateSwitchInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -262,7 +262,7 @@ void UpdateSwitchInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateTriggerInfo //-------------------------------------------------------------- UpdateTriggerInfo
void UpdateTriggerInfo (DialogPtr theDialog) void UpdateTriggerInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -272,7 +272,7 @@ void UpdateTriggerInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateLightInfo //-------------------------------------------------------------- UpdateLightInfo
void UpdateLightInfo (DialogPtr theDialog) void UpdateLightInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -281,7 +281,7 @@ void UpdateLightInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateApplianceInfo //-------------------------------------------------------------- UpdateApplianceInfo
void UpdateApplianceInfo (DialogPtr theDialog) void UpdateApplianceInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -290,7 +290,7 @@ void UpdateApplianceInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateMicrowaveInfo //-------------------------------------------------------------- UpdateMicrowaveInfo
void UpdateMicrowaveInfo (DialogPtr theDialog) void UpdateMicrowaveInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -299,7 +299,7 @@ void UpdateMicrowaveInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateGreaseInfo //-------------------------------------------------------------- UpdateGreaseInfo
void UpdateGreaseInfo (DialogPtr theDialog) void UpdateGreaseInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -308,7 +308,7 @@ void UpdateGreaseInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateInvisBonusInfo //-------------------------------------------------------------- UpdateInvisBonusInfo
void UpdateInvisBonusInfo (DialogPtr theDialog) void UpdateInvisBonusInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -319,7 +319,7 @@ void UpdateInvisBonusInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateTransInfo //-------------------------------------------------------------- UpdateTransInfo
void UpdateTransInfo (DialogPtr theDialog) void UpdateTransInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -329,7 +329,7 @@ void UpdateTransInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateEnemyInfo //-------------------------------------------------------------- UpdateEnemyInfo
void UpdateEnemyInfo (DialogPtr theDialog) void UpdateEnemyInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -338,7 +338,7 @@ void UpdateEnemyInfo (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateFlowerInfo //-------------------------------------------------------------- UpdateFlowerInfo
void UpdateFlowerInfo (DialogPtr theDialog) void UpdateFlowerInfo (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -347,7 +347,7 @@ void UpdateFlowerInfo (DialogPtr theDialog)
//-------------------------------------------------------------- BlowerFilter //-------------------------------------------------------------- BlowerFilter
Boolean BlowerFilter (DialogPtr dial, EventRecord *event, short *item) Boolean BlowerFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -401,7 +401,7 @@ Boolean BlowerFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- FurnitureFilter //-------------------------------------------------------------- FurnitureFilter
Boolean FurnitureFilter (DialogPtr dial, EventRecord *event, short *item) Boolean FurnitureFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -436,7 +436,7 @@ Boolean FurnitureFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- CustPictFilter //-------------------------------------------------------------- CustPictFilter
Boolean CustPictFilter (DialogPtr dial, EventRecord *event, short *item) Boolean CustPictFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -471,7 +471,7 @@ Boolean CustPictFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- SwitchFilter //-------------------------------------------------------------- SwitchFilter
Boolean SwitchFilter (DialogPtr dial, EventRecord *event, short *item) Boolean SwitchFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -512,7 +512,7 @@ Boolean SwitchFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- TriggerFilter //-------------------------------------------------------------- TriggerFilter
Boolean TriggerFilter (DialogPtr dial, EventRecord *event, short *item) Boolean TriggerFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -558,7 +558,7 @@ Boolean TriggerFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- LightFilter //-------------------------------------------------------------- LightFilter
Boolean LightFilter (DialogPtr dial, EventRecord *event, short *item) Boolean LightFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -607,7 +607,7 @@ Boolean LightFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- ApplianceFilter //-------------------------------------------------------------- ApplianceFilter
Boolean ApplianceFilter (DialogPtr dial, EventRecord *event, short *item) Boolean ApplianceFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -661,7 +661,7 @@ Boolean ApplianceFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- MicrowaveFilter //-------------------------------------------------------------- MicrowaveFilter
Boolean MicrowaveFilter (DialogPtr dial, EventRecord *event, short *item) Boolean MicrowaveFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -710,7 +710,7 @@ Boolean MicrowaveFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- GreaseFilter //-------------------------------------------------------------- GreaseFilter
Boolean GreaseFilter (DialogPtr dial, EventRecord *event, short *item) Boolean GreaseFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -751,7 +751,7 @@ Boolean GreaseFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- InvisBonusFilter //-------------------------------------------------------------- InvisBonusFilter
Boolean InvisBonusFilter (DialogPtr dial, EventRecord *event, short *item) Boolean InvisBonusFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -786,7 +786,7 @@ Boolean InvisBonusFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- TransFilter //-------------------------------------------------------------- TransFilter
Boolean TransFilter (DialogPtr dial, EventRecord *event, short *item) Boolean TransFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -827,7 +827,7 @@ Boolean TransFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- EnemyFilter //-------------------------------------------------------------- EnemyFilter
Boolean EnemyFilter (DialogPtr dial, EventRecord *event, short *item) Boolean EnemyFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -881,7 +881,7 @@ Boolean EnemyFilter (DialogPtr dial, EventRecord *event, short *item)
//-------------------------------------------------------------- EnemyFilter //-------------------------------------------------------------- EnemyFilter
Boolean FlowerFilter (DialogPtr dial, EventRecord *event, short *item) Boolean FlowerFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -932,7 +932,7 @@ Boolean FlowerFilter (DialogPtr dial, EventRecord *event, short *item)
void DoBlowerObjectInfo (short what) void DoBlowerObjectInfo (short what)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr, distStr; Str255 numberStr, kindStr, distStr;
short item, initial; short item, initial;
Boolean leaving, doReturn, leftFacing; Boolean leaving, doReturn, leftFacing;
@@ -1105,7 +1105,7 @@ void DoBlowerObjectInfo (short what)
void DoFurnitureObjectInfo (void) void DoFurnitureObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item; short item;
Boolean leaving, doReturn; Boolean leaving, doReturn;
@@ -1170,7 +1170,7 @@ void DoFurnitureObjectInfo (void)
void DoCustPictObjectInfo (void) void DoCustPictObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
long wasPict; long wasPict;
short item; short item;
@@ -1267,7 +1267,7 @@ void DoCustPictObjectInfo (void)
void DoSwitchObjectInfo (void) void DoSwitchObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr, roomStr, tempStr, objStr; Str255 numberStr, kindStr, roomStr, tempStr, objStr;
short item, floor, suite; short item, floor, suite;
Boolean leaving, doLink, doGoTo, doReturn; Boolean leaving, doLink, doGoTo, doReturn;
@@ -1389,7 +1389,7 @@ void DoSwitchObjectInfo (void)
void DoTriggerObjectInfo (void) void DoTriggerObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr, roomStr, tempStr, objStr; Str255 numberStr, kindStr, roomStr, tempStr, objStr;
long delayIs; long delayIs;
short item, floor, suite; short item, floor, suite;
@@ -1545,7 +1545,7 @@ void DoTriggerObjectInfo (void)
void DoLightObjectInfo (void) void DoLightObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item, initial; short item, initial;
Boolean leaving, doReturn; Boolean leaving, doReturn;
@@ -1631,7 +1631,7 @@ void DoLightObjectInfo (void)
void DoApplianceObjectInfo (short what) void DoApplianceObjectInfo (short what)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
long delay; long delay;
short item, initial; short item, initial;
@@ -1747,7 +1747,7 @@ void DoApplianceObjectInfo (short what)
void DoMicrowaveObjectInfo (void) void DoMicrowaveObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item, initial, kills; short item, initial, kills;
Boolean leaving, doReturn; Boolean leaving, doReturn;
@@ -1871,7 +1871,7 @@ void DoMicrowaveObjectInfo (void)
void DoGreaseObjectInfo (void) void DoGreaseObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item; short item;
Boolean leaving, wasSpilled, doReturn; Boolean leaving, wasSpilled, doReturn;
@@ -1945,7 +1945,7 @@ void DoGreaseObjectInfo (void)
void DoInvisBonusObjectInfo (void) void DoInvisBonusObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item; short item;
Boolean leaving, doReturn; Boolean leaving, doReturn;
@@ -2058,7 +2058,7 @@ void DoInvisBonusObjectInfo (void)
void DoTransObjectInfo (short what) void DoTransObjectInfo (short what)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr, roomStr, tempStr, objStr; Str255 numberStr, kindStr, roomStr, tempStr, objStr;
short item, floor, suite; short item, floor, suite;
Boolean leaving, doLink, doGoTo, doReturn, wasState; Boolean leaving, doLink, doGoTo, doReturn, wasState;
@@ -2181,7 +2181,7 @@ void DoTransObjectInfo (short what)
void DoEnemyObjectInfo (short what) void DoEnemyObjectInfo (short what)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
long delay; long delay;
short item, initial; short item, initial;
@@ -2291,7 +2291,7 @@ void DoEnemyObjectInfo (short what)
void DoFlowerObjectInfo (void) void DoFlowerObjectInfo (void)
{ {
DialogPtr infoDial; Dialog *infoDial;
Str255 numberStr, kindStr; Str255 numberStr, kindStr;
short item, flower; short item, flower;
Boolean leaving, doReturn; Boolean leaving, doReturn;

View File

@@ -247,7 +247,7 @@ void NewGame (short mode)
} }
NilSavedMaps(); NilSavedMaps();
SetPortWindowPort(mainWindow); SetPortWindowPort(mainWindow);
BlackenScoreboard(mainWindow->GetDrawSurface());
UpdateMenus(false); UpdateMenus(false);
if (!gameOver) if (!gameOver)

View File

@@ -38,13 +38,13 @@
#define kFloorSupportCheck 12 #define kFloorSupportCheck 12
void UpdateRoomInfoDialog (DialogPtr); void UpdateRoomInfoDialog (Dialog *);
void DragMiniTile (DrawSurface *, Point, short *); void DragMiniTile (DrawSurface *, Point, short *);
void HiliteTileOver (DrawSurface *, Point); void HiliteTileOver (DrawSurface *, Point);
Boolean RoomFilter (DialogPtr, EventRecord *, short *); Boolean RoomFilter (Dialog *, EventRecord *, short *);
short ChooseOriginalArt (short); short ChooseOriginalArt (short);
void UpdateOriginalArt (DialogPtr); void UpdateOriginalArt (Dialog *);
Boolean OriginalArtFilter (DialogPtr, EventRecord *, short *); Boolean OriginalArtFilter (Dialog *, EventRecord *, short *);
Boolean PictIDExists (short); Boolean PictIDExists (short);
short GetFirstPICT (void); short GetFirstPICT (void);
void BitchAboutPICTNotFound (void); void BitchAboutPICTNotFound (void);
@@ -66,7 +66,7 @@ extern short houseResFork, lastBackground;
//-------------------------------------------------------------- UpdateRoomInfoDialog //-------------------------------------------------------------- UpdateRoomInfoDialog
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
void UpdateRoomInfoDialog (DialogPtr theDialog) void UpdateRoomInfoDialog (Dialog *theDialog)
{ {
Rect src, dest; Rect src, dest;
short i; short i;
@@ -346,7 +346,7 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
//-------------------------------------------------------------- RoomFilter //-------------------------------------------------------------- RoomFilter
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
Boolean RoomFilter (DialogPtr dial, EventRecord *event, short *item) Boolean RoomFilter (Dialog *dial, EventRecord *event, short *item)
{ {
Point mouseIs; Point mouseIs;
short newTileOver; short newTileOver;
@@ -428,7 +428,7 @@ void DoRoomInfo (void)
{ {
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
#define kBackgroundsMenuID 140 #define kBackgroundsMenuID 140
DialogPtr roomInfoDialog; Dialog *roomInfoDialog;
MenuHandle backgroundsMenu; MenuHandle backgroundsMenu;
Str255 floorStr, suiteStr, objectsStr, tempStr; Str255 floorStr, suiteStr, objectsStr, tempStr;
short item, i, newBack; short item, i, newBack;
@@ -609,7 +609,7 @@ void DoRoomInfo (void)
//-------------------------------------------------------------- UpdateOriginalArt //-------------------------------------------------------------- UpdateOriginalArt
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
void UpdateOriginalArt (DialogPtr theDialog) void UpdateOriginalArt (Dialog *theDialog)
{ {
Pattern dummyPattern; Pattern dummyPattern;
@@ -663,7 +663,7 @@ void UpdateOriginalArt (DialogPtr theDialog)
//-------------------------------------------------------------- OriginalArtFilter //-------------------------------------------------------------- OriginalArtFilter
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
Boolean OriginalArtFilter (DialogPtr dial, EventRecord *event, short *item) Boolean OriginalArtFilter (Dialog *dial, EventRecord *event, short *item)
{ {
Point mouseIs; Point mouseIs;
@@ -746,7 +746,7 @@ Boolean OriginalArtFilter (DialogPtr dial, EventRecord *event, short *item)
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
short ChooseOriginalArt (short was) short ChooseOriginalArt (short was)
{ {
DialogPtr theDialog; Dialog *theDialog;
long longID; long longID;
short item, newPictID, tempShort, wasPictID; short item, newPictID, tempShort, wasPictID;
Boolean leaving; Boolean leaving;

View File

@@ -39,10 +39,10 @@
#define kMaxExtraHouses 8 #define kMaxExtraHouses 8
void UpdateLoadDialog (DialogPtr); void UpdateLoadDialog (Dialog *);
void PageUpHouses (DialogPtr); void PageUpHouses (Dialog *);
void PageDownHouses (DialogPtr); void PageDownHouses (Dialog *);
Boolean LoadFilter (DialogPtr, EventRecord *, short *); Boolean LoadFilter (Dialog *, EventRecord *, short *);
void SortHouseList (void); void SortHouseList (void);
void DoDirSearch (void); void DoDirSearch (void);
@@ -63,7 +63,7 @@ extern UInt32 doubleTime;
//-------------------------------------------------------------- UpdateLoadWindow //-------------------------------------------------------------- UpdateLoadWindow
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
void UpdateLoadDialog (DialogPtr theDialog) void UpdateLoadDialog (Dialog *theDialog)
{ {
Rect tempRect, dialogRect, dummyRect; Rect tempRect, dialogRect, dummyRect;
short houseStart, houseStop, i, wasResFile, isResFile, count; short houseStart, houseStop, i, wasResFile, isResFile, count;
@@ -138,7 +138,7 @@ void UpdateLoadDialog (DialogPtr theDialog)
//-------------------------------------------------------------- PageUpHouses //-------------------------------------------------------------- PageUpHouses
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
void PageUpHouses (DialogPtr theDial) void PageUpHouses (Dialog *theDial)
{ {
Rect tempRect; Rect tempRect;
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface(); DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
@@ -172,7 +172,7 @@ void PageUpHouses (DialogPtr theDial)
//-------------------------------------------------------------- PageDownHouses //-------------------------------------------------------------- PageDownHouses
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
void PageDownHouses (DialogPtr theDial) void PageDownHouses (Dialog *theDial)
{ {
Rect tempRect; Rect tempRect;
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface(); DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
@@ -205,7 +205,7 @@ void PageDownHouses (DialogPtr theDial)
//-------------------------------------------------------------- LoadFilter //-------------------------------------------------------------- LoadFilter
#ifndef COMPILEDEMO #ifndef COMPILEDEMO
Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item) Boolean LoadFilter (Dialog *dial, EventRecord *event, short *item)
{ {
short screenCount, i, wasIndex; short screenCount, i, wasIndex;
@@ -364,7 +364,7 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
void DoLoadHouse (void) void DoLoadHouse (void)
{ {
Rect tempRect; Rect tempRect;
DialogPtr theDial; Dialog *theDial;
short i, item, wasIndex, screenCount; short i, item, wasIndex, screenCount;
Boolean leaving, whoCares; Boolean leaving, whoCares;
ModalFilterUPP loadFilterUPP; ModalFilterUPP loadFilterUPP;

View File

@@ -59,29 +59,29 @@
#define kDoBitchDlgsCheck 14 #define kDoBitchDlgsCheck 14
void SetBrainsToDefaults (DialogPtr); void SetBrainsToDefaults (Dialog *);
void UpdateSettingsBrains (DialogPtr); void UpdateSettingsBrains (Dialog *);
Boolean BrainsFilter (DialogPtr, EventRecord *, short *); Boolean BrainsFilter (Dialog *, EventRecord *, short *);
void DoBrainsPrefs (void); void DoBrainsPrefs (void);
void SetControlsToDefaults (DialogPtr); void SetControlsToDefaults (Dialog *);
void UpdateControlKeyName (DialogPtr); void UpdateControlKeyName (Dialog *);
void UpdateSettingsControl (DialogPtr); void UpdateSettingsControl (Dialog *);
Boolean ControlFilter (DialogPtr, EventRecord *, short *); Boolean ControlFilter (Dialog *, EventRecord *, short *);
void DoControlPrefs (void); void DoControlPrefs (void);
void SoundDefaults (DialogPtr); void SoundDefaults (Dialog *);
void UpdateSettingsSound (DialogPtr); void UpdateSettingsSound (Dialog *);
void HandleSoundMusicChange (short, Boolean); void HandleSoundMusicChange (short, Boolean);
Boolean SoundFilter (DialogPtr, EventRecord *, short *); Boolean SoundFilter (Dialog *, EventRecord *, short *);
void DoSoundPrefs (void); void DoSoundPrefs (void);
void DisplayDefaults (void); void DisplayDefaults (void);
void FrameDisplayIcon (DialogPtr); void FrameDisplayIcon (Dialog *);
void DisplayUpdate (DialogPtr); void DisplayUpdate (Dialog *);
Boolean DisplayFilter (DialogPtr, EventRecord *, short *); Boolean DisplayFilter (Dialog *, EventRecord *, short *);
void DoDisplayPrefs (void); void DoDisplayPrefs (void);
void SetAllDefaults (void); void SetAllDefaults (void);
void FlashSettingsButton (short); void FlashSettingsButton (short);
void UpdateSettingsMain (DialogPtr); void UpdateSettingsMain (Dialog *);
Boolean PrefsFilter (DialogPtr, EventRecord *, short *); Boolean PrefsFilter (Dialog *, EventRecord *, short *);
void BitchAboutChanges (void); void BitchAboutChanges (void);
@@ -105,7 +105,7 @@ extern Boolean changeLockStateOfHouse, saveHouseLocked, doPrettyMap;
//============================================================== Functions //============================================================== Functions
//-------------------------------------------------------------- SetBrainsToDefaults //-------------------------------------------------------------- SetBrainsToDefaults
void SetBrainsToDefaults (DialogPtr theDialog) void SetBrainsToDefaults (Dialog *theDialog)
{ {
SetDialogNumToStr(theDialog, kMaxFilesItem, 24L); SetDialogNumToStr(theDialog, kMaxFilesItem, 24L);
#ifdef powerc #ifdef powerc
@@ -130,7 +130,7 @@ void SetBrainsToDefaults (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateSettingsBrains //-------------------------------------------------------------- UpdateSettingsBrains
void UpdateSettingsBrains (DialogPtr theDialog) void UpdateSettingsBrains (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -143,7 +143,7 @@ void UpdateSettingsBrains (DialogPtr theDialog)
//-------------------------------------------------------------- BrainsFilter //-------------------------------------------------------------- BrainsFilter
Boolean BrainsFilter (DialogPtr dial, EventRecord *event, short *item) Boolean BrainsFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -221,7 +221,7 @@ Boolean BrainsFilter (DialogPtr dial, EventRecord *event, short *item)
void DoBrainsPrefs (void) void DoBrainsPrefs (void)
{ {
DialogPtr prefDlg; Dialog *prefDlg;
long tempLong; long tempLong;
short itemHit, wasMaxFiles; short itemHit, wasMaxFiles;
Boolean leaving; Boolean leaving;
@@ -325,7 +325,7 @@ void DoBrainsPrefs (void)
//-------------------------------------------------------------- SetControlsToDefaults //-------------------------------------------------------------- SetControlsToDefaults
void SetControlsToDefaults (DialogPtr theDialog) void SetControlsToDefaults (Dialog *theDialog)
{ {
PasStringCopy(PSTR("lf arrow"), tempLeftStr); PasStringCopy(PSTR("lf arrow"), tempLeftStr);
PasStringCopy(PSTR("rt arrow"), tempRightStr); PasStringCopy(PSTR("rt arrow"), tempRightStr);
@@ -342,7 +342,7 @@ void SetControlsToDefaults (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateControlKeyName //-------------------------------------------------------------- UpdateControlKeyName
void UpdateControlKeyName (DialogPtr theDialog) void UpdateControlKeyName (Dialog *theDialog)
{ {
DrawDialogUserText(theDialog, kRightControl + 4, tempRightStr, whichCtrl == 0); DrawDialogUserText(theDialog, kRightControl + 4, tempRightStr, whichCtrl == 0);
DrawDialogUserText(theDialog, kLeftControl + 4, tempLeftStr, whichCtrl == 1); DrawDialogUserText(theDialog, kLeftControl + 4, tempLeftStr, whichCtrl == 1);
@@ -352,7 +352,7 @@ void UpdateControlKeyName (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateSettingsControl //-------------------------------------------------------------- UpdateSettingsControl
void UpdateSettingsControl (DialogPtr theDialog) void UpdateSettingsControl (Dialog *theDialog)
{ {
short i; short i;
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface(); DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
@@ -385,7 +385,7 @@ void UpdateSettingsControl (DialogPtr theDialog)
//-------------------------------------------------------------- ControlFilter //-------------------------------------------------------------- ControlFilter
Boolean ControlFilter (DialogPtr dial, EventRecord *event, short *item) Boolean ControlFilter (Dialog *dial, EventRecord *event, short *item)
{ {
intptr_t wasKeyMap; intptr_t wasKeyMap;
@@ -508,7 +508,7 @@ Boolean ControlFilter (DialogPtr dial, EventRecord *event, short *item)
void DoControlPrefs (void) void DoControlPrefs (void)
{ {
DialogPtr prefDlg; Dialog *prefDlg;
short i, itemHit; short i, itemHit;
Boolean leaving; Boolean leaving;
ModalFilterUPP controlFilterUPP; ModalFilterUPP controlFilterUPP;
@@ -614,7 +614,7 @@ void DoControlPrefs (void)
//-------------------------------------------------------------- SoundDefaults //-------------------------------------------------------------- SoundDefaults
void SoundDefaults (DialogPtr theDialog) void SoundDefaults (Dialog *theDialog)
{ {
wasIdle = true; wasIdle = true;
wasPlay = true; wasPlay = true;
@@ -627,7 +627,7 @@ void SoundDefaults (DialogPtr theDialog)
//-------------------------------------------------------------- UpdateSettingsSound //-------------------------------------------------------------- UpdateSettingsSound
void UpdateSettingsSound (DialogPtr theDialog) void UpdateSettingsSound (Dialog *theDialog)
{ {
short howLoudNow; short howLoudNow;
@@ -676,7 +676,7 @@ void HandleSoundMusicChange (short newVolume, Boolean sayIt)
//-------------------------------------------------------------- SoundFilter //-------------------------------------------------------------- SoundFilter
Boolean SoundFilter (DialogPtr dial, EventRecord *event, short *item) Boolean SoundFilter (Dialog *dial, EventRecord *event, short *item)
{ {
short newVolume; short newVolume;
@@ -772,7 +772,7 @@ Boolean SoundFilter (DialogPtr dial, EventRecord *event, short *item)
void DoSoundPrefs (void) void DoSoundPrefs (void)
{ {
Rect tempRect; Rect tempRect;
DialogPtr prefDlg; Dialog *prefDlg;
short wasLoudness, tempVolume; short wasLoudness, tempVolume;
PLError_t theErr; PLError_t theErr;
short itemHit; short itemHit;
@@ -907,7 +907,7 @@ void DisplayDefaults (void)
//-------------------------------------------------------------- FrameDisplayIcon //-------------------------------------------------------------- FrameDisplayIcon
void FrameDisplayIcon (DialogPtr theDialog) void FrameDisplayIcon (Dialog *theDialog)
{ {
Rect theRect; Rect theRect;
@@ -941,7 +941,7 @@ void FrameDisplayIcon (DialogPtr theDialog)
//-------------------------------------------------------------- DisplayUpdate //-------------------------------------------------------------- DisplayUpdate
void DisplayUpdate (DialogPtr theDialog) void DisplayUpdate (Dialog *theDialog)
{ {
DrawDialog(theDialog); DrawDialog(theDialog);
DrawDefaultButton(theDialog); DrawDefaultButton(theDialog);
@@ -962,7 +962,7 @@ void DisplayUpdate (DialogPtr theDialog)
//-------------------------------------------------------------- DisplayFilter //-------------------------------------------------------------- DisplayFilter
Boolean DisplayFilter (DialogPtr dial, EventRecord *event, short *item) Boolean DisplayFilter (Dialog *dial, EventRecord *event, short *item)
{ {
switch (event->what) switch (event->what)
{ {
@@ -1118,7 +1118,7 @@ Boolean DisplayFilter (DialogPtr dial, EventRecord *event, short *item)
void DoDisplayPrefs (void) void DoDisplayPrefs (void)
{ {
DialogPtr prefDlg; Dialog *prefDlg;
short itemHit, wasNeighbors; short itemHit, wasNeighbors;
Boolean leaving; Boolean leaving;
ModalFilterUPP displayFilterUPP; ModalFilterUPP displayFilterUPP;
@@ -1297,7 +1297,7 @@ void FlashSettingsButton (short who)
//-------------------------------------------------------------- UpdateSettingsMain //-------------------------------------------------------------- UpdateSettingsMain
void UpdateSettingsMain (DialogPtr theDialog) void UpdateSettingsMain (Dialog *theDialog)
{ {
Str255 theStr; Str255 theStr;
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface(); DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
@@ -1323,7 +1323,7 @@ void UpdateSettingsMain (DialogPtr theDialog)
//-------------------------------------------------------------- PrefsFilter //-------------------------------------------------------------- PrefsFilter
Boolean PrefsFilter (DialogPtr dial, EventRecord *event, short *item) Boolean PrefsFilter (Dialog *dial, EventRecord *event, short *item)
{ {
Point testPt; Point testPt;
short i; short i;
@@ -1410,7 +1410,7 @@ Boolean PrefsFilter (DialogPtr dial, EventRecord *event, short *item)
void DoSettingsMain (void) void DoSettingsMain (void)
{ {
#define kAllDefaultsButton 11 #define kAllDefaultsButton 11
DialogPtr prefDlg; Dialog *prefDlg;
short itemHit; short itemHit;
Boolean leaving; Boolean leaving;
ModalFilterUPP prefsFilterUPP; ModalFilterUPP prefsFilterUPP;

View File

@@ -1,5 +1,6 @@
#include "DialogManager.h" #include "DialogManager.h"
#include "ResourceManager.h" #include "ResourceManager.h"
#include "PLArrayView.h"
#include "PLDialogs.h" #include "PLDialogs.h"
#include "PLBigEndian.h" #include "PLBigEndian.h"
#include "PLPasStr.h" #include "PLPasStr.h"
@@ -13,21 +14,247 @@
namespace PortabilityLayer namespace PortabilityLayer
{ {
namespace SerializedDialogItemTypeCodes
{
enum SerializedDialogItemTypeCode
{
kUserItem = 0x00,
kButton = 0x04,
kCheckBox = 0x05,
kRadioButton = 0x06,
kCustomControl = 0x07,
kLabel = 0x08,
kEditBox = 0x10,
kIcon = 0x20,
kImage = 0x40,
};
}
typedef SerializedDialogItemTypeCodes::SerializedDialogItemTypeCode SerializedDialogItemTypeCode_t;
struct DialogTemplateItem
{
Rect m_rect;
int16_t m_id;
uint8_t m_serializedType;
bool m_enabled;
Str255 m_name;
};
class DialogItemImpl : public DialogItem
{
public:
DialogItemImpl(const DialogTemplateItem &templateItem);
virtual ~DialogItemImpl();
Rect GetRect() const override;
virtual bool Init() = 0;
virtual void Destroy() = 0;
protected:
Rect m_rect;
int16_t m_id;
bool m_enabled;
PascalStr<255> m_name;
};
template<class T>
class DialogItemSpec : public DialogItemImpl
{
public:
DialogItemSpec(const DialogTemplateItem &tmpl)
: DialogItemImpl(tmpl)
{
}
void Destroy() override
{
static_cast<T*>(this)->~T();
free(static_cast<T*>(this));
}
static DialogItemSpec *Create(const DialogTemplateItem &tmpl)
{
void *storage = malloc(sizeof(T));
if (!storage)
return nullptr;
T *item = new (storage) T(tmpl);
DialogItemImpl *dItem = static_cast<DialogItemImpl*>(item);
if (!dItem->Init())
{
dItem->Destroy();
return nullptr;
}
return item;
}
};
class DialogItem_EditBox final : public DialogItemSpec<DialogItem_EditBox>
{
public:
explicit DialogItem_EditBox(const DialogTemplateItem &tmpl);
bool Init() override;
};
class DialogItem_Label final : public DialogItemSpec<DialogItem_Label>
{
public:
explicit DialogItem_Label(const DialogTemplateItem &tmpl);
bool Init() override;
};
class DialogItem_Unknown final : public DialogItemSpec<DialogItem_Unknown>
{
public:
explicit DialogItem_Unknown(const DialogTemplateItem &tmpl);
bool Init() override;
};
class DialogTemplate final
{
public:
DialogTemplate(DialogTemplateItem *itemStorage, size_t numItems);
void DeserializeItems(const uint8_t *data);
void Destroy();
ArrayView<const DialogTemplateItem> GetItems() const;
private:
DialogTemplateItem *m_items;
size_t m_numItems;
};
class DialogImpl final : public Dialog class DialogImpl final : public Dialog
{ {
public: public:
void Destroy() override; void Destroy() override;
Window *GetWindow() const override; Window *GetWindow() const override;
ArrayView<DialogItem*const> GetItems() const override;
static DialogImpl *Create(Window *window); bool Populate(DialogTemplate *tmpl);
static DialogImpl *Create(Window *window, size_t numItems);
private: private:
explicit DialogImpl(Window *window); explicit DialogImpl(Window *window, DialogItem **items, size_t numItems);
~DialogImpl(); ~DialogImpl();
Window *m_window; Window *m_window;
DialogItem **m_items;
size_t m_numItems;
}; };
DialogItemImpl::DialogItemImpl(const DialogTemplateItem &templateItem)
: m_enabled(templateItem.m_enabled)
, m_id(templateItem.m_id)
, m_name(PLPasStr(templateItem.m_name))
, m_rect(templateItem.m_rect)
{
}
DialogItemImpl::~DialogItemImpl()
{
}
Rect DialogItemImpl::GetRect() const
{
return m_rect;
}
DialogItem_EditBox::DialogItem_EditBox(const DialogTemplateItem &tmpl)
: DialogItemSpec<DialogItem_EditBox>(tmpl)
{
}
bool DialogItem_EditBox::Init()
{
return true;
}
DialogItem_Label::DialogItem_Label(const DialogTemplateItem &tmpl)
: DialogItemSpec<DialogItem_Label>(tmpl)
{
}
bool DialogItem_Label::Init()
{
return true;
}
DialogItem_Unknown::DialogItem_Unknown(const DialogTemplateItem &tmpl)
: DialogItemSpec<DialogItem_Unknown>(tmpl)
{
}
bool DialogItem_Unknown::Init()
{
return true;
}
DialogTemplate::DialogTemplate(DialogTemplateItem *itemStorage, size_t numItems)
: m_items(itemStorage)
, m_numItems(numItems)
{
}
void DialogTemplate::DeserializeItems(const uint8_t *data)
{
for (size_t i = 0; i < m_numItems; i++)
{
BERect itemRect;
uint8_t itemType;
data += 4; // Unused
memcpy(&itemRect, data, 8);
data += 8;
itemType = *data;
data++;
uint8_t nameLength = *data;
data++;
const uint8_t *nameBytes = data;
size_t nameLengthPadded = nameLength;
if ((nameLength & 1) == 1)
nameLengthPadded++;
data += nameLengthPadded;
DialogTemplateItem &item = m_items[i];
item.m_rect = itemRect.ToRect();
item.m_id = 0;
item.m_serializedType = (itemType & 0x7f);
item.m_enabled = ((itemType & 0x80) == 0);
item.m_name[0] = nameLength;
memcpy(item.m_name + 1, nameBytes, nameLength);
if (item.m_serializedType == SerializedDialogItemTypeCodes::kCustomControl || item.m_serializedType == SerializedDialogItemTypeCodes::kImage || item.m_serializedType == SerializedDialogItemTypeCodes::kIcon)
{
memcpy(&item.m_id, item.m_name + 1, 2);
ByteSwap::BigInt16(item.m_id);
}
}
}
void DialogTemplate::Destroy()
{
this->~DialogTemplate();
free(this);
}
ArrayView<const DialogTemplateItem> DialogTemplate::GetItems() const
{
return ArrayView<const DialogTemplateItem>(m_items, m_numItems);
}
void DialogImpl::Destroy() void DialogImpl::Destroy()
{ {
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(m_window); PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(m_window);
@@ -41,22 +268,78 @@ namespace PortabilityLayer
return m_window; return m_window;
} }
DialogImpl *DialogImpl::Create(Window *window) ArrayView<DialogItem*const> DialogImpl::GetItems() const
{ {
void *storage = malloc(sizeof(DialogImpl)); ArrayView<DialogItem*const> iter(m_items, m_numItems);
return ArrayView<DialogItem*const>(m_items, m_numItems);
}
bool DialogImpl::Populate(DialogTemplate *tmpl)
{
ArrayView<const DialogTemplateItem> templateItems = tmpl->GetItems();
const size_t numItems = templateItems.Count();
for (size_t i = 0; i < numItems; i++)
{
const DialogTemplateItem &templateItem = templateItems[i];
DialogItem *ditem = nullptr;
switch (templateItem.m_serializedType)
{
case SerializedDialogItemTypeCodes::kLabel:
ditem = DialogItem_Label::Create(templateItem);
break;
case SerializedDialogItemTypeCodes::kEditBox:
ditem = DialogItem_EditBox::Create(templateItem);
break;
default:
ditem = DialogItem_Unknown::Create(templateItem);
break;
}
if (!ditem)
return false;
m_items[i] = ditem;
}
return true;
}
DialogImpl *DialogImpl::Create(Window *window, size_t numItems)
{
size_t alignedSize = sizeof(DialogImpl) + PL_SYSTEM_MEMORY_ALIGNMENT + 1;
alignedSize -= alignedSize % PL_SYSTEM_MEMORY_ALIGNMENT;
const size_t itemsSize = sizeof(DialogItemImpl) * numItems;
void *storage = malloc(alignedSize + itemsSize);
if (!storage) if (!storage)
return nullptr; return nullptr;
return new (storage) DialogImpl(window); DialogItem **itemsList = reinterpret_cast<DialogItem **>(static_cast<uint8_t*>(storage) + alignedSize);
for (size_t i = 0; i < numItems; i++)
itemsList[i] = nullptr;
return new (storage) DialogImpl(window, itemsList, numItems);
} }
DialogImpl::DialogImpl(Window *window) DialogImpl::DialogImpl(Window *window, DialogItem **itemsList, size_t numItems)
: m_window(window) : m_window(window)
, m_items(itemsList)
, m_numItems(numItems)
{ {
} }
DialogImpl::~DialogImpl() DialogImpl::~DialogImpl()
{ {
for (size_t i = 0; i < m_numItems; i++)
{
if (DialogItem *item = m_items[i])
static_cast<DialogItemImpl*>(item)->Destroy();
}
} }
// DLOG resource format: // DLOG resource format:
@@ -80,6 +363,7 @@ namespace PortabilityLayer
{ {
public: public:
Dialog *LoadDialog(int16_t resID, Window *behindWindow) override; Dialog *LoadDialog(int16_t resID, Window *behindWindow) override;
DialogTemplate *LoadDialogTemplate(int16_t resID);
static DialogManagerImpl *GetInstance(); static DialogManagerImpl *GetInstance();
@@ -110,31 +394,83 @@ namespace PortabilityLayer
dlogH.Dispose(); dlogH.Dispose();
DialogTemplate *dtemplate = LoadDialogTemplate(header.m_itemsResID);
const size_t numItems = (dtemplate == nullptr) ? 0 : dtemplate->GetItems().Count();
if (!rect.IsValid()) if (!rect.IsValid())
{
dtemplate->Destroy();
return nullptr; return nullptr;
}
WindowManager *wm = PortabilityLayer::WindowManager::GetInstance(); WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
WindowDef wdef = WindowDef::Create(rect, 0, header.m_visible != 0, header.m_hasCloseBox != 0, header.m_referenceConstant, positionSpec, PLPasStr(titlePStr)); WindowDef wdef = WindowDef::Create(rect, 0, header.m_visible != 0, header.m_hasCloseBox != 0, header.m_referenceConstant, positionSpec, PLPasStr(titlePStr));
Window *window = wm->CreateWindow(wdef); Window *window = wm->CreateWindow(wdef);
if (!window) if (!window)
{
dtemplate->Destroy();
return nullptr; return nullptr;
}
wm->PutWindowBehind(window, behindWindow); wm->PutWindowBehind(window, behindWindow);
THandle<uint8_t> dtemplateH = rm->GetResource('DITL', header.m_itemsResID).StaticCast<uint8_t>(); DialogImpl *dialog = DialogImpl::Create(window, numItems);
Dialog *dialog = DialogImpl::Create(window);
if (!dialog) if (!dialog)
{ {
dtemplate->Destroy();
wm->DestroyWindow(window); wm->DestroyWindow(window);
return nullptr; return nullptr;
} }
if (!dialog->Populate(dtemplate))
{
dialog->Destroy();
dtemplate->Destroy();
wm->DestroyWindow(window);
return nullptr;
}
return dialog; return dialog;
} }
DialogTemplate *DialogManagerImpl::LoadDialogTemplate(int16_t resID)
{
ResourceManager *rm = ResourceManager::GetInstance();
THandle<uint8_t> dtemplateH = rm->GetResource('DITL', resID).StaticCast<uint8_t>();
if (!dtemplateH)
return nullptr;
uint16_t numItems;
memcpy(&numItems, *dtemplateH, 2);
ByteSwap::BigUInt16(numItems);
size_t dtlAlignedSize = sizeof(DialogTemplate) + PL_SYSTEM_MEMORY_ALIGNMENT - 1;
dtlAlignedSize -= dtlAlignedSize % PL_SYSTEM_MEMORY_ALIGNMENT;
const size_t dtlItemSize = sizeof(DialogTemplateItem) * numItems;
void *storage = malloc(dtlAlignedSize + dtlItemSize);
if (!storage)
{
dtemplateH.Dispose();
return nullptr;
}
uint8_t *itemsLoc = static_cast<uint8_t*>(storage) + dtlAlignedSize;
DialogTemplate *dtemplate = new (storage) DialogTemplate(reinterpret_cast<DialogTemplateItem*>(itemsLoc), numItems);
dtemplate->DeserializeItems((*dtemplateH) + 2);
dtemplateH.Dispose();
return dtemplate;
}
DialogManagerImpl *DialogManagerImpl::GetInstance() DialogManagerImpl *DialogManagerImpl::GetInstance()
{ {
return &ms_instance; return &ms_instance;

View File

@@ -0,0 +1,64 @@
#pragma once
#include <stdint.h>
template<class T>
class ArrayViewIterator;
template<class T>
class ArrayView
{
public:
ArrayView(const T *items, size_t count);
ArrayView(const ArrayView<T> &other);
size_t Count() const;
const T &operator[](size_t index) const;
ArrayViewIterator<T> begin() const;
ArrayViewIterator<T> end() const;
private:
const T *m_items;
size_t m_count;
};
#include "PLArrayViewIterator.h"
template<class T>
inline ArrayView<T>::ArrayView(const T *items, size_t count)
: m_items(items)
, m_count(count)
{
}
template<class T>
inline ArrayView<T>::ArrayView(const ArrayView<T> &other)
: m_items(other.m_items)
, m_count(other.m_count)
{
}
template<class T>
inline size_t ArrayView<T>::Count() const
{
return m_count;
}
template<class T>
const T &ArrayView<T>::operator[](size_t index) const
{
return m_items[index];
}
template<class T>
inline ArrayViewIterator<T> ArrayView<T>::begin() const
{
return ArrayViewIterator<T>(m_items);
}
template<class T>
inline ArrayViewIterator<T> ArrayView<T>::end() const
{
return ArrayViewIterator<T>(m_items + m_count);
}

View File

@@ -0,0 +1,102 @@
#pragma once
#include <stdint.h>
template<class T>
class ArrayViewIterator
{
public:
ArrayViewIterator(T *item);
ArrayViewIterator(const ArrayViewIterator<T> &other);
ArrayViewIterator<T> operator++(int);
ArrayViewIterator<T> &operator++();
ArrayViewIterator<T> operator--(int);
ArrayViewIterator<T> &operator--();
ArrayViewIterator<T> &operator+=(ptrdiff_t delta);
ArrayViewIterator<T> &operator-=(ptrdiff_t delta);
bool operator==(const ArrayViewIterator<T> &other) const;
bool operator!=(const ArrayViewIterator<T> &other) const;
operator T*() const;
private:
T *m_iter;
};
template<class T>
inline ArrayViewIterator<T>::ArrayViewIterator(T *item)
: m_iter(item)
{
}
template<class T>
inline ArrayViewIterator<T>::ArrayViewIterator(const ArrayViewIterator<T> &other)
: m_iter(other.m_iter)
{
}
template<class T>
inline ArrayViewIterator<T> ArrayViewIterator<T>::operator++(int)
{
ArrayViewIterator<T> copy = *this;
m_iter++;
return copy;
}
template<class T>
inline ArrayViewIterator<T> &ArrayViewIterator<T>::operator++()
{
m_iter++;
return *this;
}
template<class T>
inline ArrayViewIterator<T> ArrayViewIterator<T>::operator--(int)
{
ArrayViewIterator<T> copy = *this;
m_iter--;
return copy;
}
template<class T>
inline ArrayViewIterator<T> &ArrayViewIterator<T>::operator--()
{
m_iter--;
return *this;
}
template<class T>
inline ArrayViewIterator<T> &ArrayViewIterator<T>::operator+=(ptrdiff_t delta)
{
m_iter += delta;
return *this;
}
template<class T>
inline ArrayViewIterator<T> &ArrayViewIterator<T>::operator-=(ptrdiff_t delta)
{
m_iter += delta;
return *this;
}
template<class T>
inline bool ArrayViewIterator<T>::operator==(const ArrayViewIterator<T> &other) const
{
return m_iter == other.m_iter;
}
template<class T>
inline bool ArrayViewIterator<T>::operator!=(const ArrayViewIterator<T> &other) const
{
return m_iter == other.m_iter;
}
template<class T>
inline ArrayViewIterator<T>::operator T*() const
{
return m_iter;
}

View File

@@ -1,23 +1,23 @@
#include "PLDialogs.h" #include "PLDialogs.h"
void DrawDialog(DialogPtr dialog) void DrawDialog(Dialog *dialog)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
DialogPtr GetNewDialog(int resID, void *unknown, WindowPtr behind) Dialog *GetNewDialog(int resID, void *unknown, WindowPtr behind)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
return nullptr; return nullptr;
} }
DrawSurface *GetDialogPort(DialogPtr dialog) DrawSurface *GetDialogPort(Dialog *dialog)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
return nullptr; return nullptr;
} }
void GetDialogItem(DialogPtr dialog, int index, short *itemType, THandle<Control> *itemHandle, Rect *itemRect) void GetDialogItem(Dialog *dialog, int index, short *itemType, THandle<Control> *itemHandle, Rect *itemRect)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
@@ -27,7 +27,7 @@ void GetDialogItemText(THandle<Control> handle, StringPtr str)
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
void SetDialogItem(DialogPtr dialog, int index, short itemType, THandle<Control> itemHandle, const Rect *itemRect) void SetDialogItem(Dialog *dialog, int index, short itemType, THandle<Control> itemHandle, const Rect *itemRect)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
@@ -37,7 +37,7 @@ void SetDialogItemText(THandle<Control> handle, const PLPasStr &str)
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
void SelectDialogItemText(DialogPtr dialog, int item, int firstSelChar, int lastSelCharExclusive) void SelectDialogItemText(Dialog *dialog, int item, int firstSelChar, int lastSelCharExclusive)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
@@ -52,7 +52,7 @@ void ModalDialog(ModalFilterUPP filter, short *item)
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
void DisposeDialog(DialogPtr dialog) void DisposeDialog(Dialog *dialog)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
@@ -62,12 +62,12 @@ void DisposeModalFilterUPP(ModalFilterUPP upp)
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
void ShowDialogItem(DialogPtr dialog, int item) void ShowDialogItem(Dialog *dialog, int item)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
void HideDialogItem(DialogPtr dialog, int item) void HideDialogItem(Dialog *dialog, int item)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
} }

View File

@@ -4,19 +4,22 @@
#include "PLCore.h" #include "PLCore.h"
template<class T>
class ArrayView;
class PLPasStr; class PLPasStr;
struct Control; struct Control;
struct DialogItem
{
virtual Rect GetRect() const = 0;
};
struct Dialog struct Dialog
{ {
virtual void Destroy() = 0; virtual void Destroy() = 0;
virtual Window *GetWindow() const = 0; virtual Window *GetWindow() const = 0;
}; virtual ArrayView<DialogItem*const> GetItems() const = 0;
struct DialogTemplate
{
// FIXME: Audit
Rect boundsRect;
}; };
enum TEMode enum TEMode
@@ -24,33 +27,28 @@ enum TEMode
teCenter teCenter
}; };
typedef Dialog *DialogPtr; typedef Boolean(*ModalFilterUPP)(Dialog *dial, EventRecord *event, short *item);
typedef THandle<DialogTemplate> DialogTHndl; void DrawDialog(Dialog *dialog);
DrawSurface *GetDialogPort(Dialog *dialog);
void GetDialogItem(Dialog *dialog, int index, short *itemType, THandle<Control> *itemHandle, Rect *itemRect);
typedef Boolean(*ModalFilterUPP)(DialogPtr dial, EventRecord *event, short *item);
void DrawDialog(DialogPtr dialog);
DrawSurface *GetDialogPort(DialogPtr dialog);
void GetDialogItem(DialogPtr dialog, int index, short *itemType, THandle<Control> *itemHandle, Rect *itemRect);
void GetDialogItemText(THandle<Control> handle, StringPtr str); void GetDialogItemText(THandle<Control> handle, StringPtr str);
void SetDialogItem(DialogPtr dialog, int index, short itemType, THandle<Control> itemHandle, const Rect *itemRect); void SetDialogItem(Dialog *dialog, int index, short itemType, THandle<Control> itemHandle, const Rect *itemRect);
void SetDialogItemText(THandle<Control> handle, const PLPasStr &str); void SetDialogItemText(THandle<Control> handle, const PLPasStr &str);
void SelectDialogItemText(DialogPtr dialog, int item, int firstSelChar, int lastSelCharExclusive); void SelectDialogItemText(Dialog *dialog, int item, int firstSelChar, int lastSelCharExclusive);
ModalFilterUPP NewModalFilterUPP(ModalFilterUPP func); ModalFilterUPP NewModalFilterUPP(ModalFilterUPP func);
void ModalDialog(ModalFilterUPP filter, short *item); void ModalDialog(ModalFilterUPP filter, short *item);
void DisposeDialog(DialogPtr dialog); void DisposeDialog(Dialog *dialog);
void DisposeModalFilterUPP(ModalFilterUPP upp); void DisposeModalFilterUPP(ModalFilterUPP upp);
void ShowDialogItem(DialogPtr dialog, int item); void ShowDialogItem(Dialog *dialog, int item);
void HideDialogItem(DialogPtr dialog, int item); void HideDialogItem(Dialog *dialog, int item);
void TETextBox(const PLPasStr &str, short len, const Rect *rect, TEMode teMode); void TETextBox(const PLPasStr &str, short len, const Rect *rect, TEMode teMode);

View File

@@ -1020,6 +1020,12 @@ void DrawSurface::FrameRect(const Rect &rect)
} }
} }
void DrawSurface::FrameRoundRect(const Rect &rect, int quadrantWidth, int quadrantHeight)
{
PL_NotYetImplemented_TODO("RoundRect");
this->FrameRect(rect);
}
void DrawSurface::InvertFrameRect(const Rect &rect, const uint8_t *pattern) void DrawSurface::InvertFrameRect(const Rect &rect, const uint8_t *pattern)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();

View File

@@ -1,10 +1,9 @@
#pragma once #pragma once
#ifndef __PL_PASCALSTR_H__
#define __PL_PASCALSTR_H__
#include "UnsafePascalStr.h" #include "UnsafePascalStr.h"
class PLPasStr;
namespace PortabilityLayer namespace PortabilityLayer
{ {
template<size_t TSize> template<size_t TSize>
@@ -13,10 +12,12 @@ namespace PortabilityLayer
public: public:
PascalStr(); PascalStr();
PascalStr(size_t size, const char *str); PascalStr(size_t size, const char *str);
explicit PascalStr(const PLPasStr &pstr);
}; };
} }
#include <string.h> #include <string.h>
#include "PLPasStr.h"
namespace PortabilityLayer namespace PortabilityLayer
{ {
@@ -31,6 +32,10 @@ namespace PortabilityLayer
: UnsafePascalStr<TSize, true>(size, str) : UnsafePascalStr<TSize, true>(size, str)
{ {
} }
}
#endif template<size_t TSize>
PascalStr<TSize>::PascalStr(const PLPasStr &pstr)
: UnsafePascalStr<TSize, true>(pstr.Length(), pstr.Chars())
{
}
}

View File

@@ -186,6 +186,8 @@
<ClInclude Include="PLAppleEvents.h" /> <ClInclude Include="PLAppleEvents.h" />
<ClInclude Include="PLAppleEventsCommonTypes.h" /> <ClInclude Include="PLAppleEventsCommonTypes.h" />
<ClInclude Include="PLApplication.h" /> <ClInclude Include="PLApplication.h" />
<ClInclude Include="PLArrayView.h" />
<ClInclude Include="PLArrayViewIterator.h" />
<ClInclude Include="PLBigEndian.h" /> <ClInclude Include="PLBigEndian.h" />
<ClInclude Include="PLControlDefinitions.h" /> <ClInclude Include="PLControlDefinitions.h" />
<ClInclude Include="PLCore.h" /> <ClInclude Include="PLCore.h" />

View File

@@ -402,6 +402,12 @@
<ClInclude Include="ResolvedColor.h"> <ClInclude Include="ResolvedColor.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="PLArrayView.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PLArrayViewIterator.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="CFileStream.cpp"> <ClCompile Include="CFileStream.cpp">

View File

@@ -54,6 +54,7 @@ struct DrawSurface final
void FillRect(const Rect &rect); void FillRect(const Rect &rect);
void FillRectWithPattern8x8(const Rect &rect, const uint8_t *pattern); void FillRectWithPattern8x8(const Rect &rect, const uint8_t *pattern);
void FrameRect(const Rect &rect); void FrameRect(const Rect &rect);
void FrameRoundRect(const Rect &rect, int quadrantWidth, int quadrantHeight);
void InvertFrameRect(const Rect &rect, const uint8_t *pattern); void InvertFrameRect(const Rect &rect, const uint8_t *pattern);
void InvertFillRect(const Rect &rect, const uint8_t *pattern); void InvertFillRect(const Rect &rect, const uint8_t *pattern);

View File

@@ -26,6 +26,8 @@ struct Rect
bool IsValid() const; bool IsValid() const;
Rect Intersect(const Rect &rect) const; Rect Intersect(const Rect &rect) const;
Rect MakeValid() const; Rect MakeValid() const;
Rect operator-(const Point &point) const;
Rect operator+(const Point &point) const;
static Rect Create(int16_t top, int16_t left, int16_t bottom, int16_t right); static Rect Create(int16_t top, int16_t left, int16_t bottom, int16_t right);
static Rect CreateFromPoints(const Point &topLeft, const Point &bottomRight); static Rect CreateFromPoints(const Point &topLeft, const Point &bottomRight);
@@ -152,6 +154,16 @@ inline Rect Rect::MakeValid() const
return result; return result;
} }
inline Rect Rect::operator-(const Point &point) const
{
return Rect::Create(this->top - point.v, this->left - point.h, this->bottom - point.v, this->right - point.h);
}
inline Rect Rect::operator+(const Point &point) const
{
return Rect::Create(this->top + point.v, this->left + point.h, this->bottom + point.v, this->right + point.h);
}
inline Rect Rect::Create(int16_t top, int16_t left, int16_t bottom, int16_t right) inline Rect Rect::Create(int16_t top, int16_t left, int16_t bottom, int16_t right)
{ {
Rect result; Rect result;