home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------*
- con.c version 3.0 - © Copyright 1990-91 Jaba Development
-
- Author : Jan van den Baard
- Purpose: startup configuration window
- *----------------------------------------------------------------------*/
-
- /*
- * configuration window gadgets e.c.t.
- */
- static SHORT WPairs[] =
- { 2,1,246,1,246,97,2,97,2,1 };
- static SHORT WPairs1[] =
- { 2,1,246,1,246,12,2,12,2,1 };
-
- static struct Border WBorder1 =
- { 0,0,0,0,JAM1,5,WPairs1,NULL };
- static struct Border WBorder =
- { 0,0,0,0,JAM1,5,WPairs,&WBorder1 };
-
- static struct IntuiText WText2 =
- { 0,1,JAM2,10,3,NULL,(UBYTE *)"Please specify",NULL };
- static struct IntuiText WText1 =
- { 0,1,JAM2,67,40,NULL,(UBYTE *)"Screen depth :",&WText2 };
- static struct IntuiText WText =
- { 0,1,JAM2,54,15,NULL,(UBYTE *)"Edit gadgets for :",&WText1 };
-
- static SHORT WBPairs[] =
- { 0,0,234,0,234,12,0,12,0,0 };
- static struct Border WBBorder =
- { -1,-1,0,0,JAM1,5,WBPairs,NULL };
- static struct IntuiText WBText =
- { 0,1,JAM2,79,2,NULL,(UBYTE *)"WORKBENCH",NULL };
- static struct Gadget WB =
- { NULL,7,66,233,11,SELECTED,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&WBBorder,NULL,&WBText,31L,NULL,9,NULL };
-
- static SHORT OKIDOKIPairs[] =
- { 0,0,114,0,114,12,0,12,0,0 };
- static struct Border OKIDOKIBorder =
- { -1,-1,0,0,JAM1,5,OKIDOKIPairs,NULL };
-
- static struct IntuiText OKIDOKIText =
- { 0,1,JAM2,49,2,NULL,(UBYTE *)"OK",NULL };
- static struct Gadget OKIDOKI =
- { &WB,7,82,113,11,NULL,RELVERIFY,BOOLGADGET,
- (APTR)&OKIDOKIBorder,NULL,&OKIDOKIText,NULL,NULL,8,NULL };
-
- static struct IntuiText CNCText =
- { 0,1,JAM2,33,2,NULL,(UBYTE *)"CANCEL",NULL };
- static struct Gadget CNC =
- { &OKIDOKI,127,82,113,11,NULL,RELVERIFY,BOOLGADGET,
- (APTR)&OKIDOKIBorder,NULL,&CNCText,NULL,NULL,7,NULL };
-
- static SHORT DPairs[] =
- { 0,0,29,0,29,12,0,12,0,0 };
- static struct Border DBorder =
- { -1,-1,0,0,JAM1,5,DPairs,NULL };
-
- static struct IntuiText D5Text =
- { 0,1,JAM2,10,2,NULL,(UBYTE *)"5",NULL };
- static struct Gadget D5 =
- { &CNC,212,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&DBorder,NULL,&D5Text,143L,NULL,6,NULL };
-
- static struct IntuiText D4Text =
- { 0,1,JAM2,10,2,NULL,(UBYTE *)"4",NULL };
- static struct Gadget D4 =
- { &D5,160,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&DBorder,NULL,&D4Text,151L,NULL,5,NULL };
-
- static struct IntuiText D3Text =
- { 0,1,JAM2,10,2,NULL,(UBYTE *)"3",NULL };
- static struct Gadget D3 =
- { &D4,108,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&DBorder,NULL,&D3Text,155L,NULL,4,NULL };
-
- static struct IntuiText D2Text =
- { 0,1,JAM2,10,2,NULL,(UBYTE *)"2",NULL };
- static struct Gadget D2 =
- { &D3,58,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&DBorder,NULL,&D2Text,157L,NULL,3,NULL };
-
- static struct IntuiText D1Text =
- { 0,1,JAM2,10,2,NULL,(UBYTE *)"1",NULL };
- static struct Gadget D1 =
- { &D2,7,50,28,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&DBorder,NULL,&D1Text,158L,NULL,2,NULL };
-
- static SHORT WRPairs[] =
- { 0,0,114,0,114,12,0,12,0,0 };
- static struct Border WRBorder =
- { -1,-1,0,0,JAM1,5,WRPairs,NULL };
-
- static struct IntuiText REQText =
- { 0,1,JAM2,19,2,NULL,(UBYTE *)"REQUESTER",NULL };
- static struct Gadget REQ =
- { &D1,127,25,113,11,NULL,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&WRBorder,NULL,&REQText,1L,NULL,1,NULL };
-
- static struct IntuiText WNDText =
- { 0,1,JAM2,33,2,NULL,(UBYTE *)"WINDOW",NULL };
- static struct Gadget WND =
- { &REQ,7,25,113,11,SELECTED,GADGIMMEDIATE+TOGGLESELECT,BOOLGADGET,
- (APTR)&WRBorder,NULL,&WNDText,2L,NULL,0,NULL };
-
- static struct NewWindow nw_conf =
- { 197,60,249,99,3,2,GADGETUP+GADGETDOWN,ACTIVATE+RMBTRAP+NOCAREREFRESH+BORDERLESS,
- NULL,NULL,NULL,NULL,NULL,0,0,0,0,WBENCHSCREEN };
-
- /*
- * static data
- */
- static struct Window *w;
- static UWORD gad_id;
-
- /*
- * globals
- */
- extern struct Gadget *Gadget;
- extern struct Screen *MainScreen;
- extern struct NewWindow nw_main;
- extern BOOL REQUESTER;
- extern BOOL WBSCREEN;
- extern USHORT DEPTH, Code;
- extern ULONG Class;
- extern char wdt[80],wlb[MAXLABEL];
-
- /*
- * open the configuration window
- */
- LONG get_config(custom)
- ULONG custom;
- {
- if(custom) {
- nw_conf.LeftEdge = (MainScreen->Width >> 1) - 124;
- nw_conf.TopEdge = (MainScreen->Height >> 1) - 49;
- nw_conf.Screen = MainScreen;
- nw_conf.Type = CUSTOMSCREEN;
- } else {
- nw_conf.LeftEdge = 197;
- nw_conf.TopEdge = 60;
- nw_conf.Screen = NULL;
- nw_conf.Type = WBENCHSCREEN;
- }
-
- if(NOT(w = OpenWindow(&nw_conf)))
- close_up(" - ERROR: Can't open the configurations window !");
-
- draw(w,&WND,&WBorder,&WText);
-
- if(custom) {
- disable_window();
- buisy();
- DeSelectGList(w,&WND,NULL,-1L);
- if(WBSCREEN) SelectGadget(w,&WB,NULL);
- else if(DEPTH == 1) SelectGadget(w,&D1,NULL);
- else if(DEPTH == 2) SelectGadget(w,&D2,NULL);
- else if(DEPTH == 3) SelectGadget(w,&D3,NULL);
- else if(DEPTH == 4) SelectGadget(w,&D4,NULL);
- else SelectGadget(w,&D5,NULL);
-
- if(REQUESTER) SelectGadget(w,&REQ,NULL);
- else SelectGadget(w,&WND,NULL);
- }
-
- do {
- Wait(1 << w->UserPort->mp_SigBit);
- while(read_msg(w)) {
- gad_id = Gadget->GadgetID;
- switch(gad_id) {
- case 9:
- case 6:
- case 5:
- case 4:
- case 3:
- case 2: MutualExclude(w,Gadget,&D1,NULL);
- SelectGadget(w,Gadget,NULL);
- break;
- case 1:
- case 0: MutualExclude(w,Gadget,&WND,NULL);
- SelectGadget(w,Gadget,NULL);
- break;
- }
- }
- } while((gad_id != 7)&&(gad_id != 8));
- CloseWindow(w);
-
- if(gad_id == 8) {
- if(SelectTest(&WND)) {
- REQUESTER = FALSE;
- nw_main.Flags = FLAGS_NM;
- strcpy((char *)&wdt,"Work Window");
- strcpy((char *)&wlb,"new_window");
- } else {
- REQUESTER = TRUE;
- nw_main.Flags = FLAGS_RQ;
- strcpy((char *)&wdt,"Requester");
- strcpy((char *)&wlb,"requester");
- }
- if(SelectTest(&D1)) { DEPTH = 1; WBSCREEN = FALSE; }
- else if(SelectTest(&D2)) { DEPTH = 2; WBSCREEN = FALSE; }
- else if(SelectTest(&D3)) { DEPTH = 3; WBSCREEN = FALSE; }
- else if(SelectTest(&D4)) { DEPTH = 4; WBSCREEN = FALSE; }
- else if(SelectTest(&WB)) { DEPTH = 2; WBSCREEN = TRUE; }
- else { DEPTH = 5; WBSCREEN = FALSE; }
- if(custom) {
- enable_window();
- ok();
- }
- return TRUE;
- }
- if(custom) {
- enable_window();
- ok();
- return FALSE;
- }
- close_up(" - BYE BYE......");
- }
-