Esempio n. 1
0
STATIC VOID FOGadCleanup(struct LayoutData *ld, struct AslBase_intern *AslBase)
{
    struct FOUserData 		*udata = (struct FOUserData *)ld->ld_UserData;
    struct FontRequester 	*req = (struct FontRequester *)ld->ld_Req;
    struct IntReq 		*intreq = ld->ld_IntReq;
//  struct IntFontReq 		*iforeq = (struct IntFontReq *)intreq;
    
    EnterFunc(bug("FOGadCleanup(ld=%p)\n", ld));

    if (ld->ld_Window && ld->ld_GList)
    {
        RemoveGList(ld->ld_Window, ld->ld_GList, -1);
    }
    
    killscrollergadget(&udata->NameScrollGad, AslBase);
    killscrollergadget(&udata->SizeScrollGad, AslBase);

    FreeObjects(&FOREQ_FIRST_OBJECT(udata), &FOREQ_LAST_OBJECT(udata), AslBase);
    
    FOFreeFonts(ld, AslBase);
    		
    if (udata->PreviewFont) CloseFont(udata->PreviewFont);
    
    if (ld->ld_Window)
    {
	req->fo_LeftEdge = intreq->ir_LeftEdge = ld->ld_Window->LeftEdge;
	req->fo_TopEdge  = intreq->ir_TopEdge  = ld->ld_Window->TopEdge;
	req->fo_Width    = intreq->ir_Width    = ld->ld_Window->Width;
	req->fo_Height   = intreq->ir_Height   = ld->ld_Window->Height;
    }
        
    ReturnVoid("FOGadCleanup");
}
Esempio n. 2
0
BOOL makescrollergadget(struct ScrollerGadget *scrollergad, struct LayoutData *ld,
			struct TagItem *tags, struct AslBase_intern *AslBase)
{
    struct TagItem extraproptags[] =
    {
    	{PGA_NotifyBehaviour, PG_BEHAVIOUR_NICE},
	{PGA_RenderBehaviour, PG_BEHAVIOUR_NICE},
	{TAG_MORE   	    , 0     	       }
    };
    
    struct TagItem *ti, *h_ti, *w_ti;
    WORD x, y, w, h, aw, ah;
    UWORD flags = 0;
    BOOL freehoriz = (GetTagData(PGA_Freedom, FREEVERT, tags) == FREEHORIZ);
    BOOL result = FALSE;
    
    if ((ti = FindTagItem(GA_Left, tags)))
    {
        x = ti->ti_Data;
    } else if ((ti = FindTagItem(GA_RelRight, tags)))
    {
        x = ti->ti_Data; flags |= GFLG_RELRIGHT;
    }
    
    if ((ti = FindTagItem(GA_Top, tags)))
    {
        y = ti->ti_Data;
    } else if ((ti = FindTagItem(GA_RelBottom, tags)))
    {
        y = ti->ti_Data; flags |= GFLG_RELBOTTOM;
    }
    
    if ((w_ti = FindTagItem(GA_Width, tags)))
    {
        w = w_ti->ti_Data;
    } else if ((w_ti = FindTagItem(GA_RelWidth, tags)))
    {
        w = w_ti->ti_Data; flags |= GFLG_RELWIDTH;
    }
    
    if ((h_ti = FindTagItem(GA_Height, tags)))
    {
        h = h_ti->ti_Data;
    } else if ((h_ti = FindTagItem(GA_RelHeight, tags)))
    {
        h = h_ti->ti_Data; flags |= GFLG_RELHEIGHT;
    }
    
    if (freehoriz)
    {
        aw = h; ah = h;
	w -= aw * 2;
	if (w_ti) w_ti->ti_Data = w;
    } else {
        aw = w; ah = w;
	h -= ah * 2;
	if (h_ti) h_ti->ti_Data = h; 
    }
    
    extraproptags[2].ti_Data = (IPTR)tags;
    if ((scrollergad->prop = NewObjectA(AslBase->aslpropclass, NULL, extraproptags)))
    {
        struct TagItem arrow_tags[] =
	{
	    {GA_Left		, freehoriz ? x + w - 1 : x	},
	    {GA_Top		, freehoriz ? y : y + h - 1	},
	    {GA_Width		, aw				},
	    {GA_Height		, ah				},
	    {GA_RelVerify	, TRUE				},
	    {GA_Immediate	, TRUE				},
	    {GA_Previous	, (IPTR)scrollergad->prop	},
	    {GA_ID		, ID_ARROWDEC			},
	    {TAG_DONE						}	    
	};
	
	if (flags & GFLG_RELRIGHT) arrow_tags[0].ti_Tag = GA_RelRight;
	if (flags & GFLG_RELWIDTH)
	{
	    arrow_tags[0].ti_Tag = GA_RelRight;
	    if (freehoriz) arrow_tags[0].ti_Data += 2;
	}
	
	if (flags & GFLG_RELBOTTOM) arrow_tags[1].ti_Tag = GA_RelBottom;
	if (flags & GFLG_RELHEIGHT)	
	{
	    arrow_tags[1].ti_Tag = GA_RelBottom;
	    if (!freehoriz) arrow_tags[1].ti_Data += 2;
	}
	
	if ((scrollergad->arrow1 = NewObjectA(AslBase->aslarrowclass, NULL, arrow_tags)))
	{
	    if (freehoriz)
	    {		
	        arrow_tags[0].ti_Data += aw;
	    } else {
	        arrow_tags[1].ti_Data += ah;
	    }
	    arrow_tags[6].ti_Data = (IPTR)scrollergad->arrow1;
	    arrow_tags[7].ti_Data = ID_ARROWINC;
	    
	    if ((scrollergad->arrow2 = NewObjectA(AslBase->aslarrowclass, NULL, arrow_tags)))
	    {
	        struct TagItem image_tags[] =
		{
		    {SYSIA_Which	, freehoriz ? LEFTIMAGE : UPIMAGE	},
		    {SYSIA_DrawInfo	, (IPTR)ld->ld_Dri			},
		    {SYSIA_Style	, SYSISTYLE_GADTOOLS			},
		    {IA_Width		, aw					},
		    {IA_Height		, ah					},
		    {TAG_DONE							}		
		};
	        struct Image *im;
	    	
		if ((im = NewObjectA(NULL, SYSICLASS, image_tags)))
		{
		    SetAttrs(scrollergad->arrow1, GA_Image, (IPTR)im,
		    				  TAG_DONE);
						  
		    image_tags[0].ti_Data = (freehoriz ? RIGHTIMAGE : DOWNIMAGE);
		    
		    if ((im = NewObjectA(NULL, SYSICLASS, image_tags)))
		    {
		    #if USE_SAFE_NOTIFYING
		    	struct TagItem ic_tags [] =
			{
			    {ICA_MAP , (IPTR) prop_to_lv },
			    {TAG_DONE	    	    	 }
			};
			
			if ((scrollergad->prop_ic = NewObjectA(NULL, ICCLASS, ic_tags)))
			{
			    ic_tags[0].ti_Data = (IPTR)lv_to_prop;
			    
			    if ((scrollergad->listview_ic = NewObjectA(NULL, ICCLASS, ic_tags)))			    
			    {
		    #endif			    	 
		        	struct TagItem set_tags [] =
				{
				    {ICA_TARGET	, (IPTR) scrollergad->prop	},
				    {ICA_MAP    , (IPTR) arrowdec_to_prop	},
				    {TAG_DONE					}
				};

		        	SetAttrs(scrollergad->arrow2, GA_Image, (IPTR)im,
							      TAG_DONE);

				SetAttrsA(scrollergad->arrow1, set_tags);
				set_tags[1].ti_Data = (IPTR)arrowinc_to_prop;
				SetAttrsA(scrollergad->arrow2, set_tags);

				result = TRUE;
				
		    #if USE_SAFE_NOTIFYING
		    
			    } /* if ((scrollergad->listview_ic = NewObjectA(NULL, ICCLASS, ic_tags))) */
			    
			} /* if ((scrollergad->prop_ic = NewObjectA(NULL, ICCLASS, ic_tags))) */
			
		    #endif
			
		    } /* if ((im = NewObjectA(NULL, SYSICLASS, image_tags))) */
		    
		} /* if ((im = NewObject(NULL, SYSICLASS, image_tags))) */
		
	    } /* if ((scrollergad->arrow2 = NewObjectA(NULL, BUTTONGCLASS, arrow_tags))) */
	    
	} /* if (scrollergad->arrow1 = NewObjectA(NULL, BUTTONGCLASS, arrow_tags)) */
	
    } /* if ((scrollergad->prop = NewObjectA(AslBase->aslpropclass, NULL, tags))) */
    
    if (!result) killscrollergadget(scrollergad, AslBase);
    
    return result;
}