home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / revolv.zip / REVOLVER.PAS < prev   
Pascal/Delphi Source File  |  1988-03-24  |  26KB  |  1,205 lines

  1. Program Revolver;
  2. {
  3.  
  4.                            R E V O L V E R
  5.  
  6.                              Version 1.0
  7.  
  8.                      Revolving Video Tape Catalog
  9.  
  10.  
  11.                        Copyright D. Brown, 1988
  12.  
  13.  
  14. This is a tiny List Manager, designed specifically for  maintaining a
  15. revolving catalog of video tape recordings.
  16.  
  17. It is not intended to be used in maintaining a permanent video tape
  18. library. That is best accomplished with one of the numerous programs
  19. specifically designed for that purpose, or by designing your own
  20. using a database manager.
  21.  
  22. Version 1.0 maintains two data files, one for VHS tapes and another
  23. for  BETA.
  24.  
  25. Revolver is released into the Public Domain with the understanding
  26. that it will not be sold and that any modifications will follow the
  27. "Philosophy" as outlined in the documentation.
  28.  
  29. Please refer all questions or bug reports to David Brown, via:
  30.  
  31.  
  32.                                              MCI Mail: 221-0001
  33.                                          Compuserve: 73307,1432
  34. }
  35.  
  36.  
  37. Uses CRT, PRINTER, DOS;
  38.  
  39.  
  40. type
  41.   FName = string[9];
  42.   LineStr = string[65];
  43.   RecordEraseStr = String[9];
  44.  
  45.  
  46.                 Tape = record                { Tape File  }
  47.                 ItemNumber : Integer;        { Tape Number }
  48.                 RecordErase: RecordEraseStr; { Tape in/out circulation}
  49.                 Passes     : Integer;        { Number of Recordings}
  50.                 Line1,                       { \                   }
  51.                 Line2,                       {   >  Description    }
  52.                 Line3      : LineStr;        { /                   }
  53.                end;
  54.  
  55.  
  56. var
  57.    DiskFileName                        : FName;
  58.    RE                                  : RecordEraseStr;
  59.    TapeFile                            : file of Tape;
  60.    TapeRec                             : Tape;
  61.    TType                               : String[4];
  62.  
  63.    MaxNumberOfTapes, NewEnd, Pnr,
  64.    ItemNumber, TapesPrinted, PageNum,
  65.    Col                                 : Integer;
  66.  
  67.    ED_Line1, ED_Line2, ED_Line3        : LineStr;
  68.  
  69.    Kh, Xh, Bh, Eh, Cj, LS, E, X,
  70.    MM, TT                              : Char;
  71.  
  72.    ED_RecordErase, Printed, FuncKey,
  73.    Up, NewFile, Quit, done             : Boolean;
  74.  
  75.  
  76.  
  77. {            * *   P r o c e d u r e s   * *          }
  78. {_____________________________________________________}
  79.  
  80. Procedure FindEnd;
  81. {________________}
  82. begin
  83.  
  84.   Read(TapeFile,TapeRec);
  85.     NewEnd:=FileSize(TapeFile);
  86.   MaxNumberOfTapes:=NewEnd;
  87.   If NewEnd < 2 Then NewFile:=TRUE;
  88.   If NewEnd >=1 Then NewFile:=FALSE;
  89.  
  90. end; {of FindEnd proc }
  91.  
  92.  
  93.  
  94. {    <<<     Line Print Routines   >>>   }
  95.  
  96. Procedure Feeder;
  97. {________________}
  98. begin
  99. Write(Lst,#12);
  100. end;
  101.  
  102.  
  103. Procedure Print_Out;
  104. {___________________}
  105.  
  106. Begin
  107.  
  108.      with TapeRec do
  109.  
  110.             Write(LSt,
  111.             '        TAPE # ', ItemNumber,': ',Line1,
  112.             ^J,^M,
  113.             '        [',RecordErase,']   ',Line2,
  114.             ^J,^M,
  115.             '        (',Passes,' Passes) ', Line3,
  116.             ^J,^M,
  117.             '        ---------------------------------------------------------',
  118.             ^J,^M);
  119.  
  120.      end;
  121.  
  122.  
  123. Procedure ReadOn;
  124. {______________ }
  125. Var
  126.    Rt: Char;
  127.  
  128. begin
  129. While FilePos(TapeFile) < MaxNumberOfTapes  do
  130.       begin
  131.         Read(TapeFile,TapeRec);
  132.           with TapeRec do
  133.  
  134.           If RecordErase=RE Then
  135.                          begin
  136.                          Print_Out;
  137.                          TapesPrinted:=TapesPrinted+1;
  138.  
  139.           If TapesPrinted= 15 Then
  140.                           begin
  141.                           Feeder;
  142.                           PageNum:=PageNum+1;
  143.                           Write(Lst,^J,^M,
  144.            '         Page ', PageNum,'  ',TTYPE,' Tape Catalogue',  ^J,^J,^M,
  145.  '        ---------------------------------------------------------',
  146.  ^J,^M);
  147.                           TapesPrinted:=0;
  148.                           end;
  149.                     end;
  150.       Pnr:=Pnr+1;
  151.       ReadOn;
  152.     end;
  153. end; {of proc }
  154.  
  155. Procedure PrintMast;
  156. {___________________}
  157. begin
  158.  
  159.      Writeln(Lst);
  160.      Writeln(Lst,'               V i d e o   T a p e    C a t a l o g u e     ');
  161.      Write(Lst,
  162.      ^J,^M,
  163.  
  164.        '                               ',TTYPE,' TAPES                     ',
  165.     ^J,^J,^M,
  166.        '        ---------------------------------------------------------',
  167.      ^J,^M);
  168. end;
  169.  
  170.  
  171. Procedure RunFile;
  172. {_________________}
  173. begin
  174.  
  175. Assign(TapeFile,DiskFileName);
  176.       Reset(TapeFile);
  177.            FindEnd;
  178.               reset(TapeFile);
  179.            ReadOn;
  180.       Close(TapeFile);
  181. end;
  182.  
  183.  
  184. Procedure List_Tapes;
  185. {___________________}
  186. begin
  187.      TapesPrinted:=1;
  188.      PageNum:=1;
  189.      PrintMast;
  190.                RE:='Available';
  191.                RunFile;
  192.                RE:='In Use';
  193.                RunFile;
  194.                Feeder;
  195.      Printed:=TRUE;
  196.  
  197. end;
  198.  
  199.  
  200.  
  201. Procedure LinePrint;
  202. {__________________}
  203.  
  204. label
  205. finish;
  206.  
  207. begin
  208.      Write(' Make a printout?');
  209.              TextColor(blink);     Write(' Y');
  210.              TextColor(black);     Write('/');
  211.                 TextColor(blink);  Write('n');
  212.                 TextColor(black);
  213.      Write('   ',^H,^H,^H,^H,^H);
  214. Repeat
  215. LS:=Readkey;
  216. LS:=UpCase(LS);
  217. Until (LS='Y') or (LS='N');
  218. If LS='N' Then GoTo Finish;
  219.    Printed:=False;
  220.    clrscr;
  221.    Write('Printing');
  222.    List_Tapes;
  223. finish:
  224.  
  225. end;
  226.  
  227.  
  228. {    <<<     Line Print Routines   >>>   }
  229. {                  E n d                 }
  230.  
  231.  
  232.  
  233. Procedure View;
  234. {______________}
  235. Var
  236.    Rt: Char;
  237.    Times: Integer;
  238.  
  239. begin
  240.  
  241.      RE:='Available';
  242.  
  243.                      Assign(TapeFile,DiskFileName);
  244.  
  245.                      Reset(TapeFile);
  246.  
  247.                      FindEnd;
  248.  
  249.                      reset(TapeFile);
  250.  
  251.                                      begin
  252.                                      Times:=1;
  253.                                      ClrScr;
  254.                                      TextColor(Blue);
  255.                     Writeln('   A V A I L A B L E    T A P E S');
  256. TextColor(yellow);
  257. Writeln;
  258. Write(' ');
  259. While FilePos(TapeFile) < MaxNumberOfTapes  do
  260.  
  261.       begin
  262.       Read(TapeFile,TapeRec);
  263.           with TapeRec do
  264.                  If RecordErase=RE Then
  265.  
  266.                                    begin
  267.                                    times:=times+1;
  268.                                    with TapeRec do
  269.                                    Write(ItemNumber,'  ');
  270.                                    If times=10 then
  271.  
  272.                                                begin
  273.                                                write(^J,^M,^J,' ');
  274.                                                times:=1;
  275.                                                end  { No ';' to force else }
  276.                 else
  277.                     Pnr:=Pnr+1;
  278.                                    end;
  279.        end;
  280.        Pnr:=0;
  281.                                      end;
  282.  
  283. Close(TapeFile);
  284.                 begin
  285.                      Writeln;
  286.                        Writeln;
  287.                              TextColor(black);
  288.                              Write('Touch Any Key To Continue');
  289.                      Rt:=Readkey;
  290.                   TextColor(cyan);
  291.                 end;
  292.  
  293. end;
  294.  
  295.  
  296.  
  297. Procedure WipeLine;
  298. {__________________}
  299. Var
  300. Space, BS : Integer;
  301.  
  302. begin
  303.      Space:=0;
  304.      BS:=0;
  305.  
  306. Repeat
  307. Write(' ');
  308. Space:=Space+1
  309. Until Space=65;
  310. Repeat
  311. Write(^H);
  312. BS:=BS+1;
  313. Until BS=65;
  314. end;
  315.  
  316.  
  317.  
  318. Procedure ClearRec;
  319. {__________________}
  320. Begin
  321. With TapeRec do
  322. begin
  323.  
  324. ItemNumber:=Pnr;
  325. RecordErase:='      ';
  326. Passes:=0;
  327. Line1:=' ';
  328. Line2:=' ';
  329. Line3:=' ';
  330. end;
  331. End; {of proc}
  332.  
  333.  
  334.  
  335.  
  336. Procedure RemoveRow;
  337. {____________________}
  338. Var
  339. Space, BS : Integer;
  340.  
  341. Begin
  342.                        BS:=0;
  343.                        Repeat
  344.                          Write(^H);
  345.                          BS:=BS+1;
  346.                        Until BS=64;
  347.  
  348.                        Space:=0;
  349.                        Repeat
  350.                          Write(' ');
  351.                          Space:=Space+1;
  352.                        Until Space=64;
  353.  
  354.                        BS:=0;
  355.                        Repeat
  356.                          Write(^H);
  357.                          BS:=BS+1;
  358.                        Until BS=64;
  359. End;
  360.  
  361.  
  362.  
  363. Procedure Edit_Screen;
  364. {_____________________}
  365. begin
  366. ClrScr;  {Important for Positioning }
  367.        Write(^J);WRite(' ');
  368.        Writeln('     ');
  369.        Writeln;
  370.    { Spray Record On the Screen }
  371.  
  372.  
  373.    With TapeRec do
  374.  
  375.             Write(
  376.             '                          T A P E   # ', ItemNumber,^J,^M,
  377.             ^J,^M,
  378.             ' [ ');
  379.             TextColor(Red);
  380.                      With TapeRec do
  381.                      Write(RecordErase);
  382.             TextColor(blue);
  383.             Write(' ]',^J,^M);
  384.  
  385.             TextColor(black);
  386.                       Write(' Passes: ');
  387.             TextColor(black);
  388.                       With TapeRec do
  389.                       Write(Passes,^J,^M);
  390.  
  391.             Textcolor(blue);
  392.                      With TapeRec do
  393.  
  394. Write('_________________________________________________________________',^m,
  395.       ' ',Line1,^J,^M,
  396.       '_________________________________________________________________',^m,
  397.       ' ',Line2,^J,^M,
  398.       '_________________________________________________________________',^m,
  399.       ' ',Line3,^J,^M,
  400.       ^J,^M);
  401.  
  402. end; {of Edit_Screen Proc.}
  403.  
  404.  
  405.  
  406.  
  407. Procedure Editor;
  408. {_______________}
  409. Label
  410.      Outofhere, Endit, ReTop, EndAll ;
  411.  
  412. Var
  413.     Yn  : Char;
  414.     TryStr, SecStr : String[3];
  415.     int, code, SaveCount : integer;
  416.  
  417. Begin
  418.  
  419. { Edit Tape Availability }
  420.  
  421. ReTop:
  422.  
  423.      With TapeRec do
  424.      Begin
  425.  
  426. Repeat
  427.           GoToXY(1,4);
  428.           RemoveRow;
  429.  
  430. TextColor(blink+black);
  431.           Write('In ');
  432. TextColor(black);
  433.           Write ('U');
  434. TextColor(blink+black);
  435.           Write('se / Make it ');
  436. TextColor(black);
  437.           Write('A');
  438. TextColor(blink+black);
  439.           Write('vailable ');
  440.  
  441.           GoToXY(8,4);
  442.       Xh:=ReadKey;
  443.         Write(' ',^H);
  444.          Xh:=UpCase(Xh);
  445.            Until (Xh='U') or (Xh='A') or (Xh=#13);
  446.  
  447.            If Xh='A' Then
  448.                      Begin
  449.  
  450.                           GoToXY(1,4);
  451.                               RemoveRow;
  452.                                         TextColor(red);
  453.                                                   Write('Erase this Material? ');
  454.                                         TextColor(blink+black);
  455.                                                    write('y');
  456.                                         TextColor(Red);
  457.                                                   write('/');
  458.                                         TextColor(blink+black);
  459.                                                   write('N');
  460.                                         TextColor(black);
  461.                                                   GoToXY(23,4);
  462.                           Repeat
  463.                                 Yn:=ReadKey;
  464.                                 Yn:=UpCase(Yn);
  465.                                 Until (Yn='Y') or (Yn='N');
  466.                                       If Yn='N' Then
  467.  
  468.                                     begin
  469.                                          GoTo ReTop;
  470.                                      end;
  471.                       end;
  472.  
  473.              If Yn='Y' Then
  474.  
  475.                            If Xh= 'A' Then Ed_RecordErase:=True;
  476.                            If (Xh= 'U') or (Xh=#13)
  477.                                         Then Ed_RecordErase:=False;
  478.  
  479.                            If ED_RecordErase= False Then
  480.                                    Begin
  481.                                    GoToXY(1,4);
  482.                                        RemoveRow;
  483.  
  484.                                    RecordErase:='In Use';
  485.                                     TextColor(Red);
  486.                                          Write(' In Use',^M,^J);
  487.                                          end;
  488.  
  489.                            If ED_RecordErase= True Then
  490.                                    Begin
  491.                                    SaveCount:=passes;
  492.                                    ClearRec;
  493.                                        RecordErase:='Available';
  494.                                        GoToXY(1,4);
  495.                                        RemoveRow;
  496.  
  497.                                         TextColor(Blue);
  498.                                                  Write(' Available');
  499.  
  500.                                                  Passes:=SaveCount;
  501.  
  502.                                              Edit_Screen;
  503.                                          GoTo EndIt;
  504.                                   TextColor(blue);
  505.  
  506.                                        end;
  507.  
  508.  
  509.  
  510. begin
  511.  
  512. { Edit Tape Passes }
  513.  
  514. With TapeRec do
  515. passes:=passes;
  516.  
  517. GoToXY(10,5);
  518.        TextColor(blink+black);
  519.                        Write('  ',^H,^H);
  520.                  Write(passes);
  521.                  GoToXY(10,5);
  522.  
  523.                  repeat
  524.                        repeat
  525.                        Kh:=ReadKey;
  526.                  Until (Kh>#47) or (Kh=#13)
  527.                  Until (Kh<#58) or (Kh=#13);
  528.                              If Kh=#13 then
  529.                                 begin
  530.                                      passes:=passes;
  531.                                      TextColor(black);
  532.                                      Write(' ',passes);
  533.                                      Write(^J,^M);
  534.                                      GoTo Outofhere
  535.                                 end;
  536.  
  537.                 Write('  ',^H,^H);
  538.                 TextColor(black);
  539.                           write(Kh);
  540.                           Trystr:=Kh; { push Kh onto Trystr }
  541.  
  542.                           Readln(secstr); {accept secstr (in case more chars)}
  543.                           trystr:=Kh+secstr;
  544.                           val(trystr,int,code);
  545.                           passes:=int;
  546.  
  547. outofhere:
  548.  
  549.           TextColor(blue)
  550.  
  551. end; {Begin}
  552.  
  553.  
  554.  
  555. { Edit Line 1 }
  556.  
  557. Write(' ');
  558. Kh:=#0;
  559. Kh:=ReadKey;
  560. If Kh=#13 then
  561.    begin
  562.      Line1:=Line1;
  563.      Write(^J,^M);
  564.     end;
  565.         If Kh<>#13 then
  566.            begin
  567.           WipeLine;
  568.           Write(Kh);
  569.           Readln(ED_Line1);
  570.                           Line1:=Kh+ED_Line1;
  571.                                            end;
  572.  
  573.  
  574.  
  575. { Edit Line 2 }
  576.  
  577. Write(' ');
  578. Kh:=#0;
  579. Kh:=ReadKey;
  580. If Kh=#13 then
  581.    begin
  582.      Line2:=Line2;
  583.      Write(^J,^M);
  584.     end;
  585.         If Kh<>#13 then
  586.            begin
  587.           WipeLine;
  588.           Write(Kh);
  589.           Readln(ED_Line2);
  590.                           Line2:=Kh+ED_Line2;
  591.                                            end;
  592.  
  593.  
  594.  
  595. { Edit Line 3 }
  596.  
  597. Write(' ');
  598. Kh:=#0;
  599. Kh:=ReadKey;
  600. If Kh=#13 then
  601.    begin
  602.      Line3:=Line3;
  603.      Write(^J,^M,^J);
  604.      GoTo EndAll;
  605.     end;
  606.         If Kh<>#13 then
  607.            begin
  608.           WipeLine;
  609.           Write(Kh);
  610.           Readln(ED_Line3);
  611.                           Line3:=Kh+ED_Line3;
  612.                                            end;
  613.  
  614. Writeln;
  615.  
  616.  
  617.                 ItemNumber:=(Pnr);
  618.  
  619.       end; {of BEGIN for TapeRec do }
  620.  
  621. Endit:
  622.  
  623.       GoToXY(1,12);
  624.  
  625. EndAll:
  626.  
  627. end; {of Editor Procedure}
  628.  
  629.  
  630. FUNCTION FileExists(FileName : FName) : BOOLEAN;
  631. {______________________________________________}
  632. VAR
  633.  f     : FILE;
  634.  fAttr : WORD;
  635.  
  636. BEGIN
  637.  ASSIGN(f, FileName);
  638.  GetFAttr(f, fAttr);
  639.  FileExists := (fAttr <> 0) AND ((fAttr AND Directory) = 0)
  640. END;  { FileExists }
  641.  
  642.  
  643.  
  644.  
  645. procedure Initialize;
  646. {___________________}
  647. const
  648.    MaxNumberOfTapes = 1;
  649.  
  650. begin
  651.   Assign(TapeFile,DiskFileName);
  652.   Rewrite(TapeFile);
  653.   NewFile:=TRUE;
  654. end;
  655.  
  656.  
  657.  
  658. procedure AddRec;
  659. {_______________}
  660. label
  661.  EndIt;
  662. begin
  663.   Reset(TapeFile);
  664.    Seek(TapeFile, FileSize(TapeFile));
  665.     Pnr:=FilePos(TapeFile)+1;
  666.  
  667.  
  668. ClearRec;
  669. Edit_Screen;
  670.  
  671.            If Quit=TRUE Then GoTo Endit
  672.         Else;
  673.  
  674.  
  675.        Editor;
  676.  
  677.  
  678.               Seek(TapeFile, FileSize(TapeFile));
  679.               Write(TapeFile, TapeRec);
  680.  
  681.    EndIt:
  682.                Close(TapeFile);
  683.  
  684.   end; { of AddRec proc. }
  685.  
  686. procedure Page;
  687. {______________}
  688. { Pages through records }
  689. Label
  690.      Endit, EndAll;
  691.  
  692. begin
  693.  
  694. If NewFile=TRUE Then GoTo EndAll;
  695.  
  696. Reset(TapeFile);
  697.    FindEnd;
  698.  
  699.  
  700.        If Up = True Then Pnr:=Pnr+1;
  701.        If (Up = False) and (Pnr >1) Then Pnr:=Pnr-1;
  702.  
  703.  
  704. If Pnr <= 0  Then
  705.                 begin
  706.                    pnr:=0;
  707.                    GoTo EndIt;
  708.                    end;
  709.  
  710. If Pnr > MaxNumberOfTapes Then
  711.                               begin
  712.                                 pnr:=MaxNumberOfTapes;
  713.  
  714.                               end;
  715.  
  716. If Pnr in [1..MaxNumberOfTapes] then
  717.  {If asking for existing record, then:}
  718.  
  719.  
  720.        Begin
  721.             Seek(TapeFile,Pnr-1);
  722.             Read(TapeFile,TapeRec);
  723.  
  724.  
  725. EndIt:
  726.  
  727.         Edit_screen;
  728.  
  729.  
  730.         end;
  731.  
  732. EndAll:
  733. end;{of Page Proc.}
  734.  
  735.  
  736. procedure SelectRec;
  737. {_________________}
  738.  
  739. Label
  740.      EndIt;
  741.  
  742. Var
  743.     Sel : Char;
  744.     TryStr, SecStr : String[3];
  745.     int, code, SavePnr   : integer;
  746.  
  747.  
  748. begin
  749.  
  750.  
  751.      Reset(TapeFile);
  752.         FindEnd;
  753.  
  754.         Repeat
  755.         write(^H);
  756.             RemoveRow;
  757.             TextColor(black);
  758.                  Write('  Select Tape Number ');
  759.                  TextColor(Red);
  760.                  Write('<Q>uit');
  761.                  TextColor(black);
  762.                  Write(' >> ');
  763.  
  764.                        Sel:=ReadKey;
  765.                  Until (Sel>#48) and (Sel<#58)
  766.                                  or (Sel=#0) or (Sel=#13)
  767.                                  or (Sel=#13) or (Sel='Q') or (Sel='q');
  768.                              If (Sel=#13) or (Sel=#0) or (Sel='Q') or (Sel='q')
  769.                              then
  770.                                      GoTo EndIt;
  771.  
  772.                 Write('  ',^H,^H);
  773.  
  774.                           write(Sel);
  775.                           Trystr:=Sel; { push Kh onto Trystr }
  776.  
  777.                           Readln(secstr); {accept secstr (in case more chars)}
  778.                           trystr:=Sel+secstr;
  779.                           val(trystr,int,code);
  780.                           Pnr:=int;
  781.  
  782.  
  783.                TextColor(blue);
  784.        If pnr=0 then GoTo EndIt;
  785.        If Pnr in [0..MaxNumberOfTapes] Then
  786.  
  787.        Begin
  788.             Seek(TapeFile,Pnr-1);
  789.              Read(TapeFile,TapeRec);
  790.             Edit_screen;
  791.  
  792. Endit:
  793.  
  794.           Close(TapeFile);
  795.  
  796.         end; {<new}
  797.  
  798. end; { of Select proc. }
  799.  
  800.  
  801.  
  802. procedure EditRec;
  803. {_________________}
  804.  
  805. Label
  806.      EndIt;
  807.  
  808. begin
  809.  
  810.  
  811.      If Pnr=0 Then GoTo EndIt;
  812.  
  813.      If Pnr < 1 Then
  814.                 begin
  815.                 Edit_Screen;
  816.                 GoTo EndIt;
  817.                 end;
  818.  
  819.      If Pnr >0 Then
  820.      begin
  821.  
  822.       Reset(TapeFile);
  823.                FindEnd;
  824.  
  825.  
  826.     Seek(TapeFile,Pnr-1);
  827.  
  828.     Read(TapeFile,TapeRec);
  829.  
  830.  
  831.     If Quit=TRUE Then GoTo Endit
  832.     Else;
  833.  
  834.     Editor;
  835.  
  836.         Seek(TapeFile,Pnr-1);
  837.          Write(TapeFile,TapeRec);
  838.           Edit_Screen;
  839.           Close(TapeFile);
  840. Endit:
  841.      end; {>begin}
  842.      If (Pnr=0) and (Quit=FALSE) and  (Eh='E') and  (NewFile=TRUE)
  843.  
  844.        Then AddRec;
  845.        NewFile:=FALSE;
  846. end; { of EditData proc. }
  847.  
  848.  
  849.  
  850. Procedure EditMenu;
  851. {_________________}
  852.  
  853. Label
  854. Stop, KeyPad;
  855.  
  856.  
  857. begin
  858. repeat
  859.     RemoveRow;
  860. GoToXY(1,12);
  861.   RemoveRow;
  862.   TextColor(Magenta);
  863. Write('<PgUp> Forward,');
  864.   TextColor(brown);
  865. Write('<PgDn> Reverse,');
  866.   TextColor(black);
  867. Write(' <A>dd, <E>dit, <S>elect #, <Q>uit  ',^H);
  868. TextColor(blue);
  869.  
  870. Eh:=ReadKey;
  871.  
  872. Write(' ',^H);
  873.  
  874.  
  875. If Eh=#0 Then GoTo KeyPad;
  876.  
  877. If EH <> #0 then
  878.                 FuncKey := False;
  879.  
  880.                 Eh:=UpCase(Eh);
  881.                 Until (Eh in ['A','E','S','Q']);
  882.  
  883. Case Eh of
  884.              'A' : AddRec;
  885.              'E' : EditRec; {This will become Edit THIS tape}
  886.              'S' : SelectRec;  {Select a tape to edit}
  887.              'Q' : GoTo Stop;
  888.                 end;
  889.  
  890.  
  891. KeyPad:
  892.  
  893.  
  894.  If Eh = #0 then
  895.                begin
  896.                FuncKey :=True;
  897.                        While FuncKey = True do
  898.                        begin
  899.                        Eh:=Readkey;
  900.  
  901.                             { <PageUp>  }
  902.                  If  Eh = #73 Then
  903.                               begin
  904.                             Up:=TRUE;
  905.                               Page;
  906.                               Eh:=#0;
  907.                               FuncKey :=False;
  908.                               Eh:='X';
  909.  
  910.                               GoTo Stop;
  911.                               end;
  912.  
  913.                               { <PageDn>  }
  914.                  If  Eh = #81 Then
  915.                               begin
  916.                            Up:=FALSE;
  917.                            Page;
  918.                            Eh:=#0;
  919.                               FuncKey :=False;
  920.                               Eh:='X';
  921.                               pnr:=pnr;
  922.                               end;
  923. stop:
  924.  
  925.                      end; {do}
  926.  
  927.  
  928.    end;
  929. end;
  930.  
  931.  
  932.  
  933. Procedure Edit_Mode;
  934. {__________________}
  935. begin
  936. ClrScr;
  937.  
  938.    begin
  939.  
  940.    Edit_Screen;
  941.    end;
  942.      Repeat
  943.      Quit:=FALSE;
  944.  
  945.      EditMenu;
  946. Until Eh='Q';
  947.  
  948. Clrscr;
  949. end;
  950.  
  951.  
  952.  
  953. Procedure MenuWindow;
  954. {____________________}
  955. begin
  956.      Window(18,5,57,21);
  957.  
  958. TextBackground(blue);
  959. TextColor(Yellow);
  960.  
  961. end;
  962.  
  963.  
  964. procedure NewCheck;
  965. {__________________}
  966. begin
  967.  
  968.  
  969.    Assign(TapeFile, DiskFileName);
  970.      If Not FileExists(DiskFileName) Then
  971.                                        Initialize;
  972.  
  973.  
  974.    If NewFile=FALSE Then
  975.    begin
  976.    pnr:=0;
  977.    ClearRec;
  978.    Edit_Mode;
  979.    end;
  980.  
  981.      If NewFile=TRUE
  982.        Then
  983.            begin
  984.            AddRec;
  985.            NewFile:=FALSE;
  986.            Pnr:=1;
  987.            Edit_Mode;
  988.  
  989.            end;
  990.  
  991.  
  992. end;
  993.  
  994.  
  995. Procedure EditWindow;
  996. {____________________}
  997. {+++ set editor window +++}
  998. begin
  999.  
  1000.  Window(6,8,72,17);
  1001. clrscr;
  1002. TextAttr:=white;
  1003. LowVideo;
  1004. TextBackground(lightgray);
  1005. TextColor(blue);
  1006.  
  1007. end;
  1008.  
  1009.  
  1010. Procedure Edit_Add;
  1011. {_________________}
  1012.  
  1013. begin
  1014.  
  1015. EditWindow;
  1016.  
  1017. NewCheck;
  1018.  
  1019. TextBackground(black);
  1020.  clrscr;
  1021. {   ***  Go back to Menu window  *** }
  1022. MenuWindow;
  1023. end;
  1024.  
  1025.  
  1026. Procedure Print_Mode;
  1027. {____________________}
  1028. begin
  1029. TextBackground(White);
  1030. TextColor(black);
  1031.      Window(26,13,50,13);
  1032.  
  1033. LinePrint;
  1034.  
  1035. TextBackground(blue);
  1036. TextColor(yellow);
  1037.  clrscr;
  1038.         MenuWindow;
  1039.  
  1040. end;
  1041.  
  1042.  
  1043. Procedure View_Vids;
  1044. {____________________}
  1045. begin
  1046.  
  1047. TextBackground(Magenta);
  1048.      Window(16,2,53,19);
  1049.  
  1050. View;
  1051.  
  1052. TextBackground(black);
  1053.  clrscr;
  1054. {   ***  Go back to Menu window  *** }
  1055. MenuWindow;
  1056.  
  1057. end;
  1058.  
  1059.  
  1060. Procedure Copyright;
  1061. {____________________}
  1062.  
  1063. begin
  1064. TextColor(Blue);
  1065. Writeln('                             R E V O L V E R');
  1066. Writeln('                                 Ver. 1.0');
  1067. Writeln('                        Copyright D. Brown, 1988');
  1068. TextColor(cyan);
  1069. writeln;
  1070.  
  1071. end;
  1072.  
  1073.  
  1074. Procedure TopPiece;
  1075. {__________________}
  1076. Begin
  1077. Writeln(' ╔════════════════════════════════════╗');
  1078.   Write(' ║');
  1079. Write('   File Open: ');
  1080.   Write(DiskFileName:9);
  1081.                         Writeln('             ║');
  1082. Writeln(' ╟────────────────────────────────────╢');
  1083. Writeln(' ║                                    ║');
  1084. Writeln(' ╟────────────────────────────────────╢');
  1085. Writeln(' ║                                    ║');
  1086. Writeln(' ║      E. Edit / Add / Browse        ║');
  1087. Writeln(' ║                                    ║');
  1088. Writeln(' ║      P. Print Tape Catalog         ║');
  1089. Writeln(' ║                                    ║');
  1090. Writeln(' ║      A. Available Tapes            ║');
  1091. Writeln(' ║                                    ║');
  1092. Writeln(' ║      C. Change Disk File           ║');
  1093. Writeln(' ║                                    ║');
  1094. Writeln(' ║      Q. Quit Program               ║');
  1095. Writeln(' ║                                    ║');
  1096. Write(' ╚════════════════════════════════════╝');
  1097.  
  1098. end;
  1099.  
  1100. Procedure Pick_One;
  1101. {__________________}
  1102.  
  1103. var
  1104. finish : boolean;
  1105.  
  1106.  
  1107. Begin
  1108.  
  1109. Finish:=FALSE;
  1110.    while not finish do
  1111.    begin
  1112.      Clrscr;
  1113.        TopPiece;
  1114.         GoToXY(5,4);
  1115.  
  1116.  Write('Select Tape (BETA or VHS) >  ');
  1117.  
  1118.   begin
  1119.         Repeat
  1120.          Write('_'^H);
  1121.           TT:=Readkey;
  1122.           TT:=UpCase(TT);
  1123.           Until (TT='B') Or (TT='V');
  1124.                 Finish:=TRUE;
  1125.           If TT='B' Then TTYPE:='BETA';
  1126.           If TT='V' Then TTYPE:='VHS';
  1127.  
  1128.    end;
  1129.  
  1130.     If TTYPE='BETA' Then DiskFileName:='BETA.DTA';
  1131.     If TTYPE='VHS' Then DiskFileName:='VHS.DTA';
  1132.   end;
  1133. end;
  1134.  
  1135.  
  1136.  
  1137. procedure Menu;
  1138. {_____________}
  1139.  
  1140. begin
  1141.  
  1142.    while not done do
  1143.    begin
  1144.      Clrscr;
  1145.        TopPiece;
  1146.          GoToXY(5,4);
  1147.  
  1148. Write('Select Menu Option > ');
  1149.  begin
  1150.        Repeat
  1151.          Write('_'^H);
  1152.          X:=Readkey;
  1153.           MM:=Upcase(X);
  1154.        Until (MM in ['E','P','A','Q','C']);
  1155.   end;
  1156.  
  1157. Case MM of
  1158. 'E' :  Edit_Add;
  1159. 'P' :  Print_Mode;
  1160. 'A' :  View_Vids;
  1161. 'C' :  Pick_One;
  1162. 'Q' :  done := true;
  1163. end;
  1164.  
  1165.   end;
  1166. end; {Of MAIN_Menu Proc.}
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173. {               * *   M a i n   * *              }
  1174.  
  1175.  
  1176.  
  1177. begin
  1178.  
  1179.  
  1180. { Set Default Values }
  1181. {--------------------}
  1182. NewFile:=FALSE;
  1183. Pnr:=0;
  1184. MM:=' ';
  1185. X:=' ';
  1186. DiskFileName:='NONE';
  1187. TextColor(cyan);
  1188. Done:=False;
  1189. {--------------------}
  1190. ClrScr;
  1191.        Copyright;
  1192.                  MenuWindow;
  1193.                             TopPiece;
  1194.                                      Pick_One;
  1195.                                      clrscr;
  1196.                                      menu;
  1197.  
  1198.    { Exit }
  1199. { Default Window }
  1200.   Window(1,1,80,25);
  1201. TextMode(C80);
  1202. ClrScr;
  1203. end.
  1204.  
  1205.