home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / wndw40.zip / WNDWVARS.PAS < prev    next >
Pascal/Delphi Source File  |  1987-12-12  |  7KB  |  152 lines

  1. { =========================================================================== }
  2. { WndwVars.pas - Variables for Multi-level windows          ver 4.0, 12-12-87 }
  3. {                                                                             }
  4. { This file contains all the variables needed for WNDW40.TPU.  You cannot     }
  5. { change this file for the window management utilities unless you have the    }
  6. { complete WNDW40.PAS utilities.  But you can change them for the basic       }
  7. { window utilites in WNDW40-.PAS allowing you to do a "make".                 }
  8. { =========================================================================== }
  9.  
  10. {$R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }
  11.  
  12. UNIT WndwVars;
  13.  
  14. INTERFACE
  15.  
  16. USES Crt,Qwik;
  17.  
  18. const
  19.   MaxWndw = 30;  { << Change this to suit your data needs. }
  20.  
  21. type
  22.   { Place all of your window names needed for random-access here: }
  23.   { The name Window0 is reserved for the non-window area. }
  24.   WindowNames = (Window0,
  25.                  Window1,  Window2,  Window3,  Window4,  Window5,
  26.                  Window6,  Window7,  Window8,  Window9,  Window10,
  27.                  Window11, Window12, Window13, Window14, Window15,
  28.                  Window16, Window17, Window18, Window19, Window20,
  29.                  Window21, Window22, Window23, Window24, Window25,
  30.                  Window26, Window27, Window28, Window29, Window30,
  31.                  aWindow);
  32.  
  33.   Borders = (NoBrdr, BlankBrdr, SingleBrdr, DoubleBrdr, HdoubleBrdr,
  34.              VdoubleBrdr, SolidBrdr, EvenSolidBrdr, ThinSolidBrdr1,
  35.              ThinSolidBrdr2, LhatchBrdr, MhatchBrdr, HhatchBrdr,
  36.              UserBrdr1, UserBrdr2);
  37.   BrdrRec = record
  38.               case byte of
  39.                 1: (TL,TH,TR,LV,RV,BL,BH,BR,PL,PH,PR,PT,PV,PB,PC: char);
  40.                 2: (BrdrArray: array[0..14] of char);
  41.             end;
  42.             { Each letter of the border acronym mean:
  43.                 T = top         B = bottom
  44.                 V = vertical    H = horiz
  45.                 L = left        R = right
  46.                 P = partition   C = cross
  47.               Here they are in their relative positions:
  48.                 TL  TH  PT  TH  TR
  49.                 LV      PV      RV
  50.                 PL  PH  PC  PH  PR
  51.                 LV      PV      RV
  52.                 BL  BH  PB  BH  BR    }
  53.  
  54.   DirType = (NoDir,Up,Down,VeryTop,Top,Bottom,VeryBottom,FarLeft,Left,Right,
  55.              FarRight,Center,Horiz,Vertical);
  56.   WordArray        = array[0..16383] of word;  { Virtual array }
  57.   WordArrayPtrType = ^WordArray;
  58.   WndwStatType = record
  59.               WSrow,WScol,WSrows,WScols,WSrow2,WScol2: byte;
  60.               WSWattr,WSBattr:     integer;
  61.               WSbrdr:              Borders;
  62.               WSname:              WindowNames;
  63.               WSwhereR,WSwhereC,
  64.               WSmodes,
  65.               ULcol,ULcols,ULrows: byte;      { peculiar Underlay location }
  66.               ULbytes:             word;      { size in bytes for underlay }
  67.               ULptr:               WordArrayPtrType;  { Underlay pointer   }
  68.             end;
  69.   MarginRec = record    { Margins for limiting movement with MoveWindow }
  70.                 LeftMargin,RightMargin,TopMargin,BottomMargin: byte;
  71.               end;
  72.  
  73. const
  74.   Brdr: array [BlankBrdr..UserBrdr2] of BrdrRec =
  75.     {   TL,TH,TR,LV,RV,BL,BH,BR,PL,PH,PR,PT,PV,PB,PC  }
  76.     ((BrdrArray:'               '),  { BlankBrdr      }
  77.      (BrdrArray:'┌─┐││└─┘├─┤┬│┴┼'),  { SingleBrdr     }
  78.      (BrdrArray:'╔═╗║║╚═╝╠═╣╦║╩╬'),  { DoubleBrdr     }
  79.      (BrdrArray:'╒═╕││╘═╛╞═╡╤│╧╪'),  { HdoubleBrdr    }
  80.      (BrdrArray:'╓─╖║║╙─╜╟─╢╥║╨╫'),  { VdoubleBrdr    }
  81.      (BrdrArray:'█████████─██│█┼'),  { SolidBrdr      }
  82.      (BrdrArray:'█▀████▄██─█▀│▄┼'),  { EvenSolidBrdr  }
  83.      (BrdrArray:'▐▀▌▐▌▐▄▌▐─▌▀│▄┼'),  { ThinSolidBrdr1 }
  84.      (BrdrArray:'▄▄▄▌▐▀▀▀▌─▐▄│▀┼'),  { ThinSolidBrdr2 }
  85.      (BrdrArray:'░░░░░░░░░─░░│░┼'),  { LhatchBrdr     }
  86.      (BrdrArray:'▒▒▒▒▒▒▒▒▒─▒▒│▒┼'),  { MhatchBrdr     }
  87.      (BrdrArray:'▓▓▓▓▓▓▓▓▓─▓▓│▓┼'),  { HhatchBrdr     }
  88.      (BrdrArray:'···············'),  { UserBrdr1      }  { Make your own }
  89.      (BrdrArray:'∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙')); { UserBrdr2      }  { Make your own }
  90.   PermMode    = $01;    { 00000001b - Can't be moved or removed, no underlay }
  91.   FixedMode   = $02;    { 00000010b - Can't be moved or accessed }
  92.   ShadowLeft  = $04;    { 00000100b - Shadow on the left side }
  93.   ShadowRight = $08;    { 00001000b - Shadow on the right side }
  94.   ZoomMode    = $10;    { 00010000b - Zoom effect on Make and AccessWindow }
  95.   HideMode    = $20;    { 00100000b - Hidden window, but contents saved }
  96.  
  97.   { The following are background color constants.  With Turbo's constant
  98.     folding, you can do the following example:
  99.         white+BlueBG    instead of    Attr(white,blue)
  100.     This saves code (it's only one byte!) and is the fastest possible method.
  101.     I would recommend using it over the Attr function.  You can also
  102.     deliberately add "blink" without being masked. }
  103.   BlackBG     = $00;   { Only needed for source code clarity. }
  104.   BlueBG      = $10;
  105.   GreenBG     = $20;
  106.   CyanBG      = $30;
  107.   RedBG       = $40;
  108.   MagentaBG   = $50;
  109.   BrownBG     = $60;
  110.   LightGrayBG = $70;
  111.  
  112. var
  113.   WndwStat:     array[0..MaxWndw] of WndwStatType;             { window stats }
  114.   TopWndwStat:  WndwStatType;           { Window stats on the top Level Index }
  115.   LI,HLI:       byte;            { Top Level Index, Hidden window Level Index }
  116.   Margins:      MarginRec;                 { Limits for moving windows around }
  117.   WindowModes,                     { Sum of all the window modes listed above }
  118.   ZoomDelay:    byte;         { Delay in ms between each Qbox for zoom effect }
  119.  
  120. procedure ProgrammingError (ErrorNum: byte);
  121.  
  122. IMPLEMENTATION
  123.  
  124. procedure ProgrammingError; { (ErrorNum: byte); }
  125. type  Str40 = string[40];
  126. var
  127.   Msg:       Str40;
  128.   Col,Cols:  byte;
  129.   TempArray: array[0..335] of char;
  130.   Key:       char;
  131. begin
  132.   case ErrorNum of
  133.     1: Msg:='Not enough Heap space!';
  134.     2: Msg:='Too many Windows!';
  135.     3: Msg:='Fixed/Perm Mode!'; { Can't remove/hide/access in these modes }
  136.   end;
  137.   Cols:=length(Msg)+16;
  138.   Col:=succ((CRTcols-Cols) shr 1);
  139.   QstoreToMem (12,Col,3,Cols,TempArray);
  140.   Qfill (12,Col,3,Cols,black + LightGrayBG + blink,' ');
  141.   QwriteC (13,1,CRTcols,-1,Msg+' Press a key');
  142.   sound (100);
  143.   delay (30);
  144.   nosound;
  145.   repeat
  146.     Key:=ReadKey;
  147.   until Key<>#00;
  148.   QstoreToScr (12,Col,3,Cols,TempArray);
  149. end;
  150.  
  151. END.
  152.