mirror of
https://github.com/softdorothy/Pararena2.git
synced 2024-10-31 22:06:48 +00:00
1 line
5.1 KiB
C
1 line
5.1 KiB
C
|
//============================================================
//============================================================
//== ==
//== About Dialog Routines ==
//== ==
//============================================================
//============================================================
//======================================================== Includes
#include "About.h"
#include "UnivUtilities.h"
//======================================================== Local Vars
static RgnHandle okayButtRgn;
static Rect okayButtonBounds, mainPICTBounds;
static Boolean okayButtIsHiLit, clickedDownInOkay;
//======================================================== Procedures
//======================================================== HiLiteOkayButton
void HiLiteOkayButton (void)
{
PicHandle thePict;
if (!okayButtIsHiLit)
{
thePict = GetPicture(kOkayButtPICTHiLit);
if (thePict != kNilPointer)
{
DrawPicture(thePict, &okayButtonBounds);
ReleaseResource((Handle)thePict);
okayButtIsHiLit = TRUE;
}
}
}
//======================================================== UnHiLiteOkayButton
void UnHiLiteOkayButton (void)
{
PicHandle thePict;
if (okayButtIsHiLit)
{
thePict = GetPicture(kOkayButtPICTNotHiLit);
if (thePict != kNilPointer)
{
DrawPicture(thePict, &okayButtonBounds);
ReleaseResource((Handle)thePict);
okayButtIsHiLit = FALSE;
}
}
}
//======================================================== UpdateMainPict
void UpdateMainPict (DialogPtr theDialog)
{
PicHandle thePict;
BeginUpdate((GrafPtr)theDialog);
DrawDialog((GrafPtr)theDialog);
if (isColor)
thePict = GetPicture(kAboutColorPICT);
else
thePict = GetPicture(kAboutBandWPICT);
if (thePict != kNilPointer)
{
DrawPicture(thePict, &mainPICTBounds);
ReleaseResource((Handle)thePict);
}
EndUpdate((GrafPtr)theDialog);
}
//======================================================== AboutFilter
pascal Boolean AboutFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit)
{
Point mousePt;
long dummyLong;
if (Button() && clickedDownInOkay)
{
GetMouse(&mousePt);
if(PtInRgn(mousePt, okayButtRgn))
HiLiteOkayButton();
else
UnHiLiteOkayButton();
}
switch (theEvent->what)
{
case keyDown:
switch ((theEvent->message) & charCodeMask)
{
case kReturnKeyASCII:
case kEnterKeyASCII:
HiLiteOkayButton();
Delay(8, &dummyLong);
UnHiLiteOkayButton();
*itemHit = buttItemOkay;
return(TRUE);
break;
default:
return(FALSE);
}
break;
case mouseDown:
mousePt = theEvent->where;
GlobalToLocal(&mousePt);
if(PtInRgn(mousePt, okayButtRgn))
{
clickedDownInOkay = TRUE;
return(FALSE);
}
else
return(FALSE);
break;
case mouseUp:
mousePt = theEvent->where;
GlobalToLocal(&mousePt);
if(PtInRgn(mousePt, okayButtRgn) && clickedDownInOkay)
{
UnHiLiteOkayButton();
*itemHit = buttItemOkay;
return(TRUE);
}
else
{
clickedDownInOkay = FALSE;
return(FALSE);
}
break;
case updateEvt:
UpdateMainPict(theDialog);
theEvent->what = nullEvent;
return(FALSE);
break;
default:
return(FALSE);
break;
}
}
//======================================================== DoAbout
void DoAbout (void)
{
DialogPtr aboutDialog;
Str255 longVersion;
StringPtr messagePtr;
VersRecHndl version;
Handle itemHandle;
Rect itemRect;
short itemType, itemHit;
CenterDialog(rAboutDialogID); // Call our universal centering routine
if (doZooms)
ZoomOutDialogRect(rAboutDialogID);
aboutDialog = GetNewDialog(rAboutDialogID, kNilPointer, kPutInFront);
if (aboutDialog == kNilPointer)
return;
SetPort((GrafPtr)aboutDialog); // Bring up the dialog
ShowWindow((GrafPtr)aboutDialog);
ParamText("\p", "\p", "\p", "\p");
#if kDemoVersion
ParamText("\pDEMO COPY", "\p", "\p", "\p");
#endif
// Get version info from 'vers' resource
version = (VersRecHndl)GetResource('vers', 1);
if
|