Dec 092017
 
A complete virtual windows module for Modula-2.
File VWINDOW2.ZIP from The Programmer’s Corner in
Category Modula II Source Code
A complete virtual windows module for Modula-2.
File Name File Size Zip Size Zip Type
VTEST.EXE 17904 5832 deflated
VTEST.MOD 1093 324 deflated
VWINDOWS.DEF 2775 877 deflated
VWINDOWS.DOC 7647 2505 deflated
VWINDOWS.MOD 20640 3873 deflated

Download File VWINDOW2.ZIP Here

Contents of the VWINDOWS.DOC file


This text describes the VirtualWindows module, Version 1.0, 21 March '86.

These routines are written for ITC's M2SDS version 2.0a with the base
library of the date above. They are further designed to do direct screen
access on IBM PC CGA and Monochrome display cards (or complete compatibles).
Some of the internal routines also use bios calls. Be careful porting to
another compiler or another machine.

Virtual Windows is a term coined by me to refer to a scheme where the
screen is divided into a number of seperately accessible overlapping
windows. The system provided by this module allows you to open any number
of windows, and within each window, position the cursor, change display
attributes, and even move the window.

The following files should be included in this distribution package:
VWindows.DOC - this file!
VWindows.DEF - definition file
VWindows.IMP - implementation file
VTest.MOD - test program
VTest.EXE - already compiled test program (runs on color or mono)
DOSCALL.IMP - patched version of DOSCALL to make Terminal and InOut
use the top window.

The following identifiers are exported by VirtualWindows:

CONST
Blank = 0; (* the attribute code for blank characters *)
Normal = 16; (* the attribute code for normal characters *)
Reverse = 112; (* the attribute code for reverse characters *)
Bright = 8; (* the attribute add-in for bright characters *)
Underline = 1; (* the attribute add-in for underlined characters *)
Blink = 128; (* the attribute add-in for blinking characters *)
MinX = 0; (* the minimum absolute x coordinate *)
MaxX = 79; (* the maximum absolute x coordinate *)
MinY = 0; (* the minimum absolute y coordinate *)
MaxY = 24; (* the maximum absolute y coordinate *)

TYPE
WinHandle; (* window "handles" *)
Color = [0..255]; (* the possible range of color attributes *)
XPos = [MinX..MaxX]; (* the possible range of absolute x coordinates *)
YPos = [MinY..MaxY]; (* the possible range of absolute y coordinates *)

PROCEDURE Write(win : WinHandle;
c : CHAR);
(* This procedure writes a character, and moves the cursor. bs, lf, cr,
and EOL are handled properly. *)

PROCEDURE WriteString(win : WinHandle;
s : STRING);
(* This procedure writes a string of characters as above. *)

PROCEDURE WriteLn(win : WinHandle);
(* This procedure writes a cr/lf sequence. *)

PROCEDURE ClrEol(win : WinHandle);
(* This procedure clears the line from the current cursor position on. *)

PROCEDURE ClrScr(win : WinHandle);
(* This procedure clears the entire window and homes the cursor. *)

PROCEDURE GotoXY(win : WinHandle;
x : XPos;
y : YPos);
(* This procedure changes the cursor position to the relative
coordinates specified. *)

PROCEDURE WhereX(win : WinHandle) : XPos;
(* This procedure returns the relative x coordinate of the cursor. *)

PROCEDURE WhereY(win : WinHandle) : YPos;
(* This procedure returns the relative y coordinate of the cursor. *)

PROCEDURE SetColor(win : WinHandle;
attr : Color);
(* This procedure changes the active color attribute to the one
specified. New text written will be in this new color. *)

PROCEDURE GetColor(win : WinHandle) : Color;
(* This procedure returns the currently active color attribute. *)

PROCEDURE OpenWindow(X1,
X2 : XPos;
Y1,
Y2 : YPos;
attr : Color;
border : BOOLEAN) : WinHandle;
(* This procedure opens a new window with the specified coordinates. The
active color is set to that specified. If 'Border' is true, one is
drawn. Any borders drawn are drawn such that the text of the window
will be written at the coordinates specified in this call (borders
are drawn outside of the coordinates). This procedure returns a
"handle" to be used to access the window. If the routine fails, the
handle will be NIL. *)

PROCEDURE CloseWindow(VAR win : WinHandle);
(* This routine closes the specified window. The full-screen window
cannot be closed. *)

PROCEDURE GetX1(win : WinHandle) : XPos;
(* This routine returns the absolute X1 coordinate of the window. *)

PROCEDURE GetX2(win : WinHandle) : XPos;
(* This routine returns the absolute X2 coordinate of the window. *)

PROCEDURE GetY1(win : WinHandle) : YPos;
(* This routine returns the absolute Y1 coordinate of the window. *)

PROCEDURE GetY2(win : WinHandle) : YPos;
(* This routine returns the absolute Y2 coordinate of the window. *)

PROCEDURE IsFore(win : WinHandle) : BOOLEAN;
(* This routine returns TRUE if the specified window is the top window. *)

PROCEDURE ToFront(win : WinHandle);
(* This routine moves the specified window to the top. *)

PROCEDURE TopWin() : WinHandle;
(* This routine returns the handle of the top window. *)

PROCEDURE Back() : WinHandle;
(* This routine returns the handle of the full-screen window. *)

PROCEDURE Move(win : WinHandle;
XOff,
YOff : INTEGER);
(* This routine moves the specified window to new coordinates. The new
coordinates are generated by adding XOff to the window's X1 and X2
coordinates, and YOff to the window's Y1 and Y2 coordinates. *)


A few notes:
1) The initialization routines read the full-screen into a buffer,
and use this as the full-screen window. The full-screen window
may be used in the same way as any other window, except that it
may not be moved or closed.
2) The majority of the routines except a window handle as a
parameter, This means that they affect that window and only that
window (as well as possibly how you see the underlying windows).
3) Range checking is performed on parameters to protect against
crashes. If any parameters are out of range and no other error
conditions are listed for that procedure, it will do nothing.
4) Any procedures that you use that do not use the Write() routine
provided by this module will screw up the screen! A patched DOSCALL
module is provided to enable you to use Terminal and InOut through
the windows. Note that DOS redirection is not supported via this.
Also note that DOSCALL is patched so that all output goes through
the top window.
5) Currently the module will force a HALT if it detects any display
mode other than 25x80 bw/color/graphics/mono. It will perform
direct screen writes in 25x80 bw, color and mono modes (with
wait-for-retrace in color modes) and bios calls for the 80x25
graphics. Any bios screen mode other than 2, 3, 6, or 7 will cause
a HALT.
6) The hardware cursor is positioned in the correct position on the
top window. It is only moved to one of the foreground windows if
bios writes are required (and even then it is moved back to the
foreground window as soon as the write is complete.


Donald Dumitru
11404-B MacKay Blvd
Orlando, Fl 32826
(305) 282-6479 [voice]
BIX: 'dondumitru'
(I can also be reached via ITC's M2BBS)
03/21/86


 December 9, 2017  Add comments

Leave a Reply