Ejemplo n.º 1
0
void ApplySelectionWindow(void)
{
	if((TB_WindowGadgets[GD_TBG_BUTTON]->Flags&GFLG_SELECTED) && (ActiveGadget!=BUTTON_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_BUTTON]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_BUTTON],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_CHECKBOX]->Flags&GFLG_SELECTED) && (ActiveGadget!=CHECKBOX_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_CHECKBOX]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_CHECKBOX],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_COLORWHEEL]->Flags&GFLG_SELECTED) && (ActiveGadget!=COLORWHEEL_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_COLORWHEEL]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_COLORWHEEL],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_CYCLE]->Flags&GFLG_SELECTED) && (ActiveGadget!=CYCLE_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_CYCLE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_CYCLE],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_DATATYPE]->Flags&GFLG_SELECTED) && (ActiveGadget!=DATATYPE_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_DATATYPE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_DATATYPE],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_GRADIENTSLIDER]->Flags&GFLG_SELECTED) && (ActiveGadget!=GRADIENTSLIDER_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_GRADIENTSLIDER]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_GRADIENTSLIDER],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_INTEGER]->Flags&GFLG_SELECTED) && (ActiveGadget!=INTEGER_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_INTEGER]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_INTEGER],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_LISTVIEW]->Flags&GFLG_SELECTED) && (ActiveGadget!=LISTVIEW_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_LISTVIEW]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_LISTVIEW],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_MX]->Flags&GFLG_SELECTED) && (ActiveGadget!=MX_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_MX]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MX],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_NUMBER]->Flags&GFLG_SELECTED) && (ActiveGadget!=NUMBER_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_NUMBER]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_NUMBER],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_PAGE]->Flags&GFLG_SELECTED) && (ActiveGadget!=PAGE_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_PAGE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_PAGE],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_PALETTE]->Flags&GFLG_SELECTED) && (ActiveGadget!=PALETTE_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_PALETTE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_PALETTE],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_POPUPMENU]->Flags&GFLG_SELECTED) && (ActiveGadget!=POPUPMENU_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_POPUPMENU]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_POPUPMENU],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_PROGRESS]->Flags&GFLG_SELECTED) && (ActiveGadget!=PROGRESS_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_PROGRESS]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_PROGRESS],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_SCROLLER]->Flags&GFLG_SELECTED) && (ActiveGadget!=SCROLLER_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_SCROLLER]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_SCROLLER],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_SLIDER]->Flags&GFLG_SELECTED) && (ActiveGadget!=SLIDER_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_SLIDER]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_SLIDER],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_STRING]->Flags&GFLG_SELECTED) && (ActiveGadget!=STRING_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_STRING]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_STRING],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_TAPEDECK]->Flags&GFLG_SELECTED) && (ActiveGadget!=TAPEDECK_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_TAPEDECK]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_TAPEDECK],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_TEXT]->Flags&GFLG_SELECTED) && (ActiveGadget!=TEXT_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_TEXT]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_TEXT],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_TEXTFIELD]->Flags&GFLG_SELECTED) && (ActiveGadget!=TEXTFIELD_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_TEXTFIELD]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_TEXTFIELD],TB_WindowWnd,NULL,1); }
	if((TB_WindowGadgets[GD_TBG_TREEVIEW]->Flags&GFLG_SELECTED) && (ActiveGadget!=TREEVIEW_ID)) { ClearFlag(TB_WindowGadgets[GD_TBG_TREEVIEW]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_TREEVIEW],TB_WindowWnd,NULL,1); }
	if(ActiveGadget==NULL) { SetFlag(TB_WindowGadgets[GD_TBG_NONE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_NONE],TB_WindowWnd,NULL,1); }
	else { ClearFlag(TB_WindowGadgets[GD_TBG_NONE]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_NONE],TB_WindowWnd,NULL,1); }

	if(GUI.gui_Mode!=MODE_TEST) { ClearFlag(TB_WindowGadgets[GD_TBG_MODE_TEST]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_TEST],TB_WindowWnd,NULL,1); }
	else { SetFlag(TB_WindowGadgets[GD_TBG_MODE_TEST]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_TEST],TB_WindowWnd,NULL,1); }
	if(GUI.gui_Mode!=MODE_GADGET) { ClearFlag(TB_WindowGadgets[GD_TBG_MODE_GADGET]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_GADGET],TB_WindowWnd,NULL,1); }
	else { SetFlag(TB_WindowGadgets[GD_TBG_MODE_GADGET]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_GADGET],TB_WindowWnd,NULL,1); }
	if(GUI.gui_Mode!=MODE_FRAME) { ClearFlag(TB_WindowGadgets[GD_TBG_MODE_FRAME]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_FRAME],TB_WindowWnd,NULL,1); }
	else { SetFlag(TB_WindowGadgets[GD_TBG_MODE_FRAME]->Flags,GFLG_SELECTED); RefreshGList(TB_WindowGadgets[GD_TBG_MODE_FRAME],TB_WindowWnd,NULL,1); }
}
Ejemplo n.º 2
0
static void MySetGadgetAttrsA(Object *gadget, struct TagItem *tags) {

  if(SetPageGadgetAttrsA((struct Gadget *) gadget, Window_Objs[ACTID_PAGE],
                         Window, NULL, tags)) {
    RefreshGList((struct Gadget *) gadget, Window, NULL, 1);
  }
}
Ejemplo n.º 3
0
void LIBFUNC L_ActivateStrGad(
	REG(a0, struct Gadget *gad),
	REG(a1, struct Window *win))
{
	if (!(gad->Flags&GFLG_SELECTED) && !(gad->Flags&GFLG_DISABLED))
	{
		struct StringInfo *sinfo;

		sinfo=(struct StringInfo *)gad->SpecialInfo;
		sinfo->BufferPos=strlen(sinfo->Buffer);
		RefreshGList(gad,win,0,1);
		ActivateGadget(gad,win,0);
	}
}
Ejemplo n.º 4
0
ULONG TAPEDECK_RENDER_Gadget(piClass *cl,piObject *o,Msg msg)
{
	UWORD x,y,w,h;
	struct Node_Gadget *ng;
	struct Node_Window *nw;
	struct Gadget *g,*ga;
	BOOL fill=FALSE;

	piGetAttr(o,OBJ_Node,(ULONG *)&ng);
	piGetAttr(ng->ng_Window,OBJ_Node,(ULONG *)&nw);

	x=piCX(o);
	y=piCY(o);
	w=piCW(o);
	h=piCH(o);

	SetAPen(nw->nw_Window->RPort,DrawInfo->dri_Pens[BACKGROUNDPEN]);
	SetDrMd(nw->nw_Window->RPort,JAM1);
	RectFill(nw->nw_Window->RPort,x,y,x+w,y+h);

	g=CreateContext(&g);
	if(ga=(struct Gadget *)piDoMethod(o,OM_CREATE,g))
	{
		AddGList(nw->nw_Window,ga,-1,-1,NULL);
		RefreshGList(g,nw->nw_Window,NULL,-1);
		RemoveGList(nw->nw_Window,ga,-1);
	}
	piDoMethod(o,OM_DELETE);
	g->NextGadget=NULL;
	FreeGadgets(g);

	if(ng->ng_Selected && GUI.gui_Mode==MODE_GADGET)
	{
		SetAPen(nw->nw_Window->RPort,1);
		SetDrMd(nw->nw_Window->RPort,COMPLEMENT);
		if(CurrentGadget==o) fill=TRUE;
		DrawRect(nw->nw_Window->RPort,x,y,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y,fill);
		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x,y+(h/2)-2,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y+(h/2)-2,fill);
	}
	return TRUE;
}
Ejemplo n.º 5
0
static void handleall(void)
{
    struct IntuiMessage *msg;
    BOOL		quitme = FALSE;

    while(!quitme)
    {
        WaitPort(win->UserPort);

        while ((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
        {
            switch(msg->Class)
            {
            case IDCMP_CLOSEWINDOW:
                quitme = TRUE;
                break;

            case IDCMP_IDCMPUPDATE:
            {
                struct ColorWheelRGB rgb;
                struct ColorWheelHSB hsb;
                struct TagItem	     *tags = (struct TagItem *)msg->IAddress;

                hsb.cw_Hue        = GetTagData(WHEEL_Hue, 0, tags);
                hsb.cw_Saturation = GetTagData(WHEEL_Saturation, 0, tags);
                hsb.cw_Brightness = 0xFFFFFFFF;

                ConvertHSBToRGB(&hsb, &rgb);

                SetRGB32(vp, pen1, rgb.cw_Red, rgb.cw_Green, rgb.cw_Blue);

                if (truecolor)
                {
                    RefreshGList(gradgad, win, 0, 1);
                }
            }
            break;

            } /* switch(msg->Class) */

            ReplyMsg((struct Message *)msg);

        } /* while ((msg = (struct IntuiMessage *)GetMsg(win->UserPort))) */

    } /* while(!quitme) */

}
Ejemplo n.º 6
0
static void resizeWindow(FrameworkWindow *window) {
  if(window->gadgets) {
    RemoveGList(window->intuitionWindow, window->gadgets->glist, -1);
    (*window->kind->freeGadgets)(window->gadgets);
    SetRast(window->intuitionWindow->RPort, 0);
    window->gadgets = (*window->kind->buildGadgets)(window->intuitionWindow->Width, window->intuitionWindow->Height, window->data);
    if(!window->gadgets) {
      fprintf(stderr, "resizeWindow: couldn't create gadgets\n");
      goto error;
    }
    AddGList(window->intuitionWindow, window->gadgets->glist, (UWORD)~0, -1, NULL);
    RefreshWindowFrame(window->intuitionWindow);
    RefreshGList(window->gadgets->glist, window->intuitionWindow, NULL, -1);
    GT_RefreshWindow(window->intuitionWindow, NULL);
  }

  return;

error:
  return;
}
Ejemplo n.º 7
0
/* render a standard requester */
void render_requester(struct Requester *requester, struct IntuitionBase *IntuitionBase)
{
    struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
    struct RastPort *rp = requester->ReqLayer->rp;

    if ((requester->Flags & NOREQBACKFILL) == 0)
        SetRast(rp, requester->BackFill);

    if (requester->ImageBMap && requester->Flags & PREDRAWN)
        BltBitMapRastPort(requester->ImageBMap, 0, 0,
                          rp, 0, 0, requester->Width, requester->Height, 0xc0);

    if (requester->ReqImage && requester->Flags & USEREQIMAGE)
        DrawImage(rp, requester->ReqImage, 0, 0);

    if (requester->ReqBorder)
        DrawBorder(rp, requester->ReqBorder, 0, 0);

    if (requester->ReqGadget)
        RefreshGList(requester->ReqGadget, requester->RWindow, requester, -1);

    if (requester->ReqText)
        PrintIText(rp, requester->ReqText, 0, 0);
}
Ejemplo n.º 8
0
static BOOL LayOutReq (struct AHIAudioModeRequesterExt *req, struct TextAttr *TextAttr)
{
  struct Gadget *gad;
  struct NewGadget ng;

  struct TextAttr *gadtextattr;
  struct TextFont *font;
  LONG   fontwidth,buttonheight,buttonwidth,pixels;
  struct IntuiText intuitext = {1,0,JAM1,0,0,NULL,NULL,NULL};
  LONG  sliderlevels,sliderlevel;
  LONG  selected;

  selected=GetSelected(req);
  GetSliderAttrs(req,&sliderlevels,&sliderlevel);

// Calculate gadget area
  req->gx=req->Window->BorderLeft+4;
  req->gy=req->Window->BorderTop+2;
  req->gw=req->Window->Width-req->gx-(req->Window->BorderRight+4);
  req->gh=req->Window->Height-req->gy-(req->Window->BorderBottom+2);

  if(req->Gadgets)
  {
    RemoveGList(req->Window,req->Gadgets,-1);
    FreeGadgets(req->Gadgets);
    SetAPen(req->Window->RPort,0);
    SetDrMd(req->Window->RPort,JAM1);
    EraseRect(req->Window->RPort, req->Window->BorderLeft, req->Window->BorderTop,
        req->Window->Width-req->Window->BorderRight-1,req->Window->Height-req->Window->BorderBottom-1);
    RefreshWindowFrame(req->Window);
  }
  req->Gadgets=NULL;
  if((gad=CreateContext(&req->Gadgets)))
  {
    if(TextAttr)
      gadtextattr=TextAttr;
    else
      gadtextattr=req->Window->WScreen->Font;

    if((font=OpenFont(gadtextattr)))
    {
      fontwidth=font->tf_XSize;
      CloseFont(font);
    }
    else
      return FALSE;

    buttonheight=gadtextattr->ta_YSize+6;
    intuitext.ITextFont=gadtextattr;
    intuitext.IText=req->PositiveText;
    buttonwidth=IntuiTextLength(&intuitext);
    intuitext.IText=req->NegativeText;
    pixels=IntuiTextLength(&intuitext);
    buttonwidth=max(pixels,buttonwidth);
    buttonwidth+=4+fontwidth;

// Create gadgets and check if they fit
    // Do the two buttons fit?
    if(2*buttonwidth > req->gw)
      return FALSE;
    ng.ng_TextAttr=gadtextattr;
    ng.ng_VisualInfo=req->vi;
    ng.ng_UserData=req;
// OK button
    ng.ng_LeftEdge=req->gx;
    ng.ng_TopEdge=req->gy+req->gh-buttonheight;
    ng.ng_Width=buttonwidth;
    ng.ng_Height=buttonheight;
    ng.ng_GadgetText=req->PositiveText;
    ng.ng_GadgetID=OKBUTTON;
    ng.ng_Flags=PLACETEXT_IN;
    gad=CreateGadget(BUTTON_KIND,gad,&ng,TAG_END);
// Cancel button
    ng.ng_LeftEdge=req->gx+req->gw-ng.ng_Width;
    ng.ng_GadgetText=req->NegativeText;
    ng.ng_GadgetID=CANCELBUTTON;
    gad=CreateGadget(BUTTON_KIND,gad,&ng,TAG_END);
// Frequency
    if(req->Flags & freqgad)
    {
      intuitext.IText = GetString(msgReqFrequency, req->Catalog);
      pixels=IntuiTextLength(&intuitext)+INTERWIDTH;
      if(pixels+MINSLIDERWIDTH+INTERWIDTH+FREQLEN2*fontwidth > req->gw)
        return FALSE;
      ng.ng_Width=req->gw-pixels-INTERWIDTH-FREQLEN2*fontwidth;
      ng.ng_LeftEdge=req->gx+pixels;
      ng.ng_TopEdge-=2+buttonheight;
      ng.ng_GadgetText = GetString(msgReqFrequency, req->Catalog);
      ng.ng_GadgetID=FREQSLIDER;
      ng.ng_Flags=PLACETEXT_LEFT;
      gad=CreateGadget(SLIDER_KIND,gad,&ng,
          GTSL_Min,0,
          GTSL_Max,sliderlevels-1,
          GTSL_Level,sliderlevel,
          GTSL_LevelFormat, (ULONG) FREQTEXT2,
          GTSL_MaxLevelLen,FREQLEN2,
          GTSL_LevelPlace,PLACETEXT_RIGHT,
          GTSL_DispFunc, (ULONG) m68k_IndexToFrequency,
          GA_RelVerify,TRUE,
          GA_Disabled,!sliderlevels || (req->tempAudioID == AHI_DEFAULT_ID),
          TAG_DONE);
      req->slidergadget=gad;   // Save for HadleReq()...
    }
// ListView
    if((ng.ng_Height=ng.ng_TopEdge-2-req->gy) < buttonheight)
      return FALSE;
    ng.ng_LeftEdge=req->gx;
    ng.ng_TopEdge=req->gy;
    ng.ng_Width=req->gw;
    ng.ng_GadgetText=NULL,
    ng.ng_GadgetID=LISTVIEW;
    ng.ng_Flags=PLACETEXT_ABOVE;
    gad=CreateGadget(LISTVIEW_KIND,gad,&ng,
        GTLV_ScrollWidth,(fontwidth>8 ? fontwidth*2 : 18),
        GTLV_Labels, (ULONG) req->list,
        GTLV_ShowSelected,NULL,
        ((selected == ~0) || (GadToolsBase->lib_Version >= 39) ? TAG_IGNORE : GTLV_Top),selected,
        (selected == ~0 ? TAG_IGNORE : GTLV_MakeVisible),selected,
        GTLV_Selected,selected,
        TAG_DONE);
    req->listviewgadget=gad;   // Save for HadleReq()...

    if(!gad)
      return FALSE;
  }
  else
    return FALSE;

  AddGList(req->Window,req->Gadgets,~0,-1,NULL);
  RefreshGList(req->Gadgets,req->Window,NULL,-1);
  GT_RefreshWindow(req->Window,NULL);

  return TRUE;
}
Ejemplo n.º 9
0
// Refresh buttons display
void buttons_refresh(Buttons *buttons,ULONG type)
{
	int x,y;
	Cfg_Button *button;

	// Lock bank
	GetSemaphore(&buttons->bank->lock,SEMF_SHARED,0);

	// Make selector visible
	if (type&BUTREFRESH_SELECTOR)
	{
		if (buttons_visible_select(buttons))
			type|=BUTREFRESH_REFRESH;
	}

	// Font reset
	if (type&BUTREFRESH_FONT)
	{
		// See if font has changed
		if ((strcmp(
			buttons->window->RPort->Font->tf_Message.mn_Node.ln_Name,
			buttons->bank->window.font_name))!=0 ||
			buttons->window->RPort->Font->tf_YSize!=buttons->bank->window.font_size)
		{
			// Get new font
			buttons_get_font(buttons);

			// Do full reset
			type=BUTREFRESH_RESIZE|BUTREFRESH_REFRESH;

			// Clear resized flag
			buttons->flags&=~BUTTONF_RESIZED;
		}
	}

	// Resize event?
	if (type&BUTREFRESH_RESIZE)
	{
		unsigned short min_width,min_height;
		unsigned short max_width,max_height;
		short border_x=0,border_y=0;

		// Borderless window?
		if (buttons->flags&BUTTONF_BORDERLESS)
		{
			ULONG flags;
			short old_width,old_height;
			ULONG old_border;

			// Save drag gadget flags and size
			flags=buttons->drag_gadget.Flags;
			old_width=buttons->drag_gadget.Width;
			old_height=buttons->drag_gadget.Height;
			old_border=buttons->border_type;

			// See if drag bar orientation has changed
			if (buttons_fix_drag(buttons))
			{
				short width,height;

				// Get current width/height
				width=buttons->window->Width;
				height=buttons->window->Height;

				// If bar is now horizontal, it used to be vertical
				if (buttons->drag_gadget.Flags&GFLG_RELWIDTH && flags&GFLG_RELHEIGHT)
				{
					// Adjust accordingly
					width-=old_width;
					height+=buttons->drag_gadget.Height;
				}

				// And vice versa
				else
				if (buttons->drag_gadget.Flags&GFLG_RELHEIGHT && flags&GFLG_RELWIDTH)
				{
					// Adjust
					height-=old_height;
					width+=buttons->drag_gadget.Width;
				}

				// No drag bar
				else
				if (!(buttons->drag_gadget.Flags&(GFLG_RELWIDTH|GFLG_RELHEIGHT)))
				{
					// Adjust size
					if (flags&GFLG_RELHEIGHT)
					{
						if (old_border&BTNWF_RIGHT_BELOW) border_x=old_width;
						width-=old_width;
					}
					else
					if (flags&GFLG_RELWIDTH)
					{
						if (old_border&BTNWF_RIGHT_BELOW) border_y=old_height;
						height-=old_height;
					}
				}

				// State of right/below flag changed
				else
				if (!(old_border&BTNWF_RIGHT_BELOW) && (buttons->bank->window.flags&BTNWF_RIGHT_BELOW))
				{
					// Move window up or right depending on border
					if (buttons->bank->window.flags&BTNWF_HORIZ)
						border_y=-((GUI->screen_info&SCRI_LORES)?DRAG_LO_HEIGHT:DRAG_HI_HEIGHT);
					else
					if (buttons->bank->window.flags&BTNWF_VERT)
						border_x=-DRAG_WIDTH;
				}

				// Is size not changing?
				if (buttons->window->Width==width && buttons->window->Height==height)
				{
					// Refresh buttons display
					type|=BUTREFRESH_REFRESH;
					RefreshGList(&buttons->drag_gadget,buttons->window,0,1);
				}

				// Size is changing so window will be refreshed automatically
				else
				{
					// Resize window
					ChangeWindowBox(
						buttons->window,
						buttons->window->LeftEdge+border_x,buttons->window->TopEdge+border_y,
						width,height);
					buttons->flags|=BUTTONF_RESIZED;
				}

				// Recalculate internal size
				buttons_fix_internal(buttons);
			}

			// Refresh drag gadget
			else
			{
				RefreshGList(&buttons->drag_gadget,buttons->window,0,1);
			}
		}

		// Get the maximum size of a button
		buttons_get_max_size(buttons,&max_width,&max_height);

		// Graphical buttons?
		if (buttons->bank->window.flags&BTNWF_GFX)
		{
			// Maximum is also minimum
			min_width=max_width;
		}

		// Text buttons
		else
		{
			// Get minimum width
			min_width=TextLength(buttons->window->RPort,"a",1)*6;

			// Border?
			if (!(buttons->flags&BUTTONF_BORDERLESS))
			{
				// Calculate button size from window
				max_width=buttons->window->GZZWidth/buttons->bank->window.columns;
			}

			// Is button width less than minimum?
			if (max_width<min_width) max_width=min_width;
		}

		// Store button size
		buttons->button_width=max_width;
		buttons->button_height=max_height;

		// No border or toolbar?
		if (buttons->flags&(BUTTONF_BORDERLESS|BUTTONF_TOOLBAR))
		{
			short side_borders,top_borders;

			// Start with maximum columns/rows
			buttons->button_cols=buttons->bank->window.columns;
			buttons->button_rows=buttons->bank->window.rows;

			// Calculate window size
			max_width=buttons->button_width*buttons->button_cols;
			max_height=buttons->button_height*buttons->button_rows;

			// Calculate border sizes
			side_borders=buttons->window->Width-buttons->internal.Width;
			top_borders=buttons->window->Height-buttons->internal.Height;

			// Too big for screen?
			if (max_width+side_borders>buttons->window->WScreen->Width)
			{
				buttons->button_cols=(buttons->window->WScreen->Width-side_borders)/buttons->button_width;
				max_width=buttons->button_cols*buttons->button_width;
			}
			if (max_height+top_borders>buttons->window->WScreen->Height)
			{
				buttons->button_rows=(buttons->window->WScreen->Height-top_borders)/buttons->button_height;
				max_height=buttons->button_rows*buttons->button_height;
			}

			// Add border size
			max_width+=side_borders;
			max_height+=top_borders;

			// Minimum is the maximum
			min_width=max_width;
			min_height=max_height;
		}

		// Normal borders
		else
		{
			// Get columns/rows
			buttons->button_cols=buttons->window->GZZWidth/buttons->button_width;
			buttons->button_rows=buttons->window->GZZHeight/buttons->button_height;

			// Check columns/rows don't exceed actual number of buttons
			if (buttons->button_cols>buttons->bank->window.columns)
				buttons->button_cols=buttons->bank->window.columns;
			if (buttons->button_rows>buttons->bank->window.rows)
				buttons->button_rows=buttons->bank->window.rows;

			// Get window minimum size
			min_width+=buttons->window->BorderLeft+buttons->window->BorderRight;
			min_height=buttons->window->BorderTop+buttons->window->BorderBottom+buttons->button_height;

			// Get window maximum size
			max_width=(!(buttons->bank->window.flags&BTNWF_GFX))?buttons->window->WScreen->Width:
				buttons->window->BorderLeft+
				buttons->window->BorderRight+
				buttons->bank->window.columns*buttons->button_width;
			max_height=
				buttons->window->BorderTop+
				buttons->window->BorderBottom+
				buttons->button_height*buttons->bank->window.rows;
		}

		// Set window limits
		WindowLimits(buttons->window,0,0,(ULONG)-1,(ULONG)-1);

		// See if window size can be changed
		if (!(buttons->flags&BUTTONF_RESIZED))
		{
			short width,height;

			// No border?
			if (buttons->flags&BUTTONF_BORDERLESS)
			{
				// Get desired size
				width=max_width;
				height=max_height;
			}

			// Normal borders
			else
			{
				// Get initial size
				width=buttons->window->Width;
				height=buttons->window->Height;

				// Is window narrower than minimum?
				if (buttons->window->Width<min_width) width=min_width;

				// Or wider than maximum?
				else
				if (buttons->window->Width>max_width) width=max_width;

				// Otherwise, size to button boundary
				else
				{
					// Drop back to last whole column
					width-=buttons->window->GZZWidth-(buttons->button_cols*buttons->button_width);

					// Size to make window bigger?
					if (buttons->window->Width>buttons->last_position.Width &&
						buttons->button_cols<buttons->bank->window.columns)
					{
						short new_width;

						// Get new width
						new_width=width+buttons->button_width;

						// Would this be legal?
						if (buttons->window->LeftEdge+new_width<=buttons->window->WScreen->Width)
							width=new_width;
					}
				}

				// Is window shorter than minimum?
				if (buttons->window->Height<min_height) height=min_height;

				// Or taller than maximum?
				else
				if (buttons->window->Height>max_height) height=max_height;

				// Otherwise, size to button boundary
				else
				{
					// Drop back to last whole row
					height-=buttons->window->GZZHeight-(buttons->button_rows*buttons->button_height);

					// Size to make window bigger?
					if (buttons->window->Height>buttons->last_position.Height &&
						buttons->button_rows<buttons->bank->window.rows)
					{
						short new_height;

						// Get new height
						new_height=height+buttons->button_height;

						// Would this be legal?
						if (buttons->window->TopEdge+new_height<=buttons->window->WScreen->Height)
							height=new_height;
					}
				}
			}

			// Does window need to be resized?
			if (buttons->window->Width!=width ||
				buttons->window->Height!=height)
			{
				// Resize window
				ChangeWindowBox(
					buttons->window,
					buttons->window->LeftEdge+border_x,buttons->window->TopEdge+border_y,
					width,height);
				buttons->flags|=BUTTONF_RESIZED;

				// Set window limits
				WindowLimits(buttons->window,
					min_width,
					min_height,
					max_width,
					max_height);

				// Unlock bank
				FreeSemaphore(&buttons->bank->lock);
				return;
			}
		}

		// Returned from a resize; refresh frame
		else RefreshWindowFrame(buttons->window);

		// Save window position
		buttons->last_position=*((struct IBox *)&buttons->window->LeftEdge);

		// Set window limits
		WindowLimits(buttons->window,
			min_width,
			min_height,
			max_width,
			max_height);

		// Fix sliders
		if (buttons->vert_scroll)
		{
			SetGadgetAttrs(buttons->vert_scroll,buttons->window,0,
				PGA_Total,buttons->bank->window.rows,
				PGA_Visible,buttons->button_rows,
				TAG_END);
		}
		if (buttons->horiz_scroll)
		{
			SetGadgetAttrs(buttons->horiz_scroll,buttons->window,0,
				PGA_Total,buttons->bank->window.columns,
				PGA_Visible,buttons->button_cols,
				TAG_END);
		}

		// Make sure selector is visible
		if (buttons->editor) buttons_visible_select(buttons);
	}

	// Refresh event
	if (type&BUTREFRESH_REFRESH)
	{
		// Get vertical position
		if (buttons->vert_scroll)
			GetAttr(PGA_Top,buttons->vert_scroll,(ULONG *)&buttons->button_top);
		else buttons->button_top=0;

		// Horizontal
		if (buttons->horiz_scroll)
			GetAttr(PGA_Top,buttons->horiz_scroll,(ULONG *)&buttons->button_left);
		else  buttons->button_left=0;

		// Draw buttons
		button=(Cfg_Button *)buttons->bank->buttons.lh_Head;
		for (y=0;y<buttons->bank->window.rows;y++)
		{
			for (x=0;x<buttons->bank->window.columns;x++)
			{
				// Check button is valid
				if (button && !button->node.ln_Succ) button=0;

				// Is button visible?
				if (y>=buttons->button_top && y<buttons->button_top+buttons->button_rows &&
					x>=buttons->button_left && x<buttons->button_left+buttons->button_cols)
				{
					// Draw button
					buttons_show_button(
						buttons,
						button,
						x-buttons->button_left,
						y-buttons->button_top,
						(button)?button->current:0,0);
				}

				// Get next button
				if (button) button=(Cfg_Button *)button->node.ln_Succ;
			}
		}
	}

	// Clear resized flag
	buttons->flags&=~BUTTONF_RESIZED;

	// Unlock bank
	FreeSemaphore(&buttons->bank->lock);
}
Ejemplo n.º 10
0
// Initialise backdrop info
void backdrop_init_info(
	BackdropInfo *info,
	struct Window *window,
	short no_icons)
{
	// Backdrop window pointer
	info->window=window;

	// Initialise size
	info->size.MinX=window->BorderLeft+info->left_border;
	info->size.MinY=window->BorderTop+info->top_border;
	info->size.MaxX=window->Width-window->BorderRight-info->right_border-1;
	info->size.MaxY=window->Height-window->BorderBottom-info->bottom_border-1;

	// Not re-initialising?
	if (no_icons!=-1)
	{
		BackdropObject *icon;

		// Clone rastport
		info->rp=*window->RPort;

		// Get font
		backdrop_get_font(info);

		// If not backdrop window, add scroll bars
		if (!(window->Flags&WFLG_BACKDROP))
		{
			// Create scroll bars
			if (AddScrollBars(window,&info->boopsi_list,GUI->draw_info,SCROLL_VERT|SCROLL_HORIZ|SCROLL_NOIDCMP))
			{
				// Get scrollers
				info->vert_scroller=FindBOOPSIGadget(&info->boopsi_list,GAD_VERT_SCROLLER);
				info->horiz_scroller=FindBOOPSIGadget(&info->boopsi_list,GAD_HORIZ_SCROLLER);

				// Add to window
				AddGList(window,info->vert_scroller,-1,-1,0);
				RefreshGList(info->vert_scroller,window,0,-1);
			}
		}

		// Get clip region
		info->clip_region=NewRegion();
		info->temp_region=NewRegion();

		// Allocate notification port
		if (info->notify_port=CreateMsgPort())
		{
			// Add notify request
			info->notify_req=AddNotifyRequest(DN_WRITE_ICON,0,info->notify_port);
		}

		// Lock icon list
		lock_listlock(&info->objects,0);

		// Remap existing icons
		for (icon=(BackdropObject *)info->objects.list.lh_Head;
			icon->node.ln_Succ;
			icon=(BackdropObject *)icon->node.ln_Succ)
		{
			// Remap the icon
			if (RemapIcon(icon->icon,info->window->WScreen,0))
			{
				// Had icon never been remapped before?
				if (!(icon->flags&BDOF_REMAPPED))
				{
					// Get new object size, etc
					backdrop_get_icon(info,icon,GETICON_KEEP|GETICON_POS_ONLY|GETICON_SAVE_POS|GETICON_REMAP);

					// Get new masks
					backdrop_get_masks(icon);
				}
			}
			
			// Set flag to say we've been remapped
			icon->flags|=BDOF_REMAPPED;
		}

		// Unlock icon list
		unlock_listlock(&info->objects);
	}

	// Install clip
	if (info->clip_region)
		backdrop_install_clip(info);
}
Ejemplo n.º 11
0
IPTR Prop__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct TagItem *tags,*tag;
    struct Prop_DATA *data = INST_DATA(cl, obj);
    int refresh = 0;
    int only_trigger = 0;

    for (tags = msg->ops_AttrList; (tag = NextTagItem((const struct TagItem **)&tags)); )
    {
	switch (tag->ti_Tag)
	{
	    case    MUIA_Prop_Entries:
	    	    if ((IPTR)data->entries != tag->ti_Data)
		    {
		    	data->entries = tag->ti_Data;
		    	refresh = 1;
		    }
		    else
		    {
		    	tag->ti_Tag = TAG_IGNORE;
		    }
		    break;

	    case    MUIA_Prop_First:
	    	    if ((IPTR)data->first != tag->ti_Data)
		    {
 		    	data->first = tag->ti_Data;
		    	refresh = 1;
		    }
		    else
		    {
		    	tag->ti_Tag = TAG_IGNORE;
		    }
		    break;

	    case    MUIA_Prop_Slider:
		    break;

	    case    MUIA_Prop_Visible:
	    	    if ((IPTR)data->visible != tag->ti_Data)
		    {
		    	data->visible = tag->ti_Data;
		    	refresh = 1;
		    }
		    else
		    {
		    	tag->ti_Tag = TAG_IGNORE;
		    }
		    break;

	    case    MUIA_Prop_OnlyTrigger:
		    only_trigger = tag->ti_Data;
		    break;
		    
	    case    MUIA_Prop_DeltaFactor:
	    	    data->deltafactor = tag->ti_Data;
		    break;
	}
    }

    if (data->first < 0)
	data->first = 0;

    if (data->prop_object && refresh && !only_trigger)
    {
    	calcscale16(data);
	
	/* Rendering will happen here!! This could make problems with virtual groups, forward this to MUIM_Draw??? */
	SetAttrs(data->prop_object, ICA_TARGET, NULL, TAG_DONE);
	if (SetGadgetAttrs((struct Gadget*)data->prop_object,_window(obj),NULL,
		PGA_Top,downscale(data, data->first),
		PGA_Visible,downscale(data, data->visible),
		PGA_Total,downscale(data, data->entries),
		TAG_DONE))
	    RefreshGList((struct Gadget*)data->prop_object, _window(obj), NULL, 1);
	SetAttrs(data->prop_object, ICA_TARGET, ICTARGET_IDCMP, TAG_DONE);
    }

    return DoSuperMethodA(cl,obj,(Msg)msg);
}
Ejemplo n.º 12
0
int OpenObjectList()
{
	if(!ObjectWnd)
	{
		ObjectNode[0].lvnode.ln_Name=GetCatString(MSG_MainObjWindow_MITEM)+2;
		ObjectNode[1].lvnode.ln_Name=GetCatString(MSG_MainObjMenu_MITEM)+2;
		ObjectNode[2].lvnode.ln_Name=GetCatString(MSG_MainObjImage_MITEM)+2;
		ObjectNode[3].lvnode.ln_Name=GetCatString(MSG_MainObjStrings_MITEM)+2;
		ObjectNode[4].lvnode.ln_Name=GetCatString(MSG_MainObjScreen_MITEM)+2;
		ObjectNode[5].lvnode.ln_Name=GetCatString(MSG_MainObjVersion_MITEM)+2;
		unless(ObjDownButton=NewObject(NULL, BUTTONGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			GA_Image, gui_DownImage,
			GA_RelRight, 1-(IM_WIDTH(gui_DownImage)),
			GA_RelBottom, 1-(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_DownImage)),
			GA_RightBorder,TRUE,
			GA_UserData,OBJFN_Down, 
			GA_ID, 2,
			TAG_DONE)) return 1;
		unless(ObjUpButton=NewObject(NULL, BUTTONGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			GA_Image, gui_UpImage,
			GA_RelRight, 1-(IM_WIDTH(gui_UpImage)),
			GA_RelBottom, 1-(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_DownImage)+IM_HEIGHT(gui_UpImage)),
			GA_RightBorder,TRUE,
			GA_Previous,ObjDownButton,
			GA_UserData, OBJFN_Up,
			GA_ID, 3,
			TAG_DONE)) return 1;
		unless(ObjVertProp=NewObject(NULL, PROPGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			PGA_Freedom, FREEVERT,
			PGA_NewLook, TRUE,
			PGA_Borderless, ((DrawInfo->dri_Flags & DRIF_NEWLOOK) && DrawInfo->dri_Depth != 1),
			GA_RelRight, -(IM_WIDTH(gui_SizeImage)-5),
			GA_Top, Scr->WBorTop+Scr->Font->ta_YSize+1+1,
			GA_Width, IM_WIDTH(gui_SizeImage)-2-2-4,
			GA_RelHeight, -(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_UpImage)+IM_HEIGHT(gui_DownImage)+Scr->WBorTop+Scr->Font->ta_YSize+1+1+1),
			GA_RightBorder, TRUE,
			GA_Previous,ObjUpButton,
			GA_UserData, OBJFN_Vert,
			GA_ID, 4,
			PGA_Top, ObjTop,
			PGA_Total, ObjTotal,
			PGA_Visible, ObjVisible,
			TAG_DONE)) return 1;

		OpenWindow_Object();
		Tree_NewList(&ObjectList);
		UpdateObjectList();

		GetAttr(LIST_Visible,ObjectGadgets[GD_OBJLIST],(ULONG *)&ObjVisible);
		GetAttr(LIST_Top,ObjectGadgets[GD_OBJLIST],(ULONG *)&ObjTop);
		SetGadgetAttrs((struct Gadget *)ObjVertProp,ObjectWnd,NULL,
			PGA_Top, ObjTop,
			PGA_Total, ObjTotal,
			PGA_Visible, ObjVisible,
			TAG_DONE);
			
		AddGList(ObjectWnd,(struct Gadget *)ObjDownButton,-1,-1,NULL);
		RefreshGList((struct Gadget *)ObjDownButton,ObjectWnd,NULL,-1);
		SetWndSignals();
		MenuCheck(MainMenus,FULLMENUNUM(3,1,0),TRUE);
		SetFlag(GUI.gui_Prefs->pr_Flags,PRFLAG_OBJECTSOPEN);
	}
Ejemplo n.º 13
0
// Add or remove fuel gauge
void lister_set_gauge(Lister *lister,BOOL refresh)
{
	BOOL want,change=0;

	// If lister is closed, problem is moot
	if (!lister->window ||
		(lister->more_flags&LISTERF_TITLEBARRED)) return;

	// See if lister wants a gauge
	want=lister_want_gauge(lister);

	// Does lister have gauge and we don't want it to?
	if (lister->gauge_gadget && !want)
	{
		// Remove the gadget
		RemoveGList(lister->window,lister->gauge_gadget,1);

		// Free gadget
		DisposeObject((Object *)lister->gauge_gadget);
		lister->gauge_gadget=0;

		// Fix border width
		lister->window->BorderLeft=lister->old_border_left;

		// Free pens
		lister_init_colour(lister,ENVCOL_GAUGE,TRUE);

		// Set change flag
		change=1;
	}

	// Or, do we not have it but want it?
	else
	if (!lister->gauge_gadget && want)
	{
		// Initialise pens
		lister_init_colour(lister,ENVCOL_GAUGE,FALSE);

		// Create gauge
		if ((lister->gauge_gadget=(struct Gadget *)
				NewObject(
					0,
					"dopusgaugeclass",
					GA_ID,GAD_GAUGE,
					GA_Left,0,
					GA_Top,lister->window->BorderTop,
					GA_Width,lister->window->BorderRight,
					GA_RelHeight,-lister->window->BorderTop-lister->window->BorderBottom+3,
					GA_LeftBorder,TRUE,
					DGG_FillPen,lister->lst_Colours[ENVCOL_GAUGE].cr_Pen[0],
					DGG_FillPenAlert,lister->lst_Colours[ENVCOL_GAUGE].cr_Pen[1],
					TAG_END)))
		{
			// Fix border width
			lister->window->BorderLeft=lister->window->BorderRight;

			// Add gauge to window after parent button
			AddGList(lister->window,lister->gauge_gadget,-1,1,0);
			RefreshGList(lister->gauge_gadget,lister->window,0,1);

			// Set change flag
			change=1;
		}

		// Failed
		else
		{
			// Free pens
			lister_init_colour(lister,ENVCOL_GAUGE,TRUE);
		}
	}

	// Changed?
	if (change)
	{
		// Fix left border related things
		lister->window->GZZWidth=lister->window->Width-lister->window->BorderLeft-lister->window->BorderRight;
		lister->parent_button.Width=lister->window->BorderLeft;
	}

	// Changed and need to refresh?
	if (change && refresh)
	{
		// Initialise and refresh
		lister_init_display(lister);
		lister_refresh(lister,LREFRESH_FULL|LREFRESH_FULL_ICON);

		// If the path field is added, refresh it
		if (lister->path_field && lister->flags&LISTERF_PATH_FIELD)
		{
			struct gpResize resize;

			// Fill out resize packet
			resize.MethodID=GM_RESIZE;
			resize.gpr_GInfo=0;
			resize.gpr_RPort=0;
			resize.gpr_Size.Left=lister->window->BorderLeft;
			resize.gpr_Size.Top=-(lister->window->BorderBottom+FIELD_FONT->tf_YSize+4);
			resize.gpr_Size.Width=-(lister->window->BorderLeft+lister->window->BorderRight);
			resize.gpr_Size.Height=FIELD_FONT->tf_YSize+4;
			resize.gpr_Redraw=0;
			resize.gpr_Window=lister->window;
			resize.gpr_Requester=0;

			// Tell string gadget to resize
			DoMethodA((Object *)lister->path_field,(Msg)&resize);

			// Erase behind path field
			SetAPen(lister->window->RPort,3);
			RectFill(
				lister->window->RPort,
				lister->window->BorderLeft,
				lister->window->Height+lister->path_field->TopEdge-2,
				lister->window->Width-lister->window->BorderRight-1,
				lister->window->Height+lister->path_field->TopEdge+lister->path_field->Height+1);

			// Refresh path field
			RefreshGList(lister->path_field,lister->window,0,1);
		}

		// Refresh the window frame
		RefreshWindowFrame(lister->window);

		// Do we have the gauge?
		if (lister->gauge_gadget)
		{
			// Refresh title and gauge
			lister_show_name(lister);
		}
	}
}
Ejemplo n.º 14
0
void main(int argc, char *argv[])
{
	struct gtbApplication *appl=NULL;
	struct Window *Wnd;
	struct Gadget *GList=NULL;
	Object *prev;

	unless(appl=gtbNewApplication(TAG_DONE)) Leave("Can't create application");
	unless(Scrn=NewObject(appl->ga_ScrClass,NULL,
		SCRN_LikeWorkbench,TRUE,
		SCRN_PubName,APPPUBNAME,
		SCRN_Private,FALSE,
		SCRN_Title,APPPUBNAME,
		TAG_DONE)) Leave("Can't create screen");
	unless(Cdity=NewObject(appl->ga_CxClass,NULL,
		COMM_Name,APPNAME,
		COMM_Title,APPTITLE,
		COMM_Description,APPDESCRIPTION,
		COMM_Unique,TRUE,
		COMM_Notify,TRUE,
		COMM_ShowHide,TRUE,
		COMM_Handler,(ULONG)CdityHandler,
		COMM_AddHotKeyStr,"control t",COMM_AddHotKeyID,1,
		TAG_DONE)) Leave("Can't create commodity");
	unless(CtrlC=NewObject(appl->ga_MsgClass,NULL,
		MESG_SigBit,SIGBREAKF_CTRL_C,
		MESG_Handler,(ULONG)CtrlCHandler,
		TAG_DONE)) Leave("Can't create message handler");
	unless(ARexx=NewObject(appl->ga_ARexxClass,NULL,
		REXX_Name,APPPUBNAME,
		REXX_Extension,APPEXTENSION,
		REXX_CommandTable,commands,
		REXX_Handler,(ULONG)ARexxHandler,
		TAG_DONE)) Leave("Can't create arexx");
	unless(AmigaGuide=NewObject(appl->ga_AGClass,NULL,
		AGUI_Name,APPGUIDE,
		AGUI_ScreenObject,Scrn,
		AGUI_ARexxObject,ARexx,
		AGUI_Activate,TRUE,
		AGUI_BaseName,APPNAME,
		TAG_DONE)) Leave("Can't create amigaguide");
	unless(MainWnd=NewObject(appl->ga_WndClass,NULL,WIND_CenterX,600,WIND_CenterY,20,WIND_Width,200,WIND_Height,200,
		WIND_DragBar,TRUE,
		WIND_DepthGadget,TRUE,
		WIND_SizeGadget,TRUE,
		WIND_CloseGadget,TRUE,
		WIND_Title,APPTITLE,
		WIND_ScreenObject,Scrn,
		WIND_VertScroll,TRUE,
		WIND_VertTotal,10,
		WIND_HorizScroll,TRUE,
		WIND_HorizTotal,10,
		WIND_HorizVisible,5,
		WIND_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_GADGETUP,
		WIND_Handler,(ULONG)WndHandler,
		WIND_Activate,TRUE,
		WIND_MaxWidth,-1,
		WIND_MaxHeight,-1,
		TAG_DONE)) Leave("Can't create window");
	GetAttr(WIND_Window,MainWnd,(ULONG *)&Wnd);

	unless(prev=(Object *)CreateContext(&GList)) Leave("Can't create context");
	unless(prev=gtbCreateGadget(BUTTON_KIND,NULL,NULL,
		GA_Previous,prev,
		GA_Left,Wnd->BorderLeft,
		GA_Top,Wnd->BorderTop,
		GA_Width,100,
		GA_Height,20,
		GA_Text,"Ble",
		GT_ScreenObj,Scrn,
		GT_Handler,(ULONG)Gad1Handler,
		TAG_DONE)) Leave("Can't create gadget 1");
	unless(prev=gtbCreateGadget(STRING_KIND,NULL,NULL,
		GA_Previous,prev,
		GA_Left,Wnd->BorderLeft,
		GA_Top,Wnd->BorderTop+30,
		GA_Width,100,
		GA_Height,20,
		GA_Text,"Ble2",
		GT_ScreenObj,Scrn,
		TAG_DONE)) Leave("Can't create gadget 2");
	unless(prev=gtbCreateGadget(BOOPSI_KIND,NULL,FRBUTTONCLASS,
		GA_Previous,prev,
		GA_Left,Wnd->BorderLeft,
		GA_Top,Wnd->BorderTop+60,
		GA_Width,100,
		GA_Height,20,
		GA_Text,"Ble3",
		ICA_TARGET,ICTARGET_IDCMP,
		TAG_DONE)) Leave("Can't create gadget 3");

	DoMethod(MainWnd,OM_ADDMEMBER,GList);
	RefreshGList(GList,Wnd,NULL,-1);
	GT_RefreshWindow(Wnd,NULL);

	gtbExecuteRexx(ARexx,argv[1]);

	while(gtbHandleObject(MainWnd,Cdity,CtrlC,ARexx,AmigaGuide,TAG_DONE));

	RemoveGList(Wnd,GList,-1);
	gtbFreeGadgets(GList);
end:
	if(AmigaGuide) DisposeObject(AmigaGuide);
	if(ARexx) DisposeObject(ARexx);
	if(MainWnd) DisposeObject(MainWnd);
	if(CtrlC) DisposeObject(CtrlC);
	if(Cdity) DisposeObject(Cdity);
	if(Scrn) DisposeObject(Scrn);
	if(appl) gtbDisposeApplication(appl);
}