home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 184.lha / Edimap / gadgets.h < prev    next >
C/C++ Source or Header  |  1988-04-28  |  10KB  |  300 lines

  1. char BlancLigne[] = "                                                                       ";
  2.  
  3. /*............ String requester support ........*/
  4.  
  5. UBYTE    StrBuf[8][81];
  6.  
  7. struct IntuiText question = {
  8.     3,0,JAM2,15,15,    /* front pen, back pen, mode, left, top */
  9.     NULL,         /* font */
  10.     NULL,    /* question to ask */
  11.     NULL};        /* next text */
  12.  
  13. #define LSTRG    35
  14. #define TSTRG    60
  15. #define HSTRG    14
  16. #define b_N    0
  17. #define b_S    1
  18. #define b_A    2
  19. #define b_SA    3
  20. #define b_C    4
  21. #define b_CS    5
  22. #define b_CA    6
  23. #define b_CSA    7
  24.  
  25. struct IntuiText Blanc_Txt = {0,0,JAM2,4,0,0,(UBYTE *)BlancLigne,0};
  26.  
  27. struct IntuiText N_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"N",0};
  28. struct    StringInfo Nstrinfo = {
  29.     StrBuf[b_N],
  30.     (UBYTE *)NULL,
  31.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  32.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  33.  
  34. struct IntuiText S_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"S",0};
  35. struct    StringInfo Sstrinfo = {
  36.     (UBYTE *)StrBuf[b_S],
  37.     (UBYTE *)NULL,
  38.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  39.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  40.  
  41. struct IntuiText A_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"A",0};
  42. struct    StringInfo Astrinfo = {
  43.     (UBYTE *)StrBuf[b_A],
  44.     (UBYTE *)NULL,
  45.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  46.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  47.  
  48. struct IntuiText SA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"SA",0};
  49. struct    StringInfo SAstrinfo = {
  50.     (UBYTE *)StrBuf[b_SA],
  51.     (UBYTE *)NULL,
  52.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  53.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  54.  
  55. struct IntuiText C_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"C",0};
  56. struct    StringInfo Cstrinfo = {
  57.     (UBYTE *)StrBuf[b_C],
  58.     (UBYTE *)NULL,
  59.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  60.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  61.  
  62. struct IntuiText CS_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CS",0};
  63. struct StringInfo CSstrinfo = {
  64.     (UBYTE *)StrBuf[b_CS],
  65.     (UBYTE *)NULL,
  66.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  67.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  68.  
  69. struct IntuiText CA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CA",0};
  70. struct    StringInfo CAstrinfo = {
  71.     (UBYTE *)StrBuf[b_CA],
  72.     (UBYTE *)NULL,
  73.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  74.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  75.  
  76. struct IntuiText CSA_Txt = {3,0,JAM1,-LSTRG+4,0,0,(UBYTE *)"CSA",0};
  77. struct    StringInfo CSAstrinfo = {
  78.     (UBYTE *)StrBuf[b_CSA],
  79.     (UBYTE *)NULL,
  80.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  81.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  82.  
  83. struct Gadget StringGad[8] = {
  84.   { NULL,LSTRG,TSTRG,500,14,    /* next,left,top,width,height */
  85.     GADGHCOMP,/* flags */
  86.     RELVERIFY, STRGADGET,/* activation, type */
  87.     NULL,NULL,&N_Txt,    /* gad render, sel render, gad text */
  88.     0L,            /* mutual exclude */
  89.     (APTR)&Nstrinfo,    /* special info */
  90.     0x40+b_N,NULL        /* gadget ID, user data */
  91.   },
  92.   {
  93.     NULL,LSTRG,TSTRG+HSTRG,500,14,    /* next,left,top,width,height */
  94.     GADGHCOMP,/* flags */
  95.     RELVERIFY, STRGADGET,/* activation, type */
  96.     NULL,NULL,&S_Txt,    /* gad render, sel render, gad text */
  97.     0L,            /* mutual exclude */
  98.     (APTR)&Sstrinfo,    /* special info */
  99.     0x40+b_S,NULL        /* gadget ID, user data */
  100.   },
  101.   {
  102.     NULL,LSTRG,TSTRG+HSTRG*b_A,500,14,    /* next,left,top,width,height */
  103.     GADGHCOMP,/* flags */
  104.     RELVERIFY, STRGADGET,/* activation, type */
  105.     NULL,NULL,&A_Txt,    /* gad render, sel render, gad text */
  106.     0L,            /* mutual exclude */
  107.     (APTR)&Astrinfo,    /* special info */
  108.     0x40+b_A,NULL        /* gadget ID, user data */
  109.   },
  110.   {
  111.     NULL,LSTRG,TSTRG+HSTRG*b_SA,500,14,    /* next,left,top,width,height */
  112.     GADGHCOMP,/* flags */
  113.     RELVERIFY, STRGADGET,/* activation, type */
  114.     NULL,NULL,&SA_Txt,    /* gad render, sel render, gad text */
  115.     0L,            /* mutual exclude */
  116.     (APTR)&SAstrinfo,    /* special info */
  117.     0x40+b_SA,NULL        /* gadget ID, user data */
  118.   },
  119.   {
  120.     NULL,LSTRG,TSTRG+HSTRG*b_C,500,14,    /* next,left,top,width,height */
  121.     GADGHCOMP,/* flags */
  122.     RELVERIFY, STRGADGET,/* activation, type */
  123.     NULL,NULL,&C_Txt,    /* gad render, sel render, gad text */
  124.     0L,            /* mutual exclude */
  125.     (APTR)&Cstrinfo,    /* special info */
  126.     0x40+b_C,NULL        /* gadget ID, user data */
  127.   },
  128.   {
  129.     NULL,LSTRG,TSTRG+HSTRG*b_CS,500,14,    /* next,left,top,width,height */
  130.     GADGHCOMP,/* flags */
  131.     RELVERIFY, STRGADGET,/* activation, type */
  132.     NULL,NULL,&CS_Txt,    /* gad render, sel render, gad text */
  133.     0L,            /* mutual exclude */
  134.     (APTR)&CSstrinfo,    /* special info */
  135.     0x40+b_CS,NULL        /* gadget ID, user data */
  136.   },
  137.   {
  138.     NULL,LSTRG,TSTRG+HSTRG*b_CA,500,14,    /* next,left,top,width,height */
  139.     GADGHCOMP,/* flags */
  140.     RELVERIFY, STRGADGET,/* activation, type */
  141.     NULL,NULL,&CA_Txt,    /* gad render, sel render, gad text */
  142.     0L,            /* mutual exclude */
  143.     (APTR)&CAstrinfo,    /* special info */
  144.     0x40+b_CA,NULL        /* gadget ID, user data */
  145.   },
  146.   {
  147.     NULL,LSTRG,TSTRG+HSTRG*b_CSA,500,14,    /* next,left,top,width,height */
  148.     GADGHCOMP,/* flags */
  149.     RELVERIFY, STRGADGET,/* activation, type */
  150.     NULL,NULL,&CSA_Txt,    /* gad render, sel render, gad text */
  151.     0L,            /* mutual exclude */
  152.     (APTR)&CSAstrinfo,    /* special info */
  153.     0x40+b_CSA,NULL        /* gadget ID, user data */
  154.    }
  155.   };
  156.  
  157. #define LNSTRG    50
  158. #define TNSTRG    100
  159. #define G_NOM    10
  160.  
  161. #define NOM_DU_FICHIER    1
  162. #define NOM_DE_LA_TABLE    2
  163. #define ECRITURE    3
  164. #define FINI        4
  165. #define MAL_FINI    5
  166.  
  167. UBYTE NomStrBuf[80];
  168. UBYTE nom_fich[80];
  169. struct IntuiText Nom_Txt = {3,0,JAM1,-LNSTRG+10,0,0,(UBYTE *)"Nom:",0};
  170.  
  171. struct    StringInfo Nom_strinfo = {
  172.     (UBYTE *)NomStrBuf,
  173.     (UBYTE *)NULL,
  174.     0,80,0,0,0,0,    /* initial, max, disp, undo, #chrs, dsp chrs */
  175.     0,0,NULL,0L,NULL};    /* left,top,layer,longint,keymap */
  176.  
  177. struct Gadget NomGad =
  178.   { NULL,LNSTRG,TNSTRG,480,14,    /* next,left,top,width,height */
  179.     GADGHCOMP,/* flags */
  180.     RELVERIFY, STRGADGET,/* activation, type */
  181.     NULL,NULL,&Nom_Txt,    /* gad render, sel render, gad text */
  182.     0L,            /* mutual exclude */
  183.     (APTR)&Nom_strinfo,    /* special info */
  184.     G_NOM,NULL        /* gadget ID, user data */
  185.   };
  186.  
  187. /*........... Definition des gadgets .................*/
  188.  
  189. /* Gadget ID's */
  190. #define G_SHIFT      0
  191. #define G_CTRL      1
  192. #define G_ALT      2
  193. #define G_STRING  3
  194. #define G_DEAD      4
  195. #define G_OK      5
  196. #define G_SAVE      6
  197. #define G_ABORT      7
  198. /*#define MOD_G      11*/
  199. /*#define OFF_G      6*/
  200.  
  201. #define L_TXT    10
  202. #define T_TXT    4
  203. #define WGAD    70  
  204. #define HGAD    16
  205. #define LGAD    90
  206. #define TGAD    40
  207. #define BGAD    -20
  208. #define XGAD    100
  209.  
  210. struct IntuiText ShiftTxt =
  211.          {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)"SHIFT",0};
  212. struct IntuiText CtrlTxt  =
  213.          {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)" CTRL",0};
  214. struct IntuiText AltTxt   =
  215.          {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)" ALT",0};
  216. struct IntuiText StrTxt   =
  217.          {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)"STRING",0};
  218. struct IntuiText DeadTxt  =
  219.          {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)" DEAD",0};
  220. struct IntuiText OkTxt    =
  221.          {1,0,JAM1,L_TXT  ,T_TXT,0,(UBYTE *)"  OK",0};
  222. struct IntuiText AbortTxt =
  223.          {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)"ABORT",0};
  224. struct IntuiText SaveTxt =
  225.          {1,0,JAM1,L_TXT+4,T_TXT,0,(UBYTE *)" SAVE",0};
  226.   
  227. SHORT  GadBorXY[10] = {0,0, WGAD-1,0, WGAD-1,HGAD-1, 0,HGAD-1, 0,0};
  228. struct Border GadBor = { 0,0,2,0,JAM1,5,&GadBorXY[0],NULL };
  229.  
  230.  
  231. struct Gadget AbortGad = {
  232.    NULL, LGAD+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
  233.    | GADGDISABLED,
  234.    RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
  235.    &AbortTxt, 0, NULL, G_ABORT, 0 };
  236.  
  237. struct Gadget SaveGad = {
  238.    &AbortGad, LGAD+XGAD+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
  239.    | GADGDISABLED,
  240.    RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
  241.    &SaveTxt, 0, NULL, G_SAVE, 0 };
  242.  
  243. struct Gadget OkGad = {
  244.    &SaveGad, LGAD+XGAD*2+50,BGAD,WGAD,HGAD, GADGHCOMP | GRELBOTTOM
  245.    | GADGDISABLED,
  246.    RELVERIFY, BOOLGADGET, (APTR)&GadBor, 0,
  247.    &OkTxt, 0, NULL, G_OK, 0 };
  248.  
  249. struct Gadget TogGad[5] = {
  250.   { &TogGad[1], LGAD,TGAD,WGAD,HGAD, GADGHCOMP,
  251.     RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
  252.     &ShiftTxt, 0, NULL, G_SHIFT, 0
  253.   },
  254.   { &TogGad[2], LGAD+XGAD*2,TGAD,WGAD,HGAD, GADGHCOMP,
  255.     RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
  256.     &CtrlTxt, 0, NULL, G_CTRL, 0
  257.   },
  258.   { &TogGad[3], LGAD+XGAD,TGAD,WGAD,HGAD, GADGHCOMP,
  259.     RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
  260.     &AltTxt, 0, NULL, G_ALT, 0
  261.   },
  262.   { &TogGad[4], LGAD+XGAD*3,TGAD,WGAD,HGAD, GADGHCOMP,
  263.     RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
  264.     &StrTxt, 0, NULL, G_STRING, 0
  265.   },
  266.   { &OkGad, LGAD+XGAD*4,TGAD,WGAD,HGAD, GADGHCOMP,
  267.     RELVERIFY | TOGGLESELECT, BOOLGADGET, (APTR)&GadBor, 0,
  268.     &DeadTxt, 0, NULL, G_DEAD, 0
  269.   }
  270.  };
  271.  
  272. /*............... Definition de la fenetre .............................*/
  273.  
  274. /* Edimap Window */ 
  275. struct NewWindow newWindow = {
  276.    0,0, WIDTH, HEIGHT,
  277.    -1,-1,
  278.    GADGETUP |/* GADGETDOWN |*/ CLOSEWINDOW | RAWKEY,   /* IDCMP Flags */
  279.    ACTIVATE | SMART_REFRESH | WINDOWCLOSE | WINDOWDEPTH, /* Flags */
  280.    &TogGad[0],             /* First Gadget */
  281.    NULL,             /* CheckMark */
  282.    (UBYTE *)"Edimap",   /* Title */
  283.    NULL,             /* Set up screen pointer before opening */
  284.    NULL,             /* No superbitmap */
  285.    0,0,0,0,          /* Max and Min (no sizing) */
  286.    WBENCHSCREEN              /* Screen type  */
  287.    };
  288.  
  289. /*.............. Messages globaux ..............*/
  290. BOOL modifie = FALSE;
  291.  
  292. UBYTE MSortie[] = "Table modifiée, refaites CLOSEWINDOW ou Tapez sur la touche à éditer";
  293. UBYTE *MFClose = MSortie+18;
  294. UBYTE *MTapez = MSortie+18+22;
  295. UBYTE MErreur[] = "****** Le code xxx proposé est invalide ******";
  296. #define POS_ERR 15
  297. UBYTE pas_de_place[] = "pas de place pour un buffer\n";
  298.  
  299. char txt_err[8][3] = {" N "," S "," A ","SA "," C ","CS ","CA ","CSA"};
  300.