NBPrg40. NBPRG_I.PAS. MiniOS. OpenSource.

NBPrg40. NBPRG_I.PAS. MiniOS. OpenSource.
***************************************

{ Nikita Beloshenko (GNU) 2013  }

{ NBPRG23 -> ... -> NBPRG40 }

{ Nikita Beloshenko (GNU) 2012 }

Unit NBPRG_I;

(************************************************
 *                                              *
 *   NBPRG_I.PAS                                *
 *                                              *
 *   NBPRG_I.                                   *
 *                                              *
 ************************************************)

Interface

Uses Graph;

Procedure NBPRG_I_reload_interf;

Implementation

Const
  MaxNTask_NBPRG_I = 20;

Var
  MenuColor_NBPRG_I : Byte;
  TaskList_NBPRG_I : Array[1..MaxNTask_NBPRG_I] of String;
  PNameList_NBPRG_I : Array[1..MaxNTask_NBPRG_I] of String;
  Ntask_NBPRG_I : Byte;
  TFile_NBPRG_I : Text;

Procedure DrawSmallPicture16x16_NBPRG_I(Var X0,Y0 : Integer; Path : String);
Var
  X,Y : Integer;
  i1,j1 : Byte;
  TFile : Text;
  Color : Byte;
Begin
  assign(TFile, Path);
  reset(TFile);
  For i1 := 1 To 16 Do
  Begin
    For j1 := 1 To 16 Do
    Begin
      X := X0 + j1;
      Y := Y0 + i1;
      Read(TFile, Color);
      PutPixel(X,Y,Color);
    End;
    ReadLn(TFile);
  End;
  close(TFile);
End;

Procedure DrawRectangle_NBPRG_I(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 DrawNtaskRectangle_NBPRG_I;
Var
  x1,y1,x2,y2:Integer;
  j:Byte;
  Path : String;
Begin
  MenuColor_NBPRG_I := red;
  SetColor(MenuColor_NBPRG_I);
  For j:=1 To Ntask_NBPRG_I Do
  Begin
    x1 := 20; y1 := 20 + (j-1)*40;
    x2 := 40; y2 := 40 + (j-1)*40;
    DrawRectangle_NBPRG_I(x1,y1,x2,y2);
    SetTextStyle(2, HorizDir, 5);
    OutTextXY(x2 + 20, y1, TaskList_NBPRG_I[j]);

    Path := PNameList_NBPRG_I[j];
    DrawSmallPicture16x16_NBPRG_I(x1,y1,Path);
  End;

  x1 := 20 - 5;
  x2 := 20 + 20 + 5;
  y1 := 20 - 5;
  y2 := 40 + (Ntask_NBPRG_I - 1)*40 + 5;

  DrawRectangle_NBPRG_I(x1,y1,x2,y2);
End;

Procedure NBPRG_I_reload_interf;
Var
  x1,x2,y1,y2 : Integer;
Begin

  Ntask_NBPRG_I := 0;

  assign(TFile_NBPRG_I,'list.tck');
  reset(TFile_NBPRG_I);
  While Not eof(TFile_NBPRG_I) Do
  Begin
    Inc(NTask_NBPRG_I);
    ReadLn(TFile_NBPRG_I,TaskList_NBPRG_I[Ntask_NBPRG_I]);
    ReadLn(TFile_NBPRG_I,PNameList_NBPRG_I[Ntask_NBPRG_I]);
  End;
  close(TFile_NBPRG_I);

  If NTask_NBPRG_I > MaxNTask_NBPRG_I Then NTask_NBPRG_I := MaxNTask_NBPRG_I;

  { GRAPHICAL CLEAR SCREEN }
  { ADDITION CORECTION OF GRAPHICAL INTERFACE FOR LARGE MONITOR }
  SetFillStyle(0,0);
  Bar(0,0,550,550);

  DrawNtaskRectangle_NBPRG_I;

  SetTextStyle(2, HorizDir, 5);
  OutTextXY(350,300,'Enter - Select task');

  x1 := 350 - 10;
  x2 := 500 + 10;
  y1 := 300 - 10;
  y2 := 300 + 20 + 10;
  DrawRectangle_NBPRG_I(x1,y1,x2,y2);

  OutTextXY(350,50,'Nikita Beloshenko (GNU) 2013');
End;

End.