mirror of
https://github.com/softdorothy/Glider4.git
synced 2024-06-08 13:29:32 +00:00
1 line
28 KiB
OpenEdge ABL
1 line
28 KiB
OpenEdge ABL
|
unit Utilities;
interface
uses
Palettes, Globals;
procedure SpinBall;
function SameScreenDepth: Boolean;
function DoRandom (range: Integer): Integer;
procedure UpdateMenuItems (whatMode: Integer);
procedure Select;
procedure Deselect;
procedure DoMarquee;
procedure GenericAlert (whatGives: Integer);
function ErrorCheckObject (var wasObject: objectData; var errorType: Integer): Boolean;
procedure DoCustomizeKeys;
function idleFilter (theDialog: DialogPtr; var theEvent: EventRecord; var itemHit: integer): boolean;
procedure DoAbout;
{=================================}
implementation
{=================================}
var
screenNum: Integer;
timeWas: LongInt;
{=================================}
procedure SpinBall;
var
tempByte: SignedByte;
begin
if (ballList = nil) then
Exit(SpinBall);
tempByte := HGetState(Handle(ballList));
HLock(Handle(ballList));
with ballList^^ do
begin
if (whichBall = -1) then
Exit(SpinBall);
if (whichBall >= kCursCount) then
whichBall := 1
else
whichBall := whichBall + 1;
if (useColorCursor) then
SetCCursor(ballC[whichBall])
else
SetCursor(ball[whichBall]^^);
end;
HSetState(Handle(ballList), tempByte);
end;
{=================================}
function SameScreenDepth;
var
err: OSErr;
thisWorld: SysEnvRec;
theDevice: GDHandle;
begin
SameScreenDepth := TRUE;
err := SysEnvirons(1, thisWorld);
with thisWorld do
begin
if (hasColorQD) then
begin
theDevice := GetMainDevice;
HLock(Handle(theDevice));
if ((inColor) and (theDevice^^.gdPMap^^.pixelSize <> 4)) then
SameScreenDepth := FALSE
else if ((not inColor) and (theDevice^^.gdPMap^^.pixelSize <> 1)) then
SameScreenDepth := FALSE;
HUnlock(Handle(theDevice));
end; {end - hasColorQD}
end; {with thisWorld}
end;
{=================================}
function DoRandom;
var
rawResult: LongInt;
begin
rawResult := ABS(Random);
DoRandom := (rawResult * range) div 32768;
end;
{=================================}
procedure UpdateMenuItems;
begin
case whatMode of
editToObject:
begin
SetItem(GetMenu(mEdit), iCut, 'Cut Object');
SetItem(GetMenu(mEdit), iCopy, 'Copy Object');
SetItem(GetMenu(mEdit), iPaste, 'Paste Object');
DisableItem(GetMenu(mEdit), iPaste);
SetItem(GetMenu(mEdit), iClear, 'Clear Object');
editRoom := FALSE;
if (objectScrapDirty) then
EnableItem(GetMenu(mEdit), iPaste)
else if (roomScrapDirty) then
begin
SetItem(GetMenu(mEdit), iPaste, 'Paste Room');
EnableItem(GetMenu(mEdit), iPaste);
end;
end;
editToRoom:
begin
SetItem(GetMenu(mEdit), iCut, 'Cut Room');
SetItem(GetMenu(mEdit), iCopy, 'Copy Room');
SetItem(GetMenu(mEdit), iPaste, 'Paste Room');
DisableItem(GetMenu(mEdit), iPaste);
SetItem(GetMenu(mEdit), iClear, 'Clear Room');
editRoom := TRUE;
if (roomScrapDirty) then
EnableItem(GetMenu(mEdit), iPaste)
else if (objectScrapDirty) then
begin
SetItem(GetMenu(mEdit), iPaste, 'Paste Object');
EnableItem(GetMenu(mEdit), iPaste);
end;
end;
fileExists:
begin
DisableItem(GetMenu(mFile), iNew);
DisableItem(GetMenu(mFile), iOpen);
EnableItem(GetMenu(mFile), iClose);
EnableItem(GetMenu(mFile), iSave);
EnableItem(GetMenu(mFile), iSaveAs);
EnableItem(GetMenu(mEdit), iCut);
EnableItem(GetMenu(mEdit), iCopy);
EnableItem(GetMenu(mEdit), iClear);
if (roomScrapDirty) then
EnableItem(GetMenu(mEdit), iPaste)
else if (objectScrapDirty) then
begin
SetItem(GetMenu(mEdit), iPaste, 'Paste Object');
EnableItem(GetMenu(mEdit), iPaste);
end;
EnableItem(GetMenu(mSpecial), iTryGlider);
EnableItem(GetMenu(mSpecial), iGoToRoom);
EnableItem(GetMenu(mSpecial), iPrevRoom);
EnableItem(GetMenu(mSpecial), iNextRoom);
EnableItem(GetMenu(mSpecial), iNewRoom);
EnableItem(GetMenu(mWindows), iTools);
EnableItem(GetMenu(mWindows), iHouse);
EnableItem(GetMenu(mWindows), iRoomBack);
Enabl
|