home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / MISCTI10.ZIP / TI202.ASC < prev    next >
Encoding:
Text File  |  1988-04-18  |  19.6 KB  |  635 lines

  1. PRODUCT : TURBO GRAPHIX TOOLBOX     NUMBER : 202
  2. VERSION : 1.03A
  3.      OS : PC-DOS
  4.    DATE : March 10, 1986
  5.  
  6.   TITLE : UPDATE FROM VERSION 1.03A TO VERSION 1.05A
  7.  
  8. This  packet contains update information regarding the  following 
  9. topics for the  Turbo Graphix Toolbox. 
  10.  
  11.  
  12. 1) AXIS DRAWING MODULE         AXIS.HGH                  PAGE 3
  13.  
  14. 2) POLYGON DRAWING MODULE      POLYGON.HGH               PAGE 9
  15.  
  16. 3) BAR CHART MODULE            HISTOGRM.HGH              PAGE 13
  17.  
  18. This patch will update version 1.03A of the Turbo Graphix Toolbox 
  19. to  version  1.05A.   The  Turbo Graphix ToolBox is  provided  in 
  20. source code form,  so you can make these changes directly to  the 
  21. source  code.  The reason these changes must be made is that  the 
  22. calls to SelectWindow from procedures DrawAxis,  DrawPolygon, and 
  23. DrawHistogram set the variables X1Glb, Y1Glb, X2Glb, and Y2Glb to 
  24. zero.  These  are the global descriptors for the axis margins  in 
  25. the current window, but they are destroyed upon leaving procedure 
  26. DrawAxis. The changes described in the following pages modify the 
  27. procedures  AXIS.HGH,  POLYGON.HGH,  and HISTOGRM.HGH so that the 
  28. axis margins maintain the correct values. After the modifications 
  29. have been made,  a typical calling sequence for plotting  several 
  30. curves on a common axis frame would be:
  31.  
  32.  
  33.             DrawAxis(...);         { Define the axis frame. }
  34.             DrawPolygon(...);      { Plot first curve.      }
  35.             ResetAxis;             { Set AxisGlb to true.   }
  36.             DrawPolygon(...);      { Plot second curve.     }
  37.             ResetAxis;             { Set AxisGlb to true.   }
  38.             DrawHistogram(...);    { Plot third curve.      }
  39.  
  40.  
  41. If  you make the changes described,  you should change the header 
  42. of all the modules that end in .HGH to read:
  43.  
  44.        "TURBO GRAPHIX version 1.05A"
  45.  
  46. You   should  change  the  module  version  number  in  AXIS.HGH, 
  47. POLYGON.HGH,and HISTOGRM.HGH to read:
  48.  
  49.        "Module version 1.05A"
  50.  
  51. Note: You should also delete the variable declaration:
  52.  
  53.                      Font : IBMFont;
  54.  
  55. from  the file DUMMY.INC . 
  56.                          AXIS.HGH
  57.    (***********************************************************)
  58.    (*                TURBO GRAPHIX version 1.03A              *)
  59.    (*                                                         *)
  60.    (*                   Axis drawing module                   *)
  61.    (*                  Module version  1.03A                  *)
  62.    (*                                                         *)
  63.    (*                  Copyright (C) 1985 by                  *)
  64.    (*                  BORLAND International                  *)
  65.    (***********************************************************)
  66. ****************** ( CHANGE 1.03A TO 1.05A ) ******************
  67.  
  68. procedure DrawAxis(XDens,YDens,XLeft,YTop,XRight,YBottom,XAxis,
  69.                    YAxis:integer;
  70.                    Arrows:boolean);
  71.      x2,y2,MaxExponentX,MaxExponentY,i,ys,xs,Delta,NPoints:integer;
  72.      Difference,Number,s,Fract:real;
  73.      X1RefLoc,X2RefLoc,Y1RefLoc,Y2RefLoc,X1RefLoc2,X2RefLoc2,
  74.      Y1RefLoc2,Y2RefLoc2:integer;
  75.      ClippingLoc,DirectModeLoc,HeaderLoc:boolean;
  76.  
  77.   function StringNumber(X1:real;
  78.                         MaxExponent:integer):wrkstring;
  79.     var y:wrkstring;
  80.     begin
  81.       str(X1*exp(-MaxExponent*ln(10.0)):5:2,y);
  82.       StringNumber:=y;
  83.     end;
  84.  
  85.   function GetExponent(X1:real):integer;
  86.     begin
  87.       GetExponent:=0;
  88.       if X1<>0.0 then
  89.         if abs(X1)>=1.0 then
  90. GetExponent:=trunc(ln(abs(X1))/ln(10.0))
  91.         else GetExponent:=-trunc(abs(ln(abs(X1)))/ln(10.0)+1.0);
  92.     end;
  93.  
  94.   procedure DrawNum(x1,y1,MaxExponent:integer;
  95.                     Number:real);
  96.     var i:integer;
  97.         StrNumber:wrkstring;
  98.     begin
  99.       StrNumber:=StringNumber(Number,MaxExponent);
  100.       y1:=y1-3;
  101.       for i:=1 to 5 do DrawAscii(x1,y1,1,ord(StrNumber[i]));
  102.     end;
  103. (AXIS.HGH cont.)
  104.   function Balance:integer;
  105.     begin
  106.       Balance:=0;
  107.       s:=s+Fract;
  108.       if s>=0 then
  109.        begin
  110.         s:=s-1.0;
  111.         Balance:=1;
  112.        end;
  113.     end;
  114.  
  115.   procedure DrawExponent(x1,y1,MaxExponent:integer);
  116.     var i:integer;
  117.         StrNumber:wrkstring;
  118.     begin
  119.       y1:=y1-3;
  120.       x1:=x1+1;
  121.       DrawAscii(x1,y1,1,49);
  122.       DrawAscii(x1,y1,1,48);
  123.       str(MaxExponent:3,StrNumber);
  124.       y1:=y1-3;
  125.       x1:=x1-7;
  126.       for i:=1 to 3 do DrawAscii(x1,y1,1,ord(StrNumber[i]));
  127.     end;
  128.  
  129.   begin { DrawAxis }
  130.     LineStyleLoc:=LinestyleGlb;
  131.     SetLineStyle(0);
  132.  
  133.     AxisGlb:=true;   <----------{***** DELETE THIS LINE. *****}
  134.  
  135.     DirectModeLoc:=DirectModeGlb;
  136.     DirectModeGlb:=true;
  137.     with window[WindowNdxGlb] do
  138.      begin
  139.       X1RefLoc:=x1;
  140.       X2RefLoc:=x2;
  141.       Y1RefLoc:=y1;
  142.       Y2RefLoc:=y2;
  143.  
  144.                    <---|
  145.       X1Glb:=XLeft;    |
  146.       X2Glb:=XRight;   |--------{***** DELETE THIS BLOCK. *****}
  147.       Y1Glb:=YTop;     |
  148.       Y2Glb:=YBottom;  |
  149.                    <---|
  150.  
  151. (AXIS.HGH cont.)
  152.  
  153. {**** CHANGE THE FOLLOWING CALL TO ReDefineWindow TO READ : 
  154. ****}
  155. {
  156. ReDefineWindow(WindowNdxGlb,x1+XLeft,y1+YTop,x2-XRight,y2-YBottom);
  157. }
  158.  
  159.  ReDefineWindow(WindowNdxGlb,x1+X1Glb,y1+Y1Glb,x2-X2Glb,y2-Y2Glb);
  160.  
  161.       SelectWindow(WindowNdxGlb);
  162.      end;
  163.     if (XDens<0) xor (YDens<0) then
  164.      begin
  165.       HeaderLoc:=HeaderGlb;
  166.       HeaderGlb:=False;
  167.       DrawBorder;
  168.       HeaderGlb:=HeaderLoc;
  169.      end;
  170.     XDens:=abs(XDens);
  171.     YDens:=abs(YDens);
  172.     if XDens>9 then XDens:=0;
  173.     if YDens>9 then YDens:=0;
  174.     xk0:=(X1RefGlb+4) shl 3;
  175.     yk0:=Y2RefGlb-14;
  176.     yk1:=Y1RefGlb+6;
  177.     xk1:=xk0;
  178.     yk2:=yk0;
  179.     xk2:=(X2RefGlb-2) shl 3+7;
  180.     if (XAxis>=0) or (YAxis>=0) then
  181.      begin
  182.       ClippingLoc:=ClippingGlb;
  183.       ClippingGlb:=true;
  184.       with window[WindowNdxGlb] do
  185.        begin
  186.         X1RefLoc2:=x1;
  187.         X2RefLoc2:=x2;
  188.         Y1RefLoc2:=y1;
  189.         Y2RefLoc2:=y2;
  190.        end;
  191.       ReDefineWindow(WindowNdxGlb,X1RefLoc2+4,Y1RefLoc2+6,
  192.       X2RefLoc2-2,Y2RefLoc2-14);
  193.       SelectWindow(WindowNdxGlb);
  194.       DirectModeGlb:=false;
  195.  
  196. (AXIS.HGH cont.)
  197.       if (XAxis>=0) then
  198.        begin
  199.         SetLineStyle(XAxis);
  200.         DrawLine(X1WldGlb,Y1WldGlb+Y2WldGlb,X2WldGlb,
  201.         Y1WldGlb+Y2WldGlb);
  202.         SetLineStyle(0);
  203.        end;
  204.       if (YAxis>=0) then
  205.        begin
  206.         SetLinestyle(YAxis);
  207.         DrawLine(0,Y1WldGlb,0,Y2WldGlb);
  208.         SetLineStyle(0);
  209.        end;
  210.       ClippingGlb:=ClippingLoc;
  211.       DirectModeGlb:=true;
  212.       ReDefineWindow(WindowNdxGlb,X1RefLoc2,Y1RefLoc2,
  213.       X2RefLoc2,Y2RefLoc2);
  214.       SelectWindow(WindowNdxGlb);
  215.      end;
  216.     if YDens>=2 then
  217.      begin
  218.       DrawLine(xk0,yk0,xk1,yk1);   
  219.       if Arrows then
  220.        begin
  221.         DrawLine(xk0,yk1,xk0-4,yk1+4);
  222.         DrawLine(xk0,yk1,xk0+4,yk1+4);   
  223.         dp(xk0,yk1-1);
  224.        end;
  225.      end;
  226.      if XDens>=2 then
  227.       begin
  228.        DrawLine(xk0,yk0,xk2+1,yk2);  
  229.        if Arrows then
  230.         begin
  231.          DrawLine(xk2,yk2,xk2-4,yk2-4);
  232.          DrawLine(xk2,yk2,xk2-4,yk2+4);
  233.         end;
  234.       end;
  235.     if (abs(yk0-yk1)>=35) and (abs(xk2-xk1)>=150) then
  236.      begin
  237.       DrawLine(xk0,yk0,xk0-4,yk0);
  238.       DrawLine(xk0,yk0,xk0,yk0+4);
  239.       Delta:=Y2RefGlb-Y1RefGlb-20;
  240.       NPoints:=Delta div 7;
  241.       NDiff:=Delta-(NPoints shl 3)+NPoints;
  242.       if YDens>=4 then
  243.  
  244.       begin
  245.         if abs(Y2WldGlb)>abs(Y1WldGlb) 
  246.         then MaxExponentY:=GetExponent(Y2WldGlb)
  247.         else MaxExponentY:=GetExponent(Y1WldGlb);
  248.         DrawNum(X1RefGlb shl 3,yk0+1,MaxExponentY,Y1WldGlb);
  249.         if MaxExponentY<>0 
  250.         then DrawExponent(X1RefGlb shl 3+1,yk1+2,MaxExponentY);
  251.       end;
  252.       Fract:=NDiff/NPoints;
  253.       s:=-Fract;
  254.       ys:=yk0;
  255.       Difference:=(Y2WldGlb-Y1WldGlb)/NPoints;
  256.       for i:=1 to NPoints do
  257.        begin
  258.         ys:=ys-7-Balance;
  259.         if (YDens>2) and (ys>Y1RefGlb+13) then
  260.          begin
  261.           Number:=Y1WldGlb+i*Difference;
  262.           DrawLine(xk0,ys,xk0-4,ys);
  263.           if YDens>=4 then if i mod (10-YDens)=0 then
  264.             DrawNum(X1RefGlb shl 3,ys+1,MaxExponentY,Number);
  265.          end;
  266.        end;
  267.       if XDens>=4 then
  268.        begin
  269.         if abs(X2WldGlb)>abs(X1WldGlb) 
  270.         then MaxExponentX:=GetExponent(X2WldGlb)
  271.         else MaxExponentX:=GetExponent(X1WldGlb);
  272.         DrawNum(xk0-14,yk0+10,MaxExponentX,X1WldGlb);
  273.         if MaxExponentX<>0 
  274.         then DrawExponent(xk2-13,yk0+10,MaxExponentX);
  275.        end;
  276.       Delta:=abs(X2RefGlb-X1RefGlb) shl 3-41;
  277.       NPoints:=Delta div 30;
  278.       NDiff:Delta-(NPoints shl 5)+(NPoints shl 1);         
  279.       Fract:=NDiff/NPoints;
  280.       s:=-Fract;
  281.       xs:=xko-1;
  282.       Difference:=(X2WldGlb-X1WldGlb)/NPoints;
  283.       for i:=1 to NPoints do
  284.  
  285.  
  286. (AXIS.HGH cont.)
  287.       begin
  288.         xs:=xs+30+Balance:
  289.         if (XDens>2) and (xs<X2RefGlb shl 3+7-24) then 
  290.          begin
  291.           Number:=X1WldGlb+i*Difference;
  292.           DrawLine(xs,yk0,xs,yk0+4);
  293.           if XDens>=4 then if i mod (10-XDens)=0 then
  294.             DrawNum(xs-14,yk0+10,MaxExponentX,Number);
  295.          end;
  296.        end;
  297.      end;
  298.      ReDefineWindow(WindowNdxGlb,X1RefLoc,Y1RefLoc,
  299.      X2RefLoc,Y2RefLoc);
  300.      SelectWindow(WindowNdxGlb);
  301.      DirectModeGlb:=DirectModeLoc;
  302.      SetLineStyle(LineStyleLoc);
  303.  
  304.                    |---{ ***** INSERT THE FOLLOWING BLOCK. *****}
  305.       <------------|
  306.                    | AxisGlb := true;
  307.                    | X1Glb := XLeft;
  308.                    | X2Glb := XRight;
  309.                    | Y1Glb := YTop;
  310.                    | Y2Glb := YBottom;
  311.                    |
  312.                    |---{ ***************************************}
  313.   end;
  314.  
  315.   {***** APPEND THE FOLLOWING PROCEDURE TO AXIS.HGH *****}
  316.  
  317. procedure ResetAxis;
  318.   begin
  319.     AxisGlb := true;
  320.   end;
  321.  
  322.                         POLYGON.HGH
  323.   (***********************************************************)
  324.   (*                                                         *)
  325.   (*              TURBO GRAPHIX version 1.03A                *)
  326.   (*                                                         *)
  327.   (*                Polygon drawing module                   *)
  328.   (*                 Module version 1.03A                    *)
  329.   (*                                                         *)
  330.   (*                Copyright  (C) 1985 by                   *)
  331.   (*                BORLAND   International                  *)
  332.   (***********************************************************)
  333. ********************( CHANGE 1.03A TO 1.05A )********************
  334.  
  335. procedure DrawPolygon(A:PlotArray;
  336.                       I0,NPoints,Line,Scale,Lines:integer);
  337.   var i,x1,x2,y1,y2,XOffset,YOffset:integer;
  338.       X1RefLoc,Y1RefLoc,X2RefLoc,Y2RefLoc:integer;
  339.       DeltaY,XOs1,XOs2,YOs1,YOs2:integer;
  340.       AutoClip,DirectModeLoc,PlotLine,PlotSymbol:boolean;
  341.  
  342.       X1Loc,Y1Loc,X2Loc,Y2Loc:integer; <--{*** INSERT THIS LINE.
  343. ***}
  344.  
  345.   procedure DrawPointClipped(x,y:integer);
  346.     begin
  347.       if (x1>X1RefGlb shl 3) and (x2<X2RefGlb shl 3+7) then
  348.         if (y1>Y1RefGlb) and (y2<Y2RefGlb) then dp(x,y);
  349.     end;
  350.  
  351.   procedure DrawItem(X,Y:integer);
  352.     var LineStyleLoc:integer;
  353.  
  354.     begin
  355.       LineStyleLoc:=LineStyleGlb;
  356.       SetLineStyle(0);
  357.       case Line of
  358.         2: DrawCrossDiag(X,Y,Scale);
  359.         3,4:
  360. DrawSquareC(X-Scale,Y+Scale,X+Scale,Y-Scale,(Line=4));
  361.         5: DrawDiamond(X,Y,Scale+1);
  362.         6: DrawWye(X,Y,Scale+1);
  363.         1: DrawCross(X,Y,Scale);
  364.         8: DrawCircleDirect(X,Y,Scale+1,False);
  365.         9: begin
  366.              PlotLine:=false;
  367.              if AutoClip then DrawPointClipped(X,Y)
  368.              else dp(X,Y);
  369.            end;
  370.  
  371. (POLYGON.HGH cont.)
  372.  
  373.         7: DrawStar(X,Y,Scale);
  374.        end;
  375.       SetLineStyle(LineStyleLoc);
  376.     end;
  377.  
  378.   begin
  379.     if abs(NPoints-I0)>=2 then
  380.  
  381.      begin
  382.          <-------------|{***** INSERT THE FOLLOWING BLOCK. *****}
  383.                        |
  384.                        | X1Loc := X1Glb;
  385.                        | Y1Loc := Y1Glb;
  386.                        | X2Loc := X2Glb;
  387.                        | Y2Loc := Y2Glb;
  388.                        |
  389.                        |{***************************************}
  390.       DirectModeLoc:=DirectModeGlb;
  391.       DirectModeGlb:=true;
  392.       AutoClip:=(NPoints<0);
  393.       NPoints:=abs(NPoints);
  394.       XOs1:=1;
  395.       XOs2:=1;
  396.       YOs1:=6;
  397.       YOs2:=6;
  398.       if AxisGlb then
  399.        begin
  400.         XOs1:=4;
  401.         XOs2:=2;
  402.         YOs1:=6;
  403.         YOs2:=14;
  404.         if (((X2RefGlb+7-XOs2-X1RefGlb+XOs1) > (XOs1+XOs2) shl 1)
  405. and
  406.            (Y2RefGlb-YOs2-Y1RefGlb+YOs1 > (YOs1+YOs2) shl 1))
  407. then
  408.          begin
  409.           X1RefLoc:=X1RefGlb;
  410.           x1:=X1RefGlb+XOs1+X1Glb;
  411.           Y1RefLoc:=Y1RefGlb;
  412.           y1:=Y1RefGlb+YOs1+Y1Glb;
  413.           X2RefLoc:=X2RefGlb;
  414.           x2:=X2RefGlb-XOs2-X2Glb;
  415.           Y2RefLoc:=Y2RefGlb;
  416.           y2:=Y2RefGlb-YOs2-Y2Glb;
  417.           ReDefineWindow(WindowNdxGlb,x1,y1,x2,y2);
  418.           SelectWindow(WindowNdxGlb);
  419.  
  420. (POLYGON.HGH cont.)
  421.  
  422.            <-----------------|{***** INSERT THE FOLLOWING LINE.
  423. *****}
  424.                              |
  425.                              | AxisGlb := true;
  426.                              |
  427.                              |{**************************************}
  428.          end;
  429.        end;
  430.  
  431.       PlotLine:=(Line>=0);
  432.       PlotSymbol:=(Line<>0);
  433.       Line:=abs(Line);
  434.       Scale:=abs(Scale);
  435.     if Lines<0 then
  436. DeltaY:=trunc(1.0/(abs(Y1WldGlb)+abs(Y2WldGlb)) *
  437.                             abs(Y1WldGlb) *
  438. abs(Y2RefGlb-Y1RefGlb))+1
  439.    else DeltaY:=0;
  440.    if (NPoints<2) and MessageGlb then
  441.      writeln('<DrawPolygon>: too few data pairs -> (NPoints) >=
  442. 2')
  443.    else
  444.     begin
  445.      x1:=WindowX(A[I0,1]);
  446.      y1:=Y2RefGlb+Y1RefGlb-WindowY(A[I0,2]);
  447.      DrawItem(x1,y1);
  448.      if Abs(Lines)=1 then
  449.        if AutoClip then DrawLineClipped(x1,Y2RefGlb-DeltaY,x1,y1)
  450.        else DrawLine(x1,Y2RefGlb-DeltaY,x1,y1);
  451.      for i:=I0+1 to NPoints do
  452.       begin
  453.        x2:=WindowX(A[i,1]);
  454.        y2:=Y2RefGlb+Y1RefGlb-WindowY(A[i,2]);
  455.        DrawItem(x2,y2);
  456.        if Abs(Lines)=1 then
  457.          if AutoClip then
  458. DrawLineClipped(x2,Y2RefGlb-DeltaY,x2,y2)
  459.          else DrawLine(x2,Y2RefGlb-DeltaY,x2,y2);
  460.        if PlotLine then
  461.          if AutoClip then DrawLineClipped(x1,y1,x2,y2)
  462.          else DrawLine(x1,y1,x2,y2);
  463.        x1:=x2;
  464.        y1:=y2;
  465.       end;
  466.     end;
  467.    if AxisGlb then
  468.     begin
  469.      ReDefineWindow(WindowNdxGlb,X1RefLoc,Y1RefLoc,X2RefLoc,Y2RefLoc);
  470.      SelectWindow(WindowNdxGlb);
  471.        <------------------|{***** INSERT THE FOLLOWING BLOCK.
  472. *****}
  473.                           |
  474.                           | X1Glb := X1Loc;
  475.                           | Y1Glb := Y1Loc;
  476.                           | X2Glb := X2Loc;
  477.                           | Y2Glb := Y2Loc;
  478.                           |
  479.                           |{***************************************}
  480.  
  481.      AxisGlb:=false;
  482.    end;
  483.    DirectModeGlb:=DirectModeLoc;
  484.   end
  485.  else error(18,4);
  486. end;
  487.  
  488.  
  489.                           HISTOGRM.HGH
  490.   (***********************************************************)
  491.   (*                                                         *)
  492.   (*               TURBO GRAPHIX version 1.03A               *)
  493.   (*                                                         *)
  494.   (*                    Bar chart module                     *)
  495.   (*                 Module  version  1.03A                  *)
  496.   (*                                                         *)
  497.   (*                 Copyright (C) 1985 by:                  *)
  498.   (*                 BORLAND  International                  *)
  499.   (*                                                         *)
  500.   (***********************************************************)
  501. *******************( CHANGE 1.03A TO 1.05A )
  502. *********************
  503.  
  504. procedure DrawHistogram(A:PlotArray;
  505.                         NPoints:integer;
  506.                         Hatching:boolean;
  507.                         HatchStyle:integer);
  508.  
  509.   var x1,x2,y2,NPixels,Delta,NDiff,YRef:integer;
  510.       LineStyleLoc,i:integer;
  511.       Fract,s,y,YAxis:real;
  512.       DirectModeLoc,Negative:boolean;
  513.       wtemp:WindowType;
  514.        <------------------|{***** INSERT THE FOLLOWING LINE.
  515. *****}
  516.                           |
  517.                           | X1Loc,Y1Loc,X2Loc,Y2Loc:integer;
  518.                           |
  519.                           |{**************************************}
  520.    function Balance:integer;
  521.     begin
  522.       Balance:=0;
  523.       s:=s+Fract;
  524.       if s>=0.0 then
  525.        begin
  526.         s:=s-1.0;
  527.         Balance:=1;
  528.        end;
  529.     end;
  530.  
  531.   begin { DrawHistogram }
  532.     if abs(NPoints)>=2 then
  533.      begin
  534.  
  535. (HISTOGRM.HGH cont.)
  536.  
  537.       <--------------------|{***** INSERT THE FOLLOWING BLOCK.
  538. *****}
  539.                            |
  540.                            | X1Loc := X1Glb;
  541.                            | Y1Loc := Y1Glb;
  542.                            | X2Loc := X2Glb;
  543.                            | Y2Loc := Y2Glb;
  544.                            |
  545.                            |{***************************************}
  546.       LineStyleLoc:=LinestyleGlb;
  547.       SetLineStyle(0);
  548.       if AxisGlb then
  549.        begin
  550.         wtemp:=window[WindowNdxGlb];
  551.         ReDefineWindow(WindowNdxGlb,X1RefGlb+4+X1Glb,
  552.                        Y1RefGlb+6+Y1Glb,
  553.                        X2RefGlb-2-X2Glb,Y2RefGlb-14-Y2Glb);
  554.         SelectWindow(WindowNdxGlb);
  555.  
  556.         <----------------|{*****  INSERT THE  FOLLOWING  LINE.
  557. *****}
  558.                          |
  559.                          | AxisGlb := true;
  560.                          |
  561.                          |{**************************************}
  562.        end;
  563.       DirectModeLoc:=DirectModeGlb;
  564.       DirectModeGlb:=true;
  565.       Negative:=NPoints<0;
  566.       NPoints:=abs(NPoints);
  567.       NPixels:=(X2RefGlb-X1RefGlb) shl 3+7;
  568.       Delta:=NPixels div NPoints;
  569.       NDiff:=NPixels-Delta*NPoints;
  570.       Fract:=NDiff/NPoints;
  571.       s:=-Fract;
  572.       x1:=X1RefGlb shl 3;
  573.       YRef:=trunc(Y2RefGlb+Y1RefGlb-AyGlb);
  574.       if Negative then DrawStraight(x1,X2RefGlb shl 3+7,YRef);
  575.       YAxis:=Y1RefGlb;
  576.       if BYGlb>0 then YAxis:=Y2RefGlb;
  577.  
  578. (HISTOGRM.HGH cont.)
  579.  
  580.       for i:=1 to NPoints do
  581.        begin
  582.         x2:=x1+Delta+Balance;
  583.         y:=A[i,2];
  584.         if not Negative then y:=abs(y);
  585.         if AxisGlb then y2:=trunc(AyGlb+ByGlb*y)
  586.         else y2:=trunc((AyGlb+ByGlb*y)*0.99);
  587.         y2:=Y2RefGlb+Y1RefGlb-y2;
  588.         if not Negative then
  589.          begin
  590.           DrawLine(x1,YAxis,x1,y2);
  591.           DrawStraight(x1,x2,y2);
  592.           DrawLine(x2,y2,x2,YAxis);
  593.           if Hatching then
  594.             if odd(i) then hatch(x1,y2,x2,YAxis,HatchStyle)
  595.             else hatch(x1,y2,x2,YAxis,-HatchStyle);
  596.          end
  597.         else
  598.          begin
  599.           DrawLine(x1,YRef,x1,y2);
  600.           DrawStraight(x1,x2,y2);
  601.           DrawLine(x2,y2,x2,YRef);
  602.           if Hatching then
  603.            if YRef-y2<0 then
  604.             if odd(i) then hatch(x1,YRef,x2,y2,HatchStyle)
  605.             else hatch(x1,YRef,x2,y2,-HatchStyle)
  606.            else if odd(i) then hatch(x1,y2,x2,YRef,HatchStyle)
  607.            else hatch(x1,y2,x2,YRef,-HatchStyle);
  608.          end;
  609.         x1:=x2;
  610.        end;
  611.       if AxisGlb then
  612.        begin
  613.         window[WindowNdxGlb]:=wtemp;
  614.         SelectWindow(WindowNdxGlb);
  615.  
  616. (HISTOGRM.HGH cont.)
  617.  
  618.          <-------------|{***** INSERT THE FOLLOWING BLOCK. *****}
  619.                        |
  620.                        | X1Glb := X1Loc;
  621.                        | Y1Glb := Y1Loc;
  622.                        | X2Glb := X2Loc;
  623.                        | Y2Glb := Y2Loc;
  624.                        |
  625.                        |{***************************************}
  626.  
  627.         AxisGlb:=false;
  628.        end;
  629.       DirectModeGlb:=DirectModeLoc;
  630.       SetLineStyle(LineStyleLoc);
  631.      end
  632.     else error(19,4);
  633.   end;
  634.  
  635.