{==============  FICHIER DE EDNUM  ======================}
{ Programm pricipal EDnum.pas usinage sur machines c.n.  }
{ programmation Pascal                                   }
{ Copyright (S) 1997-2011                                }
{ programmeur du programme A.Ara                         }
{ 64150 Mourenx - France.                                }
{ Licence d'utilisation accord dans un but démonstratif  }
{ file MenuEdi.pas : editeur Ednum c.n du bois num750    }
{ Numero de serie 00-331-7431-A1133071e                  } 
{========================================================}
{=================  FICHIER DE EDNUM  ===================}
{ Types publiques de Fuffers destines a l'editeur        }
{ Max_Buffer=64512;      63 Ko.                          }
{ Max_Buffer_Copy=5120;  5  ko                           }
{========================================================}
{========================================================}
{ SI B_Langa3.Blc sur Types_11                           }
{ Si B_Langa2.Blc lecture languages exemples sur Type_11 }
{ B_Langa3.Blc,P_Attrib.Blc,B_Reper1.BLC:sur Types_11    }
{========================================================}

{$i C_Outils.Blc}

Function P_Load:string;
var Nom    : string[12];
    Entree : boolean;

begin
   Nom:='';
   Readbuf(6,4,52,6,Sub_Buf^);
   BoxFill(6,4,52,6,' ');
   Box13.Rectangle(6,4,52,6,Simple);
   Putxy(21,4,' Load File Name ');

   TexteLoad:='*'+Extension;
   if Uppers(Disque_Nom) <> Uppers(Repertoire) Then TexteLoad:=Disque_Nom+TexteLoad;

   Entree:=ReadBox(8,5,TexteLoad,43,80);
   Writebuf(6,4,52,6,Sub_Buf^);
   csoff;

   if Entree Then Entree:=Verify_Rep_Fic(Disque_Nom,TexteLoad);

   if Entree Then
    begin
       if Pos('*',TexteLoad)>0 Then
         Nom:=_Fichiers_Dir(Disque_Nom,TexteLoad)
       else
       if TexteLoad<>'' Then
        begin
           if Not FileExists(Disque_Nom,TexteLoad) Then
            begin
               Entree:=Erreur_Critique(2,TexteLoad);
               Entree:=false;
               TexteLoad:='*'+Extension;
               Nom:='';
            end
           else
            begin
               Nom:=TexteLoad;
               TexteLoad:='*'+Extension;
            end;
        end
       else Entree:=false;

       if (Entree) And (Nom<>'') Then
        begin
           if _Save_Fichier Then   {*sauvegarde fichier actuel*}
            begin
               if P_New=69 Then
                begin
                   NomFic:=Nom;
                   P_load:=Nom;
                end
               else P_Load:='';    {*opperation anulle*}
            end
           else
            begin                  {*pas necasire sauvegarder*}
               NomFic:=Nom;
               P_load:=Nom;
            end;
        end {* nom<>''*}
       else
         P_Load:='';               {*fichier sans Nom*}
    end {**entree**}
   else
    P_Load:='';  {**opperation Anule**}
end;{**ends P_Load**}




Function P_Directory(Code:byte):string;
var Entree : boolean;
    Nom    : string;

begin
   Readbuf(6,9,52,11,Sub_buf^);
   BoxFill(6,9,52,11,' ');
   Box13.Rectangle(6,9,52,11,Simple);
   Putxy(21,9,' Enter File Name ');
   if Texte_Dire='' Then Texte_Dire:='*.*';
   if Disque_Dire<>Repertoire Then Texte_Dire:=Disque_Dire+Texte_Dire;
   Entree:=ReadBox(8,10,Texte_Dire,43,80);
   Writebuf(6,9,52,11,Sub_buf^);
   csoff;

   if (Pos('.',Texte_Dire) >0) Then
     Nom:='*'+Copy(Texte_Dire,Pos('.',Texte_Dire),Length(Texte_Dire));

   if Entree Then Entree:=Verify_Rep_Fic(Disque_Dire,Texte_Dire);
   if (Nom='') And (Texte_Dire<>'') Then
     Nom:='*'+Copy(Texte_Dire,Pos('.',Texte_Dire),Length(Texte_Dire));

   if (Entree)  Then
     begin
        if (POS('*',Texte_Dire)>0) Then
         Texte_Dire:=_Fichiers_Dir(Disque_dire,Texte_Dire)
        else
        if Texte_Dire<>'' Then
         begin
            if Not FileExists(Disque_Dire,Texte_Dire) Then
             begin
              Entree:=Erreur_Critique(2,Texte_Dire);
              Entree:=false;
             end;
         end
        else Entree:=false;
     end;

   if Not Entree Then
    begin
       if Texte_Dire='' Then Texte_Dire:='*.*';
       if Disque_Dire='' Then Disque_Dire:=Repertoire;
    end
   else
   if Disque_Dire='' Then Disque_Dire:=Repertoire;

   if Entree Then
    begin
       if Texte_Dire<>'' Then
        begin
           if _Save_Fichier Then        {*sauvegarde fichier actuel*}
            begin
                if P_New=69 Then
                 begin
                   NomFic:=Texte_Dire;
                   Disque_Nom:=Disque_Dire;
                   P_Directory:=Texte_Dire;
                 end
                else P_Directory:='';   {*opperation anulle*}
            end
           else
            begin                       {*pas necasire sauvegarder*}
                NomFic:=Texte_Dire;
                P_Directory:=Texte_Dire;
                Disque_Nom:=Disque_Dire;
            end;
        end
       else
         P_Directory:='';            {*fichier sans Nom*}
    end
   else
     P_Directory:='';     {* opperation Anule *}
   if Nom='' Then Nom:='*.*';
   Texte_Dire:=Uppers(Nom);
end;{**ends P_Directory**}




Procedure P_Change_Dir;
Var Entree:boolean;
    SR:string;
begin
   Entree:=false;
   SR:=Repertoire;
   Readbuf(6,10,52,12,Sub_Buf^);
   BoxFill(6,10,52,12,' ');
   Box13.Rectangle(6,10,52,12,Simple);
   Putxy(21,10,' New Directory ');
   Entree:=ReadBox(8,11,SR,43,80);
   WriteBuf(6,10,52,12,Sub_Buf^);
   if Entree Then Change_Directori(SR);
   csoff;
end;{**ends P_Change_Dir**}





Procedure P_Save;
Var SR,SN    : string;
    NomError : string[4];
    Entree   : boolean;
    n,Color  : byte;
    Ch       : Char;

begin
   if (NomFic='NONAME.???') Then
    begin
       Color:=textAttr;
       textAttr:=Menu_Color;
       Entree:=false;
       Readbuf(6,7,52,9,Sub_Buf^);
       BoxFill(6,7,52,9,' ');
       Box13.Rectangle(6,7,52,9,Simple);

       Putxy(21,7,' Rename Noname ');
       SR:=Disque_Nom;
       SN:=NomFic;
       Entree:=ReadBox(8,8,SN,43,80);
       Writebuf(6,7,52,9,Sub_buf^);
       Csoff;

       if (Entree) And (Uppers(SN) = 'PRN') Then
        begin
           Entree:=false;
        end
       else
       if (Entree) Then
        begin
           Entree:=Verify_Rep_Fic(SR,SN);
           if Entree Then
            begin
               SN:=Uppers(SN);
               NomError:=Copy(SN,1,4);
               if NomError = 'PRN.' Then
                begin
                   Entree:=false;
                   SN:='';
                   SR:='';
                   textAttr:=Color;
                   exit;
                end;
            end;
        end;

       if Entree Then Entree:=(Uppers(SN)<>'NONAME.???');

       if Entree Then
        begin
           if SN='' Then SN:='*'+extension;
           if (Pos('*',SN)>0) Then SN:=_Fichiers_Dir(SR,SN);

           if SN='' Then
            begin
               textAttr:=Color;
               Exit;
            end;

           if FileExists(SR,SN) Then
            begin
               Readbuf(6,7,52,9,Sub_Buf^);
               BoxFill(6,7,52,9,' ');
               Box13.Rectangle(6,7,52,9,Simple);
               Putxy(25,7,'   Verify ');
               Putxy(12,8,'Overwrite '+SN+'?  (Y / N)');
               Csoff;
               Repeat
               Ch:=Readkey;
               Until (Ord(Ch)=27) OR (Upcase(Ch) in['Y','N']);
               Writebuf(6,7,52,9,Sub_buf^);

               if Upcase(Ch)='Y' Then
                begin
                   if SR='' Then Disque_Nom:=Repertoire
                   else Disque_Nom:=SR;
                   NomFic:=SN;
                   Save_Fichier_Disque(Disque_Nom,NomFic);
                end
            end {**file existe**}
           else
            begin
               if Entree Then Entree:=Verify_Reper(SR,SN);
               if Entree Then
                begin
                   if SR='' Then Disque_Nom:=Repertoire;
                   NomFic:=SN;
                   Save_Fichier_Disque(Disque_Nom,NomFic);
                end;
            end;
        end; {**Entree**}

       textAttr:=Color;
    end {**end fic=Noname..**}
   else
   Save_Fichier_Disque(Disque_Nom,NomFic);
   CsOff;
end;{** ends P_Save**}




Function P_Pick_Load:string;
Var SR,SN  : string;
    Entree : boolean;

begin
   Readbuf(6,5,52,7,Sub_buf^);
   BoxFill(6,5,52,7,' ');
   Box13.Rectangle(6,5,52,7,Simple);
   Putxy(21,5,' Load File Name ');
   SN:='*.*';
   SR:=Repertoire;
   Entree:=ReadBox(8,6,SN,43,80);
   Writebuf(6,5,52,7,Sub_buf^);
   Csoff;

   if Entree Then Entree:=Verify_Rep_Fic(SR,SN);

   if (Entree) Then
    begin
       if SR='' Then SR:=Repertoire;
       if POS('*',SN)>0 Then SN:=_Fichiers_Dir(SR,SN)
       else
       if SN<>'' Then
        begin
           if Not FileExists(SR,SN) Then
            begin
               Entree:=Erreur_Critique(2,SN);
               Entree:=false;
               SN:='';
            end;
        end;
       if (Entree) And (SN<>'') Then
        begin
           if _Save_Fichier Then      {*sauvegarde fichier actuel*}
            begin
                if P_New=69 Then
                 begin
                    NomFic:=SN;
                    Disque_Nom:=SR;
                    P_Pick_load:=SN;
                 end
                else P_Pick_Load:=''; {*opperation anulle*}
             end
           else
            begin                     {*pas necasire sauvegarder*}
               NomFic:=SN;
               Disque_Nom:=SR;
               P_Pick_Load:=SN;
            end;
        end  {** sn <> '' **}
       else
         P_Pick_load:='';             {*fichier sans Nom*}

    end {*entree*}
   else
     P_Pick_Load:='';                 {*opperation Anule*}

end;{**ends P_Pick_Load**}





{========= anule en 2010 ne foctione pas sur ordinteur(XP) =======}
{* Procedure Printer_Fic;                                        *}
{*var ch:Char;                                                   *}
{*    Entree,PrnOk : boolean;                                    *}
{*    SR,Name      : string;                                     *}
{*begin                                                          *}
{*    Readbuf(6,11,55,13,Sub_Buf^);                              *}
{*    textAttr:=Menu_Color;                                      *}
{*    BoxFill(6,11,55,13,' ');                                   *}
{*    Box13.Rectangle(6,11,55,13,Simple);                        *}
{*    Putxy(20,11,' Printing file name ');                       *}
{*    Name:='*.*';Sr:='';                                        *}
{*    Entree:=ReadBox(8,12,name,46,65);                          *}
{*    Writebuf(6,11,55,13,Sub_Buf^);                             *}
{*    Csoff;                                                     *}
{*    if Entree Then Entree:=Verify_Rep_Fic(SR,name);            *}
{*    if (Entree) And (Name<>'')then                             *}
{*     begin                                                     *}
{*       if SR='' Then SR:=Repertoire;                           *}
{*       if POS('*',Name)>0 Then Name:=_Fichiers_Dir(SR,Name)    *}
{*       else                                                    *}
{*       if Name<>'' Then                                        *}
{*        begin                                                  *}
{*         if Not FileExists(SR,Name) Then                       *}
{*          begin                                                *}
{*           Entree:=Erreur_Critique(2,Name);                    *}
{*           Entree:=false;                                      *}
{*           Name:='';                                           *}
{*          end;                                                 *}
{*        end;                                                   *}
{*       if Name<>'' Then                                        *}
{*        begin                                                  *}
{*         ch:='Y';                                              *}
{*         PrnOK:=GetPrn;                                        *}
{*         if Not PrnOK Then                                     *}
{*         begin                                                 *}
{*            textAttr:=Error_Color;                             *}
{*            Readbuf(6,11,53,13,Sub_Buf^);                      *}
{*            BoxFill(6,11,53,13,' ');                           *}
{*            Box13.Rectangle(6,11,53,13,Simple);                *}
{*            Putxy(20,11,' Critical Error ');                   *}
{*     Putxy(8,12,'Error accessing PRN device. Retry or Abort?');*}
{*            csoff;                                             *}
{*             Repeat                                            *}
{*                 Ch:=Readkey;                                  *}
{*             Until (Ord(Ch)=27) OR (Upcase(Ch) in['R','A']);   *}
{*            Writebuf(6,11,53,13,Sub_Buf^);                     *}
{*            PrnOK:=GetPrn;                                     *}
{*            if (Upcase(ch)='R') And (PrnOK) Then Ch:='Y';      *}
{*         end;                                                  *}
{*         if Upcase(Ch)='Y' Then                                *}
{*          begin                                                *}
{*             Name:=Printer_File(SR,Name,true);                 *}
{*             if Name<>'' Then                                  *}
{*             begin                                             *}
{*                Readbuf(6,11,53,13,Sub_Buf^);                  *}
{*                BoxFill(6,11,53,13,' ');                       *}
{*                Box13.Rectangle(6,11,53,13,Simple);            *}
{*                Putxy(20,11,' Critical Error ');               *}
{*                Putxy(((40-Length(Name)) Div 2)+8,12,Name);    *}
{*                Csoff;                                         *}
{*                Ch:=Readkey;                                   *}
{*                Writebuf(6,11,53,13,Sub_Buf^);                 *}
{*             end;                                              *}
{*          end                                                  *}
{*          else Entree:=false;                                  *}
{*        end; {name<>''}                                        *}
{*     end; {entree}                                             *}
{*end; {end printer}                                             *}
{==== ends anule en 2010 ne foctione pas sur ordinteur(XP) =======}




Function Menu_File(y:byte):byte;
 LaBel PASE_NEW;
 var Key           : byte;
     Nom_Pick      : string;
     Nom_Reper     : string;
     New,Termine   : boolean;
     Director,Load : boolean;
begin
    Director:=false;
    Load:=false;
    New:=false;
    Termine:=false;
    HighBox(4,1,9,1,Bx);
    if Y in[61,106] Then
     begin
        Key_Code:=true;
        Case Y Of
          61: begin Y:=3;Key:=61; end;
         106: begin Y:=4;Key:=106;Alt:=true; end;
        end;
     end
    else
     begin
        if Y=0 Then Y:=3;
        Key:=0;
     end;

    ReadBuf(4,2,22,13,Menu_Buf^);
    BoxColor(6,3,22,13,FondBox);
    BoxFill(4,2,20,12,' ');
    Box13.Rectangle(4,2,20,12,Double);
    Putxy(6,3,'Load       F3');
    Putxy(6,4,'Pick   Alt-F3');
    Putxy(6,5,'New');
    Putxy(6,6,'Save       F2');
    Putxy(6,7,'Write to');
    Putxy(6,8,'Directoy   F4');
    Putxy(6,9,'Change dir');
    Putxy(6,10,'Printer...');
    Putxy(6,11,'Quit    Alt-X');
    WriteCar(6,3,'L');
    WriteCar(6,4,'P');
    WriteCar(6,5,'N');
    WriteCar(6,6,'S');
    WriteCar(6,7,'W');
    WriteCar(6,8,'D');
    WriteCar(6,9,'C');
    WriteCar(8,10,'i');
    WriteCar(6,11,'Q');
    HighBox(5,Y,19,Y,Bx);
    Mousexy(3,1);
    DisplayMouse;

    Repeat
        if (Not Key_Code) And (Key in[108,76,112,80,110,78,115,83,119,87,100,68,99,57,80,112,113,81,73,105]) Then
         begin
            HighBox(5,Y,19,Y,Bx);
            Case Key of
              {L} 108,76: Y:=3;
              {P} 112,80: Y:=4;
              {N} 110,78: Y:=5;
              {S} 115,83: Y:=6;
              {W} 119,87: Y:=7;
              {D} 100,68: Y:=8;
              {C}  99,57: Y:=9;
              {i} 73,105: Y:=10;
              {Q} 113,81: Y:=11;
            end; {case}
            Key:=13;
            HighBox(5,Y,19,Y,Bx);
         end
        else
        if ((Key_Code) And (Key in[60,61])) OR ((Alt) And (Key in[106,45])) Then
         begin
            HighBox(5,Y,19,Y,Bx);
            Case Key of
              {F2}  60: Y:=6;
              {F3}  61: Y:=3;
              {Alt-F3} 106: Y:=4;
              {Alt-X}  45: Y:=11;
            end;
            Key_Code:=false;
            Key:=13;
            HighBox(5,Y,19,Y,Bx);
         end
        else
        if (Key_Code) And (Key=72) And (Y>3) Then
         begin
            HighBox(5,Y,19,Y,Bx);
            Dec(y);
            HighBox(5,Y,19,Y,Bx);
         end
        else
        if (Key_Code) And (Key=80) And (Y<11) Then
         begin
            HighBox(5,Y,19,Y,Bx);
            inc(y);
            HighBox(5,Y,19,Y,Bx);
         end
        else
        if (Key_Code) And (Key=62) Then
         begin
            HighBox(5,Y,19,Y,Bx);
            Y:=8;
            HighBox(5,Y,19,Y,Bx);
            if P_Directory(62)<>'' Then
             begin
                Key:=69;
                Key_Code:=false;
                New:=true;
                Director:=true;
             end;
         end
        else
{F1}   if (Key_Code) and (Key=59) Then Help_Keys;

       if (Not Key_Code) And (y in[3..11]) And (Key=13) Then
        begin
           Case y Of
             3: if P_Load<>'' Then
                 begin
                    Key:=69;
                    Key_Code:=false;
                    New:=true;
                    Load:=true;
                 end;

             4: begin              {**Debut Pick**}
                   Nom_Pick:='';Nom_Reper:='';
                   Selec_Pick(Nom_Reper,Nom_Pick);
                   if Nom_Pick='61..'Then
                    begin
                       HighBox(5,Y,19,Y,Bx);
                       Y:=3;
                       HighBox(5,Y,19,Y,Bx);
                       if P_Load<>'' Then
                        begin
                           Key:=69;
                           Key_Code:=false;
                           New:=true;
                           Load:=true;
                        end;
                    end
                   else
                     begin
                        if Nom_Pick='<Load file>' Then Nom_Pick:=P_Pick_Load;
                        if Nom_Pick='NONAME.???' Then
                         begin
                            HighBox(5,Y,19,Y,Bx);
                            Y:=5;
                            HighBox(5,Y,19,Y,Bx);
                            Goto PASE_NEW;
                         end
                        else
                        if (Nom_Pick<>'') And (_Save_Fichier) Then
                         begin
                            if P_New<>69 Then    {**sauvegarde du fichier actuel**}
                              Nom_Pick:='';      {**opperation anulle**}
                         end;

                        if Nom_Pick<>'' Then
                         begin
                            NomFic:=Nom_Pick;
                            if Nom_Reper<>'' Then Disque_Nom:=Nom_Reper;
                            Key:=69;
                            Key_Code:=false;
                            New:=true;
                            Load:=true;
                         end;
                     end;
                end;{**end Pick**}

             5: begin
                   PASE_NEW:
                   Key:=P_New;
                   if Key=69 Then
                    begin
                        Key_Code:=false;
                        New:=true;
                    end;
                end;

            6: begin
                  P_Save;

                  if (Not _Save_Fichier) and (NomFic<>'NONAME.???') Then
                   begin
                      Tab[1].Rtime:=FileDate(Tab[1].NomR+Tab[1].NomF);
                      Tab[1].PosX:=X_Curseur;
                      Tab[1].PosY:=Y_Curseur;
                      Tab[1].PageDebut:=Debut_Page;
                      Tab[1].Ligne:=Line_Curseur;
                      Tab[1].Marque:=Pose_Marque;
                   end;
                  Key:=27;
                  Key_Code:=false;
                  Termine:=true;
               end;

            7: begin
                  Key:=P_Write_TO;
                  if Key=69 Then
                   begin
                      Reinit_Pick(Disque_Nom,NomFic);
                      Key:=27;
                      Termine:=true;
                      Key_Code:=false;
                   end;
               end;


            8: if P_Directory(0)<>'' Then
                begin
                    Key:=69;
                    Key_Code:=false;
                    New:=true;
                    Director:=true;
                end;

            9: P_Change_Dir;

           10: begin (**Printer_Fic;**) end;

           11: begin
                  if _Save_Fichier Then
                   begin
                      if P_New = 69 Then Fin_programme:=true;
                   end
                  else Fin_programme:=true;
               end
           end;{case}
        end; {begin}
       
       CsOff;
       if Not Termine Then
         if (Not New)  And (Not Fin_programme) Then
           begin
              DisplayMouse;
              Key:=KeyMouse;
              MaskMouse;
              if (Key=1) And (not Key_Code) And (Mbox(5,3,19,11)) Then
               begin
                  if MouseY<>Y Then
                   begin
                      HighBox(5,Y,19,Y,Bx);
                      Y:=MouseY;
                      HighBox(5,Y,19,Y,Bx);
                   end;
               end
              else
              if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(5,3,19,11)) Then
               begin
                  Key_Code:=false;
                  Key:=13;
               end
              else  {** Menus **}

              if (Key=2) And (not Key_Code) And (Mbox(13,1,60,1)) Then
               begin
                  Key:=0;
                  Case MouseX Of
                   {5..8: Key:=33;} {File}
                   13..16: Key:=18; {Edit}
                   21..27: Key:=24; {Options}
                   32..35: Key:=38; {Lang}
                   40..51: Key:=34; {Graph}
                   56..60: Key:=50; {Maths}
                   else Key:=0;
                  end;

                  if (Key<>0) Then
                   begin
                      Alt:=true;
                      Key_Code:=true;
                   end;
               end;
           end;

   Until ((Not Key_Code) And (Key In [27,101,69])) OR
         ((Key_Code) And (Alt) And (Key in[18,24,38,34,50])) OR
         ((Key_Code) And (Key in[77,75])) OR (Fin_programme);

   HighBox(4,1,9,1,Bx);
   WriteBuf(4,2,22,13,Menu_Buf^);
   Retur1:=Y;

   if New Then
    begin
        textAttr:=Edit_Color;
        Initialiser;
        if (Load) OR (Director) Then
         begin
            if Director Then Disque_Nom:=Disque_Dire;
            Load_Fichier_Disque(Disque_Nom,NomFic);
            if NomFic<>'NONAME.???' Then
             begin
                Reinit_Pick(Disque_Nom,NomFic);
                if X_curseur<Max_curseurX Then E_curseurX:=X_curseur
                else E_curseurX:=Max_curseurX-1;
                Window(1,1,80,CrtGetMaxY);
                Window(2,4,79,CrtGetMaxY-1);
                Premiere_Page_Debut(Debut_Page);
             end;
            Window(1,1,80,CrtGetMaxY);
         end
        else
         begin
            NomFic:='NONAME.???';
            Disque_Nom:=Repertoire;
        end;
    end;
 
   if ((Key_Code) And (Alt) And (Key in[18,24,38,34,50])) Then
    begin
       Case Key Of
         18: Menu_File:=2;
         24: Menu_File:=3;
         38: Menu_File:=4;
         34: Menu_File:=5;
         50: Menu_File:=6;
       end;
    end
   else
   if (Key_Code) And (Key in[77,75]) Then
    begin
       Case Key of
         77: Menu_File:=2; {* Edit;      *}
         75: Menu_File:=6; {* Menu_Maths *}
       end;
    end
   else
    begin
      Menu_File:=27;
      Retur0:=1;
    end;
end; {**ends File**}





Procedure Mode_25_50_Lines(Mode:byte);
begin
    (*********** anule en 2010 pour ordiateurs(PX) *********
     if (CrtGetMaxY=50) And (Mode=25) Then ScreenLine25
     else if (CrtGetMaxY=25) And (Mode=50) Then ScreenLine50;
    ********************************************************)
    Max_CurseurX:=78;
    Max_CurseurY:=CrtGetMaxY-4;   {position max de verticale}
    textAttr:=Menu_Color;
    Window(1,1,80,CrtGetMaxY);
    Writechar(1,1,80,' ');
    Putxy(5,1,'File    Edit    Options    Lang    Graphe Trace    Maths');
    WriteCar(5,1,'F');
    WriteCar(13,1,'E');
    WriteCar(21,1,'O');
    WriteCar(32,1,'L');
    WriteCar(40,1,'G');
    WriteCar(56,1,'M');
    textAttr:=Edit_Color;
    
    Box13.Rectangle(1,2,80,CrtGetMaxY,Simple);
    Putxy(36,2,' Edit ');
    ClearScreen(2, 3, 79, CrtGetMaxY-1,Edit_Color);
    textAttr:=Etat_Color;
    Putxy(6,3,'Line');
    Putxy(18,3,'Col');
    Putxy(28,3,'Insert');
    Putxy(35,3,'Indent');
    Putxy(49,3,'Unindent');
    Putxy(58,3,NomFic);
    textAttr:=Edit_Color;

    if X_curseur<Max_curseurX Then E_curseurX:=X_curseur
    else E_curseurX:=Max_curseurX-1;

    Window(1,1,80,CrtGetMaxY);
    Window(2,4,79,CrtGetMaxY-1);
    Premiere_Page_Debut(Debut_Page);
    Window(1,1,80,CrtGetMaxY);

    if Y_curseur>=Max_curseurY Then
     begin
         Dec(Line_curseur,Y_curseur-(Max_curseurY-1));
         Y_curseur:=Max_curseurY-1;
     end;
    Change_de_ligne:=true;
end;{**ends Mode_25_50_Lines**}




{==================================}
{*** Note :voir Menu_C.doc ********}
{==================================}


Function Menu_Options(y:byte):byte;
 var  Key     : byte;
     Ok_Ecran : byte;

begin
   Ok_Ecran:=0;
   HighBox(20,1,28,1,Bx);

   Readbuf(20,2,37,11,Menu_Buf^);
   BoxColor(22,3,37,11,FondBox);
   BoxFill(20,2,35,10,' ');
   Box13.Rectangle(20,2,35,10,Double);
   Putxy(22,3,'Changer Attr');
   Putxy(22,4,'Aide general');
   Putxy(22,5,'Screen  Size ');
   Putxy(22,6,'Test Pro.Num');
   Putxy(22,7,'Exten Defaul');
   Putxy(22,8,'Trier Block ');
   Putxy(22,9,'Information ');
   WriteCar(22,3,'C');
   WriteCar(22,4,'A');
   WriteCar(22,5,'S');
   WriteCar(27,6,'P');
   WriteCar(22,7,'E');
   WriteCar(22,8,'T');
   WriteCar(22,9,'I');
   HighBox(21,Y,34,Y,Bx);
   Find_Valeur:=0;
   Mousexy(19,1);

   Repeat
       CSOFF;
       
       (***Key:=KeyBoard;****)

       DisplayMouse;
       Key:=KeyMouse;
       MaskMouse;

       if (Key=1) And (not Key_Code) And (Mbox(21,3,34,9)) Then
        begin
           if MouseY <> Y Then
            begin
               HighBox(21,Y,34,Y,Bx);
               Y:=MouseY;
               HighBox(21,Y,34,Y,Bx);
            end;
        end
       else
       if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(21,3,34,9)) Then
        begin
           Key_Code:=false;
           Key:=13;
        end

       else  {** Menus **}

       if (Key=2) And (not Key_Code) And (Mbox(5,1,60,1)) Then
        begin
           Key:=0;
           Case MouseX Of
                5..8: Key:=33; {File}
              13..16: Key:=18; {Edit}
              {**21..27: Key:=24;**} {**Options**}
              32..35: Key:=38; {Lang}
              40..51: Key:=34; {Graph}
              56..60: Key:=50; {Maths}
              else Key:=0;
           end;

           if (Key<>0) Then
            begin
               Alt:=true;
               Key_Code:=true;
            end;
        end;

       if (Not Key_Code) And (Key in[99,67,97,65,115,83,80,112,101,69,84,116,105,73]) Then
        begin
           HighBox(21,Y,34,Y,Bx);
           Case Key of
             {C}  99,67: Y:=3;
             {A}  97,65: Y:=4;
             {S} 115,83: Y:=5;
             {P} 112,80: Y:=6;
             {E} 101,69: Y:=7;
             {T} 84,116: Y:=8;
             {I} 105,73: Y:=9;
           end; {case}
           Key:=13;
           HighBox(21,Y,34,Y,Bx);
        end
       else
       if (Key_Code) And (Key=72) And (Y>3) Then
        begin
           HighBox(21,Y,34,Y,Bx);
           Dec(y);
           HighBox(21,Y,34,Y,Bx);
        end
       else
       if (Key_Code) And (Key=80) And (Y<9) Then
        begin
           HighBox(21,Y,34,Y,Bx);
           inc(y);
           HighBox(21,Y,34,Y,Bx);
        end;

       if ((y in[3,4,5,6,7,8,9]) And (Key=13)) Then   {Load}
        begin
          Case y Of
            3: Change_Attribut;
            4: Help_Dans_Index(Repertoire+'EDnum\','EdNUM.HLP');
            5: begin
                   (*** anule Ok_Ecran:=Choix_Ecran; Key:=0;***)
               end;

            6: begin
                  Entree1:=false;
                  ix:=1;X_Car:=' ';
                  While (ix<100) And (Not Entree1) Do
                   begin
                      X_Car:=Buffer^[ix];
                      if X_Car>#32 Then Entree1:=true;
                      inc(ix);
                   end;
                  if X_Car = '%' Then
                   begin
                      Texte_Programme_Num;
                   end;
                   Key:=0;
               end;

            7: begin
                  Extension_Defaut;
                  Key:=0;
               end;

            8: begin
                  Find_Valeur:=84;
                  Key_Code:=false;
                  Key:=27;
               end;

            9: begin
                  (***if Not Control_Code Then Fin_Programme:=true;***)
                  (***Write_Num750(4,3);***)

                  debut_program;
                  textAttr:=Menu_Color;
                  Key:=0;
               end;
          end;
        end
       else
       if (Key_Code) and (Alt) And (Key=45) Then
        begin
           if _Save_Fichier Then
            begin
               if P_New = 69 Then Fin_programme:=true;
            end
           else Fin_programme:=true;
        end
       else
       if (Key_Code) and (Key=59) Then Help_Keys;

   Until ((not Key_code) And (Key in [255,27])) OR
         ((Key_Code) And (Key in[60,61,75,77])) OR
         ((Key_Code) And (Alt) And (Key in[33,18,38,34,50])) OR
         ((Alt) And (Key=106)) OR (Ok_Ecran>0) OR (Find_Valeur=84) Or
         (Fin_programme);

   HighBox(20,1,28,1,Bx);
   Writebuf(20,2,37,11,Menu_Buf^);
   Retur3:=Y;

   if ((Key_Code) And (Alt) And (Key in[33,18,38,34,50])) Then
     begin
        Case Key Of
          33: Menu_Options:=1;
          18: Menu_Options:=2;
          38: Menu_Options:=4;
          34: Menu_Options:=5;
          50: Menu_Options:=6;
        end;
     end
   else
   Case Key Of
      75: Menu_Options:=2;
      77: Menu_Options:=4;

     106: begin
             Menu_Options:=1;
             Retur1:=106;
          end;

      60: begin
             P_Save;
             Menu_Options:=27;
             Retur0:=3;
          end;

      61: begin
             Menu_Options:=1;
             Retur1:=61;
          end;

      27: begin
          Menu_Options:=27;
          Retur0:=3;
        end;
   end;

   if Key=255 THen
    begin
        X_curseur:=1;
        E_curseurX:=1;
        Y_curseur:=1;
        Line_Curseur:=1;
        Debut_Page:=1;
        textAttr:=Edit_Color;
        Window(1,1,80,CrtGetMaxY);
        Window(2,4,79,CrtGetMaxY-1);
        Premiere_Page_Debut(Debut_Page);
        Window(1,1,80,CrtGetMaxY);
        Menu_Options:=27;
        Retur0:=3;
    end
   else
   if Fin_programme Then Menu_Options:=27;

   {========================================} 
   {**** anule le annee 2010 pour PX    ****}
   {========================================}

   if Ok_Ecran In[25,50] Then
    begin
       CrtGetMaxY:=25;
   
  {===========================================}       
  {   alulle en 2010 pour XP                  }
  {    Mode_25_50_Lines(Ok_Ecran);            }  
  {    StyleMouse(2,14);                      }
  {    WindowMouse(1,1,CrtGetMaxX,CrtGetMaxY);}
  {    Menu_Options:=27;                      }
  {    Retur0:=3;                             }
  {===========================================} 
   end;
end;{**Menu Options**}



Function Menu_Language(y:byte):byte;
 var  Key   : byte;
     Entree : boolean;

begin
   HighBox(31,1,36,1,Bx);
   Readbuf(31,2,52,12,Menu_Buf^);
   BoxColor(33,3,52,12,FondBox);
   BoxFill(31,2,50,11,' ');
   Box13.Rectangle(31,2,50,11,Double);
   Putxy(33,3,'Block  '+#26+'   Notes ');
   Putxy(33,4,'Phrases '+#26+'  Notes');
   Putxy(33,5,'Fran‡ais Anglais');
   Putxy(33,6,'Anglais Fran‡ais');
   Putxy(33,7,'Tables de verbes');
   Putxy(33,8,'Examples    Find ');
   Putxy(33,9,'Repertoire  Find');
   Putxy(33,10,'Change of notes');

   WriteCar(33,3,'B');
   WriteCar(33,4,'P');
   WriteCar(33,5,'F');
   WriteCar(33,6,'A');
   WriteCar(33,7,'T');
   WriteCar(33,8,'E');
   WriteCar(33,9,'R');
   WriteCar(33,10,'C');

   HighBox(32,Y,49,Y,Bx);

   Mousexy(30,1);
   Repeat
       CSOFF;
       
       {Key:=KeyBoard;}

       DisplayMouse;
       Key:=KeyMouse;
       MaskMouse;

       if (Key=1) And (not Key_Code) And (Mbox(32,3,49,10)) Then
        begin
           if MouseY <> Y Then
            begin
               HighBox(32,Y,49,Y,Bx);
               Y:=MouseY;
               HighBox(32,Y,49,Y,Bx);
            end;
        end
       else
       if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(32,3,49,10)) Then
        begin
           Key_Code:=false;
           Key:=13;
        end
       else  {** Menus **}
       if (Key=2) And (not Key_Code) And (Mbox(5,1,60,1)) Then
        begin
           Key:=0;
           Case MouseX Of
              5..8: Key:=33; {File}
            13..16: Key:=18; {Edit}
            21..27: Key:=24; {Options}
            {**32..35: Key:=38;**} {**Lang**}
            40..51: Key:=34; {Graph}
            56..60: Key:=50; {Maths}
            else Key:=0;
           end;

           if (Key<>0) Then
            begin
               Alt:=true;
               Key_Code:=true;
            end;
        end;

       if (Not Key_Code) And (Key in[66,98,80,112,70,102,65,97,84,116,69,101,82,114,67,99]) Then
        begin
           HighBox(32,Y,49,Y,Bx);
           Case Key of
             {B} 66,98:  Y:=3;
             {P} 80,112: Y:=4;
             {F} 70,102: Y:=5;
             {A}  65,97: Y:=6;
             {T} 84,116: Y:=7;
             {E} 69,101: Y:=8;
             {R} 82,114: Y:=9;
             {C} 67,99:  Y:=10;
           end; {case}
           Key:=13;
           HighBox(32,Y,49,Y,Bx);
        end
       else
       if (Key_Code) And (Key=72) And (Y>3) Then
        begin
           HighBox(32,Y,49,Y,Bx);
           Dec(y);
           HighBox(32,Y,49,Y,Bx);
        end
       else
       if (Key_Code) And (Key=80) And (Y<10) Then
        begin
           HighBox(32,y,49,Y,Bx);
           inc(y);
           HighBox(32,Y,49,Y,Bx);
        end;

       if ((y in[3,4,5,6,7,8,9,10]) And (Key=13)) Then
        begin
          Case y Of
            3: Lire_Phrases(25,4,Dic_Nom8);
            4: Lire_Phrases(25,5,Dic_Nom7);

            5: begin
                  Entree:=Texte_traduction(6,'F');
                  if Copy_Exemples Then
                   begin
                      Key_code:=false;
                      Key:= 27;
                   end;
               end;

            6: begin
                  Entree:=Texte_traduction(7,'A');
                  if Copy_Exemples Then
                   begin
                      Key_code:=false;
                      Key:= 27;
                   end;
               end;

            7: begin
                  Nom_Help:=Table_De_Verbes(FondBox);
                  if Nom_Help<>'' Then LireTexte(Disque_Help,Nom_Help);
                  Nom_Help:='*.Hlp';
                  if Copy_Exemples Then
                   begin
                      Key_code:=false;
                      Key:= 27;
                   end;
               end;

            8: begin
                  Dir_Nom_Help;
                  if Nom_Help<>'*.Hlp' Then LireTexte(Disque_Help,Nom_Help);
                  if Copy_Exemples Then
                   begin
                      Key_code:=false;
                      Key:= 27;
                   end;
               end;

            9: Change_Repertoire_Langage(FondBox);

           10: Change_Nom_Fic_Notes(10)
          end;
        end
       else
       if (Key_Code) and (Alt) And (Key=45) Then
        begin
           if _Save_Fichier Then
            begin
               if P_New = 69 Then Fin_programme:=true;
            end
           else Fin_programme:=true;
        end
       else
       if (Key_Code) and (Key=59) Then Help_Keys;

   Until ((not Key_code) And (Key = 27)) OR
         ((Key_Code) And (Key in[60,61,75,77])) OR
         ((Key_Code) And (Alt) And (Key in[33,18,24,34,50])) OR
         ((Alt) And (Key=106)) OR  (Fin_programme);

   HighBox(31,1,36,1,Bx);
   Writebuf(31,2,52,12,Menu_Buf^);
   Retur4:=Y;
   if ((Key_Code) And (Alt) And (Key in[33,18,24,34,50])) Then
    begin
        Case Key Of
          33: Menu_Language:=1;
          18: Menu_Language:=2;
          24: Menu_Language:=3;
          34: Menu_Language:=5;
          50: Menu_Language:=6;
        end;
    end
   else
     Case Key Of
      75: Menu_Language:=3;
      77: Menu_Language:=5;
     106: begin
             Menu_Language:=1;
             Retur1:=106;
          end;
      60: begin
             P_Save;
             Menu_Language:=27;
             Retur0:=3;
          end;
      61: begin
             Menu_Language:=1;
             Retur1:=61;
          end;
      27: begin
             Menu_Language:=27;
             Retur0:=4;
          end;
     end;

   if Fin_programme Then Menu_Language:=27;

end; {**langage**}






Function Menu_Graph(y:byte):byte;
 var Key : byte;

begin
   HighBox(39,1,52,1,Bx);
   Readbuf(39,2,59,9,Menu_Buf^);
   BoxColor(41,3,59,9,FondBox);
   BoxFill(39,2,57,8,' ');
   Box13.Rectangle(39,2,57,8,Simple);
   Putxy(41,3,'Graph Trace NUM');
   Putxy(41,4,'Help  Graph Num');
   Putxy(41,5,'Notes de  C.N.C');
   Putxy(41,6,'Init Tool outil');
   Putxy(41,7,'Auto  var  Edit');

   WriteCar(41,3,'G');
   WriteCar(41,4,'H');
   WriteCar(41,5,'N');
   WriteCar(41,6,'I');
   WriteCar(41,7,'A');

   HighBox(40,Y,56,Y,Bx);

   Mousexy(38,1);
   Repeat
       Csoff;

       {Key:=KeyBoard;}

       DisplayMouse;
       Key:=KeyMouse;
       MaskMouse;

       if (Key=1) And (not Key_Code) And (Mbox(40,3,56,7)) Then
        begin
           if MouseY <> Y Then
            begin
               HighBox(40,Y,56,Y,Bx);
               Y:=MouseY;
               HighBox(40,Y,56,Y,Bx);
            end;
        end
       else
       if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(40,3,56,7)) Then
        begin
           Key_Code:=false;
           Key:=13;
        end
       else  {** Menus **}
       if (Key=2) And (not Key_Code) And (Mbox(5,1,60,1)) Then
        begin
            Key:=0;
            Case MouseX Of
                5..8: Key:=33; {File}
              13..16: Key:=18; {Edit}
              21..27: Key:=24; {Options}
              32..35: Key:=38; {Lang}
              {**40..51: Key:=34;**} {**Graph**}
              56..60: Key:=50; {Maths}
              else Key:=0;
            end;

            if (Key<>0) Then
             begin
                 Alt:=true;
                 Key_Code:=true;
             end;
        end;

       if (Not Key_Code) And (Key in[71,103,72,104,78,110,73,105,65,97]) Then
        begin
           HighBox(40,Y,56,Y,Bx);
           Case Key of
            {G} 71,103: Y:=3;
            {H} 72,104: Y:=4;
            {N} 78,110: Y:=5;
            {I} 73,105: Y:=6;
            {A}  65,97: Y:=7;
           end; {case}
        
          if (Key<>71) And (Key<>103) Then Key:=13;
          HighBox(40,Y,56,Y,Bx);
        end;

       if (Key_Code) And (Key=80) And (Y<7) Then
        begin
           HighBox(40,Y,56,Y,Bx);
           inc(Y);
           HighBox(40,Y,56,Y,Bx);
        end
       else
       if (Key_Code) And (Key=72) And (Y>3) Then
        begin
           HighBox(40,Y,56,Y,Bx);
           Dec(Y);
           HighBox(40,Y,56,Y,Bx);
        end
       else
      if Key=13 Then
       begin

          if Y=3 Then
           begin
              if (_Save_Fichier) And (NomFic<>'') And (NomFic<>'NONAME.???')  Then
               begin
                  textAttr:=Menu_Color;
                  if P_New<>69 Then
                   begin
                       Sxx1:='';
                   end;
               end;

              Window(1,1,80,CrtGetMaxY);
              SetGraphMode(GetGraphMode);

              if (Not _Save_Fichier) Then
               begin
                  ix:=1;X_Car:=' ';
                  Entree1:=false;
                  While ((ix < Fin_Buffer) And (ix<100) And (Not Entree1)) Do
                   begin
                      X_Car:=Buffer^[ix];
                      if X_Car>#32 Then Entree1:=true;
                      inc(ix);
                   end;

                  if X_Car = '%' Then
                   begin
                      GraPhique_Numeriqe(Disque_Nom,NomFic);
                   end
                  else
                    GraPhique_Numeriqe('','');
               end
              else GraPhique_Numeriqe('','');

              RESTORECRTMODE;
              EDIt_ECRAN;

              textAttr:=Edit_Color;
              if X_curseur<Max_curseurX Then E_curseurX:=X_curseur
              else E_curseurX:=Max_curseurX-1;
              Window(1,1,80,CrtGetMaxY);
              Window(2,4,79,CrtGetMaxY-1);
              Premiere_Page_Debut(Debut_Page);
              Window(1,1,80,CrtGetMaxY);

             if Y_curseur>=Max_curseurY Then
              begin
                 Dec(Line_curseur,Y_curseur-(Max_curseurY-1));
                 Y_curseur:=Max_curseurY-1;
              end;
             Change_de_ligne:=true;
             WindowMouse(1,1,CrtGetMaxX,CrtGetMaxY);
             StyleMouse(2,14);

             Key:=255;
             Key_Code:=false;
             textAttr:=Menu_Color;
             HighBox(39,1,52,1,Bx);
           end
          else
          if Y=4 Then Help_Index_Num(Repertoire+'EDnum\','Help_Num.HLP')
          else
          if Y=5 Then
           begin
              Nom_Help:=Table_De_CommandeNC(FondBox);
              if Nom_Help<>'' Then LireTexte(Disque_Help,Nom_Help);
              Nom_Help:='*.Hlp';
              if Copy_Exemples Then
               begin
                  Key_code:=false;
                  Key:= 27;
               end;
           end
          else
         if Y=6 Then Correction_Outils(28,7)
         else
         if Y=7 Then  Auto_Var_Edit;

       end;
      
      if (Key_Code) and (Alt) And (Key=45) Then
       begin
          if _Save_Fichier Then
           begin
              if P_New = 69 Then Fin_programme:=true;
           end
          else Fin_programme:=true;
       end
      else
      if (Key_Code) and (Key=59) Then Help_Keys;

   Until ((Not key_Code) And (Key in[27,255])) OR
         ((key_Code) And (Key in[75,77])) Or
         ((Key_Code) And (Alt) And (Key in[33,18,24,38,50])) OR (Fin_Programme);

   if Key = 255 Then Key:=27
   else Writebuf(39,2,59,9,Menu_Buf^);
   Retur5:=Y;
   HighBox(39,1,52,1,Bx);

   if Fin_Programme Then Menu_Graph:=27
   else
   if ((Key_Code) And (Alt) And (Key in[33,18,24,38,50])) Then
     begin
        Case Key Of
          33: Menu_Graph:=1;
          18: Menu_Graph:=2;
          24: Menu_Graph:=3;
          38: Menu_Graph:=4;
          50: Menu_Graph:=6;
        end;
     end
   else
   Case Key Of
     75: Menu_Graph:=4;
     77: Menu_Graph:=6;
     27: begin
            Menu_Graph:=27;
            Retur0:=5;
         end;
   end;
end;{**ends Menu_Graph**}
 


Function Menu_Mathes(y:byte):byte;
 var Key          : byte;
     Sn           : string[10];
     Lignes       : byte;
     Entree,Colory: boolean;
     nn           : string;

begin
   Colory:=false;
   HighBox(55,1,61,1,Bx);
   Readbuf(55,2,73,11,Menu_Buf^);
   BoxColor(57,3,73,11,FondBox);
   BoxFill(55,2,71,10,' ');
   Box13.Rectangle(55,2,71,10,Simple);
   Putxy(57,3,'Calculatrice');
   Putxy(57,4,'Calculator');
   Putxy(57,5,'Rotation   G3');
   Putxy(57,6,'Distan  Angle');
   Putxy(57,7,'G3 Centre-Arc');
   Putxy(57,8,'Light Colours');
   if Ordinateur486 Then  {**Ordinateur 486**}
     Putxy(57,9,'Proceseur 486')
   else
   Putxy(57,9,'Proceseur 386');
   WriteCar(57,3,'C');
   WriteCar(58,4,'a');
   WriteCar(57,5,'R');
   WriteCar(57,6,'D');
   WriteCar(57,7,'G');
   HighBox(56,Y,70,Y,Bx);

   Mousexy(54,1);
   Repeat

       {Key:=KeyBoard;}

       Csoff;
       DisplayMouse;
       Key:=KeyMouse;
       MaskMouse;

       if (Key=1) And (not Key_Code) And (Mbox(56,3,70,9)) Then
        begin
           if MouseY <> Y Then
            begin
               HighBox(56,Y,70,Y,Bx);
               Y:=MouseY;
               HighBox(56,Y,70,Y,Bx);
            end;
        end
       else
       if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(56,3,70,9)) Then
        begin
           Key_Code:=false;
           Key:=13;
        end
       else  {** Menus **}
       if (Key=2) And (not Key_Code) And (Mbox(5,1,51,1)) Then
        begin
            Key:=0;
            Case MouseX Of
               5..8: Key:=33; {File}
             13..16: Key:=18; {Edit}
             21..27: Key:=24; {Options}
             32..35: Key:=38; {Lang}
             40..51: Key:=34; {Graph}
             {**56..60: Key:=50;**} {**Maths**}
             else Key:=0;
            end;

            if (Key<>0) Then
              begin
                 Alt:=true;
                 Key_Code:=true;
              end;
        end;

       if (Not Key_Code) And (Key in[67,99,65,97,82,114,68,100,71,103]) Then
        begin
           HighBox(56,Y,70,Y,Bx);
           Case Key of
            {C} 67,99: Y:=3;
            {a} 65,97: Y:=4;
            {R} 82,114: Y:=5;
            {D} 68,100: Y:=6;
            {G} 71,103: Y:=7;
           end; {case}

          Key:=13;
          HighBox(56,Y,70,Y,Bx);
        end;

       if (Key_Code) And (Key=80) And (Y<9) Then
        begin
           HighBox(56,Y,70,Y,Bx);
           inc(Y);
           HighBox(56,Y,70,Y,Bx);
        end
       else
       if (Key_Code) And (Key=72) And (Y>3) Then
        begin
           HighBox(56,Y,70,Y,Bx);
           Dec(Y);
           HighBox(56,Y,70,Y,Bx);
        end
       else
       if (Not Key_Code) and (Key=13) Then
        begin
           if Y=3 Then
            begin
                ReadBuf(49,4,51+26,5+11,BuffDir^);
                BoxColor(51,5,51+26,5+11,FondBox);
                Calculatrice(49,4,Calculatrice_S2,Calculatrice_S3,Calculatrice_Total,Calculatrice_TotalM);
                WriteBuf(49,4,51+26,5+11,BuffDir^);
                CSOff;
            end
           else
           if Y=4 Then
            begin
                if CrtGetMaxY=50 Then ScreenLine25;
                Window(1,1,80,CrtGetMaxY);
                Calculator;
                Window(1,1,80,CrtGetMaxY);
                StyleMouse(2,14);
                Colory:=true;
            end
           else
           if Y=5 Then
            begin
                ReadBuf(48,6,50+30,7+8,BuffDir^);
                BoxColor(50,7,50+30,7+8,FondBox);
                DONNE_ROTATION_G3(48,6);
                WriteBuf(48,6,50+30,7+8,BuffDir^);
            end
           else
          if Y=6 Then
           begin
               ReadBuf(48,7,50+30,8+7,BuffDir^);
               BoxColor(50,8,50+30,8+7,FondBox);
               Cherche_Rayon(48,7);
               WriteBuf(48,7,50+30,8+7,BuffDir^);
           end
          else
          if Y=7 Then
           begin
              ReadBuf(48,8,50+30,9+11,BuffDir^);
              BoxColor(50,9,50+30,9+11,FondBox);
              Calcul_Centre_Arc(48,8);
              WriteBuf(48,8,50+30,9+11,BuffDir^);
           end
          else
          if Y=8 Then
           begin
               Key:=0;
               ReadBuf(40,9,50+30,12,BuffDir^);
               BoxColor(42,10,50+29,12,FondBox);
               BoxFill(40,9,50+27,11,' ');
               Box13.Rectangle(40,9,50+27,11,Simple);
               Putxy(43,10,'Modification des Couleurs [Y / N]');
               CsOff;

               Repeat
                  Key:=Keyboard;
               Until Key in[89,121,78,110,27];
        
               WriteBuf(40,9,50+30,12,BuffDir^);

               if Key in[89,121] Then
                begin
                   Mode_Color(Repertoire+'EDNUM\EDNUM.INI');
                   Colory:=true;
                   FondBox:=Edit_Color-(((Edit_Color And $70) shr 4) * 16);
                   Fond__Box:=FondBox;
                end;
               Key:=27;
           end;
          if Y=9 Then
           begin
               Key:=0;
               if Ordinateur486 Then nn:='486'
               else nn:='386';
               
               ReadBuf(40,10,50+30,13,BuffDir^);
               BoxColor(42,11,50+29,13,FondBox);
               BoxFill(40,10,50+27,12,' ');
               Box13.Rectangle(40,10,50+27,12,Simple);
               Putxy(43,11,'Proceseur 386 ou 486: ');
               Entree:=ReadBox(65,11,nn,4,5);

               if Entree Then
                begin
                   BoxFill(40,10,50+27,12,' ');
                   Box13.Rectangle(40,10,50+27,12,Simple);
                   Putxy(43,11,'Attention!!  Modification [Y / N]');
                   CsOff;
                   Repeat
                      Key:=KeyBoard;
                   Until Key in[89,121,78,110,27];
                end;

               if Key in[89,121] Then
                begin
                   if nn<>'486' Then Ordinateur486:=false
                   else Ordinateur486:=true;
                   Key:=0;
 
                   HighBox(56,Y,70,Y,Bx);
                   if Ordinateur486 Then  {**Ordinateur 486* *}
                      Putxy(57,9,'Proceseur 486')
                   else
                   Putxy(57,9,'Proceseur 386');
                   HighBox(56,Y,70,Y,Bx);

                   if Ordinateur486 Then  {Ordinateur 486}
                    begin
                       DelayPose:=100;            {** Editeur **}
                       Opertion_Tempo:=7000;      {** Graphiques **}
                       Messages_Tempo:=32000;     {** Messages sur graphiques **}
                       TempoOk:=100;
                       Tempo:=80;                 {** Vitese de graphiques **}
                       DelayPon:=31000;           {** execution des POM **}
                       DelayMouse:=2000;          {** vitese de Mousse **}
                       Tempo__Mouse:=Round(DelayMouse)+200;
                    end
                   else
                    begin                 {Ordinateur 386}
                       DelayPose:=30;
                       Opertion_Tempo:=350;
                       Messages_Tempo:=2500;
                       TempoOK:=10;
                       Tempo:=80;
                       DelayPon:=400; {Ordinateur 386}
                       DelayMouse:=70;
                       Tempo__Mouse:=Round(DelayMouse)+200;
                    end;
                end {** key = Y **}
               else
               Key:=27;
               WriteBuf(40,10,50+30,13,BuffDir^);
               Csoff;
            end;
        end
       else
       if (Key_Code) and (Alt) And (Key=45) Then
        begin
           if _Save_Fichier Then
            begin
               if P_New = 69 Then Fin_programme:=true;
            end
           else Fin_programme:=true;
        end
       else
       if (Key_Code) and (Key=59) Then Help_Keys;

   Until ((Not key_Code) And (Key in[27])) OR
         ((key_Code) And (Key in[75,77])) OR
         ((Key_Code) And (Alt) And (Key in[33,18,24,38,34])) OR
         (Fin_Programme) OR (Colory);


   if Not Colory Then
    begin
       Writebuf(55,2,73,11,Menu_Buf^);
       HighBox(55,1,61,1,Bx);
    end
   else
     begin
        Colory:=false;
        EDIt_ECRAN;

        textAttr:=Edit_Color;
        if X_curseur<Max_curseurX Then E_curseurX:=X_curseur
        else E_curseurX:=Max_curseurX-1;
        Window(1,1,80,CrtGetMaxY);
        Window(2,4,79,CrtGetMaxY-1);
        Premiere_Page_Debut(Debut_Page);
        Window(1,1,80,CrtGetMaxY);

        if Y_curseur>=Max_curseurY Then
         begin
            Dec(Line_curseur,Y_curseur-(Max_curseurY-1));
            Y_curseur:=Max_curseurY-1;
         end;
        Change_de_ligne:=true;
        WindowMouse(1,1,CrtGetMaxX,CrtGetMaxY);
        StyleMouse(2,14);

        textAttr:=Edit_Color;
        Key:=27;
     end;
   
   Retur6:=Y;
   if ((Key_Code) And (Alt) And (Key in[33,18,24,38,34])) Then
    begin
        Case Key Of
          33: Menu_Mathes:=1;
          18: Menu_Mathes:=2;
          24: Menu_Mathes:=3;
          38: Menu_Mathes:=4;
          34: Menu_Mathes:=5;
        end;
    end
   else
   if Fin_Programme Then Menu_Mathes:=27
   else
     Case Key Of
      75: Menu_Mathes:=5;
      77: Menu_Mathes:=1;
      27: begin
             Menu_Mathes:=27;
             Retur0:=6;
          end;
     end;
end;{**ends Menu_Mathes**}



Function Edit(Y:byte):byte;
 var
    Key    : byte;
    Entree : boolean;
begin
   if (StrFind='') Then Find_valeur:=0;
   HighBox(12,1,17,1,Bx);
   Readbuf(12,2,37,10,Menu_Buf^);
   BoxColor(14,3,37,10,FondBox);
   BoxFill(12,2,35,9,' ');
   Box13.Rectangle(12,2,35,9,Simple);
   Putxy(14,3,'Cherche     Ctrl Q F');
   Putxy(14,4,'Replace     Ctrl Q A');
   Putxy(14,5,'Suite-cherche Ctrl L');
   Putxy(14,6,'Evaluate  formules  ');
   Putxy(14,7,'Help evaluat formule');
   Putxy(14,8,'Clavier  -  Num 750.');

   WriteCar(14,3,'C');
   WriteCar(14,4,'R');
   WriteCar(14,5,'S');
   WriteCar(14,6,'E');
   WriteCar(14,7,'H');
   WriteCar(16,8,'a');

   HighBox(13,Y,34,Y,BX);
   Mousexy(11,1);
   Repeat

       {Key:=KeyBoard;}

       Csoff;
       DisplayMouse;
       Key:=KeyMouse;
       MaskMouse;

       if (Key=1) And (not Key_Code) And (Mbox(13,3,34,8)) Then
        begin
           if MouseY <> Y Then
            begin
               HighBox(13,Y,34,Y,Bx);
               Y:=MouseY;
               HighBox(13,Y,34,Y,Bx);
            end;
        end
       else
       if (Key=2) And (not Key_Code) And (MouseY = Y) And (Mbox(13,3,34,8)) Then
        begin
           Key_Code:=false;
           Key:=13;
        end
       else  {** Menus **}
       if (Key=2) And (not Key_Code) And (Mbox(5,1,60,1)) Then
        begin
            Key:=0;
            Case MouseX Of
               5..8: Key:=33; {File}
             {**13..16: Key:=18;**} {**Edit**}
             21..27: Key:=24; {Options}
             32..35: Key:=38; {Lang}
             40..51: Key:=34; {Graph}
             56..60: Key:=50; {Maths}
             else Key:=0;
            end;

            if (Key<>0) Then
              begin
                 Alt:=true;
                 Key_Code:=true;
              end;
        end;

       if (Not Key_Code) And (Key in[67,99,82,114,83,115,69,101,72,104,65,97]) Then
        begin
           HighBox(13,Y,34,Y,Bx);
           Case Key of
            {C} 67,99 : Y:=3;
            {R} 82,114: Y:=4;
            {S} 83,115: Y:=5;
            {E} 69,101: Y:=6;
            {H} 72,104: Y:=7;
            {a} 65,97:  Y:=8;
           end; {case}
           Key:=13;
           HighBox(13,Y,34,Y,Bx);
        end;

       if (Key_Code) and (Key=80) And (Y<8) Then
        begin
           highbox(13,Y,34,Y,BX);
           inc(Y);
           highbox(13,Y,34,Y,BX);
        end
       else
       if (Key_Code) And (Key=72) And (Y>3) Then
        begin
           highbox(13,Y,34,Y,BX);
           Dec(Y);
           highbox(13,Y,34,Y,BX);
        end
       else
       if ((Not Key_Code) And (Key=13)) Then
        begin
           Case Y Of
             3: begin
                   if ( _Finds(2)) Then
                    begin
                       Find_valeur:=63;
                       Key:=255;
                       Key_Code:=false;
                    end
                   else Find_valeur:=0;
                end;

             4: begin
                   if ( _Finds(1)) Then
                    begin
                       Find_valeur:=98;
                       Key:=255;
                       Key_Code:=false;
                    end
                   else Find_valeur:=0;
                end;

             5: begin
                   if (StrFind<>'') Then
                    begin
                       Find_valeur:=62;
                       Key:=255;
                       Key_Code:=false;
                    end
                   else Find_Valeur:=0;
                end;

             6: begin
                   Readbuf(3,7,78,11,BuffDir^);
                   BoxColor(5,8,77,11,FondBox);
                   BoxFill(3,7,75,10,' ');
                   Box13.Rectangle(3,7,75,10,Simple);
                   Putxy(34,7,' Evaluate ');
                   Repeat
                      Entree:=ReadBox(5,8,StrCalcul,68,140);
                      if (Entree) and (StrCalcul<>'') Then
                       begin
                          StrResult:=Act(StrCalcul,9,4);
                          Putxy(5,9,'                                                                ');
                          textAttr:=113;
                          Putxy(5,9,'Result: ');
                          if (Result__Error = 1) Then
                           begin
                              textAttr:=116;
                              Putxy(13,9,StrResult);
                              StrResult:='';
                           end
                          else Putxy(13,9,StrResult);
                          textAttr:=Menu_Color;
                       end;
                   Until (Not Entree);
                   Writebuf(3,7,78,11,BuffDir^);
                end;

              7: begin
                    Readbuf(14,8,64,14,BuffDir^);
                    BoxColor(16,9,64,14,FondBox);
                    BoxFill(14,8,62,13,' ');
                    Box13.Rectangle(14,8,62,13,Simple);
                    Putxy(32,8,' Help evaluate ');
                    Putxy(16,9,'  +   -   *   /   ^   (   )');
                    Putxy(16,10,'PI(0) ABS   TAN  ATAN   COS    EXP    LN');
                    Putxy(16,11,'SIN   SQRT  SQR  TRUNC  RADIA  ARSIN  ARCOS');
                    Putxy(16,12,'ROUND FRAC INT');
                    Mousexy(14,8);
                    csoff;
                    DisplayMouse;
                    Repeat
                        Key:=KeyMouse;
                    Until ( (Key=1) And (Mbox(15,9,61,12)) ) OR (Key=27);
                    MaskMouse;
                    key:=0;
                    Writebuf(14,8,64,14,BuffDir^);
                 end;

              8: begin
                    Window(1,1,80,CrtGetMaxY);
                    SetGraphMode(GetGraphMode);
                    Voir750;
                    RESTORECRTMODE;
                    EDIt_ECRAN;
                    textAttr:=Edit_Color;

                    if X_curseur<Max_curseurX Then E_curseurX:=X_curseur
                    else E_curseurX:=Max_curseurX-1;
                    Window(1,1,80,CrtGetMaxY);
                    Window(2,4,79,CrtGetMaxY-1);
                    Premiere_Page_Debut(Debut_Page);
                    Window(1,1,80,CrtGetMaxY);

                    if Y_curseur>=Max_curseurY Then
                     begin
                        Dec(Line_curseur,Y_curseur-(Max_curseurY-1));
                        Y_curseur:=Max_curseurY-1;
                     end;
                    Change_de_ligne:=true;
                    WindowMouse(1,1,CrtGetMaxX,CrtGetMaxY);
                    StyleMouse(2,14);

                    Key:=254;
                    Key_Code:=false;
                    textAttr:=Menu_Color;
                    Highbox(12,1,17,1,BX);
                 end;
           end;{**case**}
        end
       else
       if (Alt And ((Key=45) Or (Key=106)))  Then
        begin
           if (_Save_Fichier) Then
            begin
               if (P_New = 69)  Then Fin_Programme:=true;
            end
           else Fin_Programme:=true;
        end
       else
       if (Key_Code and (Key = 59)) Then Help_Keys;

   Until ((Not key_Code) And (Key in[27,255,254])) OR (Fin_Programme) OR
         ((Key=77) And (Key_Code)) OR  ((Key=75) And (Key_Code)) OR
         ((Key_Code) And (Alt) And (Key in[33,24,38,34,50]));

   Highbox(12,1,17,1,BX);

  if Key = 254 Then Key:=27
  else WriteBuf(12,2,37,10,Menu_Buf^);
  Retur2:=Y;

  if Fin_Programme Then Edit:=27
  else
  if Key=255 Then
   begin
       Edit:=27;
       Retur0:=2;
   end
  else
  if ((Key_Code) And (Alt) And (Key in[33,24,38,34,50])) Then
   begin
      Case Key Of
        33: Edit:=1;
        24: Edit:=3;
        38: Edit:=4;
        34: Edit:=5;
        50: Edit:=6;
      end;
   end
  else
  if (Key_Code) And (Key=75) Then Edit:=1
  else
  if (Key_Code) And (Key =77) Then Edit:=3
  else
  if (Key=27) Then
   begin
      Edit:=27;
      Find_valeur:=0;
      Retur0:=2;
   end;
   
  if (Find_Valeur=255) Then begin end
  else
  if (StrFind='') Then Find_valeur:=0;
end;{**ends Edit**}



Function Menu_General(X:byte):byte;
 Const XL : Array[1..6] OF byte=(9,17,28,36,52,60);
       X1 : Array[1..6] OF byte=(4,12,20,31,39,55);
 Var Key  : byte;

begin
    Key:=0;
    textAttr:=Menu_Color;
    HighBox(X1[X],1,XL[x],1,Bx);
    CSOFF;
    Repeat

        Key:=KeyBoard;

        if (Key_Code) And (Key=75) Then
         begin
            HighBox(X1[X],1,XL[x],1,Bx);
            if X=1 Then X:=6
            else Dec(x);
            HighBox(X1[X],1,XL[x],1,Bx);
         end
        else
        if (Key_Code) And (key=77) Then
         begin
            HighBox(X1[x],1,XL[x],1,Bx);
            if X=6 Then X:=1
            else inc(x);
            HighBox(X1[x],1,XL[x],1,Bx);
         end
        else
       if (Key_Code) and (Key=60) Then P_Save
       else
       if (Key_Code) and (Alt) And (Key=45) Then
        begin
           if _Save_Fichier Then
            begin
               if P_New = 69 Then Fin_Programme:=true;
            end
           else Fin_Programme:=true;
        end
       else
      if (Key_Code) and (Key=59) Then Help_Keys;

    Until ((not Key_code) And
           (Key in [27,70,102,69,101,72,104,76,108,71,103,77,109])) OR
          ((x in[1,2,3,4,5,6]) and (Key=13)) OR
          ((Key_Code) And (Key in[60])) OR
          ((Key_Code) And (Alt) And (Key in[33,18,35,38,34,50])) OR
          ((Alt) And (Key=106)) OR (Fin_Programme);

    HighBox(X1[x],1,XL[x],1,Bx);
    Retur0:=x;

    if Fin_Programme Then Menu_General:=27
    else
    if (Key=13) And (Not Fin_programme) Then Menu_General:=X
    else
    if (Not Key_Code) And (Key In[27,70,102,69,101,72,104,76,108,71,103,77,109]) Then
     begin
        Case Key OF
{F}     70,102: Menu_General:=1;
{E}     69,101: Menu_General:=2;
{H}     72,104: Menu_General:=3;
{L}     76,108: Menu_General:=4;
{G}     71,103: Menu_General:=5;
{M}     77,109: Menu_General:=6;
{Edit}      27: Menu_General:=27;
        end;
     end
    else
    if ((Key_Code) And (Alt) And (Key in[33,18,35,38])) Then
     begin
        Case Key Of
          33: Menu_General:=1;
          18: Menu_General:=2;
          35: Menu_General:=3;
          38: Menu_General:=4;
          34: Menu_General:=5;
          50: Menu_General:=6;
        end;
     end
    else
    if Key in[60,106] Then
      begin
          Menu_General:=1;
          Case Key OF
            60: Retur1:=60;
           106: Retur1:=106;
          end;
      end
    else
      Menu_General:=27;
end; {*** menu general ***}



Procedure Appel_Menu(N:byte);
begin
   Repeat
      Case n Of
       0: N:=Menu_General(Retur0);
       1: N:=Menu_File(Retur1);
       2: N:=Edit(Retur2);
       3: N:=Menu_Options(Retur3);
       4: N:=Menu_Language(Retur4);
       5: N:=Menu_Graph(Retur5);
       6: N:=Menu_Mathes(Retur6);
      end;
   Until (N=27);
end; {*** appel menu ***}

©® document original sources pascal
  
Page Last Updated: Juin 27, 2011 | Page Editor: A. Ara | SiteMap Dans Une Autre Galaxie
Cet emplacement web non-commercial, et totalement libre & indépendant de tout les parti politique ou d'organisme officiel de toute nature. Nous réflexions sont exclusivement l'avis de personnes qui rejettent le massacre que la société fait aux animaux pour tout motif.