{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�                                                                            �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�   Supplied by: Scythale             � �    Written by: Vector Sigma        �
�    Cracked by: None                 � �    Protection: None                �
�   Packaged by: MoX                  � 쿒raphics/Sound: GUI                 �
�  Release Date: 08/01/95             � �  Program Type:                     �
�        Rating:                      � �    # of Disks:                     �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
 draw_ratio_box et pct_done faites le 23/12/94
 input,choose_file,exist,file_open le 23/12/94
 title_cadre le 24/12/94
 choice_box le 25/12/94
 BGchoose_file le 08/01/95, corrig괻 le 24/02/95.
}
Unit BlueGui_;
Interface
CONST
 VER_BGUI = 'BlueGui v1.1, SourceWare (C) 94-95 XTECH.';

var
 couleur_light:byte;
 couleur_ppale:byte;

 procedure palette(index,r,g,b:byte);
 procedure noir_blanc;
 procedure couleur;
 function  light(color:byte):byte;{couleur legere}
 function  Max(x,y:integer):integer;
 function  Min(x,y:integer):integer;
 function  get_middle_screen_x:integer;{renvoie le milieu en X}
 function  get_middle_screen_Y:integer;{renvoie le milieu en Y}
 procedure exicen(x,y:integer);{bouton de fermeture}
 procedure rect_relief_inf(x1,y1,x2,y2:word;color:byte);{relief superieur}
 procedure rect_relief_sup(x1,y1,x2,y2:word;color:byte);{relief inf굍ieur}
 procedure static_line(x1,y1,x2:word;color:byte);{ligne relief}
 procedure cadre(x1,y1,x2,y2:word;color:byte);{cadre}
 procedure plaque(x1,y1,x2,y2:word;color:byte);{plaque relief}

 procedure input_box(x1,y1,x2:word;color:byte;msg:string);{boite de saisie}
 procedure text_input_box(x1,y1,x2:word;color:byte;message:string;color_msg:byte);
 function  text_input(x1,y1,x2:word;color:byte;message:string):string;{fenetre d'edition avec titre}
 function  input(x1,y1,x2:word;color:byte;mot:string):string;{boite de saisie, renvoie la chaine saisie}

 procedure draw_ratio_box(x1,y1,x2:word;color:byte);{boite de pourcentage}
 procedure pct_done(pct:word);{pour boite de pourcentage, l'augmente}

 procedure combon(x1,y1:word;color:byte);
 procedure combof(x1,y1:word;color:byte);
 procedure affiche_file(x1,y1,x2,y2:word;color:byte;var file_name:string);{affiche les fichiers disponibles dans file_name}
 function  exist(fic:string):boolean;{existence d'un fichier}
 function  file_open(color:byte;init_string:string):string;{fen늯re pour choisir un fichier}
 function  file_open_(color:byte;init_string:string):string;{fen늯re pour choisir un fichier}

 procedure a_win(x1,y1,x2,y2:word;color:byte;savewin:boolean;msg:string;special:boolean);{fen늯re effacable}
 procedure Windc;{efface la fenetre}

 procedure static_win(x1,y1,x2,y2:word;color:byte;savewin:boolean);{fenetre message}
 procedure StatC;{efface la fenetre}

 procedure draw_button(x1,y1,long,larg:word;color:byte;txt:string);{dessine un bouton}
 procedure press_button(x1,y1,long,larg:word;color:byte;txt:string);{l'enfonce}

 procedure title_cadre(x1,y1,x2,y2:word;color:byte;title:string);{trace un cadre titr�}

 function  choice_box(x1,y1:word;p:pointer;size:byte;color:byte):word;{boide de choix, entrer adr tableau, nb elem tableau}

 function  BGchoose_file(x1,y1,x2,y2:word;color:byte;var file_name:string):string;
 function  BGfile_open(color:byte;init_string:string):string;

 procedure BG_login_box;{dessine une boite de saisie d'acc둺}

 procedure Ecrit_(x,y:word;mot:string;souligne:boolean); { ecriture am굃ior괻 }
 procedure Cadre_title(x1,y1,x2,y2:word;color:byte;titre:string;t_c:byte); { cadre de sous plaque }


Implementation
uses graph,crt,dos;
type
  RGBRec = record
    RedVal, GreenVal, BlueVal : Integer;
     { Intensity values (values from 0 to 63) }
    Name: String;
    ColorNum: Integer;
     { The VGA color palette number as mapped into 16 color palette }
  end;
const  Colors : array[0..MaxColors] of RGBRec = (
   ( RedVal:0;GreenVal:0;BlueVal:0;Name:'Black';ColorNum: 0),
   ( RedVal:0;GreenVal:0;BlueVal:40;Name:'Blue';ColorNum: 1),
   ( RedVal:0;GreenVal:40;BlueVal:0;Name:'Green';ColorNum: 2),
   ( RedVal:0;GreenVal:40;BlueVal:40;Name:'Cyan';ColorNum: 3),
   ( RedVal:40;GreenVal:7;BlueVal:7;Name:'Red';ColorNum: 4),
   ( RedVal:40;GreenVal:0;BlueVal:40;Name:'Magenta';ColorNum: 5),
   ( RedVal:40;GreenVal:30; BlueVal:0;Name:'Brown';ColorNum: 20),
   ( RedVal:49;GreenVal:49;BlueVal:49;Name:'Light Gray';ColorNum: 7),
   ( RedVal:26;GreenVal:26;BlueVal:26;Name:'Dark Gray';ColorNum: 56),
   ( RedVal:0;GreenVal:0;BlueVal:63;Name:'Light Blue';ColorNum: 57),
   ( RedVal:9;GreenVal:63;BlueVal:9;Name:'Light Green';ColorNum: 58),
   ( RedVal:0;GreenVal:63;BlueVal:63;Name:'Light Cyan';ColorNum: 59),
   ( RedVal:63;GreenVal:10;BlueVal:10;Name:'Light Red';ColorNum: 60),
   ( RedVal:44;GreenVal:0;BlueVal:63;Name:'Light Magenta';ColorNum: 61),
   ( RedVal:63;GreenVal:63;BlueVal:18;Name:'Yellow';ColorNum: 62),
   ( RedVal:63; GreenVal:63; BlueVal:63; Name: 'White'; ColorNum: 63)
  );

Var
   P1,P2,P3: POINTER;
    mx1,my1:integer;
    mx2,my2:integer;
    mx3,my3:integer;

      Size_1,
      size2: WORD;
    ratioX1,
    ratioX2,
    ratioY1: word;
  open_win1,
  open_win3,
   open_win2:boolean;
   BG_save_color,
   BG_save_BK : word;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function light(color:byte):byte;
begin
if (color=8) then light:=color-1
  else
   light:=color+8;
if (color=couleur_ppale) then
 light:=couleur_light;

end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure palette(index,r,g,b:byte);assembler;
asm
mov dx,$3C8
mov al,index
out dx,al
inc dx
mov al,r
out dx,al
mov al,g
out dx,al
mov al,b
out dx,al
end;

{procedure set_palette;
begin

end;}
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure noir_blanc;
var i:byte;
begin
  for i:=1 to 7 do palette(i,63*(i+3) div 10,63*(i+3) div 10,63*(i+3) div 10);
  palette(20,56,56,56);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure couleur;
var i:byte;
begin
{ Restore original colors to the palette. The default colors might vary
   depending upon the initial values used by your video system.}
  for i := 0 to 15 do
    with Colors[i] do
      SetRGBPalette(ColorNum, RedVal, GreenVal, BlueVal);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE _save_colors()     � �                           by XTech �
�                                     � �                           15/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure _save_colors;
begin
 BG_save_color:=getcolor;
 BG_save_BK:=getbkcolor;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE _restore_colors()  � �                           by XTech �
�                                     � �                           15/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure _restore_colors;
begin
 setcolor(BG_save_color);
 setbkcolor(BG_save_BK);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure exicen(x,y:integer);
begin
 setcolor(lightblue);
 setfillstyle(solidfill,blue);
 bar(x+1,y+1,x+14,y+14);
 setcolor(black);
 line(x+15,y+1,x+15,y+15);
 line(x+1,y+15,x+15,y+15);
 setcolor(lightblue);
 line(x+1,y,x+14,y);
 line(x,y+1,x,y+15);
 setcolor(black);
 line(x+3,y+3,x+13,y+3);
 line(x+3,y+3,x+8,y+13);
 line(x+8,y+13,x+13,y+3);
 setcolor(lightblue);
 line(x+8,y+13,x+13,y+3);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure CADRE(x1,y1,x2,y2:word;color:byte);
var i:integer;
begin
 SetLineStyle(SolidLn, 0, NormWidth);
 setcolor(color);
 for i:=0 to 4 do
  begin
   rectangle(x1+i,y1+i,x2-i,y2-i);
  end;
 setcolor(light(color));
 rect_relief_sup(x1,y1,x2,y2,color);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE exist()            � �                           by XTech �
�                                     � �                           16/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function exist(fic:string):boolean;
var f:file of byte;
begin
 assign(f,fic);
 {$I-}reset(f);{$I+}
 if IOresult=0 then
  begin
   close(f);
   exist:=true;
  end
 else
  exist:=false;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE get_middle_screen_x� �                           by XTech �
�                                     � �                           16/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Renvoie le milieu de l'괹ran graphique sur X                          �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function get_middle_screen_x:integer;
begin
 get_middle_screen_x:=(GetMaxX div 2)
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE get_middle_screen_Y� �                           by XTech �
�                                     � �                           16/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Renvoie le milieu de l'괹ran graphique sur Y                          �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function get_middle_screen_y:integer;
begin
 get_middle_screen_y:=(GetMaxY div 2)
end;

{袴袴袴[ Ecrit en relief et soulign�]袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴�20/05/95�}
procedure Ecrit_(x,y:word;mot:string;souligne:boolean);
var xxx:integer;
     mt:string;
 j,i,cl:integer;
begin
 mt:=mot;

 if pos('~',mot)>0 then
   delete(mot,pos('~',mot),1);

 cl:=getcolor;
 setcolor(black);
 outtextxy(x+1,y+1,mot);
 if souligne then
   line(x+1,y+2,x+textwidth(mot)+1,y+2);
 setcolor(cl);
 outtextxy(x,y,mot);
 if souligne then
   line(x,y+1,x+textwidth(mot),y+1);
 if pos('~',mt)>0 then
   begin
     setcolor(lightgreen);
     outtextxy(x+textwidth( copy(mot,1, pos('~',mt) -1) ),y,mot[pos('~',mt)]);
     line(x+textwidth( copy(mot,1, pos('~',mt) -1) ),y+9,x+textwidth( copy(mot,1, pos('~',mt) ) ),y+9);
   end;
 setcolor(cl);
end;

{袴袴袴[ Cadre de titre ]袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴�20/05/95�}
procedure cadre_title(x1,y1,x2,y2:word;color:byte;titre:string;t_c:byte);

begin
 setcolor(black);
 line(x1+6-1,y1-1,x1-1,y1-1);
 line(x1-1,y1-1,x1-1,y2+1);
 line(x1-1,y2+1,x2+1,y2+1);
 line(x2+1,y2+1,x2+1,y1-1);
 line(x2+1,y1-1,x1+6-1+6+textwidth(titre),y1-1);

 setcolor(color);
 line(x1+6,y1,x1,y1);
 line(x1,y1,x1,y2+1);
 line(x1,y2+2,x2+2,y2+2);
 line(x2+2,y2+2,x2+2,y1);
 line(x2,y1,x1+6+6+textwidth(titre),y1);

 setcolor(t_c);
 ecrit_(x1+10,y1-textheight(titre) div 2,titre,false);

end;

{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function file_open(color:byte;init_string:string):string;
var file_name,fic:string;
begin
 a_win(105,125,430,400,color,true,'-= Ouvrir =-',false);
 SetTextStyle(DefaultFont, HorizDir, 1);
 outtextXY(112,155,'Ouvrir');
 file_name:=init_string;
 affiche_file(112,181,424,394,color,file_name);
 REPEAT
 REPEAT
  fic:=input(112,165,424,color,file_name);
  if fic=#13 then file_name:=BGfile_open(color,file_name);
 UNTIL ((pos('*',file_name)<=0)){and (file_name<>''));}
 UNTIL (exist(file_name));

 file_open:=file_name;
 windc;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function file_open_(color:byte;init_string:string):string;
var file_name,fic:string;
begin
 static_win(95,135,440,410,color,true);
 title_cadre(104,151,431,401,blue,'Ouvrir');
 file_name:=init_string;
 affiche_file(112,181,424,394,color,file_name);

 REPEAT
 REPEAT
  fic:=input(112,165,424,color,file_name);
  if fic=#13 then file_name:=BGfile_open(color,file_name)
   else
  begin
   file_name:=fic;
   affiche_file(112,181,424,394,color,file_name);
  end;
 UNTIL ((pos('*',fic)<=0)) ; {and (file_name<>''));}
 UNTIL (exist(fic));

 file_open_:=fic;
 statc;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure static_line(x1,y1,x2:word;color:byte);
begin
 SetLineStyle(SolidLn, 0, NormWidth);
 if (color=8) then setcolor(color-1)
  else
 setcolor(color+8);
 line(x1,y1,x2,y1);
 setcolor(black);
 line(x1,y1+1,x2-1,y1+1);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure static_win(x1,y1,x2,y2:word;color:byte;savewin:boolean);
var i : integer;
begin
 if savewin then
  begin
   mx2:=x1;my2:=y1;
   Size2 := ImageSize(x1,y1,x2,y2);
   GetMem(P2, Size2);
   GetImage(x1,y1,x2,y2,P2^);
   open_win2:=true;
  end;
 SetLineStyle(SolidLn, 0, NormWidth);
 setcolor(blue);
 for i:=0 to 2 do
  rectangle(x1+i,y1+i,x2-i,y2-i);
 setfillstyle(solidfill,color);
 setcolor(color);
 bar(x1+3,y1+3,x2-3,y2-3);
 {relief bord sup}
 setcolor(lightblue);
 line(x1,y1,x2,y1);
 line(x1,y1,x1,y2);
 {relief bord inf}
 setcolor(black);
 line(x1,y2,x2,y2);
 line(x2,y1,x2,y2);
 {relief interieur inf}
 setcolor(lightblue);
 line(x1+2,y2-2,x2-2,y2-2);
 line(x2-2,y1+2,x2-2,y2-2);
 {relief interieur sup}
 setcolor(black);
 line(x1+2,y1+2,x2-2,y1+2);
 line(x1+2,y1+2,x1+2,y2-2);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure StatC;
 begin;
   if open_win2 then
    begin
     PutImage(mx2,my2, P2^, NormalPut);
     freemem(P2,size2);
     open_win2:=false;
    end;
 end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure rect_relief_inf(x1,y1,x2,y2:word;color:byte);
begin
 setcolor(light(color));
 line(x1+1,y2,x2,y2);
 line(x2,y1+1,x2,y2);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure rect_relief_sup(x1,y1,x2,y2:word;color:byte);
begin
 setcolor(light(color));
 line(x1,y1,x2,y1);
 line(x1,y1,x1,y2);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure affiche_file(x1,y1,x2,y2:word;color:byte;var file_name:string);
var
 DirInfo : searchrec;
   count : integer;
     ord : integer;
begin
 SetLineStyle(SolidLn, 0, NormWidth);
 setfillstyle(solidfill,black);
 setcolor(black);
 bar(x1,y1,x2,y2);
 rect_relief_inf(x1,y1,x2,y2,color);

 setcolor(white);
 FindFirst('*.*', Directory, DirInfo);
 count:=0;
 ord:=0;
 while (DosError = 0) do
 begin
   if (((dirinfo.attr and directory)<>0)and (dirinfo.name<>'.')) then
    begin
     outtextXY(x1+2+ord,y1+5+count,DirInfo.Name+'\');
     FindNext(DirInfo);
     inc(count,textheight('F'));
     if ((count+y1+5)>=(y2-4)) then
      begin
       inc(ord,textwidth('FICHIERS.MAX '));
       if ((ord+x1+textwidth('FICHIERS.MAX'))>(x2)) then exit;
       count:=0;
      end;
    end;
   FindNext(DirInfo);
 end;
 FindFirst(file_name, Anyfile, DirInfo);
 while DosError = 0 do
 begin
   outtextXY(x1+2+ord,y1+5+count,DirInfo.Name);
   FindNext(DirInfo);
   inc(count,textheight('F'));
   if ((count+y1+5)>=(y2-4)) then
    begin
     inc(ord,textwidth('FICHIERS.MAX '));
     if ((ord+x1+textwidth('FICHIERS.MAX'))>(x2)) then exit;
     count:=0;
    end;
 end;
 if ((ord=0)and(count=0)) then outtextXY(x1+(x2-x1) div 2-textwidth('No File Found') div 2,
     y1+((y2-y1) div 2)-textheight('N') div 2,'No File Found');

end;
{****************************************************************************}
function Max(x,y:integer):integer;
begin
 if (x>y) then max:=x else max:=y;
end;
function Min(x,y:integer):integer;
begin
 if (x<y) then min:=x else min:=y;
end;
{****************************************************************************}
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function BGchoose_file(x1,y1,x2,y2:word;color:byte;var file_name:string):string;
type
 string12=string[12];
var
 DirInfo : searchrec;
   count : integer;
     ord : integer;
     lig : integer;
 fichiers: ARRAY[0..400] of ^string12;
 Max_fich: word;
 col_ref : integer;
      pc : byte;
 col_rel : integer;
     key : char;
       i : integer;
  nb_col : integer;
{procedure Interne}
procedure bar_(pc:byte;pos:boolean);
var  ofs : word;
begin
 ofs:=col_rel*textwidth('FICHIERS.MAX ');
 if pos then SetFillStyle(solidFill, light(color))
  else
    SetFillStyle(solidFill, black);

 bar(x1+2+ofs,y1+4+pc*(textheight('I')),
     x1+textwidth('FICHIERS.MAX')+ofs+4,y1+4+(pc+1)*(textheight('I')));

 if pos then
  begin
   setcolor(white);
   outtextXY(x1+2+1+ofs,y1+5+pc*(textheight('I')),fichiers[pc+(col_ref+col_rel)*26]^);
  end
 else
  begin
   setcolor(white);
   outtextXY(x1+2+ofs,y1+5+pc*(textheight('I')),fichiers[pc+(col_ref+col_rel)*26]^);
  end;
end;
{Procedure Interne}
procedure Maj(count:word);
var ii:integer;
begin
 setcolor(black);
 bar(x1,y1,x2,y2);
 rect_relief_inf(x1,y1,x2,y2,color);
 setcolor(white);
 if count=1 then count:=0;
 lig:=0;
 ord:=0;
 for ii:=count to Min(count+104,Max_fich) do
 begin
   outtextXY(x1+2+ord,y1+5+lig,fichiers[ii]^);
{   FindNext(DirInfo);}
   inc(lig,textheight('I'));
   if ((lig+y1+5)>=(y2-4)) then
    begin
     inc(ord,textwidth('FICHIERS.MAX '));
     if ((ord+x1+textwidth('FICHIERS.MAX'))>(x2)) then exit;
     lig:=0;
    end;
 end;
end;

begin

 for i:=0 to 400 do new(fichiers[i]);
 SetTextStyle(DefaultFont, HorizDir, 1);
 SetLineStyle(SolidLn, 0, NormWidth);
 setfillstyle(solidfill,black);
 setcolor(black);
 bar(x1,y1,x2,y2);
 rect_relief_inf(x1,y1,x2,y2,color);
 setcolor(white);

 FindFirst('*.*', Directory, DirInfo);
 Max_fich:=0;
 while ((DosError = 0)and(max_fich<400)) do
 begin
   if (((dirinfo.attr and directory)<>0)and (dirinfo.name<>'.')) then
    begin
     fichiers[Max_fich]^:=DirInfo.Name+'\';
     inc(Max_fich);
    end;
   FindNext(DirInfo);
 end;

 FindFirst(file_name, Anyfile, DirInfo);
 while ((DosError = 0)and(max_fich<400)) do
 begin
   if (dirinfo.attr and directory)=0 then
    begin
     fichiers[Max_fich]^:=DirInfo.Name;
     inc(Max_fich);
    end;
   FindNext(DirInfo);
 end;
 dec(Max_fich);
 maj(0); {init screen}
{*}
 pc:=0;
 col_rel:=0;
 col_ref:=0;
 bar_(pc,true);
 repeat
  key:=readkey;
  bar_(pc,false);

  if key=#27 then {ESCAPE}
   begin
    pc:=0;
    key:=#13;
   end
  else
  if key=#0 then
   begin
    key:=readkey;
   CASE key of
    #71 : begin
           pc:=0; {home}
           col_rel:=0;
           col_ref:=0;
           maj(col_ref);
          end;
    #72 : begin {up}
           if pc=0 then
            begin
             if col_rel>0 then
              begin
               dec(col_rel);
               pc:=25;
              end
             else
            if (col_ref>0) then
              begin
               dec(col_ref);
               maj(col_ref*25+1);
               col_rel:=0;
               pc:=25;
              end;
            end
           else
            dec(pc);
           bar_(pc,true);
          end;
    #73 : begin  {pgup}
           pc:=0;
          end;
    #75 : begin  {� gauche}
           if (col_rel>0) then
            begin
             dec(col_rel);
            end
           else
            if (col_ref>0) then
            begin
             dec(col_ref);
             col_rel:=0;
             maj((col_ref)*26);
            end;
          end;
    #77 : begin  {� droite}
           if ((col_ref+col_rel+1)*26+pc)>(max_fich) then
            if ((col_ref+col_rel)*26+pc)<>(max_fich) then
              begin
               nb_col:=(max_fich div 26);
               pc:=(max_fich mod 26);
               col_rel:=min(max_fich div 26,2);
               if (nb_col-2)>0 then
                col_ref:=nb_col-2
               else
                col_ref:=0;
                maj((col_ref)*26);
                bar_(pc,true);
              end;

           if (col_rel<2) then
            begin
             if ((col_ref+col_rel+1)*26+pc)<=(max_fich) then
              inc(col_rel)
            end
           else
            begin
             if (((col_ref+1)+2)*25+pc)<max_fich then
             begin
              inc(col_ref);
              col_rel:=2;
              maj((col_ref)*26);
             end;
            end;
          end;

    #79 : begin  {fin}
           nb_col:=(max_fich div 26);
           pc:=(max_fich mod 26);
           col_rel:=min(max_fich div 26,2);

           if (nb_col-2)>0 then
            col_ref:=nb_col-2
           else
             col_ref:=0;

           maj((col_ref)*26);
           bar_(pc,true);
          end;

    #80 : begin {down}
           if pc=25 then
            begin
             if col_rel<2 then
              begin
               inc(col_rel);
               pc:=0;
              end
             else
              begin
               inc(col_ref);
               maj(col_ref*25+1);
               col_rel:=2;
               pc:=0;
              end;
            end
           else
            begin
             if ((col_rel+col_ref)<>(max_fich div 26)) then
              inc(pc)
             else
              if (pc<>(max_fich mod 26)) then inc(pc);
            end;
           bar_(pc,true);
          end;
    #81 : begin  {pgdn}
           if (col_rel+col_ref)<(max_fich div 26) then
            pc:=25
           else
            pc:=(max_fich mod 26);
          end;
  end;{CASE}
    end;
  bar_(pc,true);


 until (key=#13);
 if ((ord=0)and(count=0)) then outtextXY(x1+(x2-x1) div 2-textwidth('No File Found') div 2,
     y1+((y2-y1) div 2)-textheight('N') div 2,'No File Found');
 BGchoose_file:=fichiers[pc+(col_ref+col_rel)*26]^;
 for i:=0 to 400 do dispose(fichiers[i]);
end;
{****************************************************************************}
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function BGfile_open(color:byte;init_string:string):string;
var file_name,fic:string;
    f:file;
    attr:word;
begin
 {static_win(95,135,440,410,color,true);
 SetTextStyle(DefaultFont, HorizDir, 1);
 outtextXY(112,155,'Ouvrir');           }
 file_name:=init_string;

 repeat
  fic:=BGchoose_file(112,181,424,394,color,file_name);
  if pos('\',fic)<>0 then delete(fic,pos('\',fic),1);
  Assign(F,fic);
  GetFAttr(F, Attr);
  if (attr and directory)<>0 then
   {$i-}chdir(fic);{$i+}
 until (attr and directory)=0;
 BGfile_open:=fic;
{ StatC;}
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure plaque(x1,y1,x2,y2:word;color:byte);
var i:integer;
begin
 setfillstyle(solidfill,color);
 SetLineStyle(SolidLn, 0, NormWidth);
 bar(x1+1,y1+1,x2-1,y2-1);
 rect_relief_sup(x1+1,y1+1,x2-1,y2-1,color);
 setcolor(black);
 rectangle(x1,y1,x2,y2);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure draw_ratio_box(x1,y1,x2:word;color:byte);
var i:integer;
begin
 ratioX1:=x1;
 ratioX2:=x2;
 ratioY1:=y1;
 setfillstyle(solidfill,black);
 SetLineStyle(SolidLn, 0, NormWidth);
 setcolor(black);
 bar(x1,y1,x2,y1+15);
 if (color=8) then setcolor(color-1)
  else
 setcolor(color+8);
 line(x1+1,y1+15,x2,y1+15);
 line(x2,y1+15,x2,y1+1);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure pct_done(pct:word);
begin
 if ((pct>0) and (pct<=100)) then
 begin
  setfillstyle(solidfill,white);
  bar(ratioX1+3,ratioY1+2,ratioX1+(((ratioX2-2)-ratioX1)*pct)div 100,ratioY1+13);
 end;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE input_box()        � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Affiche une boite de saisie inactive.                                 �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure input_box(x1,y1,x2:word;color:byte;msg:string);
begin
 _save_colors;
 setfillstyle(solidfill,black);
 SetLineStyle(SolidLn, 0, NormWidth);
 setcolor(black);
 bar(x1,y1,x2,y1+15);

 setcolor(light(color));
 line(x1+1,y1+15,x2,y1+15);
 line(x2,y1+15,x2,y1+1);

 setcolor(white);
 outtextXY(x1+2,y1+5,msg);
 _restore_colors;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE text_input_box()   � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Affiche titre+boite de saisie inactive.                               �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure text_input_box(x1,y1,x2:word;color:byte;message:string;color_msg:byte);
begin
 SetTextStyle(DefaultFont, HorizDir, 1);
 setcolor(color_msg);
 outtextXY(x1,y1,message);
 input_box(x1+10+textwidth(message),y1-5,x2-3,color,'');
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE text_input()       � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: affiche titre+boite de saisie active.                                 �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function text_input(x1,y1,x2:word;color:byte;message:string):string;
begin
 SetTextStyle(DefaultFont, HorizDir, 1);
 setcolor(White);
 outtextXY(x1,y1,message);
 text_input:=input(x1+10+textwidth(message),y1-5,x2-3,color,'');
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE Input()            � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Lit un STRING dans une boite de saisie.                               �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function input(x1,y1,x2:word;color:byte;mot:string):string;
var key:char;
    bs,oldstr:string;
    PC:byte;
{Procedure Interne}
procedure clear_pc;
begin
 setcolor(black);
 outtextXY(x1+2+textwidth(copy(mot,1,pc)),y1+7,'_');
end;
{Procedure Interne}
procedure clear_box;
begin
 bar(x1+2,y1+2,x2-2,y1+13);
end;
{D괷ut}
begin
 _save_colors;
 setfillstyle(solidfill,black);
 SetLineStyle(SolidLn, 0, NormWidth);
 setcolor(black);
 bar(x1,y1,x2,y1+15);

 if (color=8) then setcolor(color-1)
  else
 setcolor(color+8);{relief inf}
 line(x1+1,y1+15,x2,y1+15);
 line(x2,y1+15,x2,y1+1);

 SetTextStyle(DefaultFont, HorizDir, 1);
 setcolor(White+blink);
 oldstr:=mot;
 pc:=0{length(mot)};

 repeat
  setcolor(white);
  outtextXY(x1+2,y1+5,mot);
  setcolor(white);
  outtextXY(x1+2+textwidth(copy(mot,1,pc)),y1+7,'_');
  key:=readkey;
  clear_pc;

  if key=#27 then {ESCAPE}
   begin
    mot:='';
    key:=#13;
   end
  else
  if key=#8 then {efface un caractere � gauche du curseur}
   begin
    clear_box;
    delete(mot,pc,1);
    dec(pc);
   end
  else
  if key=#9 then {TAB}
   begin
    mot:=#13;
    key:=#13;
   end
  else
   if key=#0 then
   begin
    key:=readkey;
   CASE key of
    #71 : pc:=0; {home}
    #72 : begin
           clear_box;
           if mot<>'' then oldstr:=mot;
           mot:='';
           pc:=0;
          end;
    #75 :  begin{Fg}
            setcolor(white);
            if (pc>0) then
             begin
              dec(pc);
              outtextXY(x1+2+textwidth(copy(mot,1,pc)),y1+7,'_');
             end;
           end;
    #77 : begin{Fd}
           setcolor(white);
           if (pc<length(mot)) then
            begin
             inc(pc);
             outtextXY(x1+2+textwidth(copy(mot,1,pc)),y1+7,'_');
            end;
          end;
    #79 : pc:=length(mot);{fin}

    #80 : begin {down}
           clear_box;
           mot:=oldstr;
           pc:=length(mot);
          end;
    #83 : begin{suppr}
           clear_box;
           delete(mot,pc+1,1);
          end;
   end;{CASE}
    end
  else
   if (((ord(key)>32) and (ord(key)<127))and ((x1+2+textwidth(mot))<(x2-15))) then
    begin
     if (pc=length(mot)) then
      begin
       mot:=mot+key;
       inc(pc);
      end
     else
      begin
       insert(key,mot,pc+1);
       inc(pc);
       clear_box;
      end;
    end;
 until (key=#13);
 input:=mot;
 _restore_colors;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure a_win(x1,y1,x2,y2:word;color:byte;savewin:boolean;msg:string;special:boolean);
var i : integer;
    FillInfo: FillSettingsType;
    mx,my:integer;
begin
  if savewin then
  begin
   mx1:=x1;my1:=y1-20;
   mx:=x2+5;my:=y2+5;
   Size_1 := ImageSize(mx1,my1,mx,my);
   GetMem(P1, Size_1);
   GetImage(mx1,my1,mx,my,P1^);
   open_win1:=true;
  end;
 GetFillSettings(FillInfo);    {save fill style and color}
 SetLineStyle(SolidLn, 0, NormWidth);
 if not(special) then
 begin
  setcolor(blue);
  for i:=0 to 2 do
   begin
    rectangle(x1+i,y1+i,x2-i,y2-i);
   end;
  setcolor(lightblue);
  rect_relief_sup(x1,y1,x2,y2,blue);
 end
  else
 begin
  SetFillStyle(solidFill,black);  {  New style}
  bar(x1,y1,x2,y2);
  SetFillStyle(slashFill, yellow);  {  New style}
  setcolor(blue);
  rectangle(x1,y1,x2,y2);
  floodfill(x1+1,y1+1,blue);
  setcolor(lightblue);
  rect_relief_sup(x1,y1,x2,y2,black);
 end;
 plaque(x1+3,y1+3,x2-3,y1+20+3,color);
 exicen(x1+6,y1+6);
 plaque(x1+3,y1+20+3+1,x2-3,y2-3,color);
 setcolor(black);
 line(x1,y2,x2,y2);
 line(x2,y1,x2,y2);
 setcolor(white);                {texte message}
 settextstyle(TripleXFont,horizdir,1);
 outtextxy(x1+3+(((x2-x1)div 2)-(textwidth(msg)div 2)),y1+2,msg);
 with FillInfo do
  SetFillStyle(Pattern, Color);   { Restore old fill style }
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure Windc;
 begin;
   if open_win1 then
    begin
     PutImage(mx1,my1, P1^, NormalPut);
     freemem(P1,size_1);
     open_win1:=false;
    end;
 end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE press_button()     � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Enfonce un bouton.                                                    �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure press_button(x1,y1,long,larg:word;color:byte;txt:string);
var x,y:integer;
     mt:string;
begin
 _save_colors;
 mt:=txt;
 if pos('~',txt)>0 then
   delete(txt,pos('~',txt),1);
 SetTextStyle(DefaultFont, HorizDir, 1);
 SetFillStyle(solidfill,color);
 SetLineStyle(SolidLn, 0, NormWidth);
 bar(x1+2,y1+2,x1+long-2,y1+larg-2);
 setcolor(color);
 line(x1,y1,x1+long,y1);
 line(x1,y1,x1,y1+larg);
 setcolor(light(color));
 line(x1+1,y1+larg,x1+long,y1+larg);
 line(x1+long,y1+1,x1+long,y1+larg);
 setcolor(white);
 x:=x1+2+(((long)div 2)-(textwidth(txt)div 2))+1;
 y:=y1+(((larg)div 2)-(textheight('I')div 2))+1;
 outtextxy(x,y,txt);
 if pos('~',mt)>0 then
   begin
     setcolor(lightgreen);
     outtextxy(x+textwidth( copy(txt,1, pos('~',mt) -1) ),y,txt[pos('~',mt)]);
     line(x+textwidth( copy(txt,1, pos('~',mt) -1) ),y+9,x+textwidth( copy(txt,1, pos('~',mt) ) ),y+9);
   end;
 _restore_colors;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE draw_button()      � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use: Dessine un bouton.                                                    �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure draw_button(x1,y1,long,larg:word;color:byte;txt:string);
var mt:string;
   x,y:integer;
begin
 _save_colors;
 mt:=txt;
 if pos('~',txt)>0 then
   delete(txt,pos('~',txt),1);

 setfillstyle(solidfill,color);
 SetLineStyle(SolidLn, 0, NormWidth);
 SetTextStyle(DefaultFont, HorizDir, 1);
 bar(x1,y1,x1+long,y1+larg);
 setcolor(black);
 rectangle(x1-1,y1-1,x1+long+1,y1+larg+1);
 {relief du bouton}
 setcolor(light(color));
 line(x1,y1,x1+long,y1);
 line(x1,y1,x1,y1+larg);
{ setcolor(darkgray);
 line(x1+1,y2,x2,y2);
 line(x2,y1+1,x2,y2);
 {}
 setcolor(white);
 x:=x1+2+(((long)div 2)-(textwidth(txt)div 2));
 y:=y1+(((larg)div 2)-(textheight(txt)div 2));
 outtextxy(x,y,txt);
 if pos('~',mt)>0 then
   begin
     setcolor(lightgreen);
     outtextxy(x+textwidth( copy(txt,1, pos('~',mt) -1) ),y,txt[pos('~',mt)]);
     line(x+textwidth( copy(txt,1, pos('~',mt) -1) ),y+9,x+textwidth( copy(txt,1, pos('~',mt) ) ),y+9);
   end;
 _restore_colors;
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure title_cadre(x1,y1,x2,y2:word;color:byte;title:string);
begin
 SetLineStyle(SolidLn, 0, NormWidth);
 SetLineStyle(SolidLn, 0, NormWidth);
 SetTextStyle(DefaultFont, HorizDir, 1);
 setcolor(black);
 line(x1+8,y1,x1,y1);
 line(x1,y1,x1,y2);
 line(x1,y2,x2,y2);
 line(x2,y2,x2,y1);
 line(x2,y1,x1+(textwidth(title)+12)+2,y1);
 if (color=8) then setcolor(color-1)
  else
 setcolor(color+8);
 line(x1+9,y1+1,x1+1,y1+1);{partie sup}
 line(x1+1,y1+1,x1+1,y2-1);
 line(x2-1,y1+1,x1+(textwidth(title)+12)+2+1,y1+1);
 line(x1+1,y2+1,x2,y2+1); {partie inf}
 line(x2+1,y2+1,x2+1,y1+1);
 setcolor(darkgray);
 outtextXY(x1+12+1,y1-3+1,title);
 setcolor(white);
 outtextXY(x1+12,y1-3,title);
end;
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE ()                 � �                           by XTech �
�                                     � �                           00/00/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
function choice_box(x1,y1:word;p:pointer;size:byte;color:byte):word;
var x2,y2:word;
    pc   :byte;
    i    :byte;
    key  :char;
    sizei:integer;
    liste : array[0..100] of ^string;
    p3   : pointer;
{Procedure Interne}
procedure bar_(pc:byte;pos:boolean);
begin
 if pos then SetFillStyle(solidFill, light(color))
  else
    SetFillStyle(solidFill, color);
 bar(x1+2,y1+1+pc*(textheight('I')+2),x2-2,y1+1+(pc+1)*(textheight('I')+2));
 if pos then
  begin
   setcolor(white);
   line(x1+2,y1+1+pc*(textheight('I')+2),x2-2,y1+1+pc*(textheight('I')+2));
   setcolor(black);
   line(x1+2,y1+1+(pc+1)*(textheight('I')+2),x2-2,y1+1+(pc+1)*(textheight('I')+2));
   setcolor(white);
   outtextXY(x1+2+1,y1+2+pc*(textheight('I')+2)+1,liste[pc]^);
  end
 else
  begin
   setcolor(white);
   outtextXY(x1+2,y1+2+pc*(textheight('I')+2),liste[pc]^);
  end;

end;
begin
 SetLineStyle(SolidLn, 0, NormWidth);
 SetFillStyle(solidFill, black);
 SetTextStyle(DefaultFont,horizdir,1);
 x2:=x1+textwidth('GGGGGGGGGGGGGGGG');
 y2:=y1+(textheight('I')+4)*(size-1)+4;
   {sauve le cadre}
   Sizei := ImageSize(x1-2,y1-2,x2+2,y2+10+2);
   GetMem(P3, Sizei);
   GetImage(x1-2,y1-2,x2+2,y2+10+2,P3^);
   {}
 bar(x1,y1,x2,y2);

 setcolor(color);
 rectangle(x1-1,y1-1,x2+1,y2+1);
 rectangle(x1,y1,x2,y2);
 setcolor(black);
 rectangle(x1-2,y1-2,x2+2,y2+2);
 rect_relief_sup(x1-2,y1-2,x2+2,y2+2,color);

 SetFillStyle(solidFill, color);
 bar(x1+1,y1+1,x2-1,y2-1);
 pc:=0;
 setcolor(white);
 for i:=0 to size do new(liste[i]);
 for i:=0 to size do
  liste[i]:=ptr(seg(p^),ofs(p^)+256*i);

 for i:=0 to size do outtextXY(x1+2,y1+2+i*(textheight('I')+2),liste[i]^);
 bar_(pc,true);
 repeat
  key:=readkey;
  bar_(pc,false);

  if key=#27 then {ESCAPE}
   begin
    pc:=size+1;
    key:=#13;
   end
  else
  if key=#0 then
   begin
    key:=readkey;
   CASE key of
    #71 : pc:=0; {home}
    #72 : begin {up}
           if pc=0 then pc:=size
           else
            dec(pc);
           bar_(pc,true);
          end;
    #79 : begin
           pc:=size;{fin}
           bar_(pc,true);
          end;
    #80 : begin {down}
           inc(pc);
           if pc>size then pc:=0;
           bar_(pc,true);
          end;
  end;{CASE}
    end;
  bar_(pc,true);


 until (key=#13);
{for i:=0 to size do
 dispose(liste[i]);}
     PutImage(x1-2,y1-2, P3^, NormalPut);
     freemem(P3,sizei);
 choice_box:=pc;
end;
{袴袴袴[ Combo box off ]袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴21/05/95�}
procedure combof(x1,y1:word;color:byte);
var
        a,b : byte;
    Losange : array[1..4] of PointType;
begin
 a:=12;

 Losange[1].x:=x1-(a div 2)+2;
 Losange[1].y:=y1;

 Losange[2].x:=x1;
 Losange[2].y:=y1-(a div 2)+2;

 Losange[3].x:=x1+(a div 2)-2;
 Losange[3].y:=y1;

 Losange[4].x:=x1;
 Losange[4].y:=y1+(a div 2)-2;

 Setcolor(couleur_ppale);
 SetFillStyle(SolidFill,couleur_ppale);
 FillPoly(SizeOf(Losange) div SizeOf(PointType), Losange);

 setcolor(black);
 line(x1+a div 2,y1,x1,y1+a div 2);
 line((x1+a div 2)+1,y1,x1+1,y1+a div 2);
 line(x1,y1+a div 2,x1-a div 2,y1);

 setcolor(light(couleur_ppale));
 line(x1-a div 2,y1,x1,y1-a div 2);
 line((x1-a div 2)-1,y1,x1-1,y1-a div 2);
 line(x1,y1-a div 2,x1+a div 2,y1);

end;

{袴袴袴[ Combo box on ]袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴�21/05/95�}
procedure combon(x1,y1:word;color:byte);
var
        a,b : byte;
    Losange : array[1..4] of PointType;
begin
 a:=12;

 Losange[1].x:=x1-(a div 2)+2+1;
 Losange[1].y:=y1;

 Losange[2].x:=x1;
 Losange[2].y:=y1-(a div 2)+2+1;

 Losange[3].x:=x1+(a div 2)-2-1;
 Losange[3].y:=y1;

 Losange[4].x:=x1;
 Losange[4].y:=y1+(a div 2)-2-1;

 Setcolor(couleur_ppale);
 SetFillStyle(SolidFill,white);
 FillPoly(SizeOf(Losange) div SizeOf(PointType), Losange);

{ relief interne
 setcolor(black);
 line(Losange[1].x-1-2,Losange[1].y,Losange[2].x,Losange[1].y-1-2);
 line(Losange[1].x-1-2,Losange[1].y,Losange[4].x,Losange[4].y+1+2);}

 setcolor(black);
 line(x1+a div 2,y1,x1,y1+a div 2);
 line((x1+a div 2)+1,y1,x1+1,y1+a div 2);
 line(x1,y1+a div 2,x1-a div 2,y1);

 setcolor(light(couleur_ppale));
 line(x1-(a div 2),y1,x1,y1-(a div 2));
 line(x1-(a div 2)-1,y1,x1-1,y1-(a div 2));
 line(x1,y1-(a div 2),x1+(a div 2),y1);

end;

{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�        PROCEDURE BG_login_box()     � �                           by XTech �
�                                     � �                           15/04/95 �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
� Use:                                                                       �
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
procedure BG_login_box;
var x1,x2,y1,y2:integer;
    t1,t2:integer;
begin
 _save_colors;
 x1:=Get_Middle_Screen_X-120;
 x2:=x1+240;
 y1:=Get_Middle_Screen_Y-80;
 y2:=y1+160;
 static_win(x1,y1,x2,y2,blue,false);

 {mox(x1+1+5,y1+61,4,white);
 mox(x1+5,y1+60,4,black);}
 setcolor(white);
 SetTextStyle(1, HorizDir, 8);
 outtextXY(x1+80,y1-10,'X');
 SetTextStyle(10, HorizDir, 4);
 outtextXY(x1+130,y1,'NET');
 SetTextStyle(SmallFont, HorizDir, 4);
 outtextXY(x1+130,y1+60,'Tachy Security');

 setcolor(white);
 settextstyle(defaultfont,horizdir,1);
 t1:=90;
 t2:=t1+30;
 outtextxy(x1+10,y1+t1,'User ID:');
 Input_Box(x1+10,y1+t1+10,x2-10,blue,'');
 outtextxy(x1+10,y1+t2,'User Code:');
 Input_Box(x1+10,y1+t2+10,x2-10,blue,'');
 _restore_colors;
end;


BEGIN
 OPEN_WIN1:=FALSE;
 OPEN_WIN2:=FALSE;
 OPEN_WIN3:=FALSE;
 Writeln(Ver_BGUI);
END.