Category : Pascal Source Code
Archive   : WINDMNGR.ZIP
Filename : WINDMNGR.DOC
ETHE WINDOW MANAGER/EDITORF
VERSION 1.0
COPYRIGHT (c) 1985
BY
JIM EVERINGHAM
THE WINDOW MANAGER PAGE 1
This Program is placed in the public domain by the author
and may be distributed freely without modification. If you find
these routines to be of use or of value, a small donation of up
to $10.00 would be appreciated. Those who donate will recieve a
complete description of the program source code and its updates.
Donations, inquiries, criticisms, or suggestions can be sent to:
Jim Everingham
318 East Sheridan Avenue
Dubois, Pa 15801
(814)-238-9655
CIS: 75116,433
I am also working on an assembler window package as a
project. Any suggestions will be welcome.
The Following Files should be included in the Library file:
Include Files:
E VAR.INCF
E WINDMNGR.INCF
E GROWWIN.INCF
E DEMODEFS.INCF
Demonstration Programs:
E DEFDEMO.PASF
E DEFDEMO.COMF
E GROWDEMO.PASF
E GROWDEMO.COMF
E WINDDEMO.PASF
E WINDDEMO.COMF
Support Programs:
E WINDODEF.PASF
E WINDODEF.COMF
E PRINTMAN.BATF
And of course this file,E WINDMNGR.DOCF & EREAD.MEF
THE WINDOW MANAGER PAGE 2
Contents
Introduction .......................... Page 4
System Requirements ................... Page 5
Overview of the Window Manager ........ Pages 6 - 7
The Window Manager Routines ........... Pages 8 -14
Pre-Defining Windows .................. Pages 13-14, 17-18
Other Functions & Procedures .......... Pages 15-16
Using WINDODEF.COM .................... Pages 17-18
Monochrome Graphics ................... Page 19
Modifying the Source code ............. Page 20
Quick Reference Section ............... Pages 21-22
THE WINDOW MANAGER PAGE 3
-EIntroductionF-
The Window Manager/Editor System is a collection of ultra-
fast window routines written in Turbo Pascal Under PC-Dos 2.0.
These Routines make it very easy to add a variety of different
size and type windows into your own Turbo Pascal programs.
When using this manual, type in the example programs to get
a feeling of how the program operates.
THE WINDOW MANAGER PAGE 4
-ESystem RequirementsF-
This Program was developed on a Columbia MPC 1600-1 with
256K RAM and a Color/Graphics adapter under PC DOS 2.0. These
routines will not work on a non-PC compatible system due to the
fact that it writes directly into video RAM. I have tried the
demos on an IBM PC and they have worked fine, so I don't think
there will be any trouble getting them to work properly.
ENOTE:F If when running the demo's consecutivly, the screen
becomes full of garbage or unreadable characters, just reboot
your computer and they should work fine.
THE WINDOW MANAGER PAGE 5
-EOverview of the Window Manager/Editor System F-
The ability to create "WINDOWS" is one of the more
fascinating features of the PC. If you do not know exactly what
windows are, I will try to explain the concept to you here.
A window can be thought of as a scrolling area. The
standard IBM PC display consists (upon boot-up) of a scrolling
area of 80 columns by 25 rows of characters. This is a window,
whenever the screen fills up, it scrolls the whole screen up 1
column allowing a blank column at the bottom of the screen. The
area in which to be scrolled is from column 1, row 1 and column
80, row 25. This scrolling area can be "SET" to any portion of
the screen. For example, I can change the scrolling area to be
from column 5, row 5 (upper left hand corner) and column 50, row
20 (lower right hand corner, see figure 1.0). All text within
that area (or window) will be scrolled and the rest of the
screen will remain undisturbed.
(1,1) PC's Screen
+---------------------------------------+
| (5,5) |
| +------------------+ |
| | | |
| | | |
| | Area A | |
| | | |
| | | |
| +------------------+ |
| (50,20) |
| |
| Area B |
+---------------------------------------+
(80,25)
EFigure 1.0F, Screen. A=New Scrolling Area
B=Full viewing Area
My new scrolling area is area A, or a window consisting of
the upper-left hand coordinates (5,5) and lower right hand
coordinates (50,20). Now whenever I write to the screen,
everything in area A is scrolled and area B, the main screen, is
undisturbed (Try out the EDEFDEMO.COMF program to see how this
works).
Windows are used in many popular programs. Sidekick uses
windows, Qmodem, Pc-Talk, many disk catalog programs, etc. Many
interesting effects can be created with use of windows. For
example toggling in between windows can create the illusion of
many windows active on your screen at once. Windows can be
created in text mode, and graphics mode also.
With the Window Manager/Editor system, windows can be
manipulated with the ease of a few new procedures which are used
just like commands. Among these are commands to add, remove,
THE WINDOW MANAGER PAGE 6
title, color, create, scroll and move your windows around. The
details of these procedures will be covered in the next section
of this manual.
THE WINDOW MANAGER PAGE 7
-EImplementing Window Manager/Editor RoutinesF-
This section will describe all routines included with the
Window Manager/Editor system and detailed instructions on how to
implement them into your own Turbo Pascal programs.
In all there are seven main commands to work with (I will
refer to procedural calls as "commands" for the sake of
understanding).
1: INITIALIZE
2: ADD_WINDOW
3: GROW_WINDOW (grow window?)
4: REMOVE
5: COLOR_WINDOW
6: WINDOW_TITLE
7: SELECT_WINDOW (Optional)
To access these commands, all that is required is that you
include the following two lines at the very beginning of your
program:
{$I VAR.INC}
{$I WINDMNGR.INC}
optional: {$I GROWWIN.INC} if you wish to use growing windows.
{$I DEFS.INC} if you have defined windows (See section
on EWINDODEF.COMF for details on this).
We will discuss the syntax of each of these in detail and
then move onto the smaller functions and commands. Parameters
will be enclosed in the symbols < and > and in boldface.
E--Initialize- - F Procedure
E--__________- - F
Initializes the stack and memory for your windows to be
stored in. This -MUST- be in your program before you use any of
the other routines. There is no telling what will happen if you
don't.
Syntax:
Initialize;
I highly recommend getting into the habit of making this
the first line of your program.
E--Add_Window- - F Procedure
E--__________- - F
Saves the current screen into memory and creates a framed
window with the cursor positioned in the top left hand corner.
Syntax:
THE WINDOW MANAGER PAGE 8
Add_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
Where:
EX1F is upper left hand X-coordinate
EY1F is upper left hand Y-coordinate
EX2F is lower right hand X-coordinate
EY2F is lower right hand Y-coordinate
EForegrndF is the text foreground color
EBackgrndF is the background textcolor
EFrameF is an integer value (1..5) wich designates
the the style of frame you desire on
your window.
EFrameF types are as follows:
1 A single line surrounding the window.
2 A double line surrounding the window.
3 Two horizontal double lines and two vertical
single lines surrounding the window.
4 A solid frame the thickness of one
cursor surrounding the window.
5 No frame.
Example call:
Add_Window(5,5,50,20,1,2,2);
This call in particular will create a window with the upper
left hand corner of the frame positioned at the location (5,5)
and the lower right hand corner of the frame (not the window) at
the location (50,20). The color of the frame will be blue
(textcolor 1) against a background of green (textcolor 2).
Refer to the PC-Dos 2.0 Addendum at the end of the Turbo
Referance Manual or the last page of this manual for color value
constants. It will be surrounded by frame type #2 which is a
double lined frame. Up to eight windows can be on the screen at
one time unless the source code is modified to handle more.
This is explained in the section on source modification. Try
this little sample program to test the Add_window procedure:
{$I VAR.INC}
{$I WINDMNGR.INC}
Begin
Initialize;
Add_window(5,5,50,20,1,2,2);
repeat until keypressed
end.
When using the Add_Window procedure keep in mind that the
coordinates you give will be the coordinates of the frame of the
window. The actual window will be (X1+1,Y1+1), (X2-1,Y2-1).
THE WINDOW MANAGER PAGE 9
E--Grow_Window- - F Procedure
E--___________- - F
This procedure is essentially the same as the Add_Window
procedure in all respects except that the window will start out
as a small cube in the middle of the screen and appear to grow
to the size of the specified coordinates. Wonderful huh?
Syntax:
Grow_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
All parameters for the Grow_Window procedure are the same
as in the Add_Window procedure.
Example call:
Grow_Window(10,7,40,18,2,0,2);
Try the same example program as in the Add_Window procedure
description only substitute the Add_Window call with the
Grow_window call from above.
--ERemoveF- - Procedure
--E______F- -
Removes a specified number of windows from the screen
without destroying any of the underlying information.
Syntax:
Remove(<E# of windows to removeF>);
Where:
E# of windows to removeF is an integer number
between 1 and the number of screens that
are active.
Example call:
Remove(1);
This example call will remove the top most active window
from the screen and activate the underlying window. When the
underlying window is reactivated, the cursor is positioned
exactly where it was when you left off. For example, I can add
a window and write 'Hello' inside the window. Whenever I add a
new window and then remove it, my cursor will be automatically
positioned directly after 'o' in 'Hello'. Here is a little
sample program:
Program Remove_test;
{$I VAR.INC}
{$I WINDMNGR.INC};
{$I GROWWIN.INC}
THE WINDOW MANAGER PAGE 10
Var Ch: CHar;
Begin
Initialize;
Add_window(5,5,50,15,1,2,3);
Grow_Window(30,10,60,23,11,0,2);
Repeat until keypressed;
Read(kbd, ch);
Remove(1);
Repeat until keypressed;
Read(kbd,ch);
Remove(1)
end.
Whenever using the Remove procedure, keep in mind that the
number of windows to remove cannot be higher than the number of
windows that are active.
E--Color_Window- - F Procedure
E--____________- - F
With this command, you may change the color attributes
(foreground & background colors) of the currently active window
(the one on top).
Syntax:
Color_Window(<EForegrndF>,<EBackgrndF>);
Where:
EForegrndF is the new foreground color (or text
color) to be used.
EBackgrndF is the new background color to be used.
Example call:
Color_Window(12,7);
This call will change the attributes of the currently
active window to a foreground color of red (textcolor 12) and a
background color of light grey (textcolor 7). Here is a small
sample program that will create a window and then change the
its color after a key is pressed:
Program Change_Window_Color;
{$I VAR.INC}
{$I WINDMNGR.INC}
Var Ch: Char;
Begin
Initialize;
Add_Window(20,10,60,20,12,0,2);
THE WINDOW MANAGER PAGE 11
Repeat until keypressed;
Read(kbd,ch);
Color_Window(1,7);
Repeat until keypressed;
Read(kbd,ch);
Remove(1)
end.
E--Window_Title- - F Procedure
E--____________- - F
Adds a title to the currently activated window. The title,
providing you are not using frame type #4 or #5, is surrounded
by brackets ([ & ]).
Syntax:
Window_Title('<ETitleF>',<EColorF>);
Where:
ETitleF is a string of characters which should be
less than the width of the frame in
frame. The title must be enclosed in
single quotes.
EColorF is the combination foreground-background
(text color) of the title to be displayed.
This value is determined by the formula:
EColorF = Foreground + (background * 16)
Example: Blue colors on a green
background would be (1+(2*16)) where 1 is
the value for the color blue and 2 is the
value for the color green.
Example call:
Window_Title('TEST TITLE',(12+128)+(7*16));
This call will place the title 'TEST TITLE' at the top left
hand corner of the active window. It will be flashing red
characters (12+128) against a light gray background (7*16).
Whenever I add 128 to any of the basic colors, they become
flashing characters. Once again, a sample program:
Program Title_Test;
{$I VAR.INC}
{$I WINDMNGR.INC}
Begin
Add_Window(3,3,60,10,1,7,3);
Window_Title('TEST TITLE',(128+12)+(7*16))
end.
THE WINDOW MANAGER PAGE 12
E--Select_Window- - F Procedure
E--_____________- - F
If you have defined an include file with EWINDODEF.COMF or
have calculated the values yourself, then you may use the
Select_Window procedure. (See section on WINDODEF.COM for
information on defining windows to be used in your program).
Syntax:
Select_Window(<EWindow numberF>);
Where:
EWindow numberF is the number of the window
to activate.
Example Call:
Select_Window(1);
This little call activates a pre-defined window number one.
-A Little on defining windows-
Windows may be defined in an array and implemented into an
include file as constants easily making it possible to lay out
your windows before implementing them in your program. There
are essentially two possible ways of doing this. You can either
figure them out for yourself or use the EWINDODEF.COMF program
included in this package which will do -everything- described
below. The operation of the windodef program is explained in
the Windodef section. I will explain how to do it yourself (the
harder way), but I suggest you skip this section and read the
-Using EWINDODEF.COMF- section.
Ok, Here goes.. The values for windows can be pre-defined
and added to your programs. The way to do this is to figure out
where you want your windows to appear on the screen and enter
them into constants and have the procedure create the windows
for you. First, write down the x,y coordinates, attributes, and
titles for your windows. The next step will be to put them into
2 constants. The syntax for the Include procedure is as
follows.
PROCEDURE SELECT_WINDOW(WIN_NUM: INTEGER);
CONST WINDOWS: ARRAY[1..9,1..8] OF INTEGER =
(
(" " " " " ), {Window 8}
(0,0,0,0,0,0,0,0)); {end flag,must be present}
CONST TITLE: ARRAY[1..9] OF STRING[80] =
('Title #1',....,'Title #8','');
BEGIN
THE WINDOW MANAGER PAGE 13
IF (WINDOW[WIN_NUM,7] > 0) AND (WIN_NUM > STACK_TOP) THEN
BEGIN
ADD_WINDOW(WINDOWS[WIN_NUM,1],
WINDOWS[WIN_NUM,2],
WINDOWS[WIN_NUM,3],
WINDOWS[WIN_NUM,4],
WINDOWS[WIN_NUM,5],
WINDOWS[WIN_NUM,6],
WINDOWS[WIN_NUM,7);
IF TITLE[WIN_NUM] <> '' THEN
WINDOW_TITLE(TITLE[WIN_NUM],
WINDOWS[WIN_NUM,8]);
END
ELSE
IF WINDOWS[WIN_NUM,4] > 0 THEN
BEGIN
IMIG[LAST_WINDOW_NUM].W1:=WHEREX;
IMIG[LAST_WINDOW_NUM].W2:=WHEREY;
WINDOW(1,1,80,25);
GOTOXY(1,1);
WITH IMIG[WIN_NUM] DO
BEGIN
WINDOW(X1,Y1,X2,Y2);
TEXTCOLOR(C1+(B1*16))
END;
GOTOXY(1,1);
GOTOXY(IMIG[WIN_NUM].W1,IMIG[WIN_NUM].W2);
LAST_WINDOW_NUM:=WIN_NUM
END
END;
(See EDEMODEFS.INCF to see the real procedure)
That's it.. Although, it's much easier to use the EWINDODEF.COMF
program.
THE WINDOW MANAGER PAGE 14
E-Other Functions & ProceduresF-
Along with the main procedures described in the previous
section, there are also some smaller functions and procedures
within the window manager routines which may be accessed by the
user. In this section, we will discuss these and some of their
applications.
EActiveF function
This function returns the number of windows that are pushed
on the stack (on the screen). This number will be between 1
and 8 unless the source code is modified to handle more windows.
See the section on modifying the source code.
Syntax:
<EVariableF> := Active;
Where:
EVariableF is an integer variable;
Example call:
Windows_Up := Active;
This example call will assign the declared variable
Windows_Up to the number of windows that are on the screen. A
use for this may be to clear all the active windows off the
screen like this:
Remove(Active);
E--Set_Page- - F Procedure
E--________- - F
Used to set the current video page. That is, the area in
video RAM wich is displayed on the screen. There are four 4K
pages in color (Pages 0 though 3) mode and eight 2K pages in
Monochrome mode (Pages 0 through 7).
Syntax:
Set_Page(<EByteF>);
Where:
EByteF is a byte value within the range
$00 though $03 for color and $00
through $07 in mono.
Example call:
Set_Page($01);
THE WINDOW MANAGER PAGE 15
Sets the current video page to page 1 allowing you to write
to page 0 with regular writeln and write routines. Try this
small example program:
Program Switch_Page;
{$I VAR.INC}
{$I WINDMNGR.INC}
Var i: Integer;
Begin
ClrScr;
Set_Page($01);
For i:=1 to 300 do write(' Hello ');
Set_Page($00)
end.
This little program will clear the screen, switch to video
page #1, which will remain cleared, fill page 0 with Hello's and
then switch back to page 0 creating the illusion of speed.
If you are adventurous you can play around with the other
various procedures within the window manager routines. Within
the source are routines to write directly to screen memory, turn
off the crt, bypass the windows and write directly to screen
memory, draw boxes, and various other things...
THE WINDOW MANAGER PAGE 16
E-Using WINDODEF.COM to define windowsF-
There is also a program included with the package called
EWINDODEF.COMF. This program may be used to pre-define windows
for implementing into your own Turbo Pascal programs. The
purpose of this program is to write a E$IFnclude file. To do this
just invoke the program by typing its name at the Ms-dos prompt.
A menu will be displayed with EWINDODEFF functions numbered one
through five. We will discuss each of these.
-Option 1:- Edit/Configure window file
When this option is selected the screen is cleared and you
are asked which window number to define. At this point enter an
integer value in between one and eight. A small 5 by 5 window
is placed in the upper left hand corner of the screen. Use the
cursor keys to move this box around. An explanation of the
function keys is printed at the top of the screen. The window
can be moved, expanded, titled, re-framed, and colored. After
you have the window adjusted to your desires, just hit function
key ten to return to the main menu. Now you may select one of
the other options from the menu or define another window.
-Option 2:- Save definitions to disk file
After you have completed defining all of your windows,
select this option to save the files to an include file which
you may easily incorporate into your own Turbo program. The
file is saved to disk under the name EDEFS.INCF. After the file
is saved you may rename it to whatever you want at dos level.
To use your definitions in a Turbo program, just make the first
three lines of your program:
{$I VAR.INC}
{$I WINDMNGR.INC}
optional {$I GROWWIN.INC}
{$I DEFS.INC}
You may now use the select_window procedure described in
the previous section. See the EDEMODEFS.INCF file and the
EDEFDEMO.*F programs.
-Option 3:- Clear defined window
This option may be selected to clear a window that you have
defined. This is a precaution in case you mess up a window and
have all the others defined (or some of the windows). You will
be prompted with "Clear window number #:". Just enter the
number of the window you wish to be cleared and that window
number will be completely reset.
THE WINDOW MANAGER PAGE 17
-Option 4:- Display defined windows simultaneously
This option may be selected to display all your defined
windows on the screen at once so you can see what they look
like all together.
-Option 5:- Exit to system
This option is pretty much self explanatory. Just -be -
-certain- to save your windows before exiting.
THE WINDOW MANAGER PAGE 18
E-The Window Manager under Monochrome- F
To the best of my knowledge, this program will work fine
under IBM Monochrome Graphics. All that need be done is to
change the statement EScreen_Seg = $B800F in the EVAR.INCF file to
EScreen_Seg = $B000F. That's all, and be sure to watch what text
colors you use.
THE WINDOW MANAGER PAGE 19
E-Modifying the source codeF-
If you would like to have more than eight windows on the
screen at once, this is possible by modifying the source code of
the EVAR.INCF file to handle this. There is a constant called
-MAX_SCREENS- that may be changed to either a higher number or a
lower number. If it is changed to a higher number, each
additional window will require 4K of memory. Be sure you have
enough memory to suit the adjustment. Memory can be conserved
by lowering the number of possible windows. This will save 4K
for each additional window removed.
The constant -DATA_ADDRESS- points to page one in video
memory. By incrementing this constant, the windows can be drawn
into any portion of video memory.
You can peek through the source code and remove un-needed
procedures whenever you are writing a program. This will also
save on memory.
Please DO NOT distribute any modofied versions of this
program. I wouldn't like people calling me and saying, "Hey
Jim, this and this doesn't work!". Oh well, thanks for using
the program and I really hope you enjoy it.
THE WINDOW MANAGER PAGE 20
E-Quick Reference SectionF-
-Basic layout of your program should be as follows.-
Program
{$I VAR.INC}
{$I WINDMNGR.INC}
Your procedures and functions go here
begin {Main program body}
Inititialize;
more code...
-
-
-
end. {end main}
-Procedures:-
Initialize; {Initializes stack, must be first line}
Add_Window(
{Adds a window of specified size}
Grow_window(
{Same as add_window only window appears to grow}
Remove<<# to remove>); {removes a specified # of windows}
Color_Window(
{Change color attributes of window}
Window_Title('
{Adds a title to your window, color is determined
by the formula color = forgrnd+(backgrnd * 16)}
Select_Window(
{Selects a predefined window, if window is
already up, then it is just reactivated}
Active; {Assign the number of active windows to itself,
Function}
Set_Page(
THE WINDOW MANAGER PAGE 21
-Text color values-
0 black 8 gray
1 blue 9 light blue
2 green 10 light green
3 cyan 11 light cyan
4 red 12 light red
5 magenta 13 light magenta
6 brown 14 yellow
7 white 15 high intensity white
Note: Adding 128 to any color makes it a blinking color.
THE WINDOW MANAGER PAGE 22
Hello.....
I am a student at The Pennsylvania State University and
am in need of some extra work. If you need any program
conversions, custom programming, etc.. Please give me a call or
write me. I work for cheap! I program in Pascal, Fortran,
PL/1, PL/C, and Basic. By June 85 I shall also know PDP-11
Assembler, 8088 Assembler, and IBM SYS/370 Assembler. So if you
have some work, give a ring.
Thanks,
Jim Everingham
Jim Everingham
318 East Sheridan Avenue
DuBois Pa., 15801
814-238-9655 or
814-371-1355 after June 85
CIS: 75116,433
THE WINDOW MANAGER PAGE 23
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/