mirror of
https://github.com/softdorothy/Glider4.git
synced 2024-06-08 13:29:32 +00:00
1 line
40 KiB
OpenEdge ABL
1 line
40 KiB
OpenEdge ABL
|
unit Initialize;
interface
uses
Balloons, Palettes, Globals, GlobalUtils, FileInNOut, IdleInput;
procedure InitializeAll;
procedure DoStartUp;
{=================================}
implementation
{=================================}
procedure InitializeAll;
var
i: Integer;
ignoreStr: Str255;
{------------------------}
procedure InitToolBox;
var
ignore: Boolean;
begin
gliderResNum := CurResFile;
SetApplLimit(Ptr(LongInt(GetApplLimit) - kStackSize));
MaxApplZone;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
MoreMasters;
InitGraf(@thePort);
InitFonts;
FlushEvents(everyEvent, 0);
InitWindows;
InitMenus;
TEInit;
InitDialogs(nil);
ignore := EventAvail(EveryEvent, theEvent);
inBackground := FALSE;
end;
{------------------------}
procedure CheckOurEnvirons;
const
WNETrapNum = $60;
unimplTrapNum = $9F;
SoundBase = $0266;
ASCBase = $0CC0;
Color = 1;
Monochrome = 0;
GDTypeFlag = 1;
kPointerBase = $3F2700 - $20;
var
thisWorld: SysEnvRec;
tempRes: Handle;
theDevice: GDHandle;
initsPointer: Ptr;
theResponse, initData: LongInt;
sheSaid: Integer;
hasINIT: Boolean;
{-----------}
function DepthAlert: Integer;
var
dummyInt: Integer;
alertHandle: AlertTHndl;
alertRect: Rect;
begin
UseResFile(gliderResNum);
InitCursor;
alertHandle := AlertTHndl(Get1Resource('ALRT', rDepthAlertID));
if (alertHandle <> nil) then
begin
HNoPurge(Handle(alertHandle));
alertRect := alertHandle^^.boundsRect;
OffsetRect(alertRect, -alertRect.left, -alertRect.top);
dummyInt := (screenBits.bounds.right - alertRect.right) div 2;
OffsetRect(alertRect, dummyInt, 0);
dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3;
OffsetRect(alertRect, 0, dummyInt);
alertHandle^^.boundsRect := alertRect;
HPurge(Handle(alertHandle));
end;
dummyInt := Alert(rDepthAlertID, nil);
DepthAlert := dummyInt;
end;
{-----------}
function SetDepth (gd: GDHandle; newDepth, whichFlags, newFlags: Integer): Integer;
inline
$203C, $000A, $0013, $AAA2;
{-----------}
procedure ForceBlackAndWhite;
begin
with theDevice^^.gdPMap^^ do
if (pixelSize <> 1) then
if (cantSwitch) then {if we can't switch via software}
begin
GenericAlert(kErr2Or16Colors); {say, "Hey, set the Control Panel"}
ExitToShell;
end
else
begin {we can switch via software}
theErr := SetDepth(theDevice, 1, GDTypeFlag, Color);
inColor := FALSE;
end; {end - we can switch via software}
end;
{-----------}
procedure CheckAndSwitch;
begin
with theDevice^^.gdPMap^^ do
if ((pixelSize <> 4) and (pixelSize <> 1)) then
if (cantSwitch) then {if we can't switch via software}
begin
GenericAlert(kErr2Or16Colors); {say, "Hey, set the Control Panel"}
ExitToShell;
end
else
begin {we can switch via software}
sheSaid := DepthAlert; {bring up monitor switch alert}
case sheSaid of {what button did they click?}
1: {switch to 16 color}
theErr := SetDepth(theDevice, 4, GDTypeFlag, Color);
2: {switch to B&W}
begin
theErr := SetDepth(theDevice, 1, GDTypeFlag, Color);
inColor := FALSE;
end;
otherwise
begin
InitCursor;
ExitToShell;
end;
end;
end; {end - we can switch via software}
end;
{-----------}
begin
tempRes := Get1Resource('CURS', 128);
if (tempRes <> nil) then
begin
HLock(tempRes);
SetResInfo(tempRes, 128, 'oz');
if (ResError = WPrErr) or (ResError = FLckdErr) or (ResError = VLckdErr) then
begin
GenericAlert(kErrVolLocked);
ExitToShell;
end;
ChangedResource(tempRes);
if (ResError = WPrErr) or (ResError = FLckdErr)
|