home *** CD-ROM | disk | FTP | other *** search
- /*construct.c */
- #include "aib.h"
- #include "main.h"
-
- /* function prototypes */
- void main(void);
- void abort_me(char *);
- void setup(void);
- void closedown(void);
- void main_menu(void);
- void window_menu(void);
- void handle_input(void);
- void handle_gadgetup(struct Gadget *, UWORD);
- void handle_gadgetdown(struct Gadget *, UWORD);
- void replace_gads(short);
- void wflags_menu(void);
- void gadget_menu(void);
-
-
- /*************************** main ********************************/
- void main(void)
- {
-
- setup();
- main_menu();
- handle_input();
- }
-
- /*************************** abort **********************************/
- void abort_me(txt)
- char *txt;
- {
- request("AIB: FATAL",txt,"Abort");
- closedown();
- exit(0);
- }
-
-
- /*********************** SETUP *********************************************/
- void setup(void)
- {
-
- GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", MIN_VERSION);
- if (!GfxBase)
- abort_me("Can't open graphics.library. WB Version 36 or above required.");
- IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",
- MIN_VERSION);
- if (!IntuitionBase)
- abort_me("Can't open intuition.library. WB Version 36 or above required.");
- GadToolsBase = (struct Library *)OpenLibrary("gadtools.library",
- MIN_VERSION);
- if (!GadToolsBase)
- abort_me("Can't open gadtools.library. WB Version 36 or above required.");
-
- if ( ( AslBase = OpenLibrary(AslName,36))==0)
- abort_me("Can't open asl.library. WB Version 36 or above required.");
-
- if (!(DiskfontBase = OpenLibrary("diskfont.library",36L)))
- abort_me("Can't open diskfont.library v36 or up.");
-
- /* get access to the WorkBench screen */
- screen = LockPubScreen(NULL);
- if (!screen)
- abort_me("Couldn't lock the default public screen.");
-
- menuta = screen->Font;
-
- /* get the screen's visual information data */
- vi = GetVisualInfo(screen, TAG_DONE);
- if (!vi)
- abort_me("Couldn't get default public screen's VisualInfo.");
-
-
- /* now open up AIB, sketchpad on the WorkBench */
-
- Modify_Theirs();
-
- window = OpenWindowTags(NULL,WA_Activate, TRUE,
- WA_IDCMP,CLOSEWINDOW | VANILLAKEY | REFRESHWINDOW |
- SLIDERIDCMP | STRINGIDCMP | BUTTONIDCMP |
- CHECKBOXIDCMP | MXIDCMP | MENUPICK |LISTVIEWIDCMP,
- WA_Width, 550,
- WA_Gadgets, glist,
- WA_Left,40,
- WA_Top,0,
- WA_InnerHeight,180,
- WA_DragBar,TRUE,
- WA_DepthGadget, TRUE,
- WA_SimpleRefresh,TRUE,
- WA_Title,titles[0],
- TAG_DONE);
-
- if (!window || !theirs.sketchpad)
- abort_me("Couldn't open the windows.");
-
- GT_RefreshWindow(window,NULL);
- NewList(&tit_list);
- }
-
-
- /************************* CLOSEDOWN *************************************/
- void closedown(void)
- {
- if (menu) FreeMenus(menu);
- if (window) CloseWindow(window);
- if (theirs.sketchpad) CloseWindow(theirs.sketchpad);
- if (topt) free_allmenu(topt);
- if (newtop) free_allmenu(newtop);
- if (CustomMenuFont) CloseFont(CustomMenuFont);
- /* these two functions can take a NULL, but let's stay consistent */
- if (glist) FreeGadgets(glist);
- if (vi) FreeVisualInfo(vi);
-
- if (screen) UnlockPubScreen(NULL, screen);
- if (rmem) FreeRemember(&rmem, TRUE);
-
- if (GadToolsBase) CloseLibrary(GadToolsBase);
- if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
- if (GfxBase) CloseLibrary((struct Library *)GfxBase);
- if (DiskfontBase) CloseLibrary(DiskfontBase);
- if (AslBase) CloseLibrary(AslBase);
- }
-
-
- /************************ CREATE'EM ****************************************/
-
-
- /** main menu **/
-
- void main_menu(void)
- {
- UWORD top; /* offset into Window under titlebar */
- struct NewGadget ng; /* for Gadget positioning */
- struct Gadget *gad; /* our running Gadget pointer */
-
-
- top = window->BorderTop + 1;
- gad = CreateContext(&glist);
-
- /* now we can fill out the NewGadget structure to describe where we want
- the Gadget to be placed */
-
- ng.ng_VisualInfo = vi;
- ng.ng_TextAttr = &topaz80;
- ng.ng_Flags = 0;
-
- /* ng.ng_Flags = PLACETEXT_LEFT;*/
-
- ng.ng_LeftEdge = 195;
- ng.ng_TopEdge = top + 10;
- ng.ng_Width = 170;
- ng.ng_Height = 15;
- ng.ng_GadgetID = M_nam;
- ng.ng_GadgetText = "Project Name:";
- gad = CreateGadget(TEXT_KIND,gad,&ng,
- GTTX_Border,TRUE,
- GTTX_Text,"none",
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_Flags = 0; /*PLACETEXT_IN;*/
- ng.ng_LeftEdge = 65;
- ng.ng_TopEdge = top + 55;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID = M_pro;
- ng.ng_GadgetText = "_Project...";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_LeftEdge = 65;
- ng.ng_TopEdge = top + 95;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID= M_abo;
- ng.ng_GadgetText= "_About... ";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_LeftEdge = 65;
- ng.ng_TopEdge = top + 135;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID= M_qui;
- ng.ng_GadgetText= "_Quit... ";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_LeftEdge = window->Width-240;
- ng.ng_TopEdge = top + 55;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID= M_men;
- ng.ng_GadgetText= "_Menu... ";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_LeftEdge = window->Width-240;
- ng.ng_TopEdge = top + 95;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID= M_gad;
- ng.ng_GadgetText= "_Gadgets...";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- ng.ng_LeftEdge = window->Width-240;
- ng.ng_TopEdge = top + 135;
- ng.ng_Width = 170;
- ng.ng_Height = 20;
- ng.ng_GadgetID= M_win;
- ng.ng_GadgetText= "_Window... ";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore,'_',
- TAG_DONE);
-
- if (!gad)
- abort_me("Couldn't allocate the Gadget list.");
-
- AddGList(window, glist, (UWORD)-1, (UWORD)-1, NULL);
- RefreshGList(glist, window, NULL, (UWORD)-1);
- GT_RefreshWindow(window, NULL);
- }
-
-
- /** gadget menu **/
-
- void gadget_menu(void)
- {
- UWORD top; /* offset into Window under titlebar */
- struct NewGadget ng; /* for Gadget positioning */
- struct Gadget *gad; /* our running Gadget pointer */
- struct Node *node;
- struct maingad *tempgad = topgad;
-
- top = window->BorderTop + 1;
- gad = CreateContext(&glist);
-
-
- /* now we can fill out the NewGadget structure to describe where we want
- the Gadget to be placed */
-
-
- ng.ng_TextAttr = &topaz80;
- ng.ng_VisualInfo = vi;
- ng.ng_Flags = 0;
-
- /* prepare gad list */
- NewList(&list);
- while(tempgad)
- {
- node=(struct Node *)AllocRemember(&rmem,sizeof(struct Node), MEMF_CLEAR);
- if (!node)
- abort_me("couldn't allocate LISTVIEW list.");
- node->ln_Name = tempgad->name;
- AddTail(&list,node);
- tempgad=tempgad->next;
- }
-
- gad = conditional_gadgets(gad);
-
- ng.ng_LeftEdge = 30;
- ng.ng_TopEdge = top + 16;
- ng.ng_Width = 260;
- ng.ng_Height = 55;
- ng.ng_GadgetID = G_list;
- ng.ng_GadgetText="Current *Gadget";
- gad = CreateGadget(LISTVIEW_KIND,gad,&ng,
- GTLV_Top,(currgad)?currgad->id:0,
- GTLV_Labels,&list,
- GTLV_ReadOnly,FALSE,
- GTLV_ScrollWidth,16,
- GTLV_ShowSelected,NULL,
- GTLV_Selected,(currgad)?currgad->id:~0,
- GT_Underscore, '*',
- LAYOUTA_SPACING,2,
- TAG_DONE);
-
-
- ng.ng_LeftEdge = 345;
- ng.ng_TopEdge = top + 18;
- ng.ng_Width = 140;
- ng.ng_Height = 12;
- ng.ng_GadgetID = G_new;
- ng.ng_GadgetText="CREATE *NEW...";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 345;
- ng.ng_TopEdge = top + 33;
- ng.ng_Width = 140;
- ng.ng_Height = 12;
- ng.ng_GadgetID = G_edi;
- ng.ng_GadgetText="*EDIT Current";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GA_Disabled, (currgad)?FALSE:TRUE,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 345;
- ng.ng_TopEdge = top + 48;
- ng.ng_Width = 140;
- ng.ng_Height = 12;
- ng.ng_GadgetID = G_del;
- ng.ng_GadgetText="*DELETE Current";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GA_Disabled, (currgad)?FALSE:TRUE,
- GT_Underscore, '*',
- TAG_DONE);
-
-
- ng.ng_LeftEdge = 200;
- ng.ng_TopEdge = top + 68;
- ng.ng_Width = 180;
- ng.ng_Height = 12;
- ng.ng_GadgetID = G_type;
- ng.ng_GadgetText="Gadget type: ";
- printf("%d\n",currgad->type);
- gad = CreateGadget(TEXT_KIND,gad,&ng,
- GTTX_Text,(currgad)?testlabels[currgad->type]:NULL, /* temporary */
- GTTX_Border,TRUE,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 360;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = G_can;
- ng.ng_GadgetText="*Cancel";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 30;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = G_ok;
- ng.ng_GadgetText="*OK";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
-
- if (!gad)
- abort_me("Couldn't allocate the Gadget list.");
-
- AddGList(window, glist, (UWORD)-1, (UWORD)-1, NULL);
- RefreshGList(glist, window, NULL, (UWORD)-1);
- GT_RefreshWindow(window, NULL);
- }
-
-
- /** wflags menu **/
-
- void wflags_menu(void)
- {
- UWORD top; /* offset into Window under titlebar */
- struct NewGadget ng; /* for Gadget positioning */
- struct Gadget *gad; /* our running Gadget pointer */
-
-
- top = window->BorderTop + 1;
- gad = CreateContext(&glist);
-
- /* now we can fill out the NewGadget structure to describe where we want
- the Gadget to be placed */
-
- ng.ng_TextAttr = &topaz80;
- ng.ng_VisualInfo = vi;
- ng.ng_Flags = 0;
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 10;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_size;
- ng.ng_GadgetText="WA_*SizeGadget";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked, theirs.size,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 25;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_drag;
- ng.ng_GadgetText="WA_*DragBar";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.drag,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 40;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_dept;
- ng.ng_GadgetText="WA_*DepthGadget";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.depth,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 55;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_clos;
- ng.ng_GadgetText="WA_*CloseGadget";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.close,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 70;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_back;
- ng.ng_GadgetText="WA_*Backdrop";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.back,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 85;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_repo;
- ng.ng_GadgetText="WA_*ReportMouse";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.report,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 100;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_noca;
- ng.ng_GadgetText="WA_*NoCareRefresh";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.nocare,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 170;
- ng.ng_TopEdge = top + 115;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_bord;
- ng.ng_GadgetText="WA_*Borderless";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.bord,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 10;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_acti;
- ng.ng_GadgetText="WA_*Activate";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.act,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 25;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_rmbt;
- ng.ng_GadgetText="WA_*RMBTrap";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.rmb,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 40;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_simp;
- ng.ng_GadgetText="WA_*SimpleRefresh";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.simple,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 55;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_smar;
- ng.ng_GadgetText="WA_*SmartRefresh";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.smart,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 70;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_sizer;
- ng.ng_GadgetText="WA_*SizeBRight";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.sizer,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 85;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_sizeb;
- ng.ng_GadgetText="WA_*SizeBBottom";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.sizeb,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 100;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_auto;
- ng.ng_GadgetText="WA_*AutoAdjust";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.aut,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 455;
- ng.ng_TopEdge = top + 115;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_gimm;
- ng.ng_GadgetText="WA_*GimmeZeroZero";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked , theirs.gimme,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 360;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_can;
- ng.ng_GadgetText="*Cancel";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
-
- ng.ng_LeftEdge = 30;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W1_ok;
- ng.ng_GadgetText="*OK";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- if (!gad)
- abort_me("Couldn't allocate the Gadget list.");
-
- AddGList(window, glist, (UWORD)-1, (UWORD)-1, NULL);
- RefreshGList(glist, window, NULL, (UWORD)-1);
- GT_RefreshWindow(window, NULL);
- }
-
- /** Windows menu **/
-
- void window_menu(void)
- {
- UWORD top; /* offset into Window under titlebar */
- struct NewGadget ng; /* for Gadget positioning */
- struct Gadget *gad; /* our running Gadget pointer */
-
-
- top = window->BorderTop + 1;
- gad = CreateContext(&glist);
-
- /* now we can fill out the NewGadget structure to describe where we want
- the Gadget to be placed */
-
- ng.ng_TextAttr = &topaz80;
- ng.ng_VisualInfo = vi;
- ng.ng_Flags = 0;
-
- ng.ng_LeftEdge = 90;
- ng.ng_TopEdge = top + 10;
- ng.ng_Width = 420;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_tit;
- ng.ng_GadgetText="WA_*Title";
- gad = CreateGadget(STRING_KIND,gad,&ng,
- GTST_String, theirs.title,
- GTST_MaxChars,240,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 30;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_lef;
- ng.ng_GadgetText="WA_*Left";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.left,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 50;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_top;
- ng.ng_GadgetText="WA_*Top";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.top,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 70;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_wid;
- ng.ng_GadgetText="WA_*Width";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.width,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 90;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_hei;
- ng.ng_GadgetText="WA_*Height";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.height,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 110;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_inw;
- ng.ng_GadgetText="WA_*InnerWidth";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.innerw,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge =130;
- ng.ng_TopEdge = top + 130;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_inh;
- ng.ng_GadgetText="WA_*InnerHeight";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.innerh,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 300;
- ng.ng_TopEdge = top + 32;
- ng.ng_Width = 50;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_zoo;
- ng.ng_GadgetText="*WA_Zoom";
- gad = CreateGadget(CHECKBOX_KIND,gad,&ng,
- GTCB_Checked, theirs.zoom,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 290;
- ng.ng_TopEdge = top + 50;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_zoo1;
- ng.ng_GadgetText="Zoom *Left";
- zl=gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GA_DISABLED, (theirs.zoom)? FALSE : TRUE,
- GTIN_Number, theirs.zl,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 290;
- ng.ng_TopEdge = top + 70;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_zoo2;
- ng.ng_GadgetText="Zoom *Top";
- zt=gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GA_DISABLED, (theirs.zoom)? FALSE : TRUE,
- GTIN_Number, theirs.zt,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 290;
- ng.ng_TopEdge = top + 90;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_zoo3;
- ng.ng_GadgetText="*Zoom Width";
- zw=gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GA_DISABLED, (theirs.zoom)? FALSE : TRUE,
- GTIN_Number, theirs.zw,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 290;
- ng.ng_TopEdge = top + 110;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_zoo4;
- ng.ng_GadgetText="Zoom *Height";
- zh=gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GA_DISABLED, (theirs.zoom)? FALSE : TRUE,
- GTIN_Number, theirs.zh,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 460;
- ng.ng_TopEdge = top + 30;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_rpt;
- ng.ng_GadgetText="WA_*RptQueue";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.rpt,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 460;
- ng.ng_TopEdge = top + 50;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_minw;
- ng.ng_GadgetText="WA_*MinWidth";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.minw,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 460;
- ng.ng_TopEdge = top + 70;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_minh;
- ng.ng_GadgetText="WA_*MinHeight";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.minh,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 460;
- ng.ng_TopEdge = top + 90;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_maxw;
- ng.ng_GadgetText="WA_*MaxWidth";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.maxw,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 460;
- ng.ng_TopEdge = top + 110;
- ng.ng_Width = 55;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_maxh;
- ng.ng_GadgetText="WA_*MaxHeight";
- gad = CreateGadget(INTEGER_KIND,gad,&ng,
- GTIN_Number, theirs.maxh,
- GTIN_MaxChars,5,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 290;
- ng.ng_TopEdge = top + 130;
- ng.ng_Width = 220;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_fla;
- ng.ng_GadgetText="WA_*Flags...";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 30;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_ok;
- ng.ng_GadgetText="OK";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- ng.ng_LeftEdge = 360;
- ng.ng_TopEdge = top + 160;
- ng.ng_Width = 150;
- ng.ng_Height = 15;
- ng.ng_GadgetID = W_can;
- ng.ng_GadgetText="Cancel";
- gad = CreateGadget(BUTTON_KIND,gad,&ng,
- GT_Underscore, '*',
- TAG_DONE);
-
- if (!gad)
- abort_me("Couldn't allocate the Gadget list.");
-
- AddGList(window, glist, (UWORD)-1, (UWORD)-1, NULL);
- RefreshGList(glist, window, NULL, (UWORD)-1);
- GT_RefreshWindow(window, NULL);
-
- }
-
-
- /********************** handle input **************************************/
- void handle_input(void)
- {
- struct IntuiMessage *message;
- struct Gadget *gadget;
- ULONG class;
- UWORD code;
-
- while (1)
- {
- WaitPort(window->UserPort);
-
- /* use the new GadTools GT_GetIMsg() function to get input events */
- while (message = GT_GetIMsg(window->UserPort))
- {
- class = message->Class;
- code = message->Code;
-
- /* we'll assume it's a Gadget, but no harm is done if it isn't */
- gadget = (struct Gadget *)message->IAddress;
-
- /* use the GT_ReplyIMsg() function to reply to the message */
- GT_ReplyIMsg(message);
-
- switch (class)
- {
- case CLOSEWINDOW:
- abort_me("Done.");
- case GADGETUP:
- handle_gadgetup(gadget, code);
- break;
- case GADGETDOWN:
- handle_gadgetdown(gadget, code);
- break;
- case REFRESHWINDOW:
- /* when using a window of type SIMPLE_REFRESH, use this
- input event and GadTools-compatible refreshing code. */
- GT_BeginRefresh(window);
- GT_EndRefresh(window, TRUE);
- break;
- }
- }
- }
- }
-
-
- /************************* handle up ************************************/
-
- void handle_gadgetup(gadget, code)
- struct Gadget *gadget;
- UWORD code;
- {
- /*struct NewGadget ng;
- struct Gadget *gad;*/
-
- switch (gadget->GadgetID)
- {
- /* main menu *****************/
-
- case M_qui:
- if (request("AIB","Quit...\nAre you sure?","OK|Cancel"))
- {closedown();
- exit(0);}
- break;
-
- case M_men:
- replace_gads(3);
- menu_menu();
- old_menu();
- break;
-
- case M_win:
- capture_params();
- replace_gads(1);
- window_menu();
- break;
-
- case M_gad:
- replace_gads(2);
- gadget_menu();
- break;
-
- case M_pro:
- replace_gads(4);
- project_menu();
- break;
-
- case M_abo:
- request("AIB",
- "AIB v1.0 Copyright\nDoug Dyer ... 08/25/91\nddyer@hubcap.clemson.edu"
- ,"OK");
- break;
-
-
-
- /* window menu *****************************/
-
- case W_can:
- replace_gads(0);
- main_menu();
- break;
-
- case W_ok:
- replace_params();
- replace_gads(0);
- main_menu();
- break;
-
- case W_fla:
- capture_flags();
- replace_gads(7);
- wflags_menu();
- break;
-
- /* window flags menu ******************************/
- case W1_ok:
- replace_flags();
- replace_gads(1);
- window_menu();
- break;
-
- case W1_can:
- replace_gads(1);
- window_menu();
- break;
-
-
- /* gadget menu ********************************/
-
- case G_ok:
- currgad = NULL;
- replace_gads(0);
- main_menu();
- break;
-
- case G_can:
- currgad = NULL;
- replace_gads(0);
- main_menu();
- break;
-
- case G_new:
- replace_gads(9);
- prepare_newgad();
- gadsub_menu();
- break;
-
- case G_list:
- locate_gadget(code);
- replace_gads(2);
- gadget_menu();
- break;
-
-
- /* subgadget menu ***************************************/
-
- case G1_ok:
- replace_gads(2);
- gadget_menu();
- break;
-
- case G1_can:
- replace_gads(2);
- gadget_menu();
- break;
-
- case G1_nfont:
- FontChoice(1);
- break;
-
-
- /* menu menu **************************************************/
-
- case MM_nfont:
- FontChoice(2);
- break;
-
- case MM_ok:
- free_allmenu(newtop);
- newtop = NULL;
- generate();
- Modify_Theirs();
- replace_gads(0);
- main_menu();
- break;
-
- case MM_can:
- free_allmenu(topt);
- topt=newtop;
- newtop = NULL;
- replace_gads(0);
- main_menu();
- break;
-
- /* project menu *****************************************************/
-
- case P_load:
- load_project();
- replace_gads(0);
- main_menu();
- break;
-
- case P_can:
- replace_gads(0);
- main_menu();
- break;
-
- default:
- other_gads(gadget, code);
- break;
- }
- }
-
-
-
- /*********************************** handle down ************************/
- void handle_gadgetdown(gadget, code)
- struct Gadget *gadget;
- UWORD code;
- {
- }
-
-
- /************************ handle vanilla ********************************/
-
-
-
- /************************ Clear current menu... *************************/
- void replace_gads(short curr)
- {
- struct Gadget *gad;
-
-
- SetWindowTitles(window,titles[curr],NULL);
- if (glist) {
- short x = 0;
- for (gad=glist;gad;++x,gad=gad->NextGadget) {
- if (gad->GadgetType & GTYP_SYSGADGET)
- break;}
-
- RemoveGList(window, glist, x);
- SetRast(window->RPort, 0);
- RefreshWindowFrame(window);
-
- FreeGadgets(glist);
- glist=NULL;
- GT_RefreshWindow(window,NULL);
- }
-
- }
-