home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / DIRSHELL.SRC < prev    next >
Encoding:
Text File  |  1990-06-13  |  63.2 KB  |  2,580 lines

  1. {******************************************************************************
  2.                                                         MULTI-EDIT MACRO FILE
  3.  
  4. Name:   DIRSHELL
  5.  
  6. Description:  The Multi-Edit DOS Shell.
  7.  
  8. DIRSHELL - The main DOS Shell interface
  9. DIRMOVE - Enables mouse movement in the DOS Shell
  10. MARKLOAD - Loads marked files in the DOS Shell
  11. ARCDIR - Creates a list of files contained in an arced or zipped file
  12.  
  13.                              (C) Copyright 1989 by American Cybernetics, Inc.
  14. *******************************************************************************}
  15.  
  16. $MACRO DIRSHELL FROM EDIT TRANS;
  17. {******************************************************************************
  18.                                                                 MULTI-EDIT MACRO
  19.  
  20. Name: DIRSHELL
  21.  
  22. Description:    This implements the user interface to the Multi-Edit dos shell.
  23.  
  24. Parameters:        /S=nn        Select type, where:
  25.                                                 0 = Normal DOS Shell
  26.                                                 1 = Invoked from the Load File prompt.
  27.                                                             Should not load any files, just return
  28.                                                             a file name in Return_Str.
  29.                                                 2 = Single directory, limited use.
  30.  
  31.                             All parameters below have defaults.
  32.                             /X= Upper left corner X coordinate of directory list.
  33.                             /Y= Upper left corner Y coordinate of directory list.
  34.                             /W= Width of directory list.
  35.                             /L= Length of directory list.
  36.                             /D= Directory mask.  Defaults to *.*.
  37.  
  38. Returns:
  39.                             Return_Int  If 1, load file was selected.
  40.                             Return_Str  The last highlited directory entry
  41.  
  42.                              (C) Copyright 1989 by American Cybernetics, Inc.
  43. ******************************************************************************}
  44.  
  45.   def_str( tstr[150], ev_string[20], drive_str[32], mask[12] );
  46.     def_int( jx, Select_Type, j1,j2, wx, wy, cur_dir, old_refresh );
  47.     def_int( x, y, l, w, ev_count, dd_row );
  48.     def_int( old_x, old_y, dir_result );
  49.     def_int( t_d_t_color, t_d_b_color, t_d_h_color, t_d_s_color, t_fkey_row );
  50.     def_int( min_dir_row, max_dir_row, t_mode );
  51.  
  52.     def_char( cur_drive );
  53.  
  54.     ev_string := '@DSLEV';
  55.     t_mode := mode;
  56.     mode := dos_shell;
  57.     dir_result := 0;
  58.     old_refresh := refresh;
  59.     refresh := true;
  60.     cur_dir := 1;
  61.     wx := wherex;  wy := wherey;  {get the cursor position}
  62.     Return_Str := '';
  63.     Select_Type := Parse_Int('/S=', MParm_Str);
  64.  
  65.     t_fkey_row := fkey_row;
  66.   RM('DIRSHELL^InitDirShell /S=' + str(select_type));
  67.     tstr := global_str('@DIR_PARMS@');
  68.     max_dir_row := parse_int('/MAXR=',tstr);
  69.     min_dir_row := parse_int('/MINR=',tstr);
  70.     drive_str := parse_str('/DS=', tstr );
  71.     Push_Labels;
  72.  
  73.         {this is for a single directory list}
  74.     if select_type = 2 then
  75.         t_d_s_color := d_s_color;
  76.         t_d_h_color := d_h_color;
  77.         t_d_t_color := d_t_color;
  78.         t_d_b_color := d_b_color;
  79.  
  80.         d_b_color := m_b_color;
  81.         d_s_color := m_s_color;
  82.         d_h_color := m_h_color;
  83.         d_t_color := m_t_color;
  84.  
  85.         cur_dir := 5;
  86.         set_global_int('@DIR_CUR_DIR@', cur_dir);
  87.         x := parse_int('/X=', mparm_str);
  88.         y := parse_int('/Y=', mparm_str);
  89.         w := parse_int('/W=', mparm_str);
  90.         l := parse_int('/L=', mparm_str);
  91.  
  92.         if y < min_dir_row then
  93.             y := min_dir_row;
  94.         end;
  95.         IF y > (max_dir_row - 10) THEN
  96.             y := max_dir_row - 10;
  97.         END;
  98.  
  99.         if x < 1 then
  100.             x := 1;
  101.         end;
  102.         if x > (screen_width - 28) THEN
  103.             x := screen_width - 28;
  104.         END;
  105.         if (y + l) > (max_dir_row) then
  106.             l := (max_dir_row - y) + 1;
  107.         end;
  108.         if (x + w + 2) >= (screen_width) then
  109.             w := (screen_width - x) - 1;
  110.         end;
  111.  
  112.     Tstr := 'Help  ChDir DeleteCopy  RenameDir OfCMD   Print SelectSort              MrkDelMrkCpyMrkRepView  AttribMrkPrt      Tree  ';
  113.  
  114.         Jx := 1;
  115.     WHILE (Jx <= 20) DO
  116.             FLABEL(Copy(Tstr,((Jx - 1) * 6) + 1,6),Jx,-1);
  117.             ++ Jx;
  118.         END;
  119.  
  120.         open_dir(5);
  121.         switch_dir(5);
  122.         size_dir(x,y,x + w - 1, y + l - 1, 1);
  123.         Dir_Sort_Str := Global_Str('DIR_SORT_STR');
  124.  
  125.         tstr := parse_str('/D=', mparm_str );
  126.         call process_dir_string;
  127.         call Update_Cur_Dir;
  128.     else
  129.         x := 1;
  130.         y := min_dir_row;
  131.         cur_dir := global_int('@DIR_CUR_DIR@');
  132.         if cur_dir = 0 then
  133.             cur_dir := 1;
  134.         end;
  135.         if cur_dir > 4 then
  136.             cur_dir := 1;
  137.         end;
  138.         set_global_int('@DIR_CUR_DIR@', cur_dir);
  139.         if dir_active(cur_dir) then
  140.             switch_dir(cur_dir);
  141.         else
  142.             Open_Dir( cur_dir );
  143.             Dir_Mode := Global_Int('@DIR_MODE@');
  144.         end;
  145.  
  146.     {Assign labels for dos shell}
  147.     Tstr := 'Help  ChDir DeleteCopy  RenameDir OfCMD   Print Load  Sort  NxtDirSizDirMrkDelMrkCpyMrkRepView  AttribMrkPrt      Tree  ';
  148.  
  149.         Jx := 1;
  150.     WHILE (Jx < 21) DO
  151.             FLABEL(Copy(Tstr,((Jx - 1) * 6) + 1,6),Jx,-1);
  152.             ++ Jx;
  153.         END;
  154.  
  155.         FLABEL('Create',31,-1);
  156.         FLABEL('Kill',32,-1);
  157.  
  158.         IF (Select_Type <> 1) THEN
  159.             FLABEL('MrkLd',19,-1);
  160.         END;
  161.         FLABEL('Record',40,-1);
  162.  
  163.         If Select_Type = 1 THEN
  164.             Make_Message( 'Select file and press <ENTER>, or <ESC> to exit without selecting.' );
  165.         END;
  166.  
  167.     {Instructions for right of directory list}
  168.  
  169.         Dir_Sort_Str := Global_Str('DIR_SORT_STR');
  170.         Call Update_All_Dirs;
  171.     end;
  172.     Dir_Sort_Str := Global_Str('DIR_SORT_STR');
  173.     Update_Status_Line;
  174. main_loop:
  175.     cur_dir := global_int('@DIR_CUR_DIR@');
  176.     If error_level <> 0 THEN
  177.         RM('MEERROR');
  178.         error_level := 0;
  179.     end;
  180.     refresh := TRUE;
  181.     read_key;
  182.     if (key1 = 0) then
  183.         if (select_type <> 2) then
  184.             if (key2 = 84) then  {Switch dir}
  185.                 RM('DIRSHELL^DirWindow /M=0');
  186.                 goto main_loop;
  187.  
  188.             elsif (key2 = 104) then  {Create dir}
  189.                 RM('DIRSHELL^DirWindow /M=1');
  190.                 goto main_loop;
  191.  
  192.                 {Delete dir}
  193.             elsif (key2 = 105) then
  194.                 RM('DIRSHELL^DirWindow /M=2');
  195.                 goto main_loop;
  196.  
  197.             end;
  198.         end;
  199.  
  200.         if (key2 = 59) then
  201.             help('DIRSHELL^*');
  202.             goto main_loop;
  203.  
  204.         elsif (key2 = 238) or (key2 = 85) then
  205.             RM('DIRSHELL^DirWindow /M=3');
  206.             goto main_loop;
  207.  
  208.         elsif (key2 = 60) then  {change directory}
  209.             RM('DIRSHELL^DirOperation /M=1');
  210.             goto main_loop;
  211.  
  212.         elsif (key2 = 61) or (key2 = 83) then {delete file}
  213.             RM('DIRSHELL^DirOperation /M=3');
  214.             goto main_loop;
  215.  
  216.         elsif (key2 = 62) then {copy file}
  217.             RM('DIRSHELL^DirOperation /M=2');
  218.             goto main_loop;
  219.  
  220.         elsif (key2 = 63) then {Rename file}
  221.             RM('DIRSHELL^DirOperation /M=4');
  222.             goto main_loop;
  223.  
  224.         elsif (key2 = 64) then  {change directory mask}
  225.             RM('DIRSHELL^DirOperation /M=0');
  226.             goto main_loop;
  227.  
  228.         elsif (key2 = 65) then  {dos command}
  229.             call strip_boxes;
  230.             RM( 'MEUTIL1^SHELLDOS' );
  231.             call update_all_Dirs;
  232.             goto Main_Loop;
  233.  
  234.         elsif (key2 = 66) then  {print command}
  235.             return_str := 'PRINT ' + Dir_Entry;
  236.             RM('DIRSHELL^RunDosCmd');
  237.             Goto Main_Loop;
  238.         end;
  239.  
  240.         if (key2 = 67) then  {load file or look at directory}
  241. Load_Dir_Entry:
  242.             If (Dos_File_Attr and $10) <> 0 THEN
  243.                 tstr := FExpand(Dir_Entry);
  244.                 if Copy(tstr,length(tstr), 1) <> '\' then
  245.                     tstr := tstr + '\';
  246.                 end;
  247.                 Return_Str := get_path( dir_mask );
  248.                 Dir( tstr + truncate_path( dir_mask ) );
  249.                 CALL find_old_entry;
  250.                 call update_cur_dir;
  251.                 Goto Main_Loop;
  252.             end;
  253.  
  254.             tstr := Caps(Get_Extension(Dir_Entry));
  255.             If (Tstr = 'EXE') or (TStr = 'COM') THEN
  256.                 return_str := Dir_Entry;
  257.                 RM('DIRSHELL^RunDosCmd');
  258.                 goto main_loop;
  259.             END;
  260.             if (tstr = 'ARC') or (tstr = 'ZIP') then
  261.                 RM('DIRSHELL^ArcDir ' + dir_entry);
  262.                 call redraw_cur_dir;
  263.                 goto main_loop;
  264.             end;
  265.  
  266.             If Select_Type = 0 THEN
  267.                 tstr := Dir_Entry;
  268.                 Call Dos_Exit;
  269.                 Refresh := True;
  270.                 Set_Global_Int('LOAD_COUNT', 1);
  271.                 return_str := tstr;
  272.                 RM( 'LDFILES /LC=1' );
  273.                 Redraw;
  274.                 goto exitx;
  275.             END;
  276.  
  277.             If (Select_TYpe = 1) or (select_type = 2) THEN
  278.                 dir_result := TRUE;
  279.                 Goto Exit;
  280.             END;
  281.         end;
  282.  
  283.         if (key2 = 68) then {sort}
  284.             RM('DIRSHELL^DIRSORT');
  285.             If return_int > 0 THEN
  286.                 call update_cur_dir;
  287.             ELSE
  288.                 call redraw_cur_dir;
  289.             END;
  290.         end;
  291.  
  292.         if (key2 = 86) then {delete marked files}
  293.             RM('userin^VERIFY /L=2/C=2/H=DIRSHELL^DODELMARKED/T=Are you sure you want to delete these files?');
  294.             If Return_Int THEN
  295.                 RM('DIRSHELL^DelMarkedFiles');
  296.                 if select_type <> 2 then
  297.                     Make_Message('Marked files deleted.');
  298.                 end;
  299.                 dd_row := RETURN_INT;
  300.             end;
  301.         end;
  302.  
  303.         if (key2 = 87) then {copy marked files}
  304.             return_str := '';
  305.             RM('USERIN^QUERYBOX /L=' + str( y ) + '/C=' + str(x) +
  306.                     '/W=60/H=DIRSHELL^DOCOPYMARKED/T=Please enter destination');
  307.             If Return_Int THEN
  308.                 RM('DIRSHELL^CopyMarkedFiles');
  309.                 if select_type <> 2 then
  310.                     Make_Message('Marked files copied.');
  311.                 end;
  312.                 dd_row := RETURN_INT;
  313.             end;
  314.             goto main_loop;
  315.         end;
  316.         if (key2 = 88) then {repeat command on marked files}
  317.             return_str := '';
  318.             RM('USERIN^QUERYBOX /L=' + str( y ) + '/C=' + str(x) +
  319.                     '/W=60/H=DIRSHELL^MARKEDREPEAT/T=Please enter command line');
  320.             If Return_Int THEN
  321.                 RM('DirMarkRepeat');
  322.             end;
  323.             dd_row := RETURN_INT;
  324.             goto main_loop;
  325.         end;
  326.         If (key2 = 89) THEN {view file}
  327.             return_str := dir_entry;
  328.             RM('DirFileView');
  329.             goto main_loop;
  330.         END;
  331.         If (key2 = 90) THEN {view file attributes}
  332.             return_str := dir_entry;
  333.             RM('Fileattr');
  334.             IF (Return_Int) THEN
  335.                 call update_cur_dir;
  336.             ELSE
  337.                 call redraw_cur_dir;
  338.             END;
  339.             goto main_loop;
  340.         END;
  341.  
  342.         if (key2 = 91) then {print marked files}
  343.             RM('userin^VERIFY /L=2/C=2/H=DIRSHELL^DOPRINTMARKED/T=Are you sure you want to print these files?');
  344.             If Return_Int THEN
  345.                 RM('DIRSHELL^PrintMarkedFiles');
  346.                 if select_type <> 2 then
  347.                     Make_Message('Marked files printed.');
  348.                 end;
  349.             end;
  350.             goto main_loop;
  351.         end;
  352.  
  353.         if (key2 = 92) then {load marked files}
  354.             If Select_Type = 0 THEN
  355.                 call strip_boxes;
  356.                 RM('DIRSHELL^MARKLOAD');
  357.                 Goto Exitx;
  358.             ELSE
  359.                 if select_type <> 2 then
  360.                     Make_Message('NOT Available from the Load_File prompt.');
  361.                 end;
  362.                 Goto Main_Loop;
  363.             END;
  364.         end;
  365.  
  366.         if (select_type <> 2) and (key2 = 113) then { start/stop recording of keystroke macro }
  367.             key_record;
  368.             goto Main_Loop;
  369.         end;
  370.  
  371.         if ((key2 = 80) or (Key2 = 241)) then {cursor down}
  372.             dos_down;
  373.             goto main_loop;
  374.         end;
  375.         if ((key2 = 72) or (Key2 = 240)) then {cursor up}
  376.             dos_up;
  377.         end;
  378.         if ((key2 = 77) or (key2 = 243)) then
  379.             dos_right;
  380.         end;
  381.         if ((key2 = 75) or (key2 = 242)) then
  382.             dos_left;
  383.         end;
  384.         if (key2 = 71) then {home}
  385.             dos_home;
  386.         end;
  387.         if (key2 = 79) then {end}
  388.             refresh := false;
  389.             while dir_num < dir_total do
  390.                 dos_down;
  391.                 dos_right;
  392.             end;
  393.             refresh := true;
  394.             update_dir;
  395.          { call redraw_cur_dir; }
  396.          {dos_end;}
  397.         end;
  398.         if (key2 = 73) then {Page up}
  399.             Call Page_Up;
  400.         end;
  401.         if (key2 = 81) then {Page dn}
  402.             Call Page_Dn;
  403.         end;
  404.         if (Key2 = 245) then
  405.             goto do_escape;
  406.         end;
  407.         if (Key2 = 244) then
  408.             goto do_enter;
  409.         end;
  410.         if (Key2 = 246) then
  411.             goto do_mark;
  412.         end;
  413.         IF (key2 = 251) THEN
  414.             CALL MOUSE_EVENT2;
  415.             GOTO MAIN_LOOP;
  416.         END;
  417.         IF (key2 = 250) THEN  {mouse event}
  418.             CALL MOUSE_EVENT1;
  419.             GOTO main_loop;
  420.         END;
  421.     IF (key2 = 93) THEN
  422.       RM('DIRSHELL^TREE /CP=' + get_path(dir_mask) + '/CD=' + get_path(dir_mask));
  423.       IF return_int THEN
  424.         return_str := return_str + truncate_path(dir_mask);
  425.         RM('DIRSHELL^ProcessDir');
  426.       END;
  427.       RM('DIRSHELL^UpdateDir /M=0');
  428.             goto main_loop;
  429.     END;
  430.     else
  431.         if (key1 = 32) then
  432. do_mark:
  433.             Mark_File;
  434.             goto main_loop;
  435.         elsif (key1 = 27) then
  436. do_escape:
  437.             Return_Str := '';
  438.             Goto Exit2;
  439.         elsif (key1 = 13) then
  440. do_enter:
  441.             Goto Load_Dir_Entry;
  442.         elsif (key1 = 9) then
  443.             dir_mode := not(dir_mode);
  444. {We will probably want to get rid of this line when we get an install screen
  445. for the DOS shell}
  446.             Set_Global_Int('@DIR_MODE@',Dir_Mode);
  447.             call redraw_cur_dir;
  448.             goto main_loop;
  449.         elsif (key1 = 8) THEN
  450.             tstr := get_path(dir_mask);
  451.             jx := svl(tstr) - 1;
  452.             WHILE (jx > 0) AND (str_char(tstr,jx) <> '\') AND
  453.                         (str_char(tstr,jx) <> ':') DO
  454.                 --jx;
  455.             END;
  456.             tstr := copy(tstr,1,jx );
  457.             IF str_char( tstr, jx ) = ':' THEN
  458.                 tstr := tstr + '\';
  459.             END;
  460.             return_str := get_path( dir_mask );
  461.             dir( fexpand( tstr + truncate_path( dir_mask ) ) );
  462.             call find_old_entry;
  463.             call update_cur_dir;
  464.         end;
  465.     end;
  466.  
  467.     jx := Inq_Key(Key1,Key2,DOS_SHELL, tstr);
  468.     IF (jx = 1) OR (jx = 2) THEN
  469.         Pass_Key( key1, key2 );
  470. {        RM(TStr); }
  471.     END;
  472.     goto main_loop;
  473.  
  474. Find_Old_Entry:
  475.     refresh := false;
  476.     dos_home;
  477.     IF copy( return_str, length(return_str), 1) = '\' THEN
  478.         return_str := copy( return_str, 1, length( return_str ) - 1 );
  479.     END;
  480.     WHILE dir_num < dir_total DO
  481.         IF dir_entry = return_str THEN
  482.             REFRESH := TRUE;
  483.             RET;
  484.         END;
  485.         DOS_RIGHT;
  486.     END;
  487.     dos_home;
  488.     REFRESH := TRUE;
  489.     RET;
  490.  
  491. {********************************* SUBROUTINES *******************************}
  492.  
  493.  
  494. Page_Up:
  495.     refresh := false;
  496.     jx := 1;
  497.     j1 := dir_y2 - dir_y1 - 2;
  498.     while (jx < j1)  and (dir_num > 1) do
  499.         ++jx;
  500.         dos_up;
  501.     end;
  502.     refresh := true;
  503.     update_dir;
  504.     RET;
  505.  
  506. Page_Dn:
  507.     refresh := false;
  508.     jx := 1;
  509.     j1 := dir_y2 - dir_y1 - 2;
  510.     while (jx < j1) and (dir_num < dir_total) do
  511.         ++jx;
  512.         dos_down;
  513.     end;
  514.     refresh := true;
  515.     update_dir;
  516.     RET;
  517.  
  518.  
  519.         def_int( jy );
  520.  
  521. redraw_all_dirs:
  522.         RM('DIRSHELL^UpdateDir /M=4' );
  523.         dd_row := return_int;
  524.         RET;
  525.  
  526. XRedraw_Cur_Dir:
  527.     RM('DIRSHELL^UpdateDir /M=1');
  528.     dd_row := return_int;
  529.     ret;
  530.  
  531. Redraw_Cur_Dir:
  532.     RM('DIRSHELL^UpdateDir /M=0');
  533.     dd_row := return_int;
  534.     ret;
  535.  
  536. Update_Cur_Dir:
  537.     Dir( dir_mask );
  538.     call redraw_cur_dir;
  539.     ret;
  540.  
  541. XUpdate_Cur_Dir:
  542.     Dir( dir_mask );
  543.     call xredraw_cur_dir;
  544.     ret;
  545.  
  546. lo_cur_dir:
  547.     RM('DIRSHELL^UpdateDir /M=2');
  548.     dd_row := return_int;
  549.     ret;
  550.     RET;
  551.  
  552. process_dir_string:
  553.         return_str := tstr;
  554.         RM('DIRSHELL^ProcessDir');
  555.         tstr := get_path( dir_mask );
  556.         mask := truncate_path( dir_mask );
  557.         ret;
  558.  
  559. MOUSE_EVENT1:
  560.         old_x := Mou_Last_X;
  561.         old_y := Mou_Last_Y;
  562.         ev_count := parse_int('/EVC=', global_str('@DIR_PARMS@'));
  563.         RM('UserIn^CheckEvents /M=1/G=' + ev_string + '/#=' + str( ev_count ));
  564.         IF return_int <> 0 THEN
  565.             return_int := parse_int('/R=', return_str );
  566.             IF return_int = 0 THEN
  567.                 push_key( 27, 1 );
  568.             ELSIF return_int = 1 THEN
  569.                 push_key( 13, 28 );
  570.             END;
  571.         ELSIF (Mou_Last_Y = Fkey_Row) THEN
  572.             RM( 'MOUSE^MouseFkey' );
  573.         ELSIF (Mou_Last_X > dir_x1) AND (Mou_Last_X <= dir_x2) AND
  574.                 (Mou_Last_Y > dir_y1) AND (Mou_Last_Y < dir_y2) THEN
  575.             IF (Mou_Last_X < dir_x2) AND
  576.                 (Mou_Last_Y > (dd_row)) THEN
  577.                 jx := dir_num;
  578.  
  579.                 IF Dir_Locate_Mouse THEN
  580.                     RM('DIRSHELL^DirMove /V=1/H=' + str(dir_mode));
  581.                     IF jx = dir_num THEN
  582.                         Push_Key( 13, 28 );
  583.                     END;
  584.                 END;
  585.             { Check for drive change }
  586.             ELSIF (Mou_Last_Y > dir_y1) AND (Mou_Last_Y <= dd_row) THEN
  587.                 jx := (Mou_Last_Y - dir_y1 - 1) * (( dir_x2 - dir_x1) / 3);
  588.                 JX :=  (((Mou_Last_X - dir_x1) - 1) / 3) + 1 + jx;
  589.                 IF jx <= svl( drive_str ) THEN
  590.                     Return_Str := fexpand( (str_char( drive_str, jx ) + ':' + truncate_path( dir_mask )) );
  591.                     Dir( Return_Str );
  592.                     call redraw_cur_dir;
  593.                 END;
  594.             ELSIF (Mou_Last_X = dir_x2) THEN
  595.                 IF (Mou_Last_Y = (dir_y2 - 1)) THEN
  596.                     refresh := TRUE;
  597.                     ll4:
  598.                         Dos_Down;
  599.                         CALL Mouse_Repeat_Loop;
  600.                         IF return_int = 1 THEN
  601.                             Goto ll4;
  602.                         END;
  603.                 ELSIF (Mou_Last_Y = (dd_row + 2)) THEN
  604.                     refresh := TRUE;
  605.                  ll1:
  606.                     Dos_Up;
  607.                     CALL Mouse_Repeat_Loop;
  608.                     IF return_int = 1 THEN
  609.                         Goto ll1;
  610.                     END;
  611.                 ELSIF (Mou_Last_Y > (dd_row + 1)) AND (Mou_Last_Y < (dir_y2 - 1)) THEN
  612.                     jx := Mou_Last_Y - dd_row - 2;
  613.                     IF dir_scroll_pos > jx THEN
  614.                     ll2:
  615.                         Call Page_Up;
  616.                         CALL Mouse_Repeat_Loop;
  617.                         IF return_int = 1 THEN
  618.                             Goto ll2;
  619.                         END;
  620.                     ELSIF dir_scroll_pos < jx THEN
  621.                     ll3:
  622.                         Call Page_Dn;
  623.                         CALL Mouse_Repeat_Loop;
  624.                         IF return_int = 1 THEN
  625.                             Goto ll3;
  626.                         END;
  627.                     ELSIF dir_scroll_pos = jx THEN
  628.                         Mou_Set_Limits(dir_x2,dd_row + 3,dir_x2, dir_y2 - 2);
  629.                         du3:
  630.                             Mou_Check_Status;
  631.                             IF ((Mou_Last_Status AND 1) <> 0) THEN
  632.                                 IF old_y <> mou_last_y THEN
  633.                                     old_y := mou_last_y;
  634.                                     jy := Mou_Last_Y - dd_row - 2;
  635.                                     IF dir_scroll_pos > jy THEN
  636.                                         while dir_scroll_pos > jy do
  637.                                             call page_up;
  638.                                         END;
  639.                                     ELSIF dir_scroll_pos < jy THEN
  640.                                         while dir_scroll_pos < jy do
  641.                                             call page_dn;
  642.                                         END;
  643.                                     END;
  644.                                 END;
  645.                                 goto du3;
  646.                             END;
  647.                         Mou_Set_Limits(1,1,screen_width, screen_length);
  648.                     END;
  649.                 END;
  650.             END;
  651.         ELSIF (Mou_Last_X = dir_x1) and (Mou_Last_Y = dir_y1) THEN
  652.             jx := 1;
  653.             call mouse_set_size;
  654.         ELSIF (Mou_Last_X = dir_x2) and (Mou_Last_Y = dir_y1) THEN
  655.             jx := 2;
  656.             call mouse_set_size;
  657.         ELSIF (Mou_Last_X = dir_x2) and (Mou_Last_Y = dir_y2) THEN
  658.             jx := 4;
  659.             call mouse_set_size;
  660.         ELSIF (Mou_Last_X = dir_x1) and (Mou_Last_Y = dir_y2) THEN
  661.             jx := 3;
  662.             call mouse_set_size;
  663.         ELSIF (Mou_Last_X > dir_x1) and (Mou_Last_X < dir_x2) AND
  664.             (Mou_Last_Y = dir_y1) THEN
  665.             jx := length( dir_mask );
  666.             jy := (dir_x1 + ((dir_x2 - dir_x1) / 2)) - (jx / 2);
  667.             IF (Mou_Last_X >= jy) AND (Mou_Last_X < (jy + jx)) THEN
  668.                 jx := (mou_last_x - jy) + 1;
  669.                 tstr := dir_mask;
  670.                 WHILE (str_char( tstr, jx ) <> '\') AND (jx <= svl(tstr)) DO
  671.                     ++jx;
  672.                 END;
  673.                 Draw_Attr( jy, dir_y1, d_h_color, jx );
  674.                 IF jx < svl(tstr) then
  675.                     tstr := copy( tstr, 1, jx ) + truncate_path( tstr );
  676.                     return_str := get_path( dir_mask );
  677.                     dir( tstr );
  678.                     call find_old_entry;
  679.                 END;
  680.                 CALL redraw_cur_dir;
  681.             ELSE
  682.                 jx := 0;
  683.                 call mouse_set_size;
  684.             END;
  685.         ELSIF select_type <> 2 THEN
  686.             {Check to see if the mouse was clicked inside another dos window}
  687.             def_int( tcd );
  688.  
  689.             jx := 0;
  690.             while jx < 4 do
  691.                 ++jx;
  692.                 if dir_active(jx) and (jx <> cur_dir) then
  693.                     switch_dir( jx );
  694.                     IF (Mou_Last_X >= dir_x1) AND (Mou_Last_X <= dir_x2) AND
  695.                             (Mou_Last_Y >= dir_y1) AND (Mou_Last_Y <= dir_y2) THEN
  696.                         tcd := jx;
  697.                         switch_dir( cur_dir );
  698.                         call lo_cur_dir;
  699.                         switch_dir( tcd );
  700.                         cur_dir := tcd;
  701.                         set_global_int('@DIR_CUR_DIR@', cur_dir);
  702.                         call redraw_cur_dir;
  703.                         jx := 5;
  704.                     END;
  705.                 END;
  706.             end;
  707.             switch_dir( cur_dir );
  708.         END;
  709. mouse_exit:
  710.         RET;
  711.  
  712. mouse_set_size:
  713.         RM('WINDOW^MOVE_WIN /X1=' + str(dir_x1)+'/Y1=' + Str(dir_y1) + '/X2=' +
  714.             Str(dir_x2) + '/Y2=' + Str(dir_y2) + '/MS=' + str(0) +
  715.             '/MX1=0/MY1=' + Str(min_dir_row) + '/MX2=' +
  716.             Str(Screen_Width + 1) + '/MY2=' + Str(max_dir_row) +
  717.             '/MM=' + str( jx ) );
  718.         size_dir( parse_int('/X1=', return_str),
  719.                             parse_int('/Y1=', return_str),
  720.                             parse_int('/X2=', return_str),
  721.                             parse_int('/Y2=', return_str),
  722.                             1
  723.                         );
  724.         Call Redraw_All_Dirs;
  725.         RET;
  726.  
  727. Mouse_Repeat_Loop:
  728.         Mou_Repeat := TRUE;
  729.         du2:
  730.             Mou_Check_Status;
  731.             IF ((Mou_Last_Status AND 1) <> 0) AND (old_x = Mou_Last_X) AND
  732.                 (old_y = Mou_Last_Y) THEN
  733.                 IF check_Key THEN
  734.                     IF (key2 = 250) AND (key1 = 0) THEN
  735.                         return_int := 1;
  736.                         RET;
  737.                     ELSE
  738.                         push_key( key1, key2 );
  739.                     END;
  740.                 ELSE
  741.                     GOTO du2;
  742.                 END;
  743.             END;
  744.         return_int := 0;
  745.         Mou_Repeat := FALSE;
  746.         RET;
  747.  
  748.  
  749. MOUSE_EVENT2:
  750.         IF (Mou_Last_X > dir_x1) AND (Mou_Last_X < dir_x2) AND
  751.             (Mou_Last_Y > (dir_y1 + 1)) AND (mou_last_y < dir_y2) THEN
  752.             IF Dir_Locate_Mouse THEN
  753.                 Mark_File;
  754.             END;
  755.         END;
  756.         RET;
  757.  
  758.  
  759. {*****************************************************************************}
  760. update_all_dirs:
  761.     RM('DIRSHELL^UpdateDir /M=3');
  762.     dd_row := RETURN_INT;
  763.     RET;
  764.  
  765. strip_boxes:
  766.     jx := parse_int('/BC=', global_str('@DIR_PARMS@'));
  767.     while box_count > jx do
  768.         kill_box;
  769.     end;
  770.     ret;
  771.  
  772. Dos_Exit:
  773.         call strip_boxes;
  774. {
  775.     close_dir( 1 );
  776.     close_dir( 2 );
  777.     close_dir( 3 );
  778.     close_dir( 4 );
  779. }
  780.  
  781.     if dir_active(5) then
  782.         close_dir(5);
  783.     end;
  784.     if select_type <> 2 then
  785.         set_global_int('LAST_DIR', cur_dir);
  786.     ELSE
  787.         d_s_color := t_d_s_color;
  788.         d_h_color := t_d_h_color;
  789.         d_t_color := t_d_t_color;
  790.         d_b_color := t_d_b_color;
  791.     end;
  792.     pop_labels;
  793.     fkey_row := t_fkey_row;
  794.     kill_box;
  795.     GotoXy(wx,wy);
  796.     mode := t_mode;
  797.     refresh := old_refresh;
  798.     Ret;
  799.  
  800. exit:
  801. exit2:
  802.     ev_count := parse_int('/EVC=', global_str('@DIR_PARMS@'));
  803.     RM('UserIn^CheckEvents /M=3/G=' + ev_string + '/#=' + str( ev_count ));
  804.     Return_Str := Dir_Entry;
  805.     Call Dos_Exit;
  806.     return_int := DIR_RESULT;
  807.  
  808. exitx:
  809.  
  810. END_MACRO;
  811.  
  812. $MACRO InitDirShell;
  813.     def_int( drive_count, jx, jy, max_dir_row, min_dir_row, t_bc );
  814.     def_str( drive_str[32] );
  815.  
  816.     save_box(1,1,screen_width,screen_length);
  817.  
  818.     if fkey_row = 0 THEN
  819.         fkey_row := screen_length;
  820.     END;
  821.     IF fkey_row = status_row THEN
  822.         fkey_row := status_row - 1;
  823.     END;
  824.     max_dir_row := max_window_row;
  825.     IF (max_dir_row >= fkey_row) then
  826.         max_dir_row := fkey_row - 1;
  827.     END;
  828.  
  829.     min_dir_row := min_window_row;
  830.     IF (min_dir_row <= message_row) AND (max_window_row > message_row) then
  831.         min_dir_row := message_row + 1;
  832.     END;
  833.     IF (min_dir_row <= status_row) AND (max_window_row > status_row) then
  834.         min_dir_row := status_row + 1;
  835.     END;
  836.     IF (min_dir_row <= 0) THEN
  837.         min_dir_row := 1;
  838.     END;
  839.     t_bc := box_count;
  840.  
  841.  
  842. {get active drives on system}
  843.     R_AX := $1900;
  844.     Intr($21);
  845.     jy := R_AX and $00FF;
  846.     R_DX := jy;
  847.     R_AX := $0E00;
  848.     Intr($21);
  849.     jx := 0;
  850.     drive_count := R_AX AND $00FF;
  851.     drive_str := '';
  852.     while jx < drive_count DO
  853.         R_DX := jx;
  854.         R_AX := $0E00;
  855.         Intr($21);
  856.         R_AX := $1900;
  857.         Intr($21);
  858.         IF (R_AX and $00FF) = jx THEN
  859.             drive_str := drive_str + char( jx + 65);
  860.         END;
  861.         ++jx;
  862.     END;
  863.     R_DX := jy;
  864.     R_AX := $0E00;
  865.     Intr($21);
  866.     drive_count := svl( drive_str );
  867.  
  868.     Set_Global_Str( '@DIR_PARMS@', '/MAXR=' + str( max_dir_row )+
  869.                                             '/BC=' + str(t_bc) +
  870.                                             '/MINR=' + str(min_dir_row ) +
  871.                                             '/DS=' + drive_str +
  872.                                             '/DC=' + str(drive_count)  +
  873.                                             '/S=' + parse_str('/S=', mparm_str)
  874.                                     );
  875.  
  876. END_MACRO;
  877.  
  878.  
  879. {*******************************MULTI-EDIT MACRO******************************
  880.  
  881. Name: UpdateDir
  882.  
  883. Description:  Screen refresh for DIR windows.
  884.  
  885. Parameters:        /M=n        u_mode
  886.                                  0    = Total redraw of current window
  887.                                  1  = Partial redraw of current window
  888.                                  2  = Lo-light current window
  889.                                  3  = Update all windows
  890.                                  4  = Redraw all windows
  891.  
  892.                (C) Copyright 1989 by American Cybernetics, Inc.
  893. ******************************************************************************}
  894. $MACRO UpdateDir;
  895.     def_int( u_mode, jx, jy, t_d_color, t_h_color, dd_row, ev_count, cur_dir );
  896.     def_int( max_dir_row, min_dir_row, select_type ,nohelp);
  897.     def_str( ev_string[20], tstr[128] );
  898.  
  899.     working;
  900.     set_virtual_display;
  901.     u_mode := parse_int('/M=', mparm_str);
  902.     nohelp := Parse_int('/NH=',mparm_str);
  903.  
  904.     IF u_mode = 0 THEN
  905.         call Redraw_Cur_DIr;
  906.     ELSIF u_mode = 1 THEN
  907.         call XRedraw_Cur_DIr;
  908.     ELSIF u_mode = 2 THEN
  909.         call Lo_Cur_Dir;
  910.     ELSIF u_mode = 3 THEN
  911.         call update_all_dirs;
  912.     ELSIF u_mode = 4 THEN
  913.         call redraw_all_dirs;
  914.     END;
  915.     goto exit;
  916.  
  917. Update_Drive_Display:
  918.         RM('DIRSHELL^UpdateDrives');
  919.         dd_row := return_int;
  920.         RET;
  921.  
  922. XRedraw_Cur_Dir:
  923.     redraw_dir;
  924.     call update_drive_display;
  925.     update_dir;
  926.     jy := dir_x1 + ((dir_x2 - dir_x1) / 2);
  927.     write( dir_mask, jy - (length( dir_mask ) / 2),
  928.                                      dir_y1, 0, d_s_color );
  929.     tstr := str( disk_free( ASCII(copy( dir_mask, 1,1 )) - 64 ) / 1024 );
  930.     write( copy( dir_mask, 1, 2 ) + tstr + 'K', dir_x1 + 1, dd_row + 1, 0, d_b_color );
  931.     write( str( dir_total ) + ' files', SVL(tstr) + 5 + dir_x1,
  932.                     dd_row + 1, 0, d_b_color );
  933.     ret;
  934.  
  935. Redraw_Cur_Dir:
  936.     CALL XRedraw_Cur_Dir;
  937.     ev_count := 2;
  938.     ev_string := '@DSLEV';
  939.     Set_Global_Str(ev_string + '1', '/T=Select/KC=<ENTER>/K1=13/K2=28/R=1/X='
  940.                 + str(  jy - 11 ) + '/Y=' + str( dir_y2 ) + '/W=13');
  941.     Set_Global_Str(ev_string + '2', '/T=Done/KC=<ESC>/K1=27/K2=1/R=0/X='
  942.                 + str(  jy + 3) + '/Y=' + str( dir_y2 ) + '/W=9');
  943.     RM('UserIn^CheckEvents /M=2/G=' + ev_string + '/#=' + str( ev_count ));
  944.     Return_Str := '/EVC=';
  945.     RM('USERIN^CHNGPARM /G=@DIR_PARMS@/P=' + str(ev_count) );
  946.     RET;
  947.  
  948. lo_cur_dir:
  949.     t_d_color := d_s_color;
  950.     t_h_color := d_h_color;
  951.     d_h_color := d_t_color;
  952.     d_s_color := d_t_color;
  953.     call xredraw_cur_dir;
  954.     d_s_color := t_d_color;
  955.     d_h_color := t_h_color;
  956.     RET;
  957.  
  958.  
  959. Update_Cur_Dir:
  960.     Dir( dir_mask );
  961.     call redraw_cur_dir;
  962.     ret;
  963.  
  964. XUpdate_Cur_Dir:
  965.     Dir( dir_mask );
  966.     call xredraw_cur_dir;
  967.     ret;
  968.  
  969. set_vars:
  970.     cur_dir := global_int('@DIR_CUR_DIR@');
  971.     select_type := parse_int('/S=', global_str('@DIR_PARMS@'));
  972.     max_dir_row := parse_int('/MAXR=', global_str('@DIR_PARMS@'));
  973.     min_dir_row := parse_int('/MINR=', global_str('@DIR_PARMS@'));
  974.     ret;
  975.  
  976. update_all_dirs:
  977.     call set_vars;
  978.     call strip_boxes;
  979.     restore_box;
  980.   Call Dos_Help;
  981.     t_h_color := d_h_color;
  982.     d_h_color := d_t_color;
  983.     t_d_color := d_s_color;
  984.     d_s_color := d_t_color;
  985.     jx := 0;
  986.     if select_type <> 2 then
  987.         while jx < 4 do
  988.             ++jx;
  989.             switch_dir(jx);
  990.             IF dir_active( jx ) THEN
  991.                 if (dir_y2 > max_dir_row) then
  992.                     size_dir( dir_x1, dir_y1, dir_x2, max_dir_row, 1 );
  993.                 end;
  994.                 if (dir_y1 < min_dir_row) then
  995.                     size_dir( dir_x1, min_dir_row, dir_x2, dir_y2, 1 );
  996.                 end;
  997.                 if (jx <> cur_dir) then
  998.                     call xupdate_cur_dir;
  999.                 end;
  1000.             END;
  1001.         end;
  1002.     ELSE
  1003.         if (dir_y2 > max_dir_row) then
  1004.             size_dir( dir_x1, dir_y1, dir_x2, max_dir_row, 1 );
  1005.         end;
  1006.         if (dir_y1 < min_dir_row) then
  1007.             size_dir( dir_x1, min_dir_row, dir_x2, dir_y2, 1 );
  1008.         end;
  1009.     end;
  1010.     d_s_color := t_d_color;
  1011.     d_h_color := t_h_color;
  1012.  
  1013.     switch_dir(cur_dir);
  1014.     call update_cur_dir;
  1015.     ret;
  1016.  
  1017. strip_boxes:
  1018.     jx := parse_int('/BC=', global_str('@DIR_PARMS@'));
  1019.     while box_count > jx do
  1020.         kill_box;
  1021.     end;
  1022.     ret;
  1023.  
  1024. redraw_all_dirs:
  1025.     call set_vars;
  1026.     call strip_boxes;
  1027.     restore_box;
  1028.     call dos_help;
  1029.     t_d_color := d_s_color;
  1030.     t_h_color := d_h_color;
  1031.     d_h_color := d_t_color;
  1032.     d_s_color := d_t_color;
  1033.     jx := 0;
  1034.     if select_type <> 2 then
  1035.         while jx < 4 do
  1036.             ++jx;
  1037.             if (dir_active(jx)) THEN
  1038.                 switch_dir(jx);
  1039.                 if (dir_y2) > (max_dir_row) then
  1040.                     size_dir( dir_x1, dir_y1, dir_x2, max_dir_row, 1 );
  1041.                 end;
  1042.                 if (dir_y1) < (min_dir_row) then
  1043.                     size_dir( dir_x1, min_dir_row, dir_x2, dir_y2, 1 );
  1044.                 end;
  1045.                 IF (jx <> cur_dir) then
  1046.                     call XRedraw_cur_dir;
  1047.                 END;
  1048.             end;
  1049.         end;
  1050.     end;
  1051.     d_s_color := t_d_color;
  1052.     d_h_color := t_h_color;
  1053.     switch_dir(cur_dir);
  1054.     call redraw_cur_dir;
  1055.     ret;
  1056.  
  1057.  
  1058. dos_help:
  1059.         if (select_type <> 2) and (Nohelp = False) then
  1060.             Put_Box(48,3,80,24,0,M_B_Color,'Multi-Edit DOS Shell',false);
  1061.       Write('Use cursor keys to move.',49,4,0,m_t_color);
  1062.       Write('',49,5,0,m_t_color);
  1063.       Write('<TAB> Toggle display mode',49,5,0,m_t_color);
  1064.       Write('<Space> Mark/Unmark file',49,6,0,m_t_color);
  1065.       Write('<BackSpace> Backup directory',49,7,0,m_t_color);
  1066.       Write('<F2> Change Directory',49,08,0,m_t_color);
  1067.       Write('<F3> Delete File(s)',49,09,0,m_t_color);
  1068.       Write('<F4> Copy File(s)',49,10,0,m_t_color);
  1069.       Write('<F5> Rename File(s)',49,11,0,m_t_color);
  1070.       Write('<F6> Get New Dir Listing',49,12,0,m_t_color);
  1071.       Write('<F7> Do any DOS Command',49,13,0,m_t_color);
  1072.       Write('<F8> Print file with PRINT.COM',49,14,0,m_t_color);
  1073.       Write('<F9> Load File into window',49,15,0,m_t_color);
  1074.       Write('<F10> Sort directory',49,16,0,m_t_color);
  1075.       Write('<ShftF3> Delete Marked files',49,17,0,m_t_color);
  1076.       Write('<ShftF4> Copy Marked files',49,18,0,m_t_color);
  1077.       Write('<ShftF8> Print Marked files',49,19,0,m_t_color);
  1078.       Write('<ShftF9> Load Marked files',49,20,0,m_t_color);
  1079.       Write('<ShftF10> Directory Tree',49,21,0,m_t_color);
  1080.       Write('<AltF1> Create Window',49,22,0,m_t_color);
  1081.       Write('<AltF2> Delete Window',49,23,0,m_t_color);
  1082.       Write('Press <F1> for more HELP',52,24,0,M_B_color);
  1083.         end;
  1084.         ret;
  1085.  
  1086.  
  1087. EXIT:
  1088.     update_status_line;
  1089.     update_virtual_display;
  1090.     reset_virtual_display;
  1091.     return_int := dd_row;
  1092. END_MACRO;
  1093.  
  1094.  
  1095. {*******************************MULTI-EDIT MACRO******************************
  1096.  
  1097. Name: DirWindow
  1098.  
  1099. Description:  Performs various directory window operations.
  1100.  
  1101. Parameters:        /M=n        w_mode
  1102.                                     = 0 Switch to next dir window
  1103.                                     = 1 Create dir window
  1104.                                     = 2 Delete dir window
  1105.                                     = 3 Resize dir window
  1106.  
  1107.                (C) Copyright 1989 by American Cybernetics, Inc.
  1108. ******************************************************************************}
  1109. $MACRO DirWindow;
  1110.         def_int( w_mode, jx, cur_dir, select_type, min_dir_row, max_dir_row );
  1111.  
  1112.         cur_dir := global_int('@DIR_CUR_DIR@');
  1113.         select_type := parse_int('/S=', global_str('@DIR_PARMS@'));
  1114.         max_dir_row := parse_int('/MAXR=', global_str('@DIR_PARMS@'));
  1115.         min_dir_row := parse_int('/MINR=', global_str('@DIR_PARMS@'));
  1116.  
  1117.         w_mode := parse_int('/M=', mparm_str);
  1118.         IF w_mode = 0 THEN
  1119.             call switch_dir;
  1120.         ELSIF w_mode = 1 THEN
  1121.             call create_dir;
  1122.         ELSIF w_mode = 2 THEN
  1123.             call delete_dir;
  1124.         ELSIF w_mode = 3 THEN
  1125.             call resize_dir;
  1126.         END;
  1127.         goto exit;
  1128.  
  1129.  
  1130. switch_dir:
  1131.         RM('DIRSHELL^UpdateDir /M=2');
  1132.     call switch_dir2;
  1133.         RM('DIRSHELL^UpdateDir /M=0');
  1134.         RET;
  1135.  
  1136. switch_dir2:
  1137.         jx := 1;
  1138. switch_again:
  1139.         ++cur_dir;
  1140.         ++jx;
  1141.         if cur_dir > 4 then
  1142.             cur_dir := 1;
  1143.         end;
  1144.         set_global_int('@DIR_CUR_DIR@', cur_dir);
  1145.         switch_dir(cur_dir);
  1146.         if dir_active( cur_dir ) = 0 then
  1147.             if jx < 5 then
  1148.                 goto switch_again;
  1149.             end;
  1150.         end;
  1151.         error_level := 0;
  1152.  
  1153.     ret;
  1154.  
  1155. create_dir:
  1156.     jx := 1;
  1157. open_again:
  1158.     if dir_active(jx) then
  1159.         ++jx;
  1160.         if jx < 5 then
  1161.             goto open_again;
  1162.         end;
  1163.     end;
  1164.     error_level := 0;
  1165.     if jx < 5 then
  1166.         RM('DIRSHELL^UpdateDir /M=2');
  1167.         cur_dir := jx;
  1168.         set_global_int('@DIR_CUR_DIR@', cur_dir);
  1169.         open_dir(cur_dir);
  1170.         Dir_Mode := Global_Int('@DIR_MODE@');
  1171.         if cur_dir = 1 then
  1172.             size_dir(1,min_dir_row,47,max_dir_row, 1);
  1173.         end;
  1174.         if cur_dir = 2 then
  1175.             size_dir(48,min_dir_row,80,max_dir_row, 1);
  1176.         end;
  1177.         if cur_dir = 3 then
  1178.             size_dir(30,5,65,max_dir_row - 3, 1);
  1179.         end;
  1180.         if cur_dir = 4 then
  1181.             size_dir(15,7,50,max_dir_row - 5, 1);
  1182.         end;
  1183.         Dir( dir_mask );
  1184.         RM('DIRSHELL^UpdateDir /M=0');
  1185.     END;
  1186.     RET;
  1187.  
  1188.  
  1189. delete_dir:
  1190.     {Delete dir}
  1191.     jx := dir_active(1) + dir_active(2) + dir_active(3) + dir_active(4);
  1192.     if jx > 1 then
  1193.         close_dir(cur_dir);
  1194.     call switch_dir2;
  1195.         RM('DIRSHELL^UpdateDir /M=4');
  1196.     end;
  1197.     ret;
  1198.  
  1199. resize_dir:
  1200.     RM(
  1201.             'WINDOW^MOVE_WIN /K=1/X1=' + str(dir_x1) +
  1202.             '/Y1=' + Str(dir_y1) +
  1203.             '/X2=' + Str(dir_x2) +
  1204.             '/Y2=' + Str(dir_y2) +
  1205.             '/MX1=1/MY1=' + str(min_dir_row ) +
  1206.             '/MX2='+str(screen_width) +
  1207.             '/MY2='+str(max_dir_row)
  1208.         );
  1209.  
  1210.     IF (Return_Int) THEN
  1211.         Size_Dir(Parse_Int('/X1=',Return_Str),Parse_Int('/Y1=',Return_Str),
  1212.             Parse_Int('/X2=',Return_Str),Parse_Int('/Y2=',Return_Str), 1);
  1213.     end;
  1214.     RM('DIRSHELL^UpdateDir /M=4');
  1215.     ret;
  1216.  
  1217. EXIT:
  1218.  
  1219. END_MACRO;
  1220.  
  1221.  
  1222. {*******************************MULTI-EDIT MACRO******************************
  1223.  
  1224. Name: ProcessDir
  1225.  
  1226. Description:  Gets a directory of the path and mask stored in RETURN_STR.
  1227.  
  1228. Returns:        Nothing.
  1229.  
  1230.                (C) Copyright 1989 by American Cybernetics, Inc.
  1231. ******************************************************************************}
  1232. $MACRO ProcessDir;
  1233.         def_str(dstring[128]);
  1234.         dstring := fexpand(return_str);
  1235.         if truncate_path(dstring) = '' THEN
  1236.             dstring := dstring + '*.*';
  1237.         ELSIF (xpos('.',truncate_path(dstring),1) = 0) THEN
  1238.             dstring := dstring + '.*';
  1239.         END;
  1240.         dir( dstring );
  1241.         if (dir_total = 1) AND ((dos_file_attr and $10) <> 0) THEN
  1242.             IF caps(truncate_path(dir_entry)) = caps(truncate_path(return_str)) THEN
  1243.                 dir( dir_entry + '\*.*' );
  1244.             END;
  1245.         END;
  1246.  
  1247. END_MACRO;
  1248.  
  1249.  
  1250. {*******************************MULTI-EDIT MACRO******************************
  1251.  
  1252. Name: DIRSORT
  1253.  
  1254. Description:  User interface for setting the directory sort string.
  1255.  
  1256.                (C) Copyright 1989 by American Cybernetics, Inc.
  1257. ******************************************************************************}
  1258. $MACRO DIRSORT;
  1259.         def_int( tx, ty, max_dir_row );
  1260.         tx := dir_x1 + 1;
  1261.         ty := dir_y1 + 1;
  1262.         max_dir_row := parse_int('/MAXR=', global_str('@DIR_PARMS@'));
  1263.  
  1264.         if (ty + 8) > max_dir_row then
  1265. {
  1266.             beep;
  1267. }
  1268.             ty := max_dir_row - 8;
  1269.         end;
  1270.         if (tx + 23) > screen_width then
  1271.             tx := screen_width - 23;
  1272.         end;
  1273.         IF ty < 1 THEN
  1274.             ty := 1;
  1275.         END;
  1276.         IF tx < 1 THEN
  1277.             tx := 1;
  1278.         END;
  1279.     Put_Box(tx,ty,tx + 24,ty + 8,0,m_b_color,'Input Sort Key',true);
  1280.         Write('Extension',tx + 1,ty + 1,0,m_t_color);
  1281.         Write('E',tx + 1,ty + 1,0,m_s_color);
  1282.         Write('Name',tx + 1,ty + 2,0,m_t_color);
  1283.         Write('N',tx + 1,ty + 2,0,m_s_color);
  1284.         Write('Size',tx + 1,ty + 3,0,m_t_color);
  1285.         Write('S',tx + 1,ty + 3,0,m_s_color);
  1286.         Write('Date',tx + 1,ty + 4,0,m_t_color);
  1287.         Write('D',tx + 1,ty + 4,0,m_s_color);
  1288.         Write('Time',tx + 1,ty + 5,0,m_t_color);
  1289.         Write('T',tx + 1,ty + 5,0,m_s_color);
  1290.         Write('-reverse',tx + 1,ty + 6,0,m_t_color);
  1291.         Write('-',tx + 1,ty + 6,0,m_s_color);
  1292.         return_str := Dir_Sort_Str;
  1293.       Set_Global_Str('#DS!1',
  1294.           '/T=OK/KC=<ENTER>/W=9/K1=13/K2=28/R=1/Y=' + str(ty + 7) +
  1295.                       '/X=' + str( tx + 1 ));
  1296.       Set_Global_Str('#DS!2',
  1297.           '/T=Cancel/KC=<ESC>/W=11/K1=27/K2=1/R=0/Y=' + str(ty + 7) +
  1298.                       '/X=' + str( tx + 11 ));
  1299.     RM('USERIN^UserStr /EV=#DS!/EV#=2/H=DIRSHELL^DOSORT/W=8/X=' + str(tx + 12) + '/Y=' + str(ty + 1));
  1300.         Kill_Box;
  1301.         If return_int > 0 THEN
  1302.             Dir_Sort_Str := return_str;
  1303.             Set_Global_Str('DIR_SORT_STR', Dir_Sort_Str );
  1304.         END;
  1305.  
  1306. END_MACRO;
  1307.  
  1308.  
  1309. {*******************************MULTI-EDIT MACRO******************************
  1310.  
  1311. Name:   DirOperation
  1312.  
  1313. Description: Dos Directory shell file operations:
  1314.  
  1315. Parameters:        /M=n        o_mode
  1316.                                     = 0 New dir mask
  1317.                                     = 1 Change directory
  1318.                                     = 2 Copy file
  1319.                                     = 3 Delete file
  1320.                                     = 4 rename file
  1321.  
  1322.                (C) Copyright 1989 by American Cybernetics, Inc.
  1323. ******************************************************************************}
  1324. $MACRO DirOperation;
  1325.         def_int( o_mode, select_type );
  1326.         def_str( tstr[128] );
  1327.         select_type := parse_int('/S=', global_str('@DIR_PARMS@'));
  1328.         o_mode := parse_int('/M=', mparm_str);
  1329.  
  1330.         IF o_mode = 0 THEN
  1331.             call new_dir_mask;
  1332.         ELSIF o_mode = 1 THEN
  1333.             call change_directory;
  1334.         ELSIF o_mode = 2 THEN
  1335.             call copy_file;
  1336.         ELSIF o_mode = 3 THEN
  1337.             call delete_file;
  1338.         ELSIF o_mode = 4 THEN
  1339.             call rename_file;
  1340.         END;
  1341.         goto exit;
  1342.  
  1343. new_dir_mask:
  1344.         Return_Str := Dir_Mask;
  1345.         if select_type <> 2 then
  1346.             Make_Message('Please note that this will NOT actually change the current directory.');
  1347.         end;
  1348.         RM('USERIN^QUERYBOX /L=' + str( dir_y1 + 1 ) + '/C=' + str( dir_x1 + 1) +
  1349.             '/W=60/H=DIRSHELL^*/T=Please enter new directory mask');
  1350.         if select_type <> 2 then
  1351.             Make_Message('');
  1352.         end;
  1353.         If Return_Int THEN
  1354.             RM('DIRSHELL^processdir');
  1355.         END;
  1356.     RM('DIRSHELL^UpdateDir /M=0');
  1357.         ret;
  1358. change_directory:
  1359.         Return_Str := Dir_Path;
  1360.         If (Dos_File_Attr and $10) <> 0 THEN
  1361.             Return_Str := Dir_Entry;
  1362.         END;
  1363.         RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1364.             '/W=60/H=DIRSHELL^DOCD/T=Please enter new directory');
  1365.         If Return_Int THEN
  1366.             Change_Dir(Return_Str);
  1367.             Dir('*.*');
  1368. {If you want to retain the old directory mask when changing directories, use
  1369. this line instead of the line above
  1370.             Dir( Truncate_Path( dir_mask ));
  1371. }
  1372.         END;
  1373.         RM('DIRSHELL^UpdateDir /M=0');
  1374.         RET;
  1375.  
  1376. delete_file:
  1377.             Return_Str := Dir_Entry;
  1378.             RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1379.                 '/W=60/H=DIRSHELL^DODELFILE/T=Please enter file to delete');
  1380.             If Return_Int THEN
  1381.                 Return_Str := 'DEL ' + Return_Str;
  1382.                 RM('DIRSHELL^RunDosCmd');
  1383.             END;
  1384.             ret;
  1385.  
  1386. copy_file:
  1387.             Return_Str := Dir_Entry;
  1388.             RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1389.                 '/W=60/H=DIRSHELL^DOCOPYFILE/T=Please enter file to copy');
  1390.             If Return_Int THEN
  1391.                 tstr := return_str;
  1392.                 return_str := '';
  1393.                 RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1394.                         '/W=60/H=DIRSHELL^DOCOPYFILE/T=Please enter destination');
  1395.                 If Return_Int then
  1396.                     return_str := 'COPY ' + Tstr + ' ' + Return_Str;
  1397.                     RM('DIRSHELL^RunDosCmd');
  1398.                 end;
  1399.             END;
  1400.             ret;
  1401.  
  1402. rename_file:
  1403.             Return_Str := Dir_Entry;
  1404.             RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1405.                     '/W=60/H=DIRSHELL^DORENAME/T=Please enter file to rename');
  1406.             If Return_Int THEN
  1407.                 tstr := return_str;
  1408.                 return_str := '';
  1409.                 RM('USERIN^QUERYBOX /L=' + str( dir_y1 ) + '/C=' + str(dir_x1) +
  1410.                         '/W=60/H=DIRSHELL^DORENAME/T=Please enter new file name');
  1411.                 If Return_Int then
  1412.                     return_str := 'RENAME ' + Tstr + ' ' + Return_Str;
  1413.                     RM('DIRSHELL^RunDosCmd');
  1414.                 end;
  1415.             END;
  1416.             ret;
  1417. EXIT:
  1418. END_MACRO;
  1419.  
  1420.  
  1421. {*******************************MULTI-EDIT MACRO******************************
  1422.  
  1423. Name: RunDosCmd
  1424.  
  1425. Description:  Runs the dos command specified in RETURN_STR using
  1426.                             COMMAND.COM.  Use under DIR SHELL ONLY.
  1427.  
  1428.                (C) Copyright 1989 by American Cybernetics, Inc.
  1429. ******************************************************************************}
  1430. $MACRO RunDosCmd;
  1431.     def_int( j1,j2 );
  1432.     j1 := parse_int('/BC=', global_str('@DIR_PARMS@') );
  1433.     WHile box_count > j1 DO
  1434.         kill_box;
  1435.     END;
  1436.     j1 := Status_Row;
  1437.     Status_Row := 0;
  1438.     j2 := Fkey_Row;
  1439.     Fkey_Row := 0;
  1440.     Clear_Screen( (Dos_Back shl 4) or Dos_Color);
  1441.     gotoxy(1,2);
  1442.     Write_Sod('>' + return_str + '|13|10');
  1443.     Shell_To_Dos(return_str,true);
  1444.     Write_Sod('|13|10Press any key to continue...');
  1445.     Read_Key;
  1446.     fkey_row := j2;
  1447.     status_Row := j1;
  1448.     RM( 'UpdateDir /M=3' );
  1449.  
  1450. END_MACRO;
  1451.  
  1452.  
  1453. $MACRO UpdateDrives;
  1454.     def_int( redx, redc, um );
  1455.     def_int( jy, dd_row, drive_count, x1, y1, x2, y2 );
  1456.         def_char( cur_drive );
  1457.         def_str( drive_str[32] );
  1458.  
  1459.     um := parse_int('/M=', mparm_str);
  1460.     IF um THEN
  1461.       x1 := parse_int('/X1=', mparm_str);
  1462.       y1 := parse_int('/Y1=', mparm_str);
  1463.       x2 := parse_int('/X2=', mparm_str);
  1464.       y2 := parse_int('/Y2=', mparm_str);
  1465.       cur_drive := parse_str('/CD=', mparm_str);
  1466.     ELSE
  1467.       x1 := dir_x1;
  1468.       x2 := dir_x2;
  1469.       y1 := dir_y1;
  1470.       y2 := dir_y2;
  1471.       cur_drive := copy(dir_mask,1,1);
  1472.     END;
  1473.         drive_count := parse_int('/DC=', global_str('@DIR_PARMS@'));
  1474.         drive_str := parse_str('/DS=', global_str('@DIR_PARMS@'));
  1475.         redx := 0;
  1476.     redc := x1 + 1;
  1477.     dd_row := y1 + 1;
  1478.     jy := x2 - 1;
  1479.     WHILE (redx < Drive_Count) AND (dd_row < y2) DO
  1480.             ++redx;
  1481.             IF str_char( drive_str , redx ) = cur_drive THEN
  1482.                 write( str_char(drive_str,redx ) + ':', redc, dd_row, 0, d_h_color );
  1483.             ELSE
  1484.                 write( str_char(drive_str,redx ) + ':', redc, dd_row, 0, d_s_color );
  1485.             END;
  1486.             redc := redc + 3;
  1487.             IF redc >= jy THEN
  1488.                 IF redx < drive_count THEN
  1489.                     ++dd_row;
  1490.           redc := x1 + 1;
  1491.                 END;
  1492.             END;
  1493.         END;
  1494.  
  1495.     IF um = 0 THEN
  1496.       Size_Dir( x1, y1, x2, y2, (dd_row - y1) + 1 );
  1497.     END;
  1498.     draw_char( 196, x1 + 1, dd_row + 1, d_b_color, x2 - x1 - 1 );
  1499.         return_int := dd_row;
  1500. END_MACRO;
  1501.  
  1502.  
  1503.  
  1504.  
  1505. $MACRO DirMarkRepeat;
  1506.  
  1507.     def_int( jx, j1, j2 );
  1508.     def_str( tstr );
  1509.  
  1510.     tstr := return_str;
  1511.  
  1512.     Refresh := False;
  1513.     j1 := parse_int('/BC=', global_str('@DIR_PARMS@') );
  1514.     WHile box_count > j1 DO
  1515.         kill_box;
  1516.     END;
  1517.     DOS_HOME;
  1518.     jx := 0;
  1519.     j1 := Status_Row;
  1520.     Status_Row := 0;
  1521.     j2 := Fkey_Row;
  1522.     Fkey_Row := 0;
  1523.     Clear_Screen( (Dos_Back shl 4) or Dos_Color);
  1524.     gotoxy(1,2);
  1525.     While Dir_Num <> jx do
  1526.         jx := dir_num;
  1527.         If File_Marked THEN
  1528.             return_str := tstr;
  1529.             RM('XLATECMDLINE /F=' + dir_entry);
  1530.             Write_Sod('>' + return_str + '|13|10');
  1531.             Shell_To_DOS(return_str,true);
  1532.         end;
  1533.         Dos_right;
  1534.     end;
  1535.     Write_SOD('|13|10Press any key to continue...');
  1536.     Read_Key;
  1537.     fkey_row := j2;
  1538.     status_Row := j1;
  1539.     Refresh := True;
  1540.     RM('DIRSHELL^UpdateDir /M=3');
  1541.  
  1542. END_MACRO;
  1543.  
  1544.  
  1545.  
  1546. {*******************************MULTI-EDIT MACRO******************************
  1547.  
  1548. Name: CopyMarkedFiles
  1549.  
  1550. Description:  Copies all marked files in the current dir window to the
  1551.         destination stored in RETURN_STR.
  1552.  
  1553.                (C) Copyright 1989 by American Cybernetics, Inc.
  1554. ******************************************************************************}
  1555. $MACRO CopyMarkedFiles;
  1556.  
  1557.     return_str := 'COPY <FILE>.<EXT> ' + return_str;
  1558.     RM( 'DirMarkRepeat' );
  1559.  
  1560. END_MACRO;
  1561.  
  1562. $MACRO DelMarkedFiles;
  1563.         def_int( jx, j1, j2 );
  1564.         Refresh := False;
  1565.     j1 := parse_int('/BC=', global_str('@DIR_PARMS@') );
  1566.     WHile box_count > j1 DO
  1567.         kill_box;
  1568.     END;
  1569.     DOS_HOME;
  1570.     jx := 0;
  1571.     j1 := Status_Row;
  1572.     Status_Row := 0;
  1573.     j2 := Fkey_Row;
  1574.     Fkey_Row := 0;
  1575.     Clear_Screen( (Dos_Back shl 4) or Dos_Color);
  1576.     gotoxy(1,2);
  1577.     While Dir_Num <> jx do
  1578.         jx := dir_num;
  1579.         If File_Marked THEN
  1580.             Write_Sod('>DEL ' + Dir_Entry + '|13|10');
  1581.             Del_File(Dir_Entry);
  1582.             If Error_Level <> 0 THEN
  1583.                 Write_Sod('->Error on ' + Dir_Entry);
  1584.                 Error_Level := 0;
  1585.             end;
  1586.         end;
  1587.         Dos_right;
  1588.     end;
  1589.     Write_SOD('|13|10Press any key to continue...');
  1590.     Read_Key;
  1591.     fkey_row := j2;
  1592.     status_Row := j1;
  1593.     Refresh := True;
  1594.     RM('DIRSHELL^UpdateDir /M=3');
  1595.  
  1596. END_MACRO;
  1597.  
  1598. $MACRO PrintMarkedFiles;
  1599.         def_int( jx, j1, j2 );
  1600.  
  1601.     Refresh := False;
  1602.     j1 := parse_int('/BC=', global_str('@DIR_PARMS@') );
  1603.     WHile box_count > j1 DO
  1604.         kill_box;
  1605.     END;
  1606.     DOS_HOME;
  1607.     jx := 0;
  1608.     j1 := Status_Row;
  1609.     Status_Row := 0;
  1610.     j2 := Fkey_Row;
  1611.     Fkey_Row := 0;
  1612.     Clear_Screen( (Dos_Back shl 4) or Dos_Color);
  1613.     gotoxy(1,2);
  1614.     While Dir_Num <> jx do
  1615.         jx := dir_num;
  1616.         If File_Marked THEN
  1617.             Write_Sod('>PRINT ' + Dir_Entry + '|13|10');
  1618.             Shell_To_DOS('PRINT ' + Dir_Entry,true);
  1619.         end;
  1620.         Dos_right;
  1621.     end;
  1622.     Write_SOD('|13|10Press any key to continue...');
  1623.     Read_Key;
  1624.     fkey_row := j2;
  1625.     status_Row := j1;
  1626.     Refresh := True;
  1627.     RM('DIRSHELL^UpdateDir /M=3');
  1628.  
  1629. END_MACRO;
  1630.  
  1631.  
  1632. $MACRO DIRMOVE FROM DOS_SHELL;
  1633. {******************************************************************************
  1634.                                                                 MULTI-EDIT MACRO
  1635.  
  1636. Name:   DIRMOVE
  1637.  
  1638. Description:  Enables mouse movement in the DOS Shell.
  1639.  
  1640. Parameters:
  1641.                             /H= If 1, enables horizontal mouse movement.
  1642.                             /V= If 1, enables vertical mouse movement.
  1643.  
  1644.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1645. *******************************************************************************}
  1646.  
  1647.     def_int( jx,old_mouse_mode, vertical, horizontal, tmhs, old_x, xoffs );
  1648.  
  1649.     tmhs := Mouse_H_Sense;
  1650.     Mouse_H_Sense := tmhs * 3;
  1651.     vertical := parse_int('/V=', mparm_str);
  1652.     horizontal := parse_int('/H=', mparm_str);
  1653.     old_mouse_mode := mouse_mode;
  1654.     Mou_Check_Status;
  1655.     mou_reset;
  1656.     mouse_mode := TRUE;
  1657.     old_x := Mou_Last_X;
  1658.     xoffs := old_x - wherex;
  1659.     delay(5);
  1660.     Mou_Remove_Ptr;
  1661. loop:
  1662.     Mou_Check_Status;
  1663.     IF ((Mou_Last_Status AND 3) = 0) THEN
  1664.         GOTO exit;
  1665.     END;
  1666.     IF check_key THEN
  1667.         IF key1 = 0 THEN
  1668.             IF vertical and (key2 = 240) THEN
  1669.                 DOS_UP;
  1670.             ELSIF vertical and (key2 = 241) THEN
  1671.                 DOS_DOWN;
  1672.             ELSIF horizontal and (key2 = 242) THEN
  1673.                 DOS_LEFT;
  1674.             ELSIF horizontal and (key2 = 243) THEN
  1675.                 DOS_RIGHT;
  1676.             END;
  1677.         ELSIF key1 = 27 THEN
  1678.             goto exit;
  1679.         END;
  1680.     END;
  1681.     GOTO loop;
  1682.  
  1683. exit:
  1684.     Mouse_H_Sense := tmhs;
  1685.     mouse_mode := old_mouse_mode;
  1686.     jx := wherex + xoffs;
  1687.     IF jx < 1 THEN
  1688.         jx := 1;
  1689.     END;
  1690.     Mou_Set_Pos( jx, wherey );
  1691.     IF NOT( horizontal ) THEN
  1692.         Mou_Set_Pos( old_x, wherey );
  1693.     END;
  1694.     Mou_Draw_Ptr;
  1695. END_MACRO;
  1696.  
  1697.  
  1698. $MACRO MARKLOAD FROM DOS_SHELL TRANS;
  1699. {******************************************************************************
  1700.                                                                 MULTI-EDIT MACRO
  1701.  
  1702. Name:   MARKLOAD
  1703.  
  1704. Description:  From the DOS_SHELL, loads all marked files into new windows.
  1705.  
  1706.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1707. *******************************************************************************}
  1708.  
  1709.     Def_Int(jx,tcount);
  1710.  
  1711. { Go to the top of the DIR listing }
  1712.     Working;
  1713.     Refresh := False;
  1714.     Dos_Home;
  1715.  
  1716. {Now scan down the entire DIR list, building a global string for
  1717. each Marked entry}
  1718.     jx := 0;
  1719.     tcount := 0;
  1720.     while jx < Dir_Total DO
  1721.         JX := JX + 1;
  1722.         IF File_Marked then
  1723.             ++tcount;
  1724.             Set_Global_Str('ML!!' + Str(tcount),Dir_Entry);
  1725.         end;
  1726.         DOS_RIGHT;
  1727.     END;
  1728.  
  1729. {    close_dir( 1 );
  1730.     close_dir( 2 );
  1731.     close_dir( 3 );
  1732.     close_dir( 4 );
  1733. }
  1734.     pop_labels;
  1735.     kill_box;
  1736.     mode := edit;
  1737.  
  1738. {Go through the list of global strings and load in the files.
  1739. Set the global strings to NULL when done in order to deallocate them.}
  1740.     jx := 1;
  1741.     While jx <= tcount do
  1742.         Return_str := Global_Str('ML!!' + Str(jx));
  1743.         RM( 'LDFILES /LC=1' );
  1744.         Error_Level := 0;
  1745.         ++jx;
  1746.     end;
  1747.     RM('WINDOW^SetWindowNames');
  1748.     Refresh := True;
  1749.     redraw;
  1750. END_MACRO;
  1751.  
  1752.  
  1753.  
  1754.  
  1755. $MACRO MarkRepeat;
  1756.  
  1757.     def_int( jx, j1, j2 );
  1758.     def_str( tstr );
  1759.  
  1760.     tstr := return_str;
  1761.  
  1762.     Refresh := False;
  1763.     j1 := parse_int('/BC=', global_str('@DIR_PARMS@') );
  1764.     WHile box_count > j1 DO
  1765.         kill_box;
  1766.     END;
  1767.     DOS_HOME;
  1768.     jx := 0;
  1769.     j1 := Status_Row;
  1770.     Status_Row := 0;
  1771.     j2 := Fkey_Row;
  1772.     Fkey_Row := 0;
  1773.     Clear_Screen( (Dos_Back shl 4) or Dos_Color);
  1774.     gotoxy(1,2);
  1775.     While Dir_Num <> jx do
  1776.         jx := dir_num;
  1777.         If File_Marked THEN
  1778.             return_str := tstr;
  1779.             RM('XLATECMDLINE /F=' + dir_entry);
  1780.             Write_Sod('>' + return_str + '|13|10');
  1781.             Shell_To_DOS(return_str,true);
  1782.         end;
  1783.         Dos_right;
  1784.     end;
  1785.     Write_SOD('|13|10Press any key to continue...');
  1786.     Read_Key;
  1787.     fkey_row := j2;
  1788.     status_Row := j1;
  1789.     Refresh := True;
  1790.     RM('DIRSHELL^UpdateDir /M=3');
  1791.  
  1792. END_MACRO;
  1793.  
  1794.  
  1795. $MACRO ARCDIR FROM ALL TRANS;
  1796. {******************************************************************************
  1797.                                                                 MULTI-EDIT MACRO
  1798.  
  1799. Name: ARCDIR
  1800.  
  1801. Description:    List an archive file.  Now supports both .ARC and .ZIP files.
  1802.  
  1803. Parameters:        MParm_Str = the archive file name.
  1804.  
  1805. Global Strings:
  1806.                             'ARCDIR_COMMAND'  is the parameters for running the
  1807.                                 archive program to generate the list for .ARC files.
  1808.                             'ZIPDIR_COMMAND'  is the parameters for running the
  1809.                                 archive program to generate the list for .ZIP files.
  1810.                                 /D1=nn  The number of lines at the top of the list to
  1811.                                     delete.  This is to get rid of the startup message and
  1812.                                     other junk.
  1813.                                 /D2=nn  The number of lines at the bottom of the list to
  1814.                                     delete.  This gets rid of any junk at the bottom.
  1815.                                 /S1=nn  The number of lines at the top of the list to
  1816.                                     leave in but skip.  This is done after the deleting.
  1817.                                 /S2=nn  The number of lines at the bottom of the list to
  1818.                                     leave in but skip.  This is done after the deleting.
  1819.                                 /C=str  The command to user to run the program.  Must be
  1820.                                     the last parameter.
  1821.                              Example:
  1822.                                  Set_Global_Str('ARCDIR_COMMAND',
  1823.                                             '/D1=6/D2=0/S1=2/S2=2/C=C:\UTIL\PKPAK -V' );
  1824.  
  1825.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1826. ******************************************************************************}
  1827.  
  1828.     def_int( t_win, jx, d1, d2, s1, s2 );
  1829.     def_str( arc_cmd[80] );
  1830.     refresh := false;
  1831.     t_win := cur_window;
  1832.     switch_window(window_count);
  1833.     create_window;
  1834.     working;
  1835.     if caps(get_extension(mparm_str)) = 'ZIP' then
  1836.         arc_cmd := global_str('ZIPDIR_COMMAND');
  1837.         if arc_cmd = '' then
  1838.             arc_cmd := '/D1=6/S1=2/S2=2/C=PKUNZIP -V';
  1839.         end;
  1840.     else
  1841.         arc_cmd := global_str('ARCDIR_COMMAND');
  1842.         if arc_cmd = '' then
  1843.             arc_cmd := '/D1=6/S1=2/S2=2/C=PKUNPAK -V';
  1844.         end;
  1845.     end;
  1846.     d1 := parse_int('/D1=', arc_cmd);
  1847.     d2 := parse_int('/D2=', arc_cmd);
  1848.     s1 := parse_int('/S1=', arc_cmd);
  1849.     s2 := parse_int('/S2=', arc_cmd);
  1850.     jx := xpos('/C=', arc_cmd, 1);
  1851.     arc_cmd := copy(arc_cmd, jx + 3, 80);
  1852.     make_message(arc_cmd + ' ' + mparm_str);
  1853.     shell_to_dos(arc_cmd + ' '+ mparm_str + ' > ' + me_path + user_id + 'DIR.TMP', true);
  1854.     load_file( me_path + user_id + 'DIR.TMP' );
  1855.     jx := 0;
  1856.     while jx < d1 do
  1857.         ++jx;
  1858.         del_line;
  1859.     end;
  1860.     eof;
  1861.     jx := 0;
  1862.     while jx < d2 do
  1863.         ++jx;
  1864.         del_line;
  1865.         up;
  1866.     end;
  1867.     tof;
  1868.     jx := 0;
  1869.     while jx < s1 do
  1870.         ++jx;
  1871.         eol;
  1872.         goto_col(100);
  1873.         text('|254');
  1874.         down;
  1875.     end;
  1876.     eof;
  1877.     jx := 0;
  1878.     while jx < s2 do
  1879.         ++jx;
  1880.         goto_col(100);
  1881.         text('|254');
  1882.         up;
  1883.     end;
  1884.     TOF;
  1885.     RM('USERIN^WMENU /H=DIRSHELL^DOSELECT%ARC/DBL=1/T=' + dir_entry );
  1886.     refresh := false;
  1887.     delete_window;
  1888.     switch_window(t_win);
  1889.     make_message('');
  1890.     refresh := true;
  1891. END_MACRO;
  1892.  
  1893.  
  1894.  
  1895. $MACRO DirFileView;
  1896.  
  1897.     def_int( o_win, omode );
  1898.     def_str( tstr[128] );
  1899.  
  1900.     IF (File_Attr(Return_Str) and $18) THEN
  1901.         RM('MEERROR^Beeps /C=1');
  1902.     ELSE
  1903.         tstr := return_str;
  1904.         refresh := false;
  1905.         omode := mode;
  1906.         mode := edit;
  1907.         o_win := window_id;
  1908.      {switch_window( window_count );
  1909.         create_window;}
  1910.         rm('LDFILES /LC=1/NC=1');
  1911.         read_only := TRUE;
  1912.         RM('USERIN^EDITWINDOW /X=5/Y=5/W=70/L=18/H=DIRSHELL^*/SE=1/T=' + tstr);
  1913.         read_only := false;
  1914.         refresh := false;
  1915.         delete_window;
  1916.         switch_win_id( o_win );
  1917.         mode := omode;
  1918.     END;
  1919.  
  1920. END_MACRO;
  1921.  
  1922.  
  1923. $MACRO tree TRANS;
  1924. {*******************************MULTI-EDIT MACRO******************************
  1925.  
  1926. Name: TREE
  1927.  
  1928. Description:  Creates a graphic directory "tree".
  1929.  
  1930. Parameters:
  1931.                             /X= X coordinate of box
  1932.                             /Y= X coordinate of box
  1933.                             /CP= Current path
  1934.                             /CD= Current drive
  1935.  
  1936.                (C) Copyright 1989 by American Cybernetics, Inc.
  1937. ******************************************************************************}
  1938.     def_int( level_count, level, tfsa, done,  tins, ttab, oline, orow, ocol,
  1939.           line_counter, wl, screen_full, old_time, old_undo, current_path_line,
  1940.                     tr,jx, x, y, w, l, wc, premature_done, key_press,
  1941.           old_window, event_count, dd_row, rebuild, tm,
  1942.                     tree_window, old_refresh );
  1943.  
  1944.   def_str( tstr[128], event_str[20],
  1945.                     title[50], new_drive[2],
  1946.                     cur_drive[2], tstr2,
  1947.                     current_path[128], xstr[80] );
  1948.  
  1949.   old_refresh := refresh;
  1950.     old_undo := undo_stat;
  1951.     undo_stat := FALSE;
  1952.   level := 0;
  1953.   tm := mode;
  1954.   mode := edit;
  1955.     tins := insert_mode;
  1956.     insert_mode := FALSE;
  1957.     ttab := tab_expand;
  1958.     tab_expand := false;
  1959.     done := FALSE;
  1960.  
  1961.   IF global_str('@DIR_PARMS@') = '' THEN
  1962.     RM('DIRSHELL^InitDirShell');
  1963.   END;
  1964.  
  1965.     current_path := parse_str('/CP=', mparm_str);
  1966.   tstr := global_str('@TREE_PARMS@');
  1967.   tree_window := parse_int('/W=', tstr );
  1968.   cur_drive := parse_str('/CD=', tstr );
  1969.   new_drive := copy(fexpand(parse_str('/CD=', mparm_str)), 1, 1 );
  1970.   rebuild := parse_int('/R=', tstr);
  1971.     current_path_line := parse_int('/CP=', tstr);
  1972.   IF new_drive = '' THEN
  1973.     new_drive := cur_drive;
  1974.   END;
  1975. {
  1976.     make_message( mparm_str );
  1977. }
  1978.   IF (new_drive <> cur_drive) or (cur_drive = '') THEN
  1979.  {   new_drive := copy(fexpand('\'), 1, 1 );}
  1980.     rebuild := TRUE;
  1981.   END;
  1982.  
  1983.     premature_done := FALSE;
  1984.     oline := 1;
  1985.     orow := 1;
  1986.     ocol := 1;
  1987.   event_count := 0;
  1988.   event_str := '@EVTREE#';
  1989.     old_window := window_id;
  1990.   push_labels;
  1991.     flabel('CDrive', 2, -1 );
  1992.     tfsa := file_search_attr;
  1993.     file_search_attr := $10;
  1994.     refresh := false;
  1995.  
  1996.   IF NOT(switch_win_id( tree_window ) ) THEN
  1997.     switch_window( window_count );
  1998.     create_window;
  1999.     tree_window := window_id;
  2000.     rebuild := TRUE;
  2001.   END;
  2002.     x := parse_int('/X=', mparm_str);
  2003.     y := parse_int('/Y=', mparm_str);
  2004.   w := 52;
  2005.     l := 20;
  2006.     IF x = 0 THEN
  2007.         x := 2;
  2008.     END;
  2009.     IF y = 0 THEN
  2010.         y := 2;
  2011.     END;
  2012.     IF (y + l + 1) > (max_window_row) THEN
  2013.         IF y >= max_window_row THEN
  2014.             y := max_window_row - 10;
  2015.         END;
  2016.         l :=  max_window_row - y - 1;
  2017.     END;
  2018.     IF (x + w + 20) > (screen_width) THEN
  2019.         IF x >= (screen_width - 20) THEN
  2020.             x := screen_width - 42;
  2021.         END;
  2022.         w :=  screen_width - x - 2;
  2023.     END;
  2024.     put_box( x, y, x + w + 2, y + l + 1, 0, m_b_color, 'Directory Tree', TRUE);
  2025.     window_attr := $86;
  2026.     t_color := m_t_color;
  2027.     c_color := m_t_color;
  2028.     b_color := m_b_color;
  2029.     s_color := m_s_color;
  2030.     eof_color := (m_t_color and $F0) + (m_t_color shr 4);
  2031.   wc := (x + (w / 2)) + 1;
  2032.   Set_Global_Str(event_str + '1',
  2033.       '/T=Cancel/KC=<ESC>/W=11/K1=27/K2=1/R=0/Y=' +
  2034.                   str(y + l) +
  2035.                   '/X=' + str( wc - 14));
  2036.   Set_Global_Str(event_str + '2',
  2037.       '/T=Select/KC=<ENTER>/W=13/K1=27/K2=1/R=1/Y=' +
  2038.                   str(y + l) +
  2039.                   '/X=' + str( wc - 2));
  2040.   event_count := 2;
  2041.   RM('CheckEvents /M=2/G=' + event_str + '/#=' + str(event_count));
  2042.     old_time := system_timer;
  2043.   IF not(rebuild) THEN
  2044.     set_mark(1);
  2045.     eof;
  2046.     IF c_col = 1 THEN
  2047.       up;
  2048.     END;
  2049.     line_counter := c_line;
  2050.         call reset_line_changed;
  2051.         call find_current_path;
  2052.         c_color := m_s_color;
  2053.     get_mark(1);
  2054.     call draw_display;
  2055.     update_status_line;
  2056.     refresh := true;
  2057.     redraw;
  2058.     call highlight;
  2059.     insert_mode := TRUE;
  2060.   END;
  2061. loopx:
  2062.   IF done THEN
  2063.     goto exit;
  2064.   END;
  2065.   IF rebuild THEN
  2066.     tstr := new_drive + ':\*.*';
  2067.     call do_rebuild;
  2068.     insert_mode := TRUE;
  2069.   END;
  2070.     IF check_key THEN
  2071.         call master_key_loop;
  2072.     END;
  2073.     goto loopx;
  2074.  
  2075. draw_display:
  2076.   refresh := false;
  2077.   RM('DIRSHELL^UpdateDrives /M=1/X1=' + str(x) + '/Y1=' + str(y) + '/X2=' +
  2078.         str( x + w ) + '/Y2=' + str( y + l ) + '/CD=' + new_drive );
  2079.   dd_row := return_int;
  2080.   size_window( x, dd_row + 1, x + w, y + l );
  2081.     wl := win_y2 - win_y1 - 2;
  2082.   ret;
  2083.  
  2084. do_rebuild:
  2085.     key_press := false;
  2086.     c_color := t_color;
  2087.     current_path_line := 0;
  2088.     premature_done := FALSE;
  2089.   call draw_display;
  2090.   rebuild := false;
  2091.   erase_window;
  2092.   put_line( new_drive + ':');
  2093.     set_mark(1);
  2094.     down;
  2095.   put_line( '' );
  2096.     refresh := true;
  2097.     redraw;
  2098.   insert_mode := false;
  2099.     screen_full := 0;
  2100.   line_counter := 1;
  2101.   title := '  Building Tree  ';
  2102.   write( title, wc - (svl(title) / 2), y, 0, working_color );
  2103.   level := 0;
  2104.     call get_dir;
  2105.   title := '─Directory Tree──';
  2106.   write( title, wc - (svl(title) / 2), y, 0, b_color );
  2107.     update_status_line;
  2108.     call reset_line_changed;
  2109.     c_color := m_s_color;
  2110.     call find_current_path;
  2111.     get_mark(1);
  2112.     IF NOT(key_press) AND (current_path_line > 0) THEN
  2113.         tof;
  2114.         down;
  2115.         down;
  2116.         down;
  2117.         down;
  2118.         goto_line( current_path_line );
  2119.     eol;
  2120.     left;
  2121.     goto_col( (((c_col - 1) / 13) * 13) + 1 );
  2122.     END;
  2123.     refresh := true;
  2124.     redraw;
  2125.   cur_drive := new_drive;
  2126.     call highlight;
  2127.   ret;
  2128.  
  2129. get_dir:
  2130.     level_count := 0;
  2131.     IF first_file( tstr ) = 0 THEN
  2132. loop:
  2133.         IF screen_full THEN
  2134.             IF check_key THEN
  2135.                 tr := refresh;
  2136.                 set_mark(2);
  2137.                 get_mark(1);
  2138.                 refresh := true;
  2139.                 call master_key_loop;
  2140.                 set_mark(1);
  2141.                 refresh := tr;
  2142.                 get_mark(2);
  2143.             END;
  2144.         END;
  2145.         IF (last_file_attr AND $10) THEN
  2146.             IF (last_file_name <> '.') AND (last_file_name <> '..') THEN
  2147.                 IF level > 0 THEN
  2148.                     jx := level * 13;
  2149.                     goto_col( jx  );
  2150.                     up;
  2151.                     IF cur_char = '└' THEN
  2152.                         text('├');
  2153.                     ELSIF (cur_char = ' ') or (cur_char = '|255') THEN
  2154.                         IF level_count = 0 THEN
  2155.                             eol;
  2156.                             text(copy('────────────', 1, jx-  c_col) + '┐');
  2157.                         ELSE
  2158.                             set_mark(3);
  2159.                             WHILE cur_char = ' ' DO
  2160.                                 text('│');
  2161.                                 left;
  2162.                                 up;
  2163.                             END;
  2164.                             IF cur_char = '└' THEN
  2165.                                 text('├');
  2166.                             END;
  2167.                             get_mark(3);
  2168.                         END;
  2169.                     END;
  2170.                     down;
  2171.                     goto_col( jx );
  2172.                     text('└' + last_file_name);
  2173.                 ELSE
  2174.                     goto_col(1);
  2175.                     put_line( last_file_name );
  2176.                 END;
  2177.               IF (line_counter >= wl) THEN
  2178.                     refresh := false;
  2179.                     IF screen_full = 0 THEN
  2180.                         set_mark(2);
  2181.                         refresh := true;
  2182.                         screen_full := true;
  2183.                         tof;
  2184.                         call highlight;
  2185.                         refresh := false;
  2186.                         get_mark(2);
  2187.                   END;
  2188.                     goto_line( line_counter + 2 );
  2189.                 ELSE
  2190.                     DOWN;
  2191.                 END;
  2192.                 ++line_counter;
  2193.                 create_global_str( '@FILEREC@' + str(level), file_search_rec );
  2194.                 create_global_str( '@FILETSTR@' + str(level), tstr );
  2195.                 tstr := get_path(tstr) + last_file_name + '\*.*';
  2196.                 ++level;
  2197.                 call get_dir;
  2198.                 --level;
  2199.                 file_search_rec := global_str( '@FILEREC@' + str(level));
  2200.                 tstr := global_str( '@FILETSTR@' + str(level));
  2201.                 set_global_str( '@FILEREC@' + str(level), '');
  2202.                 set_global_str( '@FILETSTR@' + str(level), '' );
  2203.                 ++level_count;
  2204.             END;
  2205.         END;
  2206.     IF NOT(done) and (next_file = 0) and NOT(rebuild) THEN
  2207.             goto loop;
  2208.         END;
  2209.         premature_done := DONE;
  2210.     END;
  2211.     ret;
  2212.  
  2213. find_current_path:
  2214.     set_mark(4);
  2215.     current_path_line := 0;
  2216.     IF copy(current_path, 1, 1) = cur_drive THEN
  2217.         tof;
  2218.         tstr := copy(current_path, 4, 254);
  2219.         jx := xpos('\', tstr, 1 );
  2220.         IF jx = 0 THEN
  2221.             jx := svl(tstr) + 1;
  2222.         END;
  2223.         IF search_fwd('%' + copy(tstr,1, jx - 1), 0) THEN
  2224.         fcp_loop:
  2225.             call create_return_str;
  2226.             IF return_str = current_path THEN
  2227.                 line_changed := TRUE;
  2228.                 current_path_line := c_line;
  2229.             ELSE
  2230.                 call skip_right;
  2231.                 IF (c_col > 1) AND (NOT(at_eof)) THEN
  2232.                     goto fcp_loop;
  2233.                 END;
  2234.             END;
  2235.         END;
  2236.     END;
  2237. fcp_exit:
  2238.     get_mark(4);
  2239.     ret;
  2240.  
  2241.  
  2242. master_key_loop:
  2243.     key_press := TRUE;
  2244.   call lowlight;
  2245.     IF key1 = 27 THEN
  2246.    esc:
  2247.         done := TRUE;
  2248.     return_int := 0;
  2249.   ELSIF key1 = 13 THEN
  2250.    enter:
  2251.     return_int := TRUE;
  2252.     done := TRUE;
  2253.     call create_return_str;
  2254.     ELSIF key1 = 0 THEN
  2255.         IF (key2 = 60) THEN
  2256.             call get_new_drive;
  2257.         ELSIF (key2 = 80) AND ( c_line < (line_counter) ) THEN
  2258.       call skip_down;
  2259.         ELSIF (key2 = 72) THEN
  2260.       call skip_up;
  2261.         ELSIF (key2 = 77) THEN
  2262.       call skip_right;
  2263.         ELSIF (key2 = 75) THEN
  2264.       call skip_left;
  2265.     ELSIF (key2 = 71) THEN
  2266.       tof;
  2267.     ELSIF (key2 = 79) THEN
  2268.       eof;
  2269.       down;
  2270.       goto_col(1);
  2271.       call skip_right;
  2272.     ELSIF (key2 =  73) THEN
  2273.       page_up;
  2274.       call skip_up;
  2275.     ELSIF (key2 = 81) THEN
  2276.       page_down;
  2277.       call skip_down;
  2278.     ELSIF (key2 = 250) THEN
  2279.       call mouse_event;
  2280.         ELSE
  2281.             goto check_for_key_macro;
  2282.         END;
  2283.     ELSE
  2284. check_for_key_macro:
  2285.         IF inq_key( key1, key2, DOS_SHELL, xstr ) > 0 THEN
  2286.             pass_key(key1, key2);
  2287.         END;
  2288.     END;
  2289.     call highlight;
  2290.     ret;
  2291.  
  2292.  
  2293. lowlight:
  2294.     IF line_changed THEN
  2295.         draw_attr( wherex, wherey, c_color, 12 );
  2296.     ELSE
  2297.         draw_attr( wherex, wherey, t_color, 12 );
  2298.     END;
  2299.   ret;
  2300.  
  2301.  
  2302. create_return_str:
  2303.   return_str := '';
  2304.   set_mark(2);
  2305. crs_loop:
  2306.   refresh := false;
  2307.   ocol := c_col;
  2308.   return_str := get_word('─┐ |255|9') + '\' + return_str;
  2309.   IF ocol > 1 THEN
  2310.     goto_col(ocol - 13);
  2311.     call skip_up;
  2312.     goto crs_loop;
  2313.   END;
  2314.   refresh := false;
  2315.     IF copy( return_str, 2, 1) <> ':' THEN
  2316.       return_str := cur_drive + ':\' + return_str;
  2317.     END;
  2318.   get_mark(2);
  2319.   ret;
  2320.  
  2321. skip_down:
  2322.   down;
  2323. skip_down2:
  2324.   IF (copy(get_line,c_col,12) = '            ') or at_eol THEN
  2325.     IF c_col > 1 THEN
  2326.       left;
  2327.       IF cur_char = '│' THEN
  2328.         WHILE NOT( at_eof ) and (cur_char = '│') DO
  2329.           DOWN;
  2330.         END;
  2331.         right;
  2332.         IF at_eof THEN
  2333.           goto skip_up;
  2334.         END;
  2335.         goto skip_down2;
  2336.       END;
  2337.       goto_col( c_col - 12);
  2338.       IF at_eof THEN
  2339.         goto skip_up;
  2340.       END;
  2341.       goto skip_down2;
  2342.     ELSE
  2343.       IF (at_eof) THEN
  2344.         goto skip_up;
  2345.       ELSE
  2346.         goto skip_down;
  2347.       END;
  2348.     END;
  2349.   END;
  2350.   ret;
  2351.  
  2352. skip_up:
  2353.   up;
  2354. skip_up2:
  2355.   IF (copy(get_line,c_col,12) = '            ') or at_eol THEN
  2356. {If we don't see the next level, keep looking}
  2357.     IF c_col > 1 THEN
  2358.       left;
  2359.  
  2360.       IF xpos(cur_char,' │',1) THEN
  2361.         WHILE ( c_line > 1 ) and (xpos(cur_char,'│ ',1) <> 0) DO
  2362.           UP;
  2363.         END;
  2364.         RIGHT;
  2365.         goto skip_up2;
  2366.       END;
  2367.  
  2368. {
  2369.       IF cur_char = '│' THEN
  2370.         WHILE ( c_line > 1 ) and (cur_char = '│') DO
  2371.           UP;
  2372.         END;
  2373.         RIGHT;
  2374.         goto skip_up2;
  2375.       END;
  2376. }
  2377.       goto_col( c_col - 12);
  2378.       goto skip_up2;
  2379.     ELSE
  2380.       IF c_line > 1 THEN
  2381.         goto skip_up;
  2382.       END;
  2383.     END;
  2384.   END;
  2385.   ret;
  2386.  
  2387. skip_right:
  2388.   down;
  2389.     refresh := false;
  2390.   goto_col( c_col + 13 );
  2391.   IF at_eol THEN
  2392. skip_right2:
  2393.     eol;
  2394.     left;
  2395.     goto_col( (((c_col - 1) / 13) * 13) + 1 );
  2396.   END;
  2397.   IF at_eof THEN
  2398.     call skip_up;
  2399.   END;
  2400.     refresh := TRUE;
  2401.   ret;
  2402.  
  2403. skip_left:
  2404.   UP;
  2405.   eol;
  2406.   left;
  2407.   goto_col( (((c_col - 1) / 13) * 13) + 1 );
  2408.   ret;
  2409.  
  2410. mouse_event:
  2411.   jx := c_line;
  2412.   ocol := c_col;
  2413.     RM('MOUSE^MouseInWindow');
  2414.   IF (return_int = 1) THEN
  2415.     goto_col( (((c_col - 1) / 13) * 13) + 1 );
  2416.     IF (jx = c_line) AND (ocol = c_col) THEN
  2417.       done := TRUE;
  2418.       call create_return_str;
  2419.     ELSE
  2420.       call skip_up2;
  2421.     END;
  2422.   ELSIF (Mou_Last_Y = Fkey_Row) THEN
  2423.     RM( 'MOUSE^MouseFkey' );
  2424.   ELSIF (Mou_Last_X = Win_X2) THEN
  2425.     RM('MOUSE^HandleScrollBar /EOF=1/L=' + str(line_counter));
  2426.     IF return_int = 1 THEN
  2427.       call skip_right2;
  2428.     ELSIF return_int = 2 THEN
  2429.       call skip_right2;
  2430.     END;
  2431.   ELSIF (Mou_Last_Y > y) AND (Mou_Last_Y <= dd_row) THEN
  2432.     jx := (Mou_Last_Y - y - 1) * ( w / 3);
  2433.     JX :=  (((Mou_Last_X - x) - 1) / 3) + 1 + jx;
  2434.     tstr := parse_str('/DS=',global_str('@DIR_PARMS@'));
  2435.     IF jx <= svl( tstr ) THEN
  2436.       new_drive := str_char( tstr, jx );
  2437.       rebuild := TRUE;
  2438.     END;
  2439.   ELSIF (Mou_Last_X > X) AND (Mou_Last_Y <= (X + W)) THEN
  2440.     RM('CheckEvents /M=1/G=' + event_str + '/#=' + str(event_count));
  2441.     IF RETURN_INT <> 0 THEN
  2442.       RETURN_INT := Parse_Int('/R=', Return_Str );
  2443.       IF return_int = 1 THEN
  2444.         done := TRUE;
  2445.         call create_return_str;
  2446.       ELSIF return_int = 0 THEN
  2447.         done := TRUE;
  2448.       END;
  2449.     END;
  2450.   ELSIF (Mou_Last_X < X) OR (Mou_Last_X > (X + W + 3))
  2451.             OR (Mou_Last_Y < Y) OR (Mou_Last_Y > (WIN_Y2 + 1)) THEN
  2452.         Push_Key(0,250);
  2453.         RETURN_INT := 0;
  2454.     done := TRUE;
  2455.   END;
  2456.   ret;
  2457.  
  2458. highlight:
  2459.   IF (refresh = FALSE) OR (DONE) THEN
  2460.     ret;
  2461.   END;
  2462.     ocol := c_col;
  2463.     goto_col( c_col + 12 );
  2464.     goto_col(ocol);
  2465.     draw_attr( wherex, wherey, m_h_color, 12 );
  2466.     ret;
  2467.  
  2468. get_new_drive:
  2469.     tstr := parse_str('/DS=',global_str('@DIR_PARMS@'));
  2470.         jx := svl(tstr);
  2471.         while jx > 0 DO
  2472.             tstr := str_ins( ':()', tstr, jx + 1 );
  2473.             --jx;
  2474.         END;
  2475.         RM('USERIN^XMENU /B=1/L=Select Drive/M=' + tstr);
  2476.         IF return_int > 0 THEN
  2477.         tstr := parse_str('/DS=',global_str('@DIR_PARMS@'));
  2478.       new_drive := str_char( tstr, return_int );
  2479.       rebuild := TRUE;
  2480.         END;
  2481.         ret;
  2482.  
  2483. reset_line_changed:
  2484.         mark_pos;
  2485.         tof;
  2486.         while NOT(at_eof) DO
  2487.             line_changed := FALSE;
  2488.             down;
  2489.         END;
  2490.         goto_mark;
  2491.         ret;
  2492.  
  2493. exit:
  2494.   tstr := '/W=' + str(tree_window) + '/CD=' + cur_drive;
  2495.   IF premature_done THEN
  2496.         erase_window;
  2497.     tstr := tstr + '/R=1';
  2498.   END;
  2499.   set_global_str('@TREE_PARMS@', tstr);
  2500.   pop_labels;
  2501.   RM('CheckEvents /M=3/G=' + event_str + '/#=' + str(event_count));
  2502.     refresh := false;
  2503.   window_attr := $81;
  2504.     kill_box;
  2505.     switch_win_id( old_window );
  2506.   refresh := old_refresh;
  2507.     file_search_attr := tfsa;
  2508.     insert_mode := tins;
  2509.     tab_expand := ttab;
  2510.     undo_stat := old_undo;
  2511.   mode := tm;
  2512. END_MACRO;
  2513.  
  2514. $MACRO FILEATTR;
  2515. {*******************************MULTI-EDIT MACRO******************************
  2516.  
  2517. Name: FILEATTR
  2518.  
  2519. Description:  Allows user to view/change file attributes.
  2520.  
  2521. Parameters:
  2522.                             Return_Str = The default file name to change file attributes of.
  2523.  
  2524.                (C) Copyright 1989 by American Cybernetics, Inc.
  2525. ******************************************************************************}
  2526.     Def_Str(F_Name[80]);
  2527.     Def_Int(T_Attr);
  2528.  
  2529.     RM('USERIN^QUERYBOX /C=15/W=40/T=FILE TO VIEW////CHANGE ATTRIBUTES/F2=Dir   /L=3');
  2530.     IF Not(Return_Int) THEN
  2531.         Goto EXIT;
  2532.     END;
  2533.  
  2534.     F_Name := Caps(Return_Str);
  2535.  
  2536.     T_Attr := File_Attr(F_Name);
  2537.     IF (Error_Level) THEN
  2538.         RM('MEERROR');
  2539.         Return_Int := 0;
  2540.         Goto EXIT;
  2541.     END;
  2542.     IF (T_Attr and $18) THEN
  2543.         RM('MEERROR^MESSAGEBOX /B=1/M=' + F_Name + 'is a ' +
  2544.                 Copy('Volume LabelDirectory',(((T_Attr and $18) shr 4) * 12) + 1,12) +
  2545.                 '!  Changing attributes is not allowed.');
  2546.         Return_Int := 0;
  2547.         Goto EXIT;
  2548.     END;
  2549.  
  2550.     Set_Global_Str('ISTR_1','/T=On/F=Off');
  2551.     Set_Global_Int('IINT_1',(T_Attr and $20) shr 5);
  2552.     Set_Global_Str('IPARM_1','/C=27/L=1/W=3/H=/TP=5/T=Archive  ');
  2553.     Set_Global_Str('ISTR_2','/T=On/F=Off');
  2554.     Set_Global_Int('IINT_2',T_Attr and $01);
  2555.     Set_Global_Str('IPARM_2','/C=27/L=2/W=3/H=/TP=5/T=Read Only');
  2556.     Set_Global_Str('ISTR_3','/T=On/F=Off');
  2557.     Set_Global_Int('IINT_3',(T_Attr and $02) shr 1);
  2558.     Set_Global_Str('IPARM_3','/C=27/L=3/W=3/H=/TP=5/T=Hidden   ');
  2559.     Set_Global_Str('ISTR_4','/T=On/F=Off');
  2560.     Set_Global_Int('IINT_4',(T_Attr and $04) shr 2);
  2561.     Set_Global_Str('IPARM_4','/C=27/L=4/W=3/H=/TP=5/T=System   ');
  2562.  
  2563.     RM('USERIN^DATA_IN /A=1/W=68/#=4/S=1/X=4/Y=5/T=CHANGE FILE ATTRIBUTES FOR: '
  2564.         + Caps(Truncate_Path(F_Name)));
  2565.  
  2566.  
  2567.     IF Not(Return_Int) THEN
  2568.         Goto EXIT;
  2569.     END;
  2570.  
  2571.     Set_File_Attr(F_Name,(Global_Int('IINT_1') shl 5) + Global_Int('IINT_2') +
  2572.         (Global_Int('IINT_3') shl 1) + (Global_Int('IINT_4') shl 2));
  2573.     IF (Error_Level) THEN
  2574.         RM('MEERROR');
  2575.         Return_Int := 0;
  2576.         Goto EXIT;
  2577.     END;
  2578.  
  2579. EXIT:
  2580. END_MACRO;