home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / SYSPC22.ZIP / WINDOW.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1988-01-17  |  1.7 KB  |  113 lines

  1. var winds:array [0..2] of windowrec;
  2.     split,inuse:byte;
  3.  
  4. procedure getcoor;
  5. begin
  6.   with winds[inuse] do begin
  7.     window (x1,y1,x2,y2);
  8.     cx:=wherex;
  9.     cy:=wherey;
  10.     if cy<1 then cy:=1;
  11.     if cy>(y2-y1)+1 then cy:=(y2-y1)+1
  12.   end
  13. end;
  14.  
  15. procedure usewind (n:byte);
  16. begin
  17.   getcoor;
  18.   inuse:=n;
  19.   with winds[n] do begin
  20.     window (x1,y1,x2,y2);
  21.     gotoxy (cx,cy);
  22.     textcolor (color);
  23.     textbackground (0);
  24.     lasty:=y2-y1+1
  25.   end
  26. end;
  27.  
  28. procedure setwind (n:byte; nx1,ny1,nx2,ny2:byte);
  29. var i:integer;
  30. begin
  31.   i:=inuse;
  32.   usewind(n);
  33.   with winds[n] do begin
  34.     x1:=nx1;
  35.     y1:=ny1;
  36.     x2:=nx2;
  37.     y2:=ny2
  38.   end;
  39.   usewind(n);
  40.   if n<>i then usewind(i)
  41. end;
  42.  
  43. procedure initwind (n,nx1,ny1,nx2,ny2,ncolor:byte);
  44. begin
  45.   with winds[n] do begin
  46.     x1:=nx1;
  47.     y1:=ny1;
  48.     x2:=nx2;
  49.     y2:=ny2;
  50.     cx:=1;
  51.     cy:=1;
  52.     color:=ncolor
  53.   end
  54. end;
  55.  
  56. procedure top;
  57. begin
  58.   usewind (1)
  59. end;
  60.  
  61. procedure bottom;
  62. begin
  63.   usewind (2)
  64. end;
  65.  
  66. procedure wholescreen;
  67. begin
  68.   usewind (0)
  69. end;
  70.  
  71. procedure drawsplit;
  72. var cnt:integer;
  73. begin
  74.   usewind (0);
  75.   textcolor (splitcolor);
  76.   gotoxy (1,split);
  77.   for cnt:=0 to 79 do writeturbo (chr(196));
  78.   bottom
  79. end;
  80.  
  81. procedure initwinds;
  82. begin
  83.   splitmode:=false;
  84.   initwind (0,1,1,80,25,splitcolor);
  85.   initwind (2,1,1,80,23,normbotcolor);
  86.   split:=0;
  87.   inuse:=0;
  88.   bottom
  89. end;
  90.  
  91. procedure unsplit;
  92. begin
  93.   setwind (2,1,1,80,23);
  94.   setwind (1,1,1,80,split);
  95.   top;
  96.   clrscr;
  97.   splitmode:=false;
  98.   bottom
  99. end;
  100.  
  101. procedure splitscreen (v:byte);
  102. begin
  103.   if splitmode then unsplit;
  104.   splitmode:=true;
  105.   split:=v;
  106.   drawsplit;
  107.   initwind (1,1,1,80,split-1,normtopcolor);
  108.   setwind (2,1,split+1,80,23);
  109.   top;
  110.   clrscr;
  111.   bottom
  112. end;
  113.