| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- (* Copyright (C) 1987 Jensen & Partners International *)
- DEFINITION MODULE Window;
- (* Window Management *)
- CONST
- ScreenWidth = 80;
- ScreenDepth = 25;
- PaletteSize = 10;
- PaletteMax = PaletteSize-1;
- TYPE
- WinType = POINTER TO WinDescriptor;
- RelCoord = CARDINAL;
- AbsCoord = CARDINAL;
- Color = ( Black, Blue, Green, Cyan,
- Red, Magenta, Brown, LightGray,
- DarkGray, LightBlue, LightGreen, LightCyan,
- LightRed, LightMagenta, Yellow, White );
- PaletteRange = SHORTCARD [ 0..PaletteMax ];
- TitleStr = ARRAY[0..ScreenWidth-1] OF CHAR;
- FrameStr = ARRAY[0..8] OF CHAR; (* Characters for frame *)
- (* 0 1 2 *)
- (* 3 4 *)
- (* 5 6 7 *)
- WinDef = RECORD
- X1,Y1,
- X2,Y2 : AbsCoord; (* outer co-ordinates of
- opposite corners *)
- Foreground,
- Background : Color; (* not used if Palette *)
- CursorOn : BOOLEAN; (* if cursor active *)
- WrapOn : BOOLEAN; (* if EOL wrap enabled *)
- Hidden : BOOLEAN; (* if window on view *)
- FrameOn : BOOLEAN; (* if frame *)
- FrameDef : FrameStr; (* only used if frame *)
- FrameFore,
- FrameBack : Color; (* only used if frame
- and not Palette Window *)
- END;
- TitleMode = ( NoTitle,
- LeftUpperTitle,CenterUpperTitle,RightUpperTitle,
- LeftLowerTitle,CenterLowerTitle,RightLowerTitle );
- CONST
- SingleFrame = FrameStr('ÚÄ¿³³ÀÄÙ') ;
- DoubleFrame = FrameStr('ÉÍ»ººÈͼ') ;
- FullScreenDef = WinDef ( 0,0, ScreenWidth-1,ScreenDepth-1,
- White,Black,TRUE,TRUE,FALSE,FALSE,
- ' ',Black,Black );
- VAR
- FullScreen : WinType;
- PROCEDURE Open(WD: WinDef) : WinType;
- (*
- creates a new window, clears the window, and puts it on view
- on top of any existing windows
- *)
- PROCEDURE SetTitle( W : WinType;
- Title : ARRAY OF CHAR;
- Mode : TitleMode);
- (*
- updates the window title within the window frame,
- positioning it in the position defined by the title mode
- *)
- PROCEDURE SetFrame( W : WinType;
- Frame : FrameStr;
- Fore, Back : Color);
- (*
- Changes the frame around the specified window,
- redisplaying title if required
- *)
- PROCEDURE Use(W: WinType);
- (*
- Causes all subsequent output (by the current process)
- to appear in the specified Window
- NB does not have to be Top Window (or in fact on the screen at all)
- *)
- PROCEDURE PutOnTop(W : WinType);
- (*
- Puts the specified window on the top of the window stack,
- ensuring that it is fully visible.
- If this results in other windows becoming obscured then a buffer
- is allocated for each of these windows.
- All otherwise undirected output (i.e. with no Use) will appear
- within this window.
- *)
- PROCEDURE PutBeneath(W: WinType; WA: WinType);
- (*
- Puts window W beneath window WA
- *)
- PROCEDURE Hide(W: WinType);
- (*
- Removes window from the Window stack and also the screen,
- placing the windows contents in a buffer for possible re-display later.
- Uncovers obscured windows.
- *)
- PROCEDURE Change(W: WinType; X1,Y1,X2,Y2: AbsCoord);
- (*
- Changes the size and/or position of the specified window.
- The contents of the window will be moved with it.
- *)
- PROCEDURE SnapShot;
- (*
- Updates the Window buffer from the screen
- only works with non-palette windows
- To capture the screen,
- first Open should be used with Hidden set in WinDef,
- then SnapShot can be called to capture the screen contents
- then PutOnTop can be used to 'unhide' the window.
- *)
- PROCEDURE Close(VAR W: WinType);
- (*
- Removes the specified window from the screen,
- deletes window descriptor and
- de-allocates any buffers previously allocated.
- Also sets W to Nil to prevent further use of window.
- *)
- PROCEDURE Used(): WinType;
- (*
- Returns the current window being used for output for this process.
- If no window assigned by Use then returns Top.
- *)
- PROCEDURE Top() : WinType;
- (*
- Returns the current top Window.
- *)
- PROCEDURE ObscuredAt(W : WinType; X,Y: RelCoord) : BOOLEAN;
- (*
- Returns if the specified window is obscured at the specified position.
- *)
- PROCEDURE At(X,Y: AbsCoord) : WinType;
- (*
- Returns the window displayed at the absolute position X,Y
- *)
- PROCEDURE SetProcessLocks(LockProc,UnlockProc: PROC);
- (*
- Enables process locking in window system
- *)
- PROCEDURE GotoXY(X,Y: RelCoord);
- (*
- Sets the current X Y position of the window currently being used
- *)
- PROCEDURE WhereX() : RelCoord;
- (*
- Returns the current X position of the window currently being used
- *)
- PROCEDURE WhereY() : RelCoord;
- (*
- Returns the current Y position of the window currently being used
- *)
- PROCEDURE ConvertCoords( W : WinType;
- X,Y : RelCoord;
- VAR XO,YO : AbsCoord);
- (*
- Converts window relative co-ordinates to absolute screen co-ordinates
- *)
- PROCEDURE Clear;
- (*
- clears the current window
- *)
- PROCEDURE CursorOn;
- (*
- Turns the cursor on in the current window.
- NB cursor is only visible when turned on AND window is on top.
- *)
- PROCEDURE CursorOff;
- (*
- Turns the cursor off in the current window.
- *)
- PROCEDURE InsLine;
- (*
- Inserts a blank line at the cursor position
- scrolling the screen down beneath
- *)
- PROCEDURE DelLine;
- (*
- Deletes the line at the cursor position
- scrolling the screen up below
- *)
- PROCEDURE ClrEol;
- (*
- Clears from the cursor to the end of line
- *)
- PROCEDURE TextColor(c: Color);
- (*
- Sets the text foreground color of the current window
- *)
- PROCEDURE TextBackground(c: Color);
- (*
- Sets the text background color of the current window
- *)
- PROCEDURE DirectWrite(X,Y : RelCoord; (* start coords *)
- A : ADDRESS; (* address of char array *)
- Len : CARDINAL); (* length to be written *)
- (*
- Writes directly to current window at the specified X,Y coordinates
- with no check for special (i.e. control) chars or eol wrap.
- *)
- PROCEDURE SetWrap(on: BOOLEAN);
- (*
- Enables/disables automatic wrap when writing beyond the right end of
- the current window
- *)
- PROCEDURE Info(W: WinType; VAR WD: WinDef);
- (* gets information for the specified window *)
- (* ------------------------------------------------------------------- *)
- (* Palette Windows *)
- (* --------------------------------------------------------------------*)
- TYPE
- PaletteColorDef = RECORD Fore,Back : Color END;
- PaletteDef = ARRAY PaletteRange OF PaletteColorDef;
- CONST
- NormalPaletteColor = 0;
- FramePaletteColor = 1;
- PROCEDURE PaletteOpen(WD : WinDef; Pal: PaletteDef) : WinType;
- (*
- Creates a new palette window, clears the window to NormalPaletteColor,
- draws the frame in FramePaletteColor and puts it on view on top of
- any existing windows,
- *)
- PROCEDURE SetPalette(W: WinType; Pal: PaletteDef);
- (*
- Changes the Palette of the specified window,
- redisplaying the changed colors
- *)
- PROCEDURE PaletteColor() : PaletteRange;
- PROCEDURE SetPaletteColor(pc: PaletteRange);
- PROCEDURE PaletteColorUsed(W: WinType; pc: PaletteRange) : BOOLEAN;
- (*
- Returns if color in use anywhere in the window W.
- Returns false if W not a palette window.
- *)
- (* Low level routines to read and write to the window buffer direct *)
- (* a single line at a time *)
- PROCEDURE (*$F*) RdBufferLn ( W : WinType; (* Source window *)
- X,Y : RelCoord; (* start co-ords *)
- Dest : ADDRESS; (* address of buffer *)
- Len : CARDINAL ); (* length in WORDs *)
- PROCEDURE (*$F*) WrBufferLn ( W : WinType; (* Dest window *)
- X,Y : RelCoord; (* start co-ords *)
- Src : ADDRESS; (* address of buffer *)
- Len : CARDINAL ); (* length in WORDs *)
- TYPE
- BufferPtr = POINTER TO ARRAY [0..ScreenWidth*ScreenDepth-1] OF CARDINAL ;
- WinDescriptor = RECORD (* Internal *)
- Guard : CARDINAL ;
- Next : WinType ;
- CursorChain : WinType ;
- WDef : WinDef ;
- XA,YA,XB,YB : AbsCoord ; (* inner window pane *)
- OWidth,ODepth : CARDINAL ; (* outer window *)
- Width, Depth : CARDINAL ; (* inner pane *)
- Title : POINTER TO TitleStr ;
- TMode : TitleMode ;
- CurrentX,
- CurrentY : RelCoord ;
- IsPalette : BOOLEAN ;
- PalAttr : ARRAY PaletteRange OF SHORTCARD ;
- CurPalColor : PaletteRange ;
- Buffer : BufferPtr ;
- UserRecord : ADDRESS ;
- END ;
- END Window.
|