home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECOLIBII / ECO_INFO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-03-02  |  9.5 KB  |  299 lines

  1. {$F+}
  2. (*
  3.  
  4.          ┌────────────────[ File Information Report ]────────────────┐
  5.          │                                                           │
  6.          │   Sourcefile for The Fast Commander, V3.51 and higher.    │
  7.          │   All material is protected and licensed.                 │
  8.          │   (C) Copyright 1992 by EUROCON PANATIONAL CORPORATION.   │
  9.          │   Written exclusively by Floor Naaijkens for              │
  10.          │   UltiHouse Software / The ECO Group All Rights Reserved. │
  11.          │   See various documentory files for further information   │
  12.          │   on how to handle these files.                           │
  13.          │                                                           │
  14.          │   Filename:      ECO_INFO.PAS                             │
  15.          │   Version:       3.51                                     │
  16.          │   Last change:   02-05-91  14:14                          │
  17.          │   Dependencies:  FIL·, EXT·, MEM·, SCN·, DOS·, CRT·,      │
  18.          │                  ····, ····, ····, ····, ····, ····.      │
  19.          │                                                           │
  20.          └───────────────────────────────────────────────────────────┘
  21.  
  22. *)
  23.  
  24.  
  25. {$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-}
  26. unit eco_info;
  27. interface uses
  28.   dos, eco_lib
  29.  
  30.   ;
  31.  
  32.  
  33. const
  34.   riba : char = '╢';
  35.   leba : char = '╟';
  36.   veba : char = '║';
  37.   bt   : byte =   0;
  38.  
  39.  
  40. var
  41.   mfree: longint;
  42.  
  43. const
  44.   floppies: boolean = false;
  45.   startdrv: byte    =     3;
  46.  
  47.  
  48.   function __drvstr(drv,x1,x2: byte; f: boolean): string;
  49.   procedure __updatinf(
  50.     header: string;
  51.     var x1, y1, x2, y2: byte; var fullscn: boolean;
  52.     f1, b1, h, f2, b2, scr_f, scr_b, numdrives: byte; var retkey: word;
  53.     show: boolean
  54.   );
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. implementation
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   function __drvstr(drv,x1,x2: byte; f: boolean): string; { drv 1 = a: }
  69.   var
  70.     error       :    word;
  71.     dfr, dsize,
  72.     perc        : longint;
  73.     percstr     :  string;
  74.   
  75.   begin
  76.     if __isdrvfil(chr(drv+64), error) then begin
  77.       dfr := diskfree(drv); dsize := disksize(drv);
  78.       perc := trunc((dfr / dsize) * 100);
  79.       percstr := __juststr(__num(perc), ' ', 2, _right_just_str) + '%';
  80.   
  81.       if f then __drvstr := copy(chr(drv+64) + ' ' +
  82.         __juststr(__pntstr(dsize), ' ', 11, _right_just_str) + ' ' +
  83.         __juststr(__pntstr(dfr), ' ', 11, _right_just_str) + '  ' +
  84.         percstr, 1, x2-x1-1) else if length(__num(dsize)) <= 7 then
  85.         __drvstr := copy(chr(drv+64) + ' ' +
  86.           __juststr(__pntstr(dsize div 1024)+ 'K', ' ', 7, _right_just_str) +' '+
  87.           __juststr(__pntstr(dfr div 1024)+ 'K', ' ', 7, _right_just_str) + ' ' +
  88.           percstr, 1, x2-x1-1
  89.         ) else __drvstr := copy(chr(drv+64) + ' ' +
  90.           __juststr(__pntstr(dsize div 1048576)+'M',' ',7,_right_just_str) +' '+
  91.           __juststr(__pntstr(dfr div 1048576)+ 'M',' ',7,_right_just_str)+' ' +
  92.           percstr, 1, x2-x1-1
  93.         );
  94.     end else __drvstr := 'Drive ' + chr(drv+64) + ' not available'
  95.   end;
  96.   
  97.   
  98.   
  99.   procedure __updatinf;
  100.   var
  101.     msize,
  102.     doslong,
  103.     statusbits,
  104.     mshellfree     :    longint;
  105.     statusflags    : _keystatus;
  106.     key,
  107.     dosmem, extmem :       word;
  108.     st             :     string;
  109.     fullscnlen,
  110.     i,j,hh         :       byte;
  111.     ff             :       text;
  112.     progsize       :  _progsize;
  113.     sts            :     string;
  114.     retkeypressed  :    boolean;
  115.   
  116.   
  117.     procedure infoscn(cur: boolean);
  118.     var i: byte;
  119.   
  120.       function __dirs: string;
  121.       begin
  122.         __dirs := __lo(
  123.           __xlatestr(
  124.             __packfil(
  125.               __normfil(
  126.                 _doscurpath
  127.               ),
  128.               x2-x1-3
  129.             ),
  130.             '\', '/'
  131.           )
  132.         )
  133.       end;
  134.  
  135.     begin
  136.       __clrscn(x1,y1,x2,y2,f1,b1,' ');  __boxscn(x1, y1, x2, y2, bt, f1, b1);
  137.       if cur then __betwscn(x1, x2, y1+00, b1, f1, ' Info ') else
  138.         __betwscn(x1, x2, y1+00, f1, b1, ' Info ');
  139.       __betwscn(x1, x2, y1+01, h,  b1, header);
  140.       __betwscn(x1, x2, y1+02, h,  b1, 'All Rights Reserved');
  141.       __betwscn(x1, x2, y1+03, h,  b1, '(C) MCMXCIII by UltiHouse');
  142.       __betwscn(x1, x2, y1+04, f1, b1, leba + __rep(x2-x1-1, '─') + riba);
  143.       __betwscn(x1, x2, y1+07, f1, b1, leba + __rep(x2-x1-1, '─') + riba);
  144.       __betwscn(x1, x2, y1+07, h,  b1, '[Drives (Size/Free)]');
  145.       __betwscn(x1, x2, y1+04, h,  b1, '[' + __dirs + ']');
  146.   
  147.       if __existfil('dirinfo') then hh := (y2-y1-4) div 2 -1 else begin
  148.         hh := y2-y1-4-1;
  149.         __betwscn(x1,x2,y2-1,h,b1,'No `dirinfo'' file')
  150.       end;
  151.       mfree := maxavail; mshellfree := __sizemem(progsize);
  152.       mshellfree := mshellfree * 16 - 4000;
  153.   
  154.       __totalmem(dosmem, extmem); doslong := longint(dosmem);
  155.       msize := doslong * 1024;
  156.   
  157.       if fullscn then
  158.         __betwscn(x1+1,x2-1,y1+05, f1, b1, 'Mem: ' + __pntstr(msize) +
  159.           ', Free: '+ __pntstr(mfree)) else
  160.         __betwscn(x1+1,x2-1,y1+05, f1, b1, 'Mem: ' + __pntstr(msize div 1024) +
  161.           'K, Free: '+ __pntstr(mfree div 1024) + 'K');
  162.   
  163.       if fullscn then
  164.         __betwscn(x1+1,x2-1,y1+06, f1, b1, 'Shell: ' + __pntstr(mshellfree)) else
  165.         __betwscn(x1+1,x2-1,y1+06, f1, b1, 'Shell: ' +
  166.           __pntstr(mshellfree div 1024) + 'K');
  167.   
  168.       if hh <> (y2-y1-4-1) then begin
  169.         __betwscn(x1, x2, y1+04+hh, f1, b1, leba + __rep(x2-x1-1, '─') + riba);
  170.         __betwscn(x1, x2, y1+04+hh, h,  b1, '[Directory]');
  171.         assign(ff,'dirinfo'); reset(ff); i := 1;
  172.         while (i<=hh+1) and not eof(ff) do begin
  173.           readln(ff,st); __write(x1+1, y1+04+hh+i, f1, b1,
  174.             ' ' + copy(st,1,x2-x1-1-2) + ' ');
  175.           inc(i);
  176.         end; close(ff);
  177.       end;
  178.   
  179.   
  180.        { dec(hh,2); if hh > numdrives then hh := numdrives;}
  181.       j := 1; hh := __min(numdrives, hh-2);
  182.       if floppies then startdrv := 1 else startdrv := 3;
  183.       for i := startdrv to hh do begin
  184.         sts := __drvstr(i,x1,x2,fullscn);
  185.        if copy(sts,1 ,4)<>'Driv' then begin
  186.           inc(j); __write(x1+2, y1+04+2+j,f1,b1, sts)
  187.         end;
  188.       end;
  189.     end; { infoscn }
  190.   
  191.   
  192.   
  193.   begin
  194.     retkeypressed := false;
  195.     infoscn(false);
  196.   
  197.     if show then exit;
  198.     __betwscn(x1, x2, y1+00, b1, f1, ' Info ');
  199.     __attrib(x1+1, y2-1, x2-1, y2-1, scr_f, scr_b);
  200.   
  201.     fullscnlen := x2-x1-1; key := retkey;
  202.     repeat
  203.       if retkey=$0000 then key := __retkey else begin
  204.         key := retkey; retkey := $0000
  205.       end;
  206.       statusbits := __statkey(statusflags);
  207.   
  208.       case key of
  209.   
  210.         _up, _padup: begin
  211.           if statusflags._scrollstate then begin
  212.             if statusflags._capsstate then begin
  213.               if (y1>1) then begin
  214.                 __copyscn(x1,y1,x2,y2,x1,y1-1);
  215.                 {__partscn(scn4, x1, y2, x2, y2, true);}
  216.                 dec(y1); dec(y2);
  217.               end{ else smallbeep;}
  218.             end else begin
  219.               if y2 > y1+12 then begin
  220.                 __copyscn(x1, y2-2, x2, y2, x1, y2-3);
  221.                 __write(x1, y2+0, f1, b1, __rep(x2-x1+1, ' '));
  222.                 dec(y2); 
  223.                 {__partscn(scn4,x1,y2+1,x2,_currows-2, true);}
  224.                 infoscn(true)
  225.               end {else smallbeep;}
  226.             end;
  227.           end; { status }
  228.         end;
  229.   
  230.         _down, _paddown: begin
  231.           if statusflags._scrollstate then begin
  232.             if statusflags._capsstate then begin
  233.               if (y2<_currows-2) then begin
  234.                 __copyscn(x1,y1,x2,y2,x1,y1+1);
  235.                 {__partscn(scn4, x1, y1, x2, y1, true);}
  236.                 inc(y1); inc(y2);
  237.               end {else smallbeep;}
  238.             end else begin
  239.               if y2 < _currows - 2 then begin
  240.                 __copyscn(x1, y2-2, x2, y2, x1, y2-1);
  241.                 __write(x1, y2-2, f1, b1, veba);
  242.                 __write(x2, y2-2, f1, b1, veba);
  243.                 inc(y2);
  244.                 infoscn(true)
  245.               end {else smallbeep;}
  246.             end;
  247.           end; { status }
  248.         end;
  249.   
  250.         _left, _padleft: begin
  251.           if statusflags._scrollstate then begin
  252.             if statusflags._capsstate then begin
  253.               if (x1>1) then begin
  254.                 __copyscn(x1,y1,x2,y2,x1-1,y1);
  255.                 {__partscn(scn4, x2, y1, x2, y2, true);}
  256.                 dec(x1); dec(x2);
  257.               end {else smallbeep;}
  258.             end else begin
  259.               if fullscn then begin
  260.                 {__partscn(scn4,x2-13,y1,x2,y2,true);}
  261.                 fullscn := false; {smallbeep;} 
  262.                 dec(x2, 13); fullscnlen := x2-x1-1;
  263.                 infoscn(true)
  264.               end;
  265.             end;
  266.           end;
  267.         end;
  268.   
  269.         _right, _padright: begin
  270.           if statusflags._scrollstate then begin
  271.             if statusflags._capsstate then begin
  272.               if (x2<_curcolumns) then begin
  273.                 __copyscn(x1,y1,x2,y2,x1+1,y1);
  274.                 {__partscn(scn4, x1, y1, x1, y2, true);}
  275.                 inc(x1); inc(x2);
  276.               end {else smallbeep;}
  277.             end else begin
  278.               if not(fullscn) and (x2<80-13) then begin
  279.                 fullscn := true;{ smallbeep;} inc(x2, 13); fullscnlen := 23;
  280.                 infoscn(true)
  281.               end;
  282.             end;
  283.           end;
  284.         end;
  285.   
  286.         else if (key<>_tab) then retkeypressed := true;
  287.   
  288.       end; { case }
  289.   
  290.     until retkeypressed;
  291.     retkey := key; __betwscn(x1, x2, y1+00, f1, b1, ' Info ');
  292.   
  293.   end; { __updatinf }
  294.   
  295.   
  296.  
  297. end. { unit }
  298.  
  299.