char BlancLigne[] = "                                                                       ";

/*............ String requester support ........*/

UBYTE	StrBuf[8][81];

struct IntuiText question = {
    3,0,JAM2,15,15,	/* front pen, back pen, mode, left, top */
    NULL, 		/* font */
    NULL,	/* question to ask */
    NULL};		/* next text */

#define LSTRG	35
#define TSTRG	60
#define HSTRG	14
#define b_N	0
#define b_S	1
#define b_A	2
#define b_SA	3
#define b_C	4
#define b_CS	5
#define b_CA	6
#define b_CSA	7

struct IntuiText Blanc_Txt = {0,0,JAM2,4,0,0,(UBYTE *)BlancLigne,0};

struct IntuiText N_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"N",0};
struct	StringInfo Nstrinfo = {
    StrBuf[b_N],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText S_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"S",0};
struct	StringInfo Sstrinfo = {
    (UBYTE *)StrBuf[b_S],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText A_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"A",0};
struct	StringInfo Astrinfo = {
    (UBYTE *)StrBuf[b_A],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText SA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"SA",0};
struct	StringInfo SAstrinfo = {
    (UBYTE *)StrBuf[b_SA],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText C_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"C",0};
struct	StringInfo Cstrinfo = {
    (UBYTE *)StrBuf[b_C],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText CS_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CS",0};
struct StringInfo CSstrinfo = {
    (UBYTE *)StrBuf[b_CS],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText CA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CA",0};
struct	StringInfo CAstrinfo = {
    (UBYTE *)StrBuf[b_CA],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct IntuiText CSA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CSA",0};
struct	StringInfo CSAstrinfo = {
    (UBYTE *)StrBuf[b_CSA],
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct Gadget StringGad[8] = {
  { NULL,LSTRG,TSTRG,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&N_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&Nstrinfo,	/* special info */
    0x40+b_N,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&S_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&Sstrinfo,	/* special info */
    0x40+b_S,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_A,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&A_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&Astrinfo,	/* special info */
    0x40+b_A,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_SA,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&SA_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&SAstrinfo,	/* special info */
    0x40+b_SA,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_C,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&C_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&Cstrinfo,	/* special info */
    0x40+b_C,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_CS,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&CS_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&CSstrinfo,	/* special info */
    0x40+b_CS,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_CA,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&CA_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&CAstrinfo,	/* special info */
    0x40+b_CA,NULL		/* gadget ID, user data */
  },
  {
    NULL,LSTRG,TSTRG+HSTRG*b_CSA,500,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&CSA_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&CSAstrinfo,	/* special info */
    0x40+b_CSA,NULL		/* gadget ID, user data */
   }
  };

#define LNSTRG	50
#define TNSTRG	100
#define G_NOM	10

#define NOM_DU_FICHIER	1
#define NOM_DE_LA_TABLE	2
#define ECRITURE	3
#define FINI		4
#define MAL_FINI	5

UBYTE NomStrBuf[80];
UBYTE nom_fich[80];
struct IntuiText Nom_Txt = {3,0,JAM1,-LNSTRG+10,0,0,(UBYTE *)"Nom:",0};

struct	StringInfo Nom_strinfo = {
    (UBYTE *)NomStrBuf,
    (UBYTE *)NULL,
    0,80,0,0,0,0,	/* initial, max, disp, undo, #chrs, dsp chrs */
    0,0,NULL,0L,NULL};	/* left,top,layer,longint,keymap */

struct Gadget NomGad =
  { NULL,LNSTRG,TNSTRG,480,14,	/* next,left,top,width,height */
    GADGHCOMP,/* flags */
    RELVERIFY, STRGADGET,/* activation, type */
    NULL,NULL,&Nom_Txt,	/* gad render, sel render, gad text */
    0L,			/* mutual exclude */
    (APTR)&Nom_strinfo,	/* special info */
    G_NOM,NULL		/* gadget ID, user data */
  };

/*........... Definition des gadgets .................*/
 
/* Gadget ID's */
#define G_SHIFT	  0
#define G_CTRL	  1
#define G_ALT	  2
#define G_STRING  3
#define G_DEAD	  4
#define G_OK	  5
#define G_SAVE	  6
#define G_ABORT	  7
/*#define MOD_G	  11*/
/*#define OFF_G	  6*/

#define L_TXT	10
#define T_TXT	4
#define WGAD	70  
#define HGAD	16
#define LGAD	90
#define TGAD	40
#define BGAD	-20
#define XGAD	100

struct IntuiText ShiftTxt =
		 {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)"SHIFT",0};
struct IntuiText CtrlTxt  =
		 {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)" CTRL",0};
struct IntuiText AltTxt   =
		 {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)" ALT",0};
struct IntuiText StrTxt   =
		 {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)"STRING",0};
struct IntuiText DeadTxt  =
		 {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)" DEAD",0};
struct IntuiText OkTxt    =
		 {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)"  OK",0};
struct IntuiText AbortTxt =
		 {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)"ABORT",0};
struct IntuiText SaveTxt =
		 {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)" SAVE",0};
  
SHORT  GadBorXY[10] = {0,0, WGAD-1,0, WGAD-1,HGAD-1, 0,HGAD-1, 0,0};
struct Border GadBor = { 0,0,2,0,JAM1,5,&GadBorXY[0],NULL };


struct Gadget AbortGad = {
   NULL, LGAD+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
   | GADGDISABLED,
   RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
   &AbortTxt, 0, NULL, G_ABORT, 0 };

struct Gadget SaveGad = {
   &AbortGad, LGAD+XGAD+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
   | GADGDISABLED,
   RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
   &SaveTxt, 0, NULL, G_SAVE, 0 };

struct Gadget OkGad = {
   &SaveGad, LGAD+XGAD*2+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
   | GADGDISABLED,
   RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
   &OkTxt, 0, NULL, G_OK, 0 };

struct Gadget TogGad[5] = {
  { &TogGad[1], LGAD,TGAD,WGAD,HGAD, GADGHCOMP,
    RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
    &ShiftTxt, 0, NULL, G_SHIFT, 0
  },
  { &TogGad[2], LGAD+XGAD*2,TGAD,WGAD,HGAD, GADGHCOMP,
    RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
    &CtrlTxt, 0, NULL, G_CTRL, 0
  },
  { &TogGad[3], LGAD+XGAD,TGAD,WGAD,HGAD, GADGHCOMP,
    RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
    &AltTxt, 0, NULL, G_ALT, 0
  },
  { &TogGad[4], LGAD+XGAD*3,TGAD,WGAD,HGAD, GADGHCOMP,
    RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
    &StrTxt, 0, NULL, G_STRING, 0
  },
  { &OkGad, LGAD+XGAD*4,TGAD,WGAD,HGAD, GADGHCOMP,
    RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
    &DeadTxt, 0, NULL, G_DEAD, 0
  }
 };

/*............... Definition de la fenetre .............................*/

/* Edimap Window */ 
struct NewWindow newWindow = {
   0,0, WIDTH, HEIGHT,
   -1,-1,
   GADGETUP |/* GADGETDOWN |*/ CLOSEWINDOW | RAWKEY,   /* IDCMP Flags */
   ACTIVATE | SMART_REFRESH | WINDOWCLOSE | WINDOWDEPTH, /* Flags */
   &TogGad[0],             /* First Gadget */
   NULL,             /* CheckMark */
   (UBYTE *)"Edimap",   /* Title */
   NULL,             /* Set up screen pointer before opening */
   NULL,             /* No superbitmap */
   0,0,0,0,          /* Max and Min (no sizing) */
   WBENCHSCREEN              /* Screen type  */
   };

/*.............. Messages globaux ..............*/
BOOL modifie = FALSE;

UBYTE MSortie[] = "Table modifiée, refaites CLOSEWINDOW ou Tapez sur la touche à éditer";
UBYTE *MFClose = MSortie+18;
UBYTE *MTapez = MSortie+18+22;
UBYTE MErreur[] = "****** Le code xxx proposé est invalide ******";
#define POS_ERR 15
UBYTE pas_de_place[] = "pas de place pour un buffer\n";

char txt_err[8][3] = {" N "," S "," A ","SA "," C ","CS ","CA ","CSA"};
