home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WINDMNGR.ZIP / GROWWIN.INC < prev    next >
Encoding:
Text File  |  1986-01-13  |  3.3 KB  |  96 lines

  1. Procedure Write_Screen(long_string:maxstr; xcoord,ycoord,color: integer);
  2.  
  3. var str_len, real_pos, scr_pos: integer;
  4.  
  5. begin
  6.      str_len:=length(long_string);
  7.      Scr_pos:=0;
  8.      for real_pos:=1 to str_len do
  9.                  if scr_pos < 4001 then
  10.                        begin
  11.                             scr_pos:=((xcoord*2)-1)+(ycoord*160);
  12.                             Page_1[scr_pos]:=ord(copy(long_string,real_pos,1));
  13.                             Page_1[scr_pos+1]:=Color;
  14.                             xcoord:=xcoord+1;
  15.                        end
  16. end;
  17.  
  18. Procedure Grow_Frame(WindowType, UpperLeftX, UpperLeftY, LowerRightX, LowerRightY, color: Integer);
  19. var i: integer;
  20. begin
  21.      Write_Screen(chr(Fc[WindowType,1]),UpperLeftX, UpperLeftY,Color);
  22.      for i:=UpperLeftX+1 to LowerRightX-1 do Write_Screen(chr(Fc[WindowType,2]),i,UpperleftY,color);
  23.      Write_Screen(chr(Fc[WindowType,3]),i+1,UpperleftY,color);
  24.      for i:=UpperLeftY+1 to LowerRightY-1 do
  25.          begin
  26.               Write_Screen(chr(Fc[WindowType,4]),UpperLeftX , i,color);
  27.               Write_Screen(chr(Fc[WindowType,4]),LowerRightX, i,color);
  28.          end;
  29.      Write_Screen(chr(Fc[WindowType,5]),UpperLeftX, LowerRightY, color);
  30.      for i:=UpperLeftX+1 to LowerRightX-1 do Write_Screen(chr(Fc[WindowType,6]),i,LowerrightY,color);
  31.      Write_Screen(chr(Fc[WindowType,7]),i+1,LowerRightY,color)
  32. end ;
  33.  
  34. Procedure Grow_Window(x1,y1,x2,y2,c1,c2,wt:integer);
  35.  
  36.  
  37. var i,j,p1,p2,p3,p4,sl,knt:integer;
  38.  
  39. begin
  40.      p1:=x1+trunc((x2-x1)/2);
  41.      p2:=y1+trunc((y2-(y1))/2);
  42.      p3:=p1;
  43.      p4:=p2;
  44.      Scrn_off;
  45.      Move(real_Screen,page_1,4000);
  46.      Scrn_on;
  47.      Set_page($01);
  48.      if p1>p2 then knt:=trunc((x2-x1)/2)
  49.               else knt:=trunc((y2-y1)/2);
  50.      y1:=y1-1;
  51.      y2:=y2-1;
  52.      x1:=x1+1;
  53.      x2:=x2-1;
  54.      for sl:=1 to round(Knt/3) do
  55.           begin
  56.                   if p1>(x1-2) then
  57.                           p1:=p1-3
  58.                   else
  59.                   if p1>(x1-1) then
  60.                           p1:=p1-2
  61.                   else
  62.                      if p1>x1 then
  63.                           p1:=p1-1;
  64.                   if p3<(x2+2) then
  65.                           p3:=p3+3
  66.                   else
  67.                   if p3<(x2+1) then
  68.                           p3:=p3+2
  69.                   else
  70.                      if p3<x2 then
  71.                           p3:=p3+1;
  72.                   if p2>(y1+2) then
  73.                           p2:=p2-3
  74.                   else
  75.                   if p2>(y1+1) then
  76.                           p2:=p2-2
  77.                   else
  78.                      if p2>y1 then
  79.                           p2:=p2-1;
  80.                   if p4<(y2-2) then
  81.                           p4:=p4+3
  82.                   else
  83.                   if p4<(y2-1) then
  84.                           p4:=p4+2
  85.                   else
  86.                      if p4<y2 then
  87.                           p4:=p4+1;
  88.                Normvideo;
  89.                window(p1,p2,p3,p4);
  90.                clrscr;
  91.                Grow_frame(wt,p1,p2,p3,p4,(c1+(c2*16)));
  92.           end;
  93.     p2:=p2+1;
  94.     p4:=p4+1;
  95.     Add_Window(p1,p2,p3,p4,c1,c2,wt);
  96.     Set_page($00)
  97. end;