home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d158
/
memboardtest.lha
/
MemBoardTest
/
myscreen.mod
< prev
next >
Wrap
Text File
|
1988-10-02
|
13KB
|
441 lines
IMPLEMENTATION MODULE myscreen;
(* DECLARE bittextintui, bittext, bitgadg *)
FROM SYSTEM IMPORT ADR, ADDRESS, BYTE, WORD, NULL;
FROM Libraries IMPORT OpenLibrary, CloseLibrary;
FROM Colors IMPORT ColorMap, ColorMapPtr;
FROM GraphicsLibrary IMPORT GraphicsName, GraphicsBase, BitMap;
FROM Views IMPORT ModeSet,Modes;
FROM Text IMPORT Text;
FROM Pens IMPORT SetAPen,SetDrMd,Move,Draw,RectFill;
FROM InOut IMPORT WriteString, WriteLn;
FROM Windows IMPORT OpenWindow, CloseWindow;
FROM Intuition IMPORT GadgetFlagSet,GadgetFlags,
ActivationFlagSet,ActivationFlags,IntuitionName,IntuitionBase,
Gadget,GadgetPtr,Requester,BorderPtr,Border,Screen,ScreenFlagSet,
ScreenPtr,ScreenFlags,RethinkDisplay,RemakeDisplay,CustomScreen,
WindowFlags, WindowFlagSet, NewWindow, Window, IDCMPFlags, IDCMPFlagSet,
IntuiMessage, IntuiMessagePtr, IntuitionText, IntuitionTextPtr,
WindowPtr;
FROM Screens IMPORT OpenScreen, CloseScreen, NewScreen, WBenchToFront,
ScreenToFront, MakeScreen;
FROM Rasters IMPORT RastPort;
FROM Strings IMPORT String, Concat, SetTerminator;
FROM Gadgets IMPORT AddGadget, ScreenGadget, StrGadget, BoolGadget,
RefreshGadgets,RemoveGadget;
FROM mygadg IMPORT decgadg,boolborder;
VAR
Width, Height: CARDINAL;
VAR
newscr: NewScreen;
bittext,rereadtext,errtext,looptext : String;
bittextintui,rereadtextintui : IntuitionText;
strborder1,strborder2,selectborder: Border;
strpairs1,strpairs2,selectpairs : ARRAY[0..30] OF WORD;
fileofftext,fileontext : String;
fileofftextintui, fileontextintui, errtextintui, loopertextintui : IntuitionText;
bitgadg, fileongadg, fileoffgadg : Gadget;
PROCEDURE InitScreen(width, height, depth: CARDINAL): BOOLEAN;
CONST JAM1 = 0; (* jam 1 color into raster *)
JAM2 = 1; (* jam 2 colors into raster *)
COMPLEMENT = 2; (* XOR bits into raster *)
INVERSVID = 4; (* inverse video for drawing modes *)
VAR
CM: ColorMapPtr;
k : LONGCARD;
i,j, gadgid,px,py : CARDINAL;
igadg : GadgetPtr;
posn,mx,my : INTEGER;
newwin : NewWindow;
quit, done : BOOLEAN;
BEGIN
Width := width;
Height := height;
SetTerminator(CHR(0));
stadrresult := '500000';
enadrresult := '500010';
errresult := '0010';
looperresult:= '0001';
screentitle := 'RAMTEST (C) George Vokalek, South Australia, Apr 1987';
windowtitle := 'Version 2.40 PROTON MICROELECTRONICS PTY LTD, July 1987';
sttext := 'Start Address';
entext := 'End Address';
errtext := 'Error Limit';
looptext:= 'Loop Counter';
IF (GraphicsBase = 0) OR (IntuitionBase = 0) THEN RETURN FALSE; END;
WITH newscr DO (* Setup the Intuition screen *)
LeftEdge := 0; TopEdge := 0;
Width := width; Height := height; Depth := depth;
DetailPen := BYTE(0); BlockPen := BYTE(1);
ViewModes := ModeSet{Lace,Hires};
Font := NULL;
DefaultTitle := ADR(screentitle);
Gadgets := NULL;
CustomBitMap := NULL;
Type := CustomScreen;
END; (* with *)
ourscreen := ScreenPtr(OpenScreen(ADR(newscr)));
(* initialise the viewport *)
WITH ourscreen^.VPort DO
CM := colorMap;
WITH CM^ DO
type := BYTE(0); (* ARRAY xRGB *)
flags := BYTE(0);
count := 1;
(* calculate number of colour entries in ColourTable[] *)
WHILE depth > 0 DO
count := count * 2;
DEC(depth);
END;
FOR i := 0 TO count-1 DO
colorTable^[i] := ColourTable[i];
END;
END;
END;
ScreenToFront(ourscreen);
RemakeDisplay();
RethinkDisplay();
WITH stadrtextintui DO
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
LeftEdge := 10;
TopEdge := -11;
ITextFont := NULL;
IText := ADR(sttext);
NextText := NULL;
END;
WITH enadrtextintui DO
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
LeftEdge := 10;
TopEdge := -11;
ITextFont := NULL;
IText := ADR(entext);
NextText := NULL;
END;
WITH errtextintui DO
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
LeftEdge := -15;
TopEdge := -11;
ITextFont := NULL;
IText := ADR(errtext);
NextText := NULL;
END;
WITH loopertextintui DO
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
LeftEdge := -15;
TopEdge := -11;
ITextFont := NULL;
IText := ADR(looptext);
NextText := NULL;
END;
WITH stgadgstring DO
Buffer := ADR(stadrresult);
UndoBuffer := ADR(stadrresult);
BufferPos := 0;
MaxChars := 8;
DispPos := 0;
UndoPos := 0;
NumChars := 8;
DispCount := 0;
CLeft := 5;
CTop := 3;
Layer := NULL;
LongInt := 0;
AltKeyMap := NULL;
END; (* WITH *)
WITH engadgstring DO
Buffer := ADR(enadrresult);
UndoBuffer := ADR(enadrresult);
BufferPos := 0;
MaxChars := 8;
DispPos := 0;
UndoPos := 0;
NumChars := 8;
DispCount := 0;
CLeft := 5;
CTop := 3;
Layer := NULL;
LongInt := 0;
AltKeyMap := NULL;
END; (* WITH *)
WITH errgadgstring DO
Buffer := ADR(errresult);
UndoBuffer := ADR(errresult);
BufferPos := 0;
MaxChars := 6;
DispPos := 0;
UndoPos := 0;
NumChars := 6;
DispCount := 0;
CLeft := 5;
CTop := 3;
Layer := NULL;
LongInt := 0;
AltKeyMap := NULL;
END; (* WITH *)
WITH loopergadgstring DO
Buffer := ADR(looperresult);
UndoBuffer := ADR(looperresult);
BufferPos := 0;
MaxChars := 6;
DispPos := 0;
UndoPos := 0;
NumChars := 6;
DispCount := 0;
CLeft := 5;
CTop := 3;
Layer := NULL;
LongInt := 0;
AltKeyMap := NULL;
END; (* WITH *)
strpairs1[0] := WORD(-1);
strpairs1[1] := WORD(-2);
strpairs1[2] := WORD(130);
strpairs1[3] := WORD(-2);
strpairs1[4] := WORD(130);
strpairs1[5] := WORD(-20);
strpairs1[6] := WORD(150);
strpairs1[7] := WORD(8);
strpairs1[8] := WORD(130);
strpairs1[9] := WORD(36);
strpairs1[10] := WORD(130);
strpairs1[11] := WORD(18);
strpairs1[12] := WORD(-1);
strpairs1[13] := WORD(18);
strpairs1[14] := WORD(-1);
strpairs1[15] := WORD(-2);
WITH strborder1 DO
LeftEdge := -1;
TopEdge := -1;
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
Count := BYTE(8);
XY := ADR(strpairs1);
NextBorder := BorderPtr(NULL);
END; (* with *)
strpairs2[0] := WORD(-1);
strpairs2[1] := WORD(-2);
strpairs2[2] := WORD(150);
strpairs2[3] := WORD(-2);
strpairs2[4] := WORD(150);
strpairs2[5] := WORD(-20);
strpairs2[6] := WORD(170);
strpairs2[7] := WORD(8);
strpairs2[8] := WORD(150);
strpairs2[9] := WORD(36);
strpairs2[10] := WORD(150);
strpairs2[11] := WORD(18);
strpairs2[12] := WORD(-1);
strpairs2[13] := WORD(18);
strpairs2[14] := WORD(-1);
strpairs2[15] := WORD(-2);
WITH strborder2 DO
LeftEdge := -1;
TopEdge := -1;
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
Count := BYTE(8);
XY := ADR(strpairs2);
NextBorder := BorderPtr(NULL);
END; (* with *)
selectpairs[0] := WORD(-1);
selectpairs[1] := WORD(-2);
selectpairs[2] := WORD(150);
selectpairs[3] := WORD(-2);
selectpairs[10] := WORD(150);
selectpairs[11] := WORD(18);
selectpairs[12] := WORD(-1);
selectpairs[13] := WORD(18);
selectpairs[14] := WORD(-1);
selectpairs[15] := WORD(-2);
WITH selectborder DO
LeftEdge := -1;
TopEdge := -1;
FrontPen := BYTE(1);
BackPen := BYTE(0);
DrawMode := BYTE(JAM1);
Count := BYTE(5);
XY := ADR(selectpairs);
NextBorder := BorderPtr(NULL);
END; (* with *)
WITH stadrgadg DO
NextGadget := GadgetPtr(ADR(enadrgadg));
LeftEdge := 100;
TopEdge := 30;
Width := 70;
Height := 12;
Flags := GadgetFlagSet{};
Activation := ActivationFlagSet{GadgetImmediate,RelVerify};
GadgetType := StrGadget;
GadgetRender := ADR(strborder1);
SelectRender := NULL;
GadgetText := IntuitionTextPtr(ADR(stadrtextintui));
MutualExclude := 0;
SpecialInfoString := ADR(stgadgstring);
GadgetID := 10;
END; (* WITH *)
WITH enadrgadg DO
NextGadget := GadgetPtr(ADR(errnogadg));
LeftEdge := 100;
TopEdge := 60;
Width := 70;
Height := 12;
Flags := GadgetFlagSet{};
Activation := ActivationFlagSet{GadgetImmediate,RelVerify};
GadgetType := StrGadget;
GadgetRender := ADR(strborder2);
SelectRender := NULL;
GadgetText := IntuitionTextPtr(ADR(enadrtextintui));
MutualExclude := 0;
SpecialInfoString := ADR(engadgstring);
GadgetID := 11;
END; (* WITH *)
WITH errnogadg DO
NextGadget := GadgetPtr(ADR(loopergadg));
LeftEdge := 20;
TopEdge := 60;
Width := 60;
Height := 12;
Flags := GadgetFlagSet{};
Activation := ActivationFlagSet{GadgetImmediate,RelVerify};
GadgetType := StrGadget;
GadgetRender := ADR(boolborder);
SelectRender := NULL;
GadgetText := IntuitionTextPtr(ADR(errtextintui));
MutualExclude := 0;
SpecialInfoString := ADR(errgadgstring);
GadgetID := 12;
END; (* WITH *)
WITH loopergadg DO
NextGadget := GadgetPtr(ADR(decgadg));
LeftEdge := 180;
TopEdge := 120;
Width := 60;
Height := 12;
Flags := GadgetFlagSet{};
Activation := ActivationFlagSet{GadgetImmediate,RelVerify};
GadgetType := StrGadget;
GadgetRender := ADR(boolborder);
SelectRender := NULL;
GadgetText := IntuitionTextPtr(ADR(loopertextintui));
MutualExclude := 0;
SpecialInfoString := ADR(loopergadgstring);
GadgetID := 13;
END; (* WITH *)
WITH newwin DO
LeftEdge := 0;
TopEdge := 15;
Width := width;
Height := height - 20;
DetailPen := BYTE(0);
BlockPen := BYTE(1);
FirstGadget := GadgetPtr(ADR(stadrgadg));
Title := ADR(windowtitle);
Screen := ourscreen;
BitMap := NULL;
Type := CustomScreen;
END; (* with *)
newwin.Flags:=WindowFlagSet{BackDrop,Borderless,WindowClose,
Activate,NoCareRefresh,RMBTrap};
newwin.IDCMPFlags:=IDCMPFlagSet{CloseWindowFlag,GadgetUp,GadgetDown,
MouseButtons};
WriteString('about to open window');
WriteLn;
ourwindow := OpenWindow(newwin);
WriteString('window now open');
WriteLn;
RP:=ADR(ourscreen^.RPort);
RETURN TRUE;
END InitScreen;
PROCEDURE Refresh;
VAR dummy:Requester;
BEGIN
RefreshGadgets(ADR(stadrgadg),ourwindow,ADR(dummy));
END Refresh;
PROCEDURE EndMake;
BEGIN
CloseWindow(WindowPtr(ourwindow));
CloseScreen(ourscreen);
CloseLibrary(GraphicsBase);
CloseLibrary(IntuitionBase);
END EndMake;
BEGIN
GraphicsBase := OpenLibrary(GraphicsName,0);
IntuitionBase := OpenLibrary(IntuitionName,0);
ColourTable[0] := 0777H; (* black *)
ColourTable[1] := 0000H; (* green *)
ColourTable[2] := 000FH; (* blue *)
ColourTable[3] := 0F00H; (* red *)
ColourTable[4] := 0FFFH; (* white *)
ColourTable[7] := 008FH; (* purple, complement of black *)
ColourTable[6] := 00F0H; (* yellow, complement of green *)
END myscreen.