home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR9 / QWIK71A.ZIP / QWIKDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1993-09-23  |  27KB  |  802 lines

  1. { ========================================================================== }
  2. { QwikDemo.pas - Demo program for QWIK screen utilities.  ver 7.1a, 09-23-93 }
  3. {                                                                            }
  4. { Demo has been programmed best for color cards in 25-line mode.  It can     }
  5. { also be tested in 40-column mode.                                          }
  6. {   Copyright (c) 1986,1993 James H. LeMay, Eagle Performance Software       }
  7. { ========================================================================== }
  8.  
  9. program QwikDemo;
  10.  
  11. {$A-,B-,D-,E-,F-,G-,I-,L-,N-,P-,Q-,R-,S-,T-,V-,X+,Y-}
  12. { $A+,B-,D+,E-,F-,G-,I-,L+,N-,P-,Q-,R-,S-,T-,V-,X+,Y+}
  13. {$M 12000, 0, 0}
  14.  
  15. uses
  16.   Crt,Qwik,Strs;
  17.  
  18. type
  19.   BrdrRec =
  20.     record                 { For Qbox procedure }
  21.       TL,TH,TR,LV,RV,BL,BH,BR: char;
  22.     end;
  23.  
  24. var
  25.   Strng,Strng2:          string[75];
  26.   Data: array [1.. 9] of string[41];
  27.   Vert: array [1..24] of string[41];
  28.   PC:   array [1..14] of string[41];
  29.   Init: array [1..11] of string[41];
  30.   Other:array [1..12] of string[41];
  31.   Crsr: array [1..13] of string[41];
  32.   Eoss: array [1.. 5] of string[41];
  33.   SavedBlock, PopUpBlock: array [1..4000] of byte;
  34.   ColL,ColR:              array [1..3] of byte;
  35.   Row,Rows,Col,Cols,Step,ColMax: byte;
  36.   i,Count,Fgrnd,Bgrnd:           word;
  37.   BrdrAttr, WndwAttr:            integer;
  38.   BlkRow,BlkCol,V:               byte;
  39.   Rnum:                          Real;
  40.   Ch:                            char;
  41.   LastVideoMode:                 byte;
  42.  
  43. const
  44.   Wait: word = 400;      { One unit of wait in milliseconds for demo. }
  45.   { These are lines for Qbox }
  46.   Border1: BrdrRec = (TL:'┌';TH:'─';TR:'┐';
  47.                       LV:'│';       RV:'│';
  48.                       BL:'└';BH:'─';BR:'┘');
  49.   Border2: BrdrRec = (TL:'╔';TH:'═';TR:'╗';
  50.                       LV:'║';       RV:'║';
  51.                       BL:'╚';BH:'═';BR:'╝');
  52.   BWcolors: array[0..3] of byte = (
  53.               Black,        { Black     on Black }
  54.               LightGray,    { LightGray on Black }
  55.               White,        { White     on Black }
  56.               LightGrayBG); { Black     on LightGray }
  57.  
  58. { Since Zenith doesn't have snow on any CGAs, turn off snow checking }
  59. procedure CheckZenith;
  60. type CharArray8 = array[1..8] of char;
  61. var  ZdsRom: ^CharArray8;
  62. begin
  63.   ZdsRom := Ptr(SegF000,$800C);
  64.   if Qsnow and (ZdsRom^='ZDS CORP') then
  65.     begin
  66.       Qsnow    := false;
  67.       CardSnow := false;
  68.     end;
  69. end;
  70.  
  71. { Qbox is an application of QWIK screen utilities.  It can make fast
  72.   pop-up menus.  See WNDWxx.ZIP for more applications. }
  73. procedure Qbox (Row,Col,Rows,Cols: byte; WndwAttr,BrdrAttr: integer;
  74.                                                       Brdr: BrdrRec);
  75. begin
  76.   if (Rows>=2) and (Cols>=2) then
  77.   begin
  78.     with Brdr do
  79.     begin
  80.       Qwrite    (Row       ,Col                     ,BrdrAttr,TL);
  81.       QfillEos  (                           1,Cols-2,BrdrAttr,TH);
  82.       QwriteEos (                                    BrdrAttr,TR);
  83.       Qfill     (Row+1     ,Col       ,Rows-2,1     ,BrdrAttr,LV);
  84.       Qfill     (Row+1     ,Col+Cols-1,Rows-2,1     ,BrdrAttr,RV);
  85.       Qwrite    (Row+Rows-1,Col                     ,BrdrAttr,BL);
  86.       QfillEos  (                           1,Cols-2,BrdrAttr,BH);
  87.       QwriteEos (                                    BrdrAttr,BR);
  88.       Qfill     (Row+1     ,Col+1     ,Rows-2,Cols-2,WndwAttr,' ')
  89.     end
  90.   end
  91. end;
  92.  
  93. procedure CloseDemo;
  94. begin
  95.   if QVideoMode<=CO40 then
  96.     begin
  97.       if LastVideoMode>CO40 then
  98.         delay (Wait*4);
  99.       TextMode (LastVideoMode+hi(LastMode));
  100.     end;
  101.   GotoRC (23, 1);
  102.   SetCursor (CursorInitial);
  103. end;
  104.  
  105. procedure PromptKey;
  106. begin
  107.   Qwrite (25,CRTcols-19,SameAttr,'press any key ...');
  108.   Ch := ReadKey;
  109.   if Ch=#27 then
  110.     begin
  111.       CloseDemo;
  112.       Halt;
  113.     end;
  114. end;
  115.  
  116. procedure ClearScreen (Attr: integer);
  117. begin
  118.   Qbox ( 1, 1,CRTrows,CRTcols,Attr,Attr,Border1);
  119. end;
  120.  
  121. procedure ExplodeBoxes;
  122. var
  123.   TopRow,BottomRow,MaxRows,MaxCols,DeltaCols,LeftCol,RightCol: byte;
  124.   CenterCol:    byte;
  125.   ClockReading: word absolute $0040:$006C; { low memory clock }
  126.   StartTime:    word;
  127.  
  128. {}procedure ScatterBoxes;
  129. {}begin
  130. {}  Rows:= succ(random(MaxRows));
  131. {}  if QVideoMode<=CO40 then              { Keep aspect 1:1 }
  132. {}       Cols:= Rows + Rows shr 2         { 1.2 cols/row }
  133. {}  else Cols:= Rows shl 1 + Rows shr 1;  { 2.4 cols/row }
  134. {}  Col := LeftCol + random (RightCol-LeftCol-Cols+2);
  135. {}  Row := TopRow  + random (BottomRow-TopRow-Rows+2);
  136. {}  if QVideoMode=Mono then
  137. {}  TextAttr:=BWcolors[(random(4))]
  138. {}  else
  139. {}    begin
  140. {}      Fgrnd:= random (16);
  141. {}      Bgrnd:= random (8);
  142. {}      if Bgrnd=Fgrnd then inc(Fgrnd);
  143. {}      TextAttr:=Fgrnd + Bgrnd shl 4;
  144. {}    end;
  145. {}  Qfill (Row,Col,Rows,Cols,TextAttr,#178);
  146. {}end;
  147.  
  148. begin
  149.   CenterCol:=CRTcols shr 1;
  150.   randomize;
  151.   StartTime:=ClockReading;
  152.   for Step:=1 to 12 do
  153.     begin
  154.       { Set boundaries }
  155.       TopRow:=13-Step;
  156.       BottomRow:=13+Step;
  157.       MaxRows:=Step;
  158.       if QVideoMode<=CO40 then                      { Keep aspect 1:1 }
  159.         begin
  160.           MaxCols:= MaxRows + MaxRows shr 2;        { 1.2 cols/row }
  161.           DeltaCols:=(Step*5 div 3);
  162.         end
  163.       else
  164.         begin
  165.           MaxCols:= MaxRows shl 1 + MaxRows shr 1;  { 2.4 cols/row }
  166.           DeltaCols:=(Step*10 div 3);
  167.         end;
  168.       LeftCol  :=succ(CenterCol)-DeltaCols;
  169.       RightCol :=CenterCol+DeltaCols;
  170.       if Step<12 then
  171.         begin
  172.           for Count:=1 to 40 do ScatterBoxes;
  173.         end
  174.       else
  175.         repeat
  176.           ScatterBoxes;
  177.         until ClockReading-StartTime>=60;  { about 60/18.2 seconds }
  178.     end;
  179. end;
  180.  
  181. procedure InitDemo;
  182. begin
  183. { --- Set up data --- }
  184. { If you set a mode, do it first before Qinit! }
  185. { Please!  Test a mode first to see if it is different than what you want; }
  186. { then change if necessary.  Otherwise, the screen jumps. }
  187.  
  188.   CheckBreak := false;
  189.   CheckZenith;
  190.   SetMultiTask;
  191.   LastVideoMode := QVideoMode;
  192.   if (QVideoMode<>Mono) and not Have3270 then
  193.     begin
  194.       ClearScreen (LightGray+BlackBG);
  195.       QwriteC (11,1,CRTcols,SameAttr,'(1) 80 column mode');
  196.       QwriteC (12,1,CRTcols,SameAttr,'(2) 40 column mode');
  197.       QwriteC (14,1,CRTcols,SameAttr,'Which mode [1,2]? ');
  198.       GotoEos;
  199.       repeat
  200.         Ch:=ReadKey;
  201.       until ch in ['1','2'];
  202.       V := QVideoMode;
  203.       case ch of
  204.         '1': case V of
  205.                BW40: V:=BW80;
  206.                CO40: V:=CO80;
  207.              end;
  208.         '2': case V of
  209.                BW80: V:=BW40;
  210.                CO80: V:=CO40;
  211.              end;
  212.       end;
  213.       if V<>LastMode then
  214.         begin
  215.           TextMode (V);
  216.           Qinit;           { << Do Qinit again after change of mode!! }
  217.           CheckZenith;
  218.           SetMultiTask;
  219.         end;
  220.     end;
  221.   ModCursor (CursorOff);
  222.   Strng:=   'Q Screen Utilities';
  223.   Strng2:=  ' QWIK Screen Utilities  ';
  224.   Data[1]:= '1';
  225.   Data[2]:= '22';
  226.   Data[3]:= '333';
  227.   Data[4]:= Strng;
  228.   Data[5]:= 'Odd  Length';
  229.   Data[6]:= 'Even  Length';
  230.   Data[7]:= '18 characters wide';
  231.   Data[8]:= '19 characters width';
  232.   Data[9]:= 'Margin to Margin width';
  233.   Vert[1]:= 'TABLE 1';
  234.   Vert[2]:= '1234567890123';
  235.   Vert[3]:= '│││││││││││││';
  236.   Vert[4]:= ' xxx x xx x';
  237.   Vert[5]:= '--------';
  238.   Vert[6]:= '│││││││││││││';
  239.   Vert[7]:= '';
  240.   Vert[8]:= 'unknown';
  241.   Vert[9]:= '';
  242.   Vert[10]:= '│││││││││││││';
  243.   Vert[11]:= '';
  244.   Vert[12]:= 'IN';
  245.   Vert[13]:= '';
  246.   Vert[14]:= 'OUT';
  247.   Vert[15]:= '';
  248.   Vert[16]:= 'CHKD';
  249.   Vert[17]:= '';
  250.   Vert[18]:= '▓▓▓▓▓▓▓▓▓▓▓▓▓';
  251.   Vert[19]:= '';
  252.   Vert[20]:= 'TBA';
  253.   Vert[21]:= '';
  254.   Vert[22]:= '▓▓▓▓▓▓▓▓▓▓▓▓▓';
  255.   Vert[23]:= 'CHKD';
  256.   Vert[24]:= '│││││';
  257.   PC[1]:=  'COMPUTERS:           ADAPTERS:';
  258.   PC[2]:=  '------------------   ----------';
  259.   PC[3]:=  'IBM PC               MDA';
  260.   PC[4]:=  'IBM XT               CGA';
  261.   PC[5]:=  'IBM AT               EGA';
  262.   PC[6]:=  'IBM PCjr             MCGA';
  263.   PC[7]:=  'IBM PC Convertible   VGA';
  264.   PC[8]:=  'IBM PS/2 Model 25    8514/A';
  265.   PC[9]:=  'IBM PS/2 Model 30    Hercules:';
  266.   PC[10]:= 'IBM PS/2 Model 50      HGC';
  267.   PC[11]:= 'IBM PS/2 Model 60      HGC Plus';
  268.   PC[12]:= 'IBM PS/2 Model 70      InColor';
  269.   PC[13]:= 'IBM PS/2 Model 80';
  270.   PC[14]:= 'IBM 3270 PC';
  271.   Other[ 1]:='QscrollUp  - Qwik scroll up';
  272.   Other[ 2]:='QscrollDown- Qwik scroll down';
  273.   Other[ 3]:='QscrToVscr - block to virtual screen';
  274.   Other[ 4]:='QVscrToScr - virtual screen to block';
  275.   Other[ 5]:='QreadStr   - reads string from screen';
  276.   Other[ 6]:='QreadChar  - reads char   from screen';
  277.   Other[ 7]:='QreadAttr  - reads attr   from screen';
  278.   Other[ 8]:='QviewPage  - view any video page';
  279.   Other[ 9]:='QwritePage - write to any video page';
  280.   Other[10]:='QwriteSub  - for sub-strings';
  281.   Other[11]:='QfillC     - a self-centering Qfill';
  282.   Other[12]:='QattrC     - a self-centering Qattr';
  283.   Crsr[ 1]:='GotoRC      - absolute cursor position';
  284.   Crsr[ 2]:='WhereR      - absolute cursor row';
  285.   Crsr[ 3]:='WhereC      - absolute cursor column';
  286.   Crsr[ 4]:='SetCursor   - sets cursor mode';
  287.   Crsr[ 5]:='GetCursor   - gets cursor mode';
  288.   Crsr[ 6]:='ModCursor   - modifies cursor mode';
  289.   Crsr[ 7]:='CursorInitial   - cursor at startup';
  290.   Crsr[ 8]:='CursorUnderline - normal cursor';
  291.   Crsr[ 9]:='CursorHalfBlock - for insert editing';
  292.   Crsr[10]:='CursorBlock     - for the nearsighted';
  293.   Crsr[11]:='A total of 43 utilities';
  294.   Crsr[12]:='optimizing in just 2.9k bytes or less!';
  295.   Init[1]:='∙ Works in DOS and DPMI platforms';
  296.   Init[2]:='∙ Detects dual monitor/adapters for';
  297.   Init[3]:='   all systems previously listed';
  298.   Init[4]:='∙ Identifies each system by name';
  299.   Init[5]:='∙ Gets System ID and Submodel ID';
  300.   Init[6]:='∙ Gets CPU ID';
  301.   Init[7]:='∙ Sets FAR pointer for virtual screens';
  302.   Init[8]:='∙ Determines need for wait-for-retrace';
  303.   Init[9]:='∙ Gets screen dimensions: Rows by Cols';
  304.   Init[10]:='∙ Determines the number of video pages';
  305.   Init[11]:='∙ Sets 4 standard cursor shapes';
  306.   Eoss[1]:=' ∙ QwriteEos    - just like Qwrite    ';
  307.   Eoss[2]:=' ∙ QwriteEosV   - just like QwriteV   ';
  308.   Eoss[3]:=' ∙ QwriteEosSub - just like QwriteSub ';
  309.   Eoss[4]:=' ∙ QfillEos     - just like Qfill     ';
  310.   Eoss[5]:=' ∙ QattrEos     - just like Qattr     ';
  311. end;
  312.  
  313. procedure ExplodeScreen;
  314. begin
  315.   { --- Initial screen --- }
  316.   ClearScreen (White+BlueBG);
  317.   QwriteC (11, 1,CRTcols,Yellow+BlueBG,Strng2);
  318.   QwriteC (13, 1,CRTcols,SameAttr,'Your screen is about to explode.');
  319.   QwriteC (14, 1,CRTcols,SameAttr,'Hold on to your seat ...');
  320.   Delay   (Wait*5);
  321.  
  322.   { --- Explosion of Boxes --- }
  323.   ClearScreen (Black+LightGrayBG);
  324.   ExplodeBoxes;
  325.  
  326.   QfillC  (10, 1,CRTcols, 6,34,RedBG  ,' ');
  327.   QfillC  (11, 1,CRTcols, 4,30,BrownBG,' ');
  328.   TextAttr:= Yellow+RedBG;
  329.   QwriteC (12, 1,CRTcols,TextAttr,Strng2);
  330.   QwriteC (13, 1,CRTcols,TextAttr,'     Version  7.1a      ');
  331. end;
  332.  
  333. procedure SaveScreen;
  334. begin
  335.   { --- Save Screen for Page Demo --- }
  336.   if MaxPage>0 then
  337.     begin
  338.       QstoreToMem ( 1, 1,25,CRTcols,SavedBlock);
  339.       QwritePage  (1);
  340.       QstoreToScr ( 1, 1,25,CRTcols,SavedBlock);
  341.       QwritePage  (0);
  342.     end;
  343.   { --- End of Save Screen --- }
  344.   Delay   (Wait*4);
  345.   TextAttr:= White+BlueBG;
  346.   QwriteC ( 6, 1,CRTcols,TextAttr,' Qwrite will write with new attributes  ');
  347.   QwriteC ( 7, 1,CRTcols,TextAttr,' that you specify direct to the screen. ');
  348.   Delay   (Wait*6);
  349.   QwriteC (18, 1,CRTcols,SameAttr,'Qwrite will also use existing attributes');
  350.   QwriteC (19, 1,CRTcols,SameAttr,'   when you do not even know or care.   ');
  351.                         { highlight the word 'existing' }
  352.   QattrC  (18, 6,CRTcols+5,1,10,White+RedBG+Blink);
  353.   Delay   (wait*10);
  354.   QwriteC (21, 1,CRTcols,TextAttr,' Say Goodbye to this screen. ');
  355.  
  356.   Delay   (wait*3);
  357.   { --- Disintigrate Screen --- }
  358.   for i:=1 to 5000 do
  359.     begin
  360.       Row:=random(25)+1;
  361.       Col:=random(CRTcols)+1;
  362.       Qfill (row,col, 1, 1,Black,' ');
  363.     end;
  364. end;
  365.  
  366. procedure ListCompatibles;
  367. begin
  368.   { --- Compatible computer and adapter list --- }
  369.   ClearScreen (LightGrayBG);
  370.   QwriteC ( 4, 1,CRTcols,SameAttr,'QWIK Screen Utilities detects these');
  371.   QwriteC ( 5, 1,CRTcols,SameAttr,'compatible computers and adapters:');
  372.   delay   (wait*5);
  373.   Col:=(CRTcols-30) shr 1;
  374.   for Row:=7 to 20 do
  375.     Qwrite (Row,Col,SameAttr,PC[Row-6]);
  376.   QwriteC (23, 1,CRTcols,SameAttr,'Working text modes 0,1,2,3, or 7!');
  377.   PromptKey;
  378. end;
  379.  
  380. procedure ListDetection;
  381. begin
  382.   { --- Qinit detection --- }
  383.   ClearScreen (LightGrayBG);
  384.   QwriteC ( 4, 1,CRTcols,SameAttr,'To configure QWIK, Qinit not only');
  385.   QwriteC ( 5, 1,CRTcols,SameAttr,'detects computers/adapters, it:');
  386.   delay   (wait*5);
  387.   Col:=(CRTcols-36) shr 1;
  388.   for Row:=09 to 19 do
  389.     Qwrite (Row,Col,SameAttr,Init[Row-8]);
  390.   QwriteC (22,1,CrtCols,Blue+LightGrayBG+Blink,
  391.            'Ideal for small, tight projects!');
  392.   PromptKey;
  393. end;
  394.  
  395. procedure UsingStr;
  396. begin
  397.   { --- Qwrite with Str on Reals Demo --- }
  398.   ClearScreen (Yellow+BlackBG);
  399.   QwriteC ( 2, 1,CRTcols,SameAttr,'Qwrite with the Strs unit will write');
  400.   QwriteC ( 3, 1,CRTcols,SameAttr,'reals and integers faster:');
  401.   Delay   (wait*7);
  402.   Rnum:=1.23E+05;
  403.   for col:=0 to CRTcols div 20 -1 do
  404.   for row:=5 to 24 do
  405.   begin
  406.     Rnum:=Rnum+1;
  407.     Qwrite (row,col*20+4,SameAttr,StrRF(Rnum,12));
  408.   end;
  409.   PromptKey;
  410. end;
  411.  
  412. procedure Centering;
  413. begin
  414.   { --- Centering Demo --- }
  415.   ClearScreen (LightGrayBG);
  416.   QwriteC ( 2, 1,CRTcols,SameAttr,'QwriteC will automatically');
  417.   QwriteC ( 3, 1,CRTcols,SameAttr,'center your data ...');
  418.   QwriteC ( 4, 1,CRTcols,SameAttr,'(Odd breaks are shifted to the left.)');
  419.   Delay   (wait*6);
  420.  
  421.   { - Set up columns for varying column modes - }
  422.   ColL[2]:=1; ColR[2]:=CRTcols;
  423.   if CRTcols<80 then
  424.     begin
  425.       ColL[1]:=ColL[2]; ColL[3]:=CRTcols div 2;
  426.       ColR[1]:=ColR[2]; ColR[3]:=CRTcols div 2;
  427.     end
  428.   else
  429.     begin
  430.       ColL[1]:=3; ColR[1]:=26; ColL[3]:=CRTcols-14; ColR[3]:=CRTcols-14;
  431.     end;
  432.  
  433.   QwriteC ( 7,ColL[1],ColR[1],SameAttr,'between margins ...');
  434.   Qbox    ( 8,(ColL[1]+ColR[1]) shr 1 -12,15,26,white,LightGray,Border1);
  435.   Delay   (wait*3);
  436.   for row:=11 to 19 do
  437.     QwriteC (row,ColL[1],ColR[1],SameAttr, Data[row-10]);
  438.   Delay   (wait*5);
  439.  
  440.   QwriteC ( 7,ColL[2],ColR[2],SameAttr,'between two columns ...');
  441.   QfillC  ( 9,ColL[2],ColR[2],13,24,Yellow,' ');     {  Clear window }
  442.   for row:= 9 to 21 do
  443.     QwriteC  (row,ColL[2],ColR[2],SameAttr,'><');     {  Show two columns  }
  444.   Delay   (wait*3);
  445.   for row:=11 to 19 do
  446.     QwriteC (row,ColL[2],ColR[2],LightRed, Data[row-10]);
  447.   Delay   (wait*5);
  448.  
  449.   QwriteC ( 7,ColL[3],ColR[3],SameAttr,'or on a center line ...');
  450.   QfillC  ( 8,ColL[3],ColR[3],15,27,Black+LightGrayBG,' ');  {Clear window}
  451.   for row:=09 to 21 do                 {  Show center line  }
  452.     QwriteC  (row,ColL[3],ColR[3],Black+LightGrayBG,'|');
  453.   Delay   (wait*3);
  454.   for row:=11 to 19 do
  455.     QwriteC (row,ColL[3],ColR[3],SameAttr, Data[row-10]);
  456.   PromptKey;
  457. end;
  458.  
  459. procedure Vertical;
  460. begin
  461.   { --- Vertical Writing Demo --- }
  462.   ClearScreen (White+BlueBG);
  463.   QwriteC ( 3, 1,CRTcols,SameAttr,'QwriteV and QwriteVC will');
  464.   QwriteC ( 4, 1,CRTcols,SameAttr,'write vertically ...');
  465.   Delay   (wait*6);
  466.  
  467.   { - Set up columns for varying column modes - }
  468.   if CRTcols<80 then
  469.     begin
  470.       ColL[1]:=8;    ColR[1]:=33;
  471.       ColL[2]:=9;    ColR[2]:=32;
  472.       ColL[3]:=8;    ColR[3]:=33;
  473.     end
  474.   else
  475.     begin
  476.       ColL[1]:=2;    ColR[1]:=27;
  477.       ColL[2]:=29;   ColR[2]:=52;
  478.       ColL[3]:=54;   ColR[3]:=79;
  479.     end;
  480.  
  481.   QwriteC ( 7,ColL[1],ColR[1],SameAttr,'Top justified ...');
  482.   Qbox    ( 8,ColL[1],15,26,DarkGray+GreenBG,White+GreenBG,Border1);
  483.   Delay   (wait*3);
  484.   for col:=1 to 24 do
  485.     QwriteV (9,col-1+ColL[1],SameAttr,Vert[col]);
  486.   QwriteEosV (SameAttr,#254);
  487.   Delay   (wait*5);
  488.  
  489.   QwriteC ( 7,ColL[2],ColR[2],SameAttr,'   centered ...   ');
  490.   QfillC  ( 8,ColL[2],ColR[2],15,26,White+BlueBG,' ');
  491.   QfillC  ( 9,ColL[2],ColR[2],13,24,LightGrayBG,' ');
  492.   Delay   (wait*3);
  493.   for col:=1 to 24 do
  494.     QwriteVC ( 9,21,col-2+ColL[2],SameAttr,Vert[col]);
  495.   QwriteEosV (SameAttr,#254);
  496.   Delay   (wait*5);
  497.  
  498.   QwriteC ( 7,ColL[3],ColR[3],SameAttr,'or bottom justified ...');
  499.   Qbox    ( 8,ColL[3],15,26,CyanBG,White+CyanBG,Border1);
  500.   Delay   (wait*3);
  501.   for col:=1 to 24 do
  502.     QwriteV ( 22-length(Vert[col]),col-1+ColL[3],SameAttr,Vert[col]);
  503.   PromptKey;
  504. end;
  505.  
  506. procedure QwikFilling;
  507. begin
  508.   { --- Qfill Demo --- }
  509.   ClearScreen (White+BlackBG);
  510.   QwriteC ( 3, 1,CRTcols,SameAttr,'Qfill as well as Qattr can fill');
  511.   QwriteC ( 4, 1,CRTcols,SameAttr,'your screen in several ways.');
  512.   Delay   (wait*7);
  513.  
  514.   QwriteC ( 7, 1,CRTcols,SameAttr,'by rows ...');
  515.   Delay   (wait*3);
  516.   for row:= 9 to 24 do
  517.     Qfill (row, 2, 1,CRTcols-2,9+row,Chr(row+56));
  518.   Delay   (wait*5);
  519.  
  520.   Qfill   ( 7, 2,18,CRTcols-2,white,' ');       {  Clear Lines }
  521.   QwriteC ( 7, 1,CRTcols,SameAttr,'by columns ...');
  522.   Delay   (wait*3);
  523.   for col:=2 to CRTcols-1 do
  524.     Qfill ( 9,col,16,1,16+col,chr(col+63));
  525.   Delay   (wait*5);
  526.  
  527.   Qfill   ( 7, 2,18,CRTcols-2,white,' ');       {  Clear Lines }
  528.   QwriteC ( 7, 1,CRTcols,SameAttr,'or by row-by-column blocks ...');
  529.   Delay   (wait*3);
  530.     Qfill ( 9,2,16,CRTcols-2,Yellow+BlueBG,'!');
  531.   Delay   (wait*5);
  532. end;
  533.  
  534. procedure QboxDemo;
  535. begin
  536.   { --- Qbox demo --- }
  537.   ClearScreen (LightGrayBG);
  538.   QwriteC ( 2, 1,CRTcols,SameAttr,'Qbox is an application procedure made');
  539.   QwriteC ( 3, 1,CRTcols,SameAttr,'from Qwrite and Qfill.  Together they');
  540.   QwriteC ( 4, 1,CRTcols,SameAttr,'can make windows with borders easy.');
  541.   Delay   (wait*9);
  542.   QwriteC (14, 1,CRTcols,SameAttr,'How about 100 of them? ... ');
  543.   Delay   (wait*4);
  544.   ColMax:=CRTcols-21;
  545.   for i:=1 to 100 do
  546.     begin
  547.       row:=random (10)+6;
  548.       col:=random (ColMax)+2;
  549.       if QVideoMode=Mono then
  550.         begin
  551.           BrdrAttr:=BWcolors[random(4)];
  552.           WndwAttr:=BWcolors[random(4)];
  553.         end
  554.       else
  555.         begin
  556.           BrdrAttr:=random (128);
  557.           WndwAttr:=random (128);
  558.         end;
  559.       Qbox (row,col,10,20,BrdrAttr,WndwAttr,Border2);
  560.     end;
  561.   Delay (wait*10);
  562. end;
  563.  
  564. procedure PopUpDemo;
  565. begin
  566.   { --- Block Transfer and PopUp Demo --- }
  567.   Qfill   ( 1, 1,25,CRTcols,yellow,'?');       {  Clear Screen }
  568.   QfillC  (10, 1,CRTcols, 6,40,BrownBG,' ');   {  Clear Block }
  569.   QwriteC (11, 1,CRTcols,SameAttr,'Qstore will save and restore');
  570.   QwriteC (12, 1,CRTcols,SameAttr,'Row-by-Column blocks on your display.');
  571.   QwriteC (13, 1,CRTcols,SameAttr,'It is so fast, I have to slow it down');
  572.   QwriteC (14, 1,CRTcols,SameAttr,'so you can see it.');
  573.     Delay (wait*11);
  574.     BlkRow:=8;
  575.     BlkCol:=CRTcols div 2 - 9;
  576.   QstoreToMem(BlkRow,BlkCol,10,20,SavedBlock);
  577.   { --- Make a Pop Up Menu --- }
  578.   Qbox (BlkRow,BlkCol,10,20,Yellow+BlueBG,Brown+BlueBG,Border2);
  579.   QwriteC (BlkRow+4,BlkCol,BlkCol+20,SameAttr,'Pop Up');
  580.   QwriteC (BlkRow+5,BlkCol,BlkCol+20,SameAttr,'Menu');
  581.   { --- End of Pop Up Menu --- }
  582.   QstoreToMem (BlkRow,BlkCol,10,20,PopUpBlock);
  583.     Delay (wait*4);
  584.   ColMax:=CRTcols-20;
  585.   for i:=1 to 30 do
  586.     begin
  587.       Delay (Wait div 2);
  588.       QstoreToScr (BlkRow,BlkCol,10,20,SavedBlock);
  589.       BlkRow:=random(15)+1;
  590.       BlkCol:=random(ColMax)+1;
  591.       QstoreToMem (BlkRow,BlkCol,10,20,SavedBlock);
  592.       QstoreToScr (BlkRow,BlkCol,10,20,PopUpBlock);
  593.     end;
  594. end;
  595.  
  596. procedure PageDemo;
  597. begin
  598.   { --- Page Demo --- }
  599.   if (MaxPage>0) and not InMultiTask then
  600.     begin
  601.       QviewPage  (1);
  602.       QwritePage (1);
  603.       TextAttr:= Yellow+BlueBG;
  604.       QfillC  (20, 1,CRTcols, 3,35,TextAttr,' ');
  605.       QwriteC (20, 1,CRTcols,SameAttr,' Remember this page?  ');
  606.       QwriteC (21, 1,CRTcols,SameAttr,' It wasn''t lost, but saved using ');
  607.       QwriteC (22, 1,CRTcols,SameAttr,' Qstores and placed on a new page. ');
  608.       Delay (wait*14);
  609.       QwritePage (0);
  610.       QviewPage  (0);
  611.     end;
  612. end;
  613.  
  614. procedure EosMarker;
  615. var Row: byte;
  616. begin
  617.   { -- EOS marker -- }
  618.   ClearScreen (LightGreen+BlackBG);
  619.   QwriteC ( 3, 1,CRTcols,White,'EOS Marker:');
  620.   Col := EosC;
  621.   QwriteEos (Blink+Yellow,#07);
  622.   Qwrite  ( 4,Col,Yellow,#24' right here');
  623.   QwriteC ( 7, 1,CRTcols,SameAttr,'The TP Write procedure locates your');
  624.   QwriteC ( 8, 1,CRTcols,SameAttr,'next string by moving the cursor to');
  625.   QwriteC ( 9, 1,CRTcols,SameAttr,'the End-Of-String (EOS).  Qwik does');
  626.   QwriteC (10, 1,CRTcols,SameAttr,'the same thing, but without moving ');
  627.   QwriteC (11, 1,CRTcols,SameAttr,'cursor!  It''s done with an offset  ');
  628.   QwriteC (12, 1,CRTcols,SameAttr,'called QEosOfs.  It''s updated after');
  629.   QwriteC (13, 1,CRTcols,SameAttr,'every Qwik procedure.              ');
  630.   QwriteC (16, 1,CRTcols,SameAttr,'Now you can have the convenience of');
  631.   QwriteC (17, 1,CRTcols,SameAttr,'a TP write but the speed of Qwik!  ');
  632.   QwriteC (18, 1,CRTcols,SameAttr,'Check out these Q*Eos routines.    ');
  633.   PromptKey;
  634. end;
  635.  
  636. procedure QEosDemo;
  637. begin
  638.   { --- Q*Eos Utilities Demo --- }
  639.   ClearScreen (Black+LightGrayBG);
  640.   QwriteC ( 3, 1,CRTcols,SameAttr,'The Q*Eos procedures:');
  641.   for Row:=5 to 9 do
  642.     QwriteC (Row, 1,CRTcols,Yellow+BlackBG,Eoss[Row-4]);
  643.   QwriteC (11, 1,CRTcols,SameAttr,'Take advantage of the EOS marker to');
  644.   QwriteC (12, 1,CRTcols,SameAttr,'chain the next string - with an    ');
  645.   QwriteC (13, 1,CRTcols,SameAttr,'optional change of attribute!      ');
  646.   delay   (wait*5);
  647.   Col := (CRTcols-34) shr 1;
  648.   Qwrite (15,Col,Black+BrownBG,' Yellow ');
  649.     for Count:=1 to 2 do
  650.       begin
  651.         delay     (wait);
  652.         QwriteEos (White+BlueBG ,' Blue ');
  653.         delay     (wait);
  654.         QwriteEos (Black+BrownBG,' Yellow ');
  655.       end;
  656.   delay   (wait);
  657.   QwriteC (17, 1,CRTcols,SameAttr,'Starts where the last Qwik');
  658.   QwriteC (18, 1,CRTcols,SameAttr,'procedure left off!');
  659.   QwriteC (19, 1,CRTcols,SameAttr,'Like TP Write ... but at Qwik speed!');
  660.   delay   (wait*2);
  661.   Qwrite (22,Col,Black+BrownBG,' Yellow ');
  662.     for Count:=1 to 2 do
  663.       begin
  664.         QwriteEos (White+BlueBG ,' Blue ');
  665.         QwriteEos (Black+BrownBG,' Yellow ');
  666.       end;
  667.   PromptKey;
  668. end;
  669.  
  670. procedure UsingEos;
  671. const
  672.   Bright = Blue+LightGrayBG;
  673. begin
  674.   { -- Using Eos marker -- }
  675.   ClearScreen (Black+LightGrayBG);
  676.   Col:=succ((CRTcols-38) shr 1);
  677.   QwriteC ( 2, 1,CRTcols,White,' Using the EOS marker: ');
  678.   Qwrite ( 4,Col,Bright  ,'Now you have two marker utilities -');
  679.   Qwrite ( 5,Col,Bright  ,'(1) EOS, and (2) the cursor.  Both can');
  680.   Qwrite ( 6,Col,Bright  ,'be used interchangeably:');
  681.   Qwrite ( 8,Col,SameAttr,'GotoEos   - cursor to End-Of-String');
  682.   Qwrite ( 9,Col,SameAttr,'EosR      - End-Of-String row');
  683.   Qwrite (10,Col,SameAttr,'EosC      - End-Of-String column');
  684.   Qwrite (12,Col,Bright  ,'You can also manually alter EOS with');
  685.   Qwrite (13,Col,Bright  ,'the following procedures:');
  686.   Qwrite (15,Col,SameAttr,'EosToRC     - Sets EOS to a given row');
  687.   Qwrite (16,Col,SameAttr,'              and column.');
  688.   Qwrite (17,Col,SameAttr,'EosToRCrel  - Relatively shifts EOS by');
  689.   Qwrite (18,Col,SameAttr,'              row and column.');
  690.   Qwrite (19,Col,SameAttr,'EosToCursor - Matches Eos to the');
  691.   Qwrite (20,Col,SameAttr,'              cursor position.');
  692.   Qwrite (21,Col,SameAttr,'EosLn       - Sets EOS to next row');
  693.   Qwrite (22,Col,SameAttr,'QEosLn      - Like EosLn, but scrolls');
  694.   Qwrite (23,Col,SameAttr,'              up if on last row.');
  695.   PromptKey;
  696. end;
  697.  
  698. procedure MoreUtilities;
  699. const
  700.   Bright = Blue+LightGrayBG;
  701. begin
  702.   { --- Other Screen Utilities Demo --- }
  703.   ClearScreen (Black+LightGrayBG);
  704.   QwriteC ( 3, 1,CRTcols,Bright,'Here are more powerful');
  705.   QwriteC ( 4, 1,CRTcols,Bright,'QWIK Screen Utilities');
  706.   QwriteC ( 5, 1,CRTcols,Bright,'(for standard and virtual):');
  707.   delay   (wait*5);
  708.   Col:=(CRTcols-36) shr 1;
  709.   for Row:=8 to 19 do
  710.     Qwrite (Row,Col,SameAttr,Other[Row-7]);
  711.   PromptKey;
  712. end;
  713.  
  714. procedure CursorUtilities;
  715. const
  716.   Bright = White+BrownBG;
  717. begin
  718.   { --- Cursor Utilities Demo --- }
  719.   ClearScreen (Black+BrownBG);
  720.   QwriteC ( 2, 1,CRTcols,Bright,'And of course there are complete set');
  721.   QwriteC ( 3, 1,CRTcols,Bright,'of CURSOR location and mode routines');
  722.   QwriteC ( 4, 1,CRTcols,Bright,'for all video pages and video cards.');
  723.   delay   (wait*5);
  724.   Col:=(CRTcols-36) shr 1;
  725.   for Row:= 6 to 11 do
  726.     Qwrite (Row,Col,SameAttr,Crsr[Row-5]);
  727.   QwriteC (13, 1,CRTcols,Bright,'For universal cursor sizes, four');
  728.   QwriteC (14, 1,CRTcols,Bright,'standard shapes are initialized ');
  729.   QwriteC (15, 1,CRTcols,Bright,'by detecting each video card:   ');
  730.   for Row:=17 to 20 do
  731.     Qwrite (Row,Col,SameAttr,Crsr[Row-10]);
  732.   for Row:=22 to 23 do
  733.     QwriteC (Row,1,CRTcols,Bright,Crsr[Row-11]);
  734.   PromptKey;
  735. end;
  736.  
  737. procedure AttrDemo;
  738. begin
  739.   { --- Attribute Demo --- }
  740.   ClearScreen (Black+GreenBG);
  741.   TextAttr:= White+GreenBG;
  742.   QwriteC ( 2, 1,CRTcols,TextAttr,'QWIK Screen Utilities are hiding data');
  743.   QwriteC ( 3, 1,CRTcols,TextAttr,'on your screen ...');
  744.   Cols:=CRTcols div 20;
  745.   if QVideoMode=Mono then
  746.        TextAttr:=Black+BlackBG
  747.   else TextAttr:=Green+GreenBG;
  748.   for col:=0 to Cols-1 do
  749.     for row:=5 to 20 do
  750.       Qwrite (row,(20*col)+2,TextAttr,Strng);
  751.   Delay (wait*8);
  752.  
  753.   Qfill   ( 2, 2, 2,CRTcols-2,SameAttr,' ');        {  Clear Lines }
  754.   TextAttr:= White+GreenBG;
  755.   QwriteC ( 2, 1,CRTcols,TextAttr,'Qattr can show them -');
  756.   QwriteC ( 3, 1,CRTcols,TextAttr,'by merely changing the attribute!');
  757.   Delay   (wait*6);
  758.  
  759.   { --- Try using Turbo's color procedures this time --- }
  760.   TextColor (Black); TextBackground (Green);
  761.   Qattr   ( 5, 2,16,CRTcols-2,TextAttr);         {  Reveal Data }
  762.   Delay   (wait*5);
  763.  
  764.   Qfill   ( 2, 2, 2,CRTcols-2,SameAttr,' ');        {  Clear Lines }
  765.   TextColor (yellow); TextBackground (Green);
  766.   QwriteC ( 3, 1,CRTcols,TextAttr,'Or even just emphasize what''s seen ...');
  767.   for i:=1 to 500 do
  768.     begin
  769.       Row:= random(16) + 5;
  770.       Col:= random(Cols)*20+2;
  771.       Qattr (Row,Col, 1,18,Yellow+GreenBG);
  772.       Delay (3);
  773.       Qattr (Row,Col, 1,18,GreenBG);
  774.     end;
  775.   for i:=1 to Cols do     {  Emphasize Data }
  776.     Qattr ( 5*i,(i-1)*20+2, 1,18,Yellow+GreenBG+Blink);
  777.   Qattr   (21, 2, 4,CRTcols-2,TextAttr);
  778.   QwriteC (22, 1,CRTcols,TextAttr,'Copyright (c) 1986,1993 James H. LeMay');
  779. end;
  780.  
  781. begin
  782.   InitDemo;
  783.   ExplodeScreen;
  784.   SaveScreen;
  785.   ListCompatibles;
  786.   ListDetection;
  787.   UsingStr;
  788.   Centering;
  789.   Vertical;
  790.   QwikFilling;
  791.   QboxDemo;
  792.   PopUpDemo;
  793.   PageDemo;
  794.   EosMarker;
  795.   QEosDemo;
  796.   UsingEos;
  797.   MoreUtilities;
  798.   CursorUtilities;
  799.   AttrDemo;
  800.   CloseDemo;
  801. end.
  802.