NBPrg40. CALC.PAS. MiniOS. OpenSource.

NBPrg40. CALC.PAS. MiniOS. OpenSource.
***************************************

{ Nikita Beloshenko (GNU) 2013  }

{ NBPRG23 -> ... -> NBPRG40 }

{ Nikita Beloshenko (GNU) 2012 }

Unit Calc;

(**************************************************
 *                                                *
 *   CALC.PAS                                     *
 *                                                *
 *   Calc.                                        *
 *   This is graphical unit for NBPrg23 graphic   * 
 *   subsystem.NpPrg23 is the part of NBPrg40.    *
 *   (and also NBPrg27-33,34,35,36,37,38). This   *
 *   unit is not calculator, just interface for   *
 *   graphical unit CalcWS (calculator).          *
 *                                                *
 **************************************************)

Interface

Uses Graph, Crt, CalcWS;

Procedure DoCalc;

Implementation

Uses NBPRG_I;


Procedure DrawRectangle(Var x1,y1,x2,y2:Integer);
Begin
  Line(x1,y1,x2,y1);
  Line(x2,y1,x2,y2);
  Line(x2,y2,x1,y2);
  Line(x1,y2,x1,y1);
End;

Procedure DoCalc;
Var
  x1,y1,x2,y2 : Integer;
  ch1 : Char;
Begin
  x1 := 200; x2 := 300;
  y1 := 200; y2 := 300;

  SetFillStyle(0,SolidFill);
  Bar(x1,y1,x2,y2);

  ch1:=' ';

  Calc_Run; { FROM WORK_SYS }

  While Ord(ch1)<>27 Do
  Begin
    { NBPRG GRAPHICAL INTERFACE REBUILDING. }
    NBPRG_I_reload_interf;

    SetColor(2);
    DrawRectangle(x1,y1,x2,y2);
    SetTextStyle(2, HorizDir, 5);
    OutTextXY(x1 + (x2-x1) Div 4,
              y1 + (y2-y1) Div 4,'Calc');

    ch1 := ReadKey;
  End;
  SetFillStyle(0,SolidFill);
  Bar(x1,y1,x2,y2);
End;

End.