home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / JMICK11.ZIP / MICKEY11.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-12-20  |  33.1 KB  |  755 lines

  1. program MickeyMouseV1p1;
  2. {
  3.    TSR utility, much in the same vein as DR and QD, except...
  4.    1) Full Mouse Control (almost)
  5.    2) Ease of use
  6.    3) ShareWare (but with no anoying screen)
  7.    4) Reliable (Not so with other versions)
  8.  
  9.    AUTHOR: Jovo J. Filipovich of "Jovosys Software Engineering"
  10.    DATE History : Version 1.0 Started November 8, 1989
  11.                     -- Basic Operations done and screen manipulation
  12.                        done to the point where execute was to work
  13.                        Never Finished due to midstream modifications
  14.                   Version 1.1 Started November 13, 1989
  15.                     -- Screen Menu Modified, now easier to use.
  16.                        "Execute" mouse option implemented.
  17.                        "Scroll Up" and "Scroll Down" bars were enlarged
  18.                        so mouse need not be in a particular row.
  19.                        Options for printing (port/Page length) were moved
  20.                        to "Print" (Right Button).  Right Button on mouse
  21.                        now pulls up an option window on certain commands.
  22.  
  23. }
  24.  
  25. Uses Crt,Dos,Mouse,Unread,WritBox,InterWin;
  26.  
  27. {$I MICKEY11.INC}
  28.  
  29. CONST
  30.   FILE_ROW_START = 5;
  31.   FILE_ROW_END   = 21;
  32.   FILE_COL_START = 1;
  33.   FILE_COL_END   = 54;
  34.   MAX_FILES_SHOW = 17;
  35.   RMENU_SIZE     = 17;
  36.   RMENU : array [1..RMENU_SIZE] of StringVar = (
  37.           '╔══════════╦═════════╗',
  38.           '║   Home   ║   End   ║',
  39.           '╠══════════╬═════════╣',
  40.           '║   Copy   ║   Move  ║',
  41.           '╠══════════╬═════════╣',
  42.           '║  Delete  ║  Rename ║',
  43.           '╠══════════╬═════════╣',
  44.           '║  Print   ║   View  ║',
  45.           '╠══════════╬═════════╣',
  46.           '║ Rem DIR  ║Make DIR ║',
  47.           '╠══════════╬═════════╣',
  48.           '║ New Path ║Chg. Attr║',
  49.           '╠══════════╬═════════╣',
  50.           '║ Mark ALL ║ Execute ║',
  51.           '╠══════════╬═════════╣',
  52.           '║   EXIT   ║   QUIT  ║',
  53.           '╚══════════╩═════════╝');
  54.   SHRM_SIZE = 5;
  55.   SHRM : array [1..SHRM_SIZE] of StringVar = (
  56.           '┌────────────────────┐',
  57.           '│Left  = SELECT  /LIN│',
  58.           '│Right = UNSELECT/PG │',
  59.           '│#891311MKYV110N00167│',
  60.           '└────────────────────┘');
  61.   SCRDN_SIZE = 3;
  62.   SCRDN : array [1..SCRDN_SIZE] of StringVar = (
  63.           '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░',
  64.           '░░░░░░░░░░░░░░░░░░░░░ Scroll Down ░░░░░░░░░░░░░░░░░░░░░░',
  65.           '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░');
  66.   SCRUP_SIZE = 3;
  67.   SCRUP : array [1..SCRUP_SIZE] of StringVar = (
  68.           '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░',
  69.           '░░░░░░░░░░░░░░░░░░░░░ Scroll Up ░░░░░░░░░░░░░░░░░░░░░░░░',
  70.           '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░');
  71.   OTHER_SIZE = 3;
  72.   OTHER : array [1..OTHER_SIZE] of StringVar = (
  73.                       'Marked Information -',
  74.                       '  Files:',
  75.                       '  Bytes:');
  76.   LINF01 = 'DIR= ';
  77.   LINF02 = ' Files';
  78.   LINF03 = ' bytes free';
  79.  
  80. TYPE
  81.   FileType = (Normal,Dir,RdOnly,SysF,Arc); { Types of Files }
  82.   FileLineRec = RECORD
  83.       FileName : String[12];                       { 11 Byte File Name with . }
  84.       Filler_1 : String[3];                                   { Blank Portion }
  85.       FileSize : String[8];                 { Converted from numeric or <DIR> }
  86.       Filler_2 : String[3];                                          { Spaces }
  87.       FileDate : String[8];                                        { MM/DD/YY }
  88.       Filler_3 : String[3];                                          { Spaces }
  89.       FileTime : String[7];                                    { HH:MM[pm/am] }
  90.       Filler_4 : String[2];                                          { Spaces }
  91.       FileMark : String[1];                                    { a '*' or ' ' }
  92.       Filler_5 : String[3];                                          { Spaces }
  93.       FileAttr : String[4];                                    { HRSA or .... }
  94.       Marked   : Boolean;                                    { True If marked }
  95.       Dentry   : Boolean;                                 { True If Directory }
  96.       Executable : Boolean;                  { True IF EXE or BAT or COM file }
  97.   End;
  98.   FileLineStruc = Array [1..256] Of FileLineRec;
  99.   PieceStr = String[2]; { Used in conversions }
  100.   Mcmd = (Home_View,   End_View,    Execute_File,     Mark_All_Files,
  101.           Exit_Mickey, Quit_Mickey, Copy_File,        Move_File,
  102.           Delete_File, Rename_File, New_Path,         Chg_Attr,
  103.           Print_File,  View_File,   Remove_Dir,       Make_Dir,
  104.           Scroll_Up,   Scroll_Down, Select_File,      No_Command);
  105.  
  106.  
  107. VAR
  108.   BytesFree        : LongInt;         { Number of bytes free on current Drive }
  109.   FileCount        : Integer;                          { Total Count Of Files }
  110.   WindowOffset     : Integer;                 { Offset from first viewed file }
  111.   CurrDir          : StringVar;                      { Current Directory Path }
  112.   TotalFilesMarked : Integer;                        { Number of marked Files }
  113.   TotalBytesMarked : LongInt;              { Number of bytes the marked files }
  114.   Files            : FileLineStruc;
  115.   OriginalDir      : StringVar;                 { Starting Directory on entry }
  116.   Srow, Scol       : Word;
  117.   ExecutableName   : StringVar;        { Expected to be initialized upon EXEC }
  118.   FinalCommand     : Mcmd;
  119.   Junk             : Integer;
  120.   OldTextAttr      : Byte;
  121.  
  122.  
  123. Function NumToStr(Indx : BYTE) : PieceStr;
  124.   Begin
  125.     NumToStr := chr((Indx div 10) or $30) + chr((Indx mod 10) or $30);
  126.   End;
  127.  
  128.  
  129. Procedure ShowScreen(VAR BytesFree,MarkedBytes:LongInt; VAR CurrDir:StringVar;
  130.                      VAR MarkedFiles : Integer);
  131.   Procedure ShowMenus;
  132.     Var CurrAttr : Byte;
  133.     Begin { ShowMenus }
  134.       ClrScr; { Clear the screen }
  135.       CurrAttr := TextAttr;
  136.       TextColor(LightGray);
  137.       WriteBox(RMENU,RMENU_SIZE,1,58);
  138.       TextColor(DarkGray);
  139.       WriteBox(SHRM,SHRM_SIZE,21,58);
  140.       TextColor(Red);
  141.       WriteBox(OTHER,OTHER_SIZE,18,58);
  142.       TextColor(Brown);
  143.       WriteBox(SCRUP,SCRUP_SIZE,2,1);
  144.       WriteBox(SCRDN,SCRDN_SIZE,22,1);
  145.       TextAttr := CurrAttr;
  146.     End; { ShowMenus }
  147.  
  148.   Begin { ShowScreen }
  149.     BytesFree := DiskFree(0);           { Get the Bytes free of current drive }
  150.     GetDir(0,CurrDir);                            { Get the Current Directory }
  151.     MarkedFiles := 0;
  152.     MarkedBytes := 0;
  153.     ShowMenus;
  154.     GotoXY(1,1);   Write(LINF01);   Write(CurrDir);  { Show Current Directory }
  155.     GotoXY(66,19); Write(MarkedFiles:14);       { Show Number of Marked Files }
  156.     GotoXY(66,20); Write(MarkedBytes:14);   { Show The Number of marked Bytes }
  157.     GotoXY(28,25); Write(BytesFree:10,LINF03);{ Show Number of bytes available}
  158.   End; { ShowScreen }
  159.  
  160.  
  161.  
  162. Procedure BuildFileList(Path : StringVar; VAR FileList : FileLineStruc;
  163.                         VAR FileCount : Integer);
  164.   Var
  165.     Srec        : SearchRec;                                   { Seach Record }
  166.     Dtrec       : DateTime;                                { Date/Time record }
  167.     Attr        : Word;
  168.     Indx,I2,I3  : Integer;
  169.     Ppos,ToFill : Word;
  170.     YrS         : PieceStr;
  171.     Ext         : StringVar;                          { Used to see extention }
  172.  
  173.  
  174.   Begin
  175.     For Indx := 1 to 256 do
  176.         With FileList[Indx] do
  177.           begin
  178.             FileName := '            ';    Filler_1 := '   ';
  179.             FileSize := '';
  180.             Filler_2 := '   '; FileDate := '00-00-00';
  181.             Filler_3 := '   '; FileTime := '00:00pm';    Filler_4 := '  ';
  182.             FileMark := ' ';   Filler_5 := '   '; FileAttr := '....';
  183.             Marked := False;   Dentry := False;   Executable := False;
  184.           end; { With/FOR }
  185.     Indx := 0;
  186.     Attr := AnyFile; { $3f }
  187.     If (Path[Length(Path)] <> '\')
  188.        Then Path := Path + '\*.*'
  189.        Else Path := Path + '*.*';
  190.     FindFirst(Path,Attr,Srec);
  191.     While DosError = 0 do
  192.       begin
  193.         Inc(Indx);
  194.         If ((Srec.Attr AND VolumeID) <> VolumeID) THEN
  195.         With Srec do
  196.           begin
  197.             If (Name <> '.') AND
  198.                (Name <> '..') AND
  199.                ((Attr AND Directory) <> Directory) AND
  200.                ((Attr AND VolumeID) <> VolumeID)
  201.               Then begin
  202.                      Ppos := Pos('.',Name);
  203.                      FileList[Indx].FileName[9] := '.';
  204.                      If (Ppos > 0) { Ckeck for period }
  205.                        then begin
  206.                               For I2 := 1 to Ppos-1 do
  207.                                 FileList[Indx].FileName[I2] := Name[I2];
  208.                               I3 := 10;
  209.                               For I2 := Ppos+1 to Length(Name) do
  210.                                 begin
  211.                                   FileList[Indx].FileName[I3] := Name[I2];
  212.                                   Inc(I3);
  213.                                 end;
  214.                               Ext := '';
  215.                               Ext := Copy(Name,Ppos+1,Length(Name)-Ppos);
  216.                               If (Ext = 'EXE') OR (Ext = 'COM') or (Ext = 'BAT')
  217.                                 Then FileList[Indx].Executable := TRUE;
  218.                             end
  219.                        else For I2 := 1 to Length(Name) { No extention }
  220.                          do FileList[Indx].FileName[I2] := Name[I2];
  221.                      Str(Size:8,FileList[Indx].FileSize);
  222.                    end
  223.               Else begin
  224.                      For I2 := 1 to Length(Name) do
  225.                        FileList[Indx].FileName[I2] := Name[I2];
  226.                      FileList[Indx].FileSize := '   <DIR>';
  227.                      FileList[Indx].Dentry := TRUE;
  228.                    end; { Else }
  229.             If ((Attr AND Hidden)   = Hidden)   Then FileList[Indx].FileAttr[1] := 'H';
  230.             If ((Attr AND ReadOnly) = ReadOnly) Then FileList[Indx].FileAttr[2] := 'R';
  231.             If ((Attr AND SysFile)  = SysFile)  Then FileList[Indx].FileAttr[3] := 'S';
  232.             If ((Attr AND Archive)  = Archive)  Then FileList[Indx].FileAttr[4] := 'A';
  233.             UnpackTime(Time,DtRec);          { Unpack the passed time of file }
  234.             DtRec.Year := DtRec.Year - 1900;
  235.             Str(DtRec.Year,YrS);
  236.             FileList[Indx].FileDate := NumToStr(DtRec.Month) + '-' +
  237.                                        NumToStr(DtRec.Day)   + '-' +
  238.                                        Yrs;
  239.             YrS := '';  { For Next Section }
  240.             If DtRec.Hour >= 12
  241.               Then begin
  242.                      YrS := 'pm';                            { Set this to Pm }
  243.                      If DtRec.Hour > 12 Then DtRec.Hour := DtRec.Hour - 12;
  244.                    end { Then }
  245.               Else begin
  246.                      YrS := 'am';
  247.                      If DtRec.Hour = 0 Then DtRec.Hour := DtRec.Hour + 12;
  248.                    end; { Else and If }
  249.             FileList[Indx].FileTime := NumToStr(DtRec.Hour) + ':' +
  250.                                        NumToStr(DtRec.Min)  + YrS;
  251.           End { With }
  252.           Else Dec(Indx);                                    { Skip Volume ID }
  253.         FindNext(Srec);
  254.       end; { while }
  255.     FileCount := Indx;
  256.   End; { Build File List }
  257.  
  258.  
  259.  
  260. Procedure ShowFiles(VAR Files:FileLineStruc; Start, FileCount:Integer;
  261.                     StartRow, StartCol : Integer);
  262.   Var
  263.     CurrRow,CurrCol,Indx : Integer;
  264.   Begin
  265.     CurrRow := StartRow; CurrCol := StartCol;
  266.     Indx := Start;
  267.     While (CurrRow <= FILE_ROW_END) AND (Indx <= FileCount) do
  268.       begin
  269.         GotoXY(CurrCol,CurrRow);
  270.         With Files[Indx] do
  271.             Write(FileName,Filler_1,FileSize,Filler_2,
  272.                   FileDate,Filler_3,FileTime,Filler_4,
  273.                   FileMark,Filler_5,FileAttr);
  274.         Inc(Indx);
  275.         Inc(CurrRow);
  276.       end;
  277.     GotoXY(15,25);
  278.     Write(FileCount:4,' Files');
  279.     WindowOffset := Start - 1;
  280.   end;
  281.  
  282.  
  283.  
  284. Function UserCommand(Row,Col : Word) : Mcmd;
  285. { Returns the command at given location }
  286.   Begin
  287.     Case Col of
  288.       1..56  : Case Row of
  289.                  FILE_ROW_START..FILE_ROW_END : UserCommand := Select_File;
  290.                  2..4                         : UserCommand := Scroll_Up;
  291.                  22..24                       : UserCommand := Scroll_Down;
  292.                else UserCommand := No_Command;
  293.                end; { case row }
  294.       59..68 : Case Row of
  295.                  2  : UserCommand := Home_View;
  296.                  4  : UserCommand := Copy_File;
  297.                  6  : UserCommand := Delete_File;
  298.                  8  : UserCommand := Print_File;
  299.                  10 : UserCommand := Remove_Dir;
  300.                  12 : UserCommand := New_Path;
  301.                  14 : UserCommand := Mark_All_Files;
  302.                  16 : UserCommand := Exit_Mickey;
  303.                else UserCommand := No_Command;
  304.                end; { Case Row }
  305.       70..78 : Case Row Of
  306.                  2  : UserCommand := End_View;
  307.                  4  : UserCommand := Move_File;
  308.                  6  : UserCommand := Rename_File;
  309.                  8  : UserCommand := View_File;
  310.                  10 : UserCommand := Make_Dir;
  311.                  12 : UserCommand := Chg_Attr;
  312.                  14 : UserCommand := Execute_File;
  313.                  16 : UserCommand := Quit_Mickey;
  314.                else UserCommand := No_Command;
  315.                end; { Case Row }
  316.     Else UserCommand := No_Command;
  317.     End; { Case }
  318.   End;  { UserCommand }
  319.  
  320.  
  321. Procedure QualifyCommand(VAR Cmd : Mcmd; Row : Word;
  322.                          VAR Reason : StringVar);
  323. { Note return of index only when applicable (files)
  324.   There are certain conditions that must be met with certain commands
  325.   This Procedure Does Not Execute the commands, simply checks conditions }
  326. Var Temp : Integer;
  327.  
  328.    Begin
  329.      Reason := 'Invalid Selection Area';
  330.      Case Cmd of
  331.        Copy_File, Move_File, Delete_File,
  332.        Chg_Attr, Print_File
  333.                      : If (TotalFilesMarked < 1)
  334.                           Then Begin
  335.                                  Cmd := No_Command;      { At least one file }
  336.                                  Reason := 'At lease one file must be marked';
  337.                                end;
  338.        Rename_File, View_File
  339.                      : If (TotalFilesMarked <> 1)
  340.                           Then Begin
  341.                                  Cmd := No_Command;          { ONLY one file }
  342.                                  Reason := 'Only one marked file allowed';
  343.                                end;
  344.        Select_File   : If (Files[Row-FILE_ROW_START+WindowOffset+1].FileName[1]
  345.                                                 = ' ') { Blank }
  346.                           Then begin
  347.                                  Cmd := No_Command;
  348.                                  Reason := 'No file located there';
  349.                                end;
  350.        Execute_File  : If (TotalFilesMarked <> 1)
  351.                          Then begin
  352.                                 Cmd := No_Command;      { Must be executable }
  353.                                 Reason := 'Requires one file for execution';
  354.                               end
  355.                          Else begin
  356.                                 Temp := 1;
  357.                                 While NOT Files[Temp].Marked do Inc(Temp);
  358.                                 If NOT Files[Temp].Executable
  359.                                   Then begin
  360.                                          Cmd := No_Command;
  361.                                          Reason := 'File marked is not executable';
  362.                                        end;
  363.                               end;
  364.      end; { Case }
  365.    End;
  366.  
  367.  
  368. Procedure FwindowScroll(Direction : Integer);
  369.   { +1 = File names up -- make room for new file name at bottom
  370.     -1 = File names down -- make room at top for new file }
  371.   Var
  372.     RegPack : Registers;
  373.   Begin
  374.     RegPack.BX := $0700; { Screen Attribute }
  375.     RegPack.CX := (FILE_ROW_START-1) * 256 + 0;      { Upper Row/ Left Column }
  376.     RegPack.DX := (FILE_ROW_END-1) * 256 + FILE_COL_END-1;              { LRC }
  377.     If (Direction > 0)
  378.       Then RegPack.AX := $0601
  379.       Else RegPack.AX := $0701;
  380.     Intr($10,RegPack);                       { Call The BIOS routine to do it }
  381.   End; { FwindowScroll }
  382.  
  383.  
  384. Function UnParse(E : StringVar) : StringVar;
  385.   { Turns 'HELLO   .PAS' into 'HELLO.PAS' }
  386.   Var
  387.     Indx,Junk : Byte;
  388.     Temp      : StringVar;
  389.   Begin
  390.     Indx := Pos(' ',E);  { Find This }
  391.     If (Indx > 8) OR (Indx = 0)
  392.       then Unparse := Copy(E,1,Length(E))   { The full name filled }
  393.       else if (E[10] = ' ')
  394.              then Unparse := Copy(E,1,Indx-1) { No extension }
  395.              else begin
  396.                     Temp := Copy(E,9,4);  { Get the extention with '.' }
  397.                     Junk := Pos(' ',Temp);
  398.                     If (Junk = 0) Then Junk := 5;
  399.                     UnParse := Copy(E,1,Indx-1) + Copy(Temp,1,Junk-1);
  400.                   end;
  401.   End; { Unparse }
  402.  
  403.  
  404.  
  405. Procedure ExecuteCmd(Cmd : Mcmd; Row,Col : Word; ButtonPress : MouseButtons);
  406.   Var
  407.     OldRow, OldCol : Word;
  408.     Indx,Junk,Junk2: Integer;
  409.     Nbytes         : LongInt;
  410.     DirExtract     : StringVar;
  411.     JunkFile       : file;  { any type of file }
  412.   Begin
  413.     OldRow := Row;
  414.     OldCol := Col;
  415.     Case Cmd of
  416.       Delete_File :
  417.         begin
  418.           If (YnErrorWindow('Delete All Marked Files?'))
  419.             then begin
  420.                    Junk := TotalFilesMarked;
  421.                    Indx := 1;
  422.                    While (Junk <> 0) do
  423.                      begin
  424.                        While (Not (Files[Indx].Marked)) do Inc(Indx);
  425.                        DirExtract := UnParse(Files[Indx].FileName); { Do this }
  426.                        Assign(JunkFile,DirExtract);
  427.                        Erase(JunkFile);
  428.                        Dec(Junk);
  429.                        Inc(Indx);
  430.                      end;
  431.                    ShowScreen(BytesFree,TotalBytesMarked,CurrDir,TotalFilesMarked);
  432.                    BuildFileList(CurrDir,Files,FileCount);         { Remake }
  433.                    ShowFiles(Files,1,FileCount,FILE_ROW_START,FILE_COL_START);
  434.                  end;
  435.         end;
  436.       Select_File :
  437.         begin
  438.           Indx := Row - FILE_ROW_START + WindowOffset + 1;  { Make File Index }
  439.           If (Files[Indx].Dentry) AND (ButtonPress = RightPressed)
  440.                { If it is a directory, switch screen }
  441.             Then begin
  442.                    TotalFilesMarked := 0;
  443.                    TotalBytesMarked := 0; {Reset}
  444.                    Junk := Pos(' ',Files[Indx].FileName);        { Find Space }
  445.                    DirExtract := Copy(Files[Indx].FileName,1,Junk-1);
  446.                    ChDir(DirExtract); { Change it }
  447.                    ShowScreen(BytesFree,TotalBytesMarked,CurrDir,TotalFilesMarked);
  448.                    BuildFileList(CurrDir,Files,FileCount);           { Remake }
  449.                    ShowFiles(Files,1,FileCount,FILE_ROW_START,FILE_COL_START);
  450.                  end;
  451.           If (ButtonPress = LeftPressed)
  452.            Then begin  { Mark an unmarked file }
  453.                   If NOT(Files[Indx].Marked OR Files[Indx].Dentry)
  454.                     then begin
  455.                            Files[Indx].FileMark := '*';             { Mark it }
  456.                            GotoXY(47,Row); Write('*');
  457.                            Files[Indx].Marked := TRUE;
  458.                            Inc(TotalFilesMarked);
  459.                            Val(Files[Indx].FileSize,Nbytes,Junk);
  460.                            Inc(TotalBytesMarked,Nbytes);
  461.                          end;
  462.                 end
  463.            Else begin { Unmark a marked file }
  464.                   If (Files[Indx].Marked) AND (NOT Files[Indx].Dentry)
  465.                     then begin
  466.                            Files[Indx].FileMark := ' ';           { Unmark it }
  467.                            GotoXY(47,Row); Write(' ');
  468.                            Files[Indx].Marked := FALSE;
  469.                            Dec(TotalFilesMarked);
  470.                            Val(Files[Indx].FileSize,Nbytes,Junk);
  471.                            Dec(TotalBytesMarked,Nbytes);
  472.                          end;
  473.                 End; { else }
  474.         end;    { Select_File }
  475.       Scroll_Up :  { Left Button = Scroll 1 up, Right Button = Scroll Page Up }
  476.         begin
  477.           If (WindowOffset > 0)  { If it is 0, then no scrolling required }
  478.             then case ButtonPress of
  479.                    LeftPressed :
  480.                      begin
  481.                        FwindowScroll(-1);{Scroll the Files window down actual }
  482.                        Dec(WindowOffset);
  483.                        GotoXY(FILE_COL_START,FILE_ROW_START);
  484.                        Indx := WindowOffset + 1;
  485.                        With Files[Indx] do
  486.                          Write(FileName,Filler_1,FileSize,Filler_2,
  487.                                FileDate,Filler_3,FileTime,Filler_4,
  488.                                FileMark,Filler_5,FileAttr);
  489.                        GotoXY(OldCol,OldRow);
  490.                      end; { Case Left Pressed }
  491.                    RightPressed :
  492.                      begin   { Simply sroll up X number of times }
  493.                        For Indx := 1 to MAX_FILES_SHOW-1 do
  494.                          ExecuteCmd(Scroll_Up,Row,Col,LeftPressed);
  495.                      end;
  496.                  end; { Case -- If then }
  497.         end; { Case Scroll Up }
  498.       Scroll_Down :
  499.         begin
  500.           If ((WindowOffset+MAX_FILES_SHOW) < FileCount)
  501.                          { Max Number of files display }
  502.             then Case ButtonPress of
  503.                    LeftPressed :
  504.                      begin
  505.                        FwindowScroll(1);
  506.                        Inc(WindowOffset);
  507.                        GotoXY(FILE_COL_START,FILE_ROW_END);
  508.                        Indx := WindowOffset + MAX_FILES_SHOW;
  509.                        With Files[Indx] do
  510.                          Write(FileName,Filler_1,FileSize,Filler_2,
  511.                                FileDate,Filler_3,FileTime,Filler_4,
  512.                                FileMark,Filler_5,FileAttr);
  513.                        GotoXY(OldCol,OldRow);
  514.                      end;
  515.                    RightPressed :     { Page down }
  516.                      begin
  517.                        For Indx := 1 to MAX_FILES_SHOW-1 do
  518.                          ExecuteCmd(Scroll_Down,Row,Col,LeftPressed);
  519.                      end;
  520.             end; { If - Then case }
  521.         end; { Scroll_Down }
  522.       Mark_All_Files :
  523.         begin
  524.           If ButtonPress = LeftPressed                  { Mark all the files }
  525.             then begin
  526.                    For Indx := 1 to FileCount do
  527.                      If NOT (Files[Indx].Dentry or Files[Indx].Marked)
  528.                        { If Not A directory }
  529.                        then begin
  530.                               Files[Indx].Marked := TRUE;
  531.                               Files[Indx].FileMark := '*';
  532.                               Inc(TotalFilesMarked);
  533.                               Val(Files[Indx].FileSize,Nbytes,Junk);
  534.                               Inc(TotalBytesMarked,Nbytes);
  535.                        end;
  536.                  end
  537.             else begin                                    { Unmark all files }
  538.                    For Indx := 1 to FileCount do
  539.                      If (NOT Files[Indx].Dentry) AND (Files[Indx].Marked)
  540.                        { If Not A directory and is marked }
  541.                        then begin
  542.                               Files[Indx].Marked := FALSE;
  543.                               Files[Indx].FileMark := ' ';
  544.                               Dec(TotalFilesMarked);
  545.                               Val(Files[Indx].FileSize,Nbytes,Junk);
  546.                               Dec(TotalBytesMarked,Nbytes);
  547.                        end;
  548.                  end;
  549.           ShowFiles(Files,1,FileCount,FILE_ROW_START,FILE_COL_START);
  550.         end; { Mark all files }
  551.       Execute_File :
  552.         begin
  553.           Junk := 1;            { First, Find the 1 marked file for execution }
  554.           While NOT Files[Junk].Marked do Inc(Junk);            { it IS there }
  555.           Indx := Pos(' ',Files[Junk].FileName);
  556.           If (Indx > 8) OR (Indx = 0) Then Indx := 9; { 12 byte executables }
  557.           ExecutableName := '';
  558.           ExecutableName := Copy(Files[Junk].FileName,1,Indx-1);
  559.         End; { Execute File }
  560.       Home_View : ShowFiles(Files,1,FileCount,FILE_ROW_START,FILE_COL_START);
  561.       End_View  :
  562.         begin
  563.           Indx := FileCount - MAX_FILES_SHOW + 1;
  564.           If Indx > 0
  565.             then ShowFiles(Files,Indx,FileCount,FILE_ROW_START,FILE_COL_START);
  566.         end;
  567.     end; { Case }
  568.     GotoXY(66,19); Write(TotalFilesMarked:14);
  569.     GotoXY(66,20); Write(TotalBytesMarked:14);
  570.     GotoXY(OldCol,OldRow);
  571.   End; { ExecuteCmd }
  572.  
  573.  
  574.  
  575.  
  576. Procedure LiteCommand(MouseRow,MouseCol : Word;
  577.                       Var NewArea, OldArea : Mcmd);
  578.   Var
  579.     OldRow, OldCol : Word;              { Set by case to unhighlight old area }
  580.     NewRow, NewCol : Word;  { START of field to highlighted -- NOT CURR ROW/COL!!}
  581.     OldTit, NewTit : StringVar;                  { Strings at those locations }
  582.     NormColor,InvColor,EntC : Word;                                  { Colors }
  583.  
  584.  
  585.   Procedure GetAreaCoords(Area : Mcmd;
  586.                           Var Row,Col : Word;
  587.                           Var Tit : StringVar;
  588.                           Var NormC, InvC : Word);
  589.     { Returns corresponding row, col for area START!!!! and string name }
  590.     Begin
  591.       Case Area of
  592.         Home_View      : begin Row :=02; Col :=59; Tit := '   Home   '; end;
  593.         End_View       : begin Row :=02; Col :=70; Tit := '   End   ' ; end;
  594.         Execute_File   : begin Row :=14; Col :=70; Tit := ' Execute ' ; end;
  595.         Mark_All_Files : begin Row :=14; Col :=59; Tit := ' Mark ALL '; end;
  596.         Exit_Mickey    : begin Row :=16; Col :=59; Tit := '   EXIT   '; end;
  597.         Quit_Mickey    : begin Row :=16; Col :=70; Tit := '   QUIT  ' ; end;
  598.         Copy_File      : begin Row :=04; Col :=59; Tit := '   Copy   '; end;
  599.         Move_File      : begin Row :=04; Col :=70; Tit := '   Move  ' ; end;
  600.         Delete_File    : begin Row :=06; Col :=59; Tit := '  Delete  '; end;
  601.         Rename_File    : begin Row :=06; Col :=70; Tit := '  Rename ' ; end;
  602.         New_Path       : begin Row :=12; Col :=59; Tit := ' New Path '; end;
  603.         Chg_Attr       : begin Row :=12; Col :=70; Tit := 'Chg. Attr' ; end;
  604.         Print_File     : begin Row :=08; Col :=59; Tit := '  Print   '; end;
  605.         View_File      : begin Row :=08; Col :=70; Tit := '   View  ' ; end;
  606.         Remove_Dir     : begin Row :=10; Col :=59; Tit := ' Rem DIR  '; end;
  607.         Make_Dir       : begin Row :=10; Col :=70; Tit := 'Make DIR ' ; end;
  608.       else begin Row := 0; Col := 0; Tit := ''; end;
  609.       End; { Case }
  610.       NormC := LightGray;
  611.       InvC := Green * 16 + Black;
  612.     End; { GetAreaCoords }
  613.  
  614.  
  615.   Begin
  616.     EntC := TextAttr;
  617.     If (OldArea <> NewArea)        { Only if change of area, then change lite }
  618.       then If (NewArea <> No_Command) and
  619.               (NewArea <> Scroll_Up) and
  620.               (NewArea <> Scroll_Down) and
  621.               (NewArea <> Select_File)
  622.              then begin
  623.                     GetAreaCoords(NewArea,NewRow,NewCol,NewTit,NormColor,InvColor); { get }
  624.                     GetAreaCoords(OldArea,OldRow,OldCol,OldTit,NormColor,InvColor); { Get }
  625.                     GotoXY(OldCol,OldRow);
  626.                     TextAttr := NormColor;
  627.                     Write(OldTit);
  628.                     GotoXY(NewCol,NewRow);
  629.                     TextAttr := InvColor;
  630.                     Write(NewTit);
  631.                     OldArea := NewArea;
  632.                   end
  633.              else begin { Fail on if means moved out of menu into covered area }
  634.                     GetAreaCoords(OldArea,OldRow,OldCol,OldTit,NormColor,InvColor); { Grab }
  635.                     GotoXY(OldCol,OldRow);
  636.                     TextAttr := NormColor;
  637.                     Write(OldTit);
  638.                     OldArea := NewArea;
  639.                   end;
  640.     GotoXY(MouseCol,MouseRow);
  641.     TextAttr := EntC;
  642.   End; { Lite }
  643.  
  644.  
  645.  
  646. Procedure MouseFunc(Var LastCmd : Mcmd);  { Interface for mouse }
  647.   Var
  648.     MouseRow, MouseCol  : Word;
  649.     Indx,PrevIndx       : Integer;
  650.     MouseBpress         : MouseButtons;{(NonePressed,LeftPressed,RightPressed)}
  651.     UsrCmd              : Mcmd;                { User Commanded through mouse }
  652.     OldHighlight,
  653.     NewHighlight        : Mcmd;  { Use commands to 'know' where we are on scr }
  654.     OldColor, InvColor  : Byte;                 { Old Text Color and InvColor }
  655.     Reason              : StringVar;
  656.  
  657.   Begin
  658.     OldColor := TextAttr;                 { Save screen's text attribute here }
  659.     InvColor := Brown * 16 + White;                               { This here }
  660.     PrevIndx := 0;                                        { Set this for this }
  661.     OldHighlight := No_Command;
  662.     NewHighlight := No_Command;
  663.     ShowMouseCursor;                                         { Start off Here }
  664.     MouseBpress := GetMouseButtonStatus;          { Flush any pending presses }
  665.     UsrCmd := No_Command;
  666.     While (UsrCmd <> Exit_Mickey) AND
  667.           (UsrCmd <> Quit_Mickey) AND
  668.           (UsrCmd <> Execute_File) do
  669.       begin
  670.         MouseBpress := NonePressed;    { Flush and negate old invalid presses }
  671.         While (MouseBpress = NonePressed)                     { Retrieve next }
  672.           do begin
  673.                GetTextMouseLocation(MouseRow,MouseCol);              { Get it }
  674.                Indx := Integer(MouseRow) - FILE_ROW_START + WindowOffset + 1;
  675.                If (MouseRow in [FILE_ROW_START..FILE_ROW_END]) and
  676.                   (MouseCol in [FILE_COL_START..FILE_COL_END]) and
  677.                   (Files[Indx].FileName[1] <> ' ')
  678.                then begin                   { Highlight the Current File Line }
  679.                       If (Indx <> PrevIndx)
  680.                       then begin
  681.                              If (PrevIndx <> 0)        { Moved from last file }
  682.                              then begin
  683.                                     TextAttr := OldColor;         { Set to... }
  684.                                     GotoXY(1,PrevIndx+FILE_ROW_START-WindowOffset-1);
  685.                                     With Files[PrevIndx] do
  686.                                     Write(FileName,Filler_1,FileSize,Filler_2,
  687.                                           FileDate,Filler_3,FileTime,Filler_4,
  688.                                           FileMark,Filler_5,FileAttr);
  689.                                   end;
  690.                              GotoXY(1,MouseRow);
  691.                              TextAttr := InvColor;                { Highlight }
  692.                              With Files[Indx] do
  693.                              Write(FileName,Filler_1,FileSize,Filler_2,
  694.                                    FileDate,Filler_3,FileTime,Filler_4,
  695.                                    FileMark,Filler_5,FileAttr);
  696.                              GotoXY(MouseCol,MouseRow);               { Reset }
  697.                              PrevIndx := Indx;                { Save Old Indx }
  698.                            end;
  699.                     end
  700.                Else begin     { Now, out of text area, check if we were there }
  701.                       If (PrevIndx <> 0)
  702.                       then begin
  703.                              TextAttr := OldColor;                { Set to... }
  704.                              GotoXY(1,PrevIndx+FILE_ROW_START-WindowOffset-1);
  705.                              With Files[PrevIndx] do
  706.                              Write(FileName,Filler_1,FileSize,Filler_2,
  707.                                    FileDate,Filler_3,FileTime,Filler_4,
  708.                                    FileMark,Filler_5,FileAttr);
  709.                              GotoXY(MouseCol,MouseRow);
  710.                              PrevIndx := 0;
  711.                            end;
  712.                       NewHighlight := UserCommand(MouseRow,MouseCol);
  713.                       LiteCommand(MouseRow,MouseCol,NewHighlight,OldHighlight);
  714.                     end;
  715.                MouseBpress := GetMouseButtonStatus;
  716.              end;
  717.         TextAttr := OldColor;
  718.         GetTextMouseLocation(MouseRow,MouseCol);                     { Get it }
  719.         UsrCmd := UserCommand(MouseRow,MouseCol);  { Get the command sequence }
  720.         QualifyCommand(UsrCmd,MouseRow,Reason);
  721.         If (UsrCmd = No_Command)
  722.           Then begin
  723.                  sound(440);
  724.                  Delay(4);
  725.                  NoSound;
  726.                  NiErrorWindow(Reason);
  727.                end
  728.           Else ExecuteCmd(UsrCmd,MouseRow,MouseCol,MouseBpress);
  729.       end; { Bif Valid While }
  730.       LastCmd := UsrCmd;
  731.   End; { MouseFunc }
  732.  
  733.  
  734. BEGIN { Mickey -- main }
  735.   DirectVideo := True;
  736.   OldTextAttr := TextAttr;
  737.   TextColor(Cyan);
  738.   Srow := WhereY; Scol := WhereX;
  739.   GetDir(0,OriginalDir);
  740.   ShowScreen(BytesFree,TotalBytesMarked,CurrDir,TotalFilesMarked);
  741.   BuildFileList(CurrDir,Files,FileCount);
  742.   ShowFiles(Files,1,FileCount,FILE_ROW_START,FILE_COL_START);
  743.   MouseFunc(FinalCommand);
  744.   HideMouseCursor;
  745.   If (FinalCommand = Quit_Mickey) then ChDir(OriginalDir);
  746.   If (FinalCommand = Execute_File)
  747.     then begin
  748.            For Junk := 1 to Length(ExecutableName)
  749.              do UnreadChar(ExecutableName[Junk]);   { Exctract and push chars }
  750.            UnreadChar(chr(13)); { And A CR }
  751.          end;
  752.   TextAttr := OldTextAttr;
  753.   ClrScr;
  754. END.
  755.