home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
turbopas
/
wndw40.arc
/
WNDWVARS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-12-12
|
7KB
|
152 lines
{ =========================================================================== }
{ WndwVars.pas - Variables for Multi-level windows ver 4.0, 12-12-87 }
{ }
{ This file contains all the variables needed for WNDW40.TPU. You cannot }
{ change this file for the window management utilities unless you have the }
{ complete WNDW40.PAS utilities. But you can change them for the basic }
{ window utilites in WNDW40-.PAS allowing you to do a "make". }
{ =========================================================================== }
{$R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }
UNIT WndwVars;
INTERFACE
USES Crt,Qwik;
const
MaxWndw = 30; { << Change this to suit your data needs. }
type
{ Place all of your window names needed for random-access here: }
{ The name Window0 is reserved for the non-window area. }
WindowNames = (Window0,
Window1, Window2, Window3, Window4, Window5,
Window6, Window7, Window8, Window9, Window10,
Window11, Window12, Window13, Window14, Window15,
Window16, Window17, Window18, Window19, Window20,
Window21, Window22, Window23, Window24, Window25,
Window26, Window27, Window28, Window29, Window30,
aWindow);
Borders = (NoBrdr, BlankBrdr, SingleBrdr, DoubleBrdr, HdoubleBrdr,
VdoubleBrdr, SolidBrdr, EvenSolidBrdr, ThinSolidBrdr1,
ThinSolidBrdr2, LhatchBrdr, MhatchBrdr, HhatchBrdr,
UserBrdr1, UserBrdr2);
BrdrRec = record
case byte of
1: (TL,TH,TR,LV,RV,BL,BH,BR,PL,PH,PR,PT,PV,PB,PC: char);
2: (BrdrArray: array[0..14] of char);
end;
{ Each letter of the border acronym mean:
T = top B = bottom
V = vertical H = horiz
L = left R = right
P = partition C = cross
Here they are in their relative positions:
TL TH PT TH TR
LV PV RV
PL PH PC PH PR
LV PV RV
BL BH PB BH BR }
DirType = (NoDir,Up,Down,VeryTop,Top,Bottom,VeryBottom,FarLeft,Left,Right,
FarRight,Center,Horiz,Vertical);
WordArray = array[0..16383] of word; { Virtual array }
WordArrayPtrType = ^WordArray;
WndwStatType = record
WSrow,WScol,WSrows,WScols,WSrow2,WScol2: byte;
WSWattr,WSBattr: integer;
WSbrdr: Borders;
WSname: WindowNames;
WSwhereR,WSwhereC,
WSmodes,
ULcol,ULcols,ULrows: byte; { peculiar Underlay location }
ULbytes: word; { size in bytes for underlay }
ULptr: WordArrayPtrType; { Underlay pointer }
end;
MarginRec = record { Margins for limiting movement with MoveWindow }
LeftMargin,RightMargin,TopMargin,BottomMargin: byte;
end;
const
Brdr: array [BlankBrdr..UserBrdr2] of BrdrRec =
{ TL,TH,TR,LV,RV,BL,BH,BR,PL,PH,PR,PT,PV,PB,PC }
((BrdrArray:' '), { BlankBrdr }
(BrdrArray:'┌─┐││└─┘├─┤┬│┴┼'), { SingleBrdr }
(BrdrArray:'╔═╗║║╚═╝╠═╣╦║╩╬'), { DoubleBrdr }
(BrdrArray:'╒═╕││╘═╛╞═╡╤│╧╪'), { HdoubleBrdr }
(BrdrArray:'╓─╖║║╙─╜╟─╢╥║╨╫'), { VdoubleBrdr }
(BrdrArray:'█████████─██│█┼'), { SolidBrdr }
(BrdrArray:'█▀████▄██─█▀│▄┼'), { EvenSolidBrdr }
(BrdrArray:'▐▀▌▐▌▐▄▌▐─▌▀│▄┼'), { ThinSolidBrdr1 }
(BrdrArray:'▄▄▄▌▐▀▀▀▌─▐▄│▀┼'), { ThinSolidBrdr2 }
(BrdrArray:'░░░░░░░░░─░░│░┼'), { LhatchBrdr }
(BrdrArray:'▒▒▒▒▒▒▒▒▒─▒▒│▒┼'), { MhatchBrdr }
(BrdrArray:'▓▓▓▓▓▓▓▓▓─▓▓│▓┼'), { HhatchBrdr }
(BrdrArray:'···············'), { UserBrdr1 } { Make your own }
(BrdrArray:'∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙')); { UserBrdr2 } { Make your own }
PermMode = $01; { 00000001b - Can't be moved or removed, no underlay }
FixedMode = $02; { 00000010b - Can't be moved or accessed }
ShadowLeft = $04; { 00000100b - Shadow on the left side }
ShadowRight = $08; { 00001000b - Shadow on the right side }
ZoomMode = $10; { 00010000b - Zoom effect on Make and AccessWindow }
HideMode = $20; { 00100000b - Hidden window, but contents saved }
{ The following are background color constants. With Turbo's constant
folding, you can do the following example:
white+BlueBG instead of Attr(white,blue)
This saves code (it's only one byte!) and is the fastest possible method.
I would recommend using it over the Attr function. You can also
deliberately add "blink" without being masked. }
BlackBG = $00; { Only needed for source code clarity. }
BlueBG = $10;
GreenBG = $20;
CyanBG = $30;
RedBG = $40;
MagentaBG = $50;
BrownBG = $60;
LightGrayBG = $70;
var
WndwStat: array[0..MaxWndw] of WndwStatType; { window stats }
TopWndwStat: WndwStatType; { Window stats on the top Level Index }
LI,HLI: byte; { Top Level Index, Hidden window Level Index }
Margins: MarginRec; { Limits for moving windows around }
WindowModes, { Sum of all the window modes listed above }
ZoomDelay: byte; { Delay in ms between each Qbox for zoom effect }
procedure ProgrammingError (ErrorNum: byte);
IMPLEMENTATION
procedure ProgrammingError; { (ErrorNum: byte); }
type Str40 = string[40];
var
Msg: Str40;
Col,Cols: byte;
TempArray: array[0..335] of char;
Key: char;
begin
case ErrorNum of
1: Msg:='Not enough Heap space!';
2: Msg:='Too many Windows!';
3: Msg:='Fixed/Perm Mode!'; { Can't remove/hide/access in these modes }
end;
Cols:=length(Msg)+16;
Col:=succ((CRTcols-Cols) shr 1);
QstoreToMem (12,Col,3,Cols,TempArray);
Qfill (12,Col,3,Cols,black + LightGrayBG + blink,' ');
QwriteC (13,1,CRTcols,-1,Msg+' Press a key');
sound (100);
delay (30);
nosound;
repeat
Key:=ReadKey;
until Key<>#00;
QstoreToScr (12,Col,3,Cols,TempArray);
end;
END.