home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / gadgeted_438.lzh / GadgetED / Source / con.c < prev    next >
C/C++ Source or Header  |  1991-01-17  |  5KB  |  189 lines

  1. /*----------------------------------------------------------------------*
  2.    con.c version 2.0 -  © Copyright 1990 Jaba Development
  3.  
  4.    Author : Jan van den Baard
  5.    Purpose: startup configuration window
  6.  *----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  * configuration window gadgets e.c.t.
  10.  */
  11. static struct IntuiText WText1 =
  12.  { 1,0,JAM1,67,39,NULL,(UBYTE *)"Screen depth :",NULL
  13.  };
  14. static struct IntuiText WText =
  15.  { 1,0,JAM1,54,13,NULL,(UBYTE *)"Edit gadgets for :",&WText1
  16.  };
  17. static struct Gadget txt =
  18.  { NULL,0,0,1,1,GADGHNONE,NULL,BOOLGADGET,
  19.    NULL,NULL,&WText,NULL,NULL,NULL,NULL
  20.  };
  21. static SHORT WBPairs[] =
  22.  { 0,0,234,0,234,12,0,12,0,0
  23.  };
  24. static struct Border WBBorder =
  25.  { -1,-1,1,0,JAM1,5,WBPairs,NULL
  26.  };
  27. static struct IntuiText WBText =
  28.  { 1,0,JAM1,79,2,NULL,(UBYTE *)"WORKBENCH",NULL
  29.  };
  30. static struct Gadget WB =
  31.  { &txt,7,66,233,11,SELECTED,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  32.    (APTR)&WBBorder,NULL,&WBText,31L,NULL,9,NULL
  33.  };
  34. static SHORT OKPairs[] =
  35.  { 0,0,114,0,114,12,0,12,0,0
  36.  };
  37. static struct Border OKBorder =
  38.  { -1,-1,1,0,JAM1,5,OKPairs,NULL
  39.  };
  40.  
  41. static struct IntuiText OKText =
  42.  { 1,0,JAM1,49,2,NULL,(UBYTE *)"OK",NULL
  43.  };
  44. static struct Gadget OK =
  45.  { &WB,7,82,113,11,NULL,RELVERIFY,BOOLGADGET,
  46.    (APTR)&OKBorder,NULL,&OKText,NULL,NULL,8,NULL
  47.  };
  48.  
  49. static struct IntuiText CNCText =
  50.  { 1,0,JAM1,33,2,NULL,(UBYTE *)"CANCEL",NULL
  51.  };
  52. static struct Gadget CNC =
  53.  { &OK,127,82,113,11,NULL,RELVERIFY,BOOLGADGET,
  54.    (APTR)&OKBorder,NULL,&CNCText,NULL,NULL,7,NULL
  55.  };
  56.  
  57. static SHORT DPairs[] =
  58.  { 0,0,29,0,29,12,0,12,0,0
  59.  };
  60. static struct Border DBorder =
  61.  { -1,-1,1,0,JAM1,5,DPairs,NULL
  62.  };
  63. static struct IntuiText D5Text =
  64.  { 1,0,JAM1,10,2,NULL,(UBYTE *)"5",NULL
  65.  };
  66. static struct Gadget D5 =
  67.  { &CNC,212,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  68.    (APTR)&DBorder,NULL,&D5Text,143L,NULL,6,NULL
  69.  };
  70. static struct IntuiText D4Text =
  71.  { 1,0,JAM1,10,2,NULL,(UBYTE *)"4",NULL
  72.  };
  73. static struct Gadget D4 =
  74.  { &D5,160,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  75.    (APTR)&DBorder,NULL,&D4Text,151L,NULL,5,NULL
  76.  };
  77. static struct IntuiText D3Text =
  78.  { 1,0,JAM1,10,2,NULL,(UBYTE *)"3",NULL
  79.  };
  80. static struct Gadget D3 =
  81.  { &D4,108,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  82.    (APTR)&DBorder,NULL,&D3Text,155L,NULL,4,NULL
  83.  };
  84. static struct IntuiText D2Text =
  85.  { 1,0,JAM1,10,2,NULL,(UBYTE *)"2",NULL
  86.  };
  87. static struct Gadget D2 =
  88.  { &D3,58,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  89.    (APTR)&DBorder,NULL,&D2Text,157L,NULL,3,NULL
  90.  };
  91. static struct IntuiText D1Text =
  92.  { 1,0,JAM1,10,2,NULL,(UBYTE *)"1",NULL
  93.  };
  94. static struct Gadget D1 =
  95.  { &D2,7,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  96.    (APTR)&DBorder,NULL,&D1Text,158L,NULL,2,NULL
  97.  };
  98. static SHORT WRPairs[] =
  99.  { 0,0,114,0,114,12,0,12,0,0
  100.  };
  101. static struct Border WRBorder =
  102.  { -1,-1,1,0,JAM1,5,WRPairs,NULL
  103.  };
  104. static struct IntuiText REQText =
  105.  { 1,0,JAM1,19,2,NULL,(UBYTE *)"REQUESTER",NULL
  106.  };
  107. static struct Gadget REQ =
  108.  { &D1,127,25,113,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  109.    (APTR)&WRBorder,NULL,&REQText,1L,NULL,1,NULL
  110.  };
  111. static struct IntuiText WNDText =
  112.  { 1,0,JAM1,33,2,NULL,(UBYTE *)"WINDOW",NULL
  113.  };
  114. static struct Gadget WND =
  115.  { &REQ,7,25,113,11,SELECTED,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
  116.    (APTR)&WRBorder,NULL,&WNDText,2L,NULL,0,NULL
  117.  };
  118. static struct NewWindow nw_conf =
  119.  { 197,60,246,97,3,2,GADGETUP+GADGETDOWN,ACTIVATE+RMBTRAP+NOCAREREFRESH,
  120.    &WND,NULL,(UBYTE *)"Please specify",NULL,NULL,0,0,0,0,WBENCHSCREEN
  121.  };
  122.  
  123. /*
  124.  * static data
  125.  */
  126. static struct Window *w;
  127. static USHORT         gad_id;
  128.  
  129. /*
  130.  * globals
  131.  */
  132. extern struct Gadget    *Gadget;
  133. extern struct NewWindow  nw_main;
  134. extern BOOL              REQUESTER;
  135. extern BOOL              WBSCREEN;
  136. extern USHORT            DEPTH, Code;
  137. extern ULONG             Class;
  138. extern char              wdt[80],wlb[MAXLABEL];
  139.  
  140. /*
  141.  * open the configuration window
  142.  */
  143. VOID get_config()
  144. {
  145.     if(NOT(w = OpenWindow(&nw_conf)))
  146.         close_up("   - ERROR: Can't open the configurations window !");
  147.  
  148.     do
  149.     {   Wait(1 << w->UserPort->mp_SigBit);
  150.         while(read_msg(w))
  151.         {   gad_id    = Gadget->GadgetID;
  152.             switch(gad_id)
  153.             {   case 9:
  154.                 case 6:
  155.                 case 5:
  156.                 case 4:
  157.                 case 3:
  158.                 case 2: MutualExclude(w,Gadget,&D1,NULL);
  159.                         SelectGadget(w,Gadget,NULL);
  160.                         break;
  161.                 case 1:
  162.                 case 0: MutualExclude(w,Gadget,&WND,NULL);
  163.                         SelectGadget(w,Gadget,NULL);
  164.                         break;
  165.             }
  166.         }
  167.     } while((gad_id != 7)&&(gad_id != 8));
  168.     CloseWindow(w);
  169.     if(gad_id == 8)
  170.     {
  171.         if(SelectTest(&WND))  REQUESTER = FALSE;
  172.         else
  173.         {   REQUESTER = TRUE;
  174.             nw_main.Flags  = WINDOWDRAG+WINDOWSIZING+SIZEBRIGHT+SIZEBBOTTOM;
  175.             nw_main.Flags |= GIMMEZEROZERO+BORDERLESS+NOCAREREFRESH+SMART_REFRESH+ACTIVATE;
  176.             strcpy((char *)&wdt,"Requester");
  177.             strcpy((char *)&wlb,"requester");
  178.         }
  179.         if(SelectTest(&D1))        DEPTH = 1;
  180.         else if(SelectTest(&D2))   DEPTH = 2;
  181.         else if(SelectTest(&D3))   DEPTH = 3;
  182.         else if(SelectTest(&D4))   DEPTH = 4;
  183.         else if(SelectTest(&WB)) { DEPTH = 2; WBSCREEN = TRUE; }
  184.         else                       DEPTH = 5;
  185.         return;
  186.     }
  187.     close_up("    - BYE BYE......");
  188. }
  189.