示例#1
0
/******* TapUnit::Init() **********************************/
BOOL UXTapUnit__Hidd_TapUnit__Init(OOP_Class *cl, OOP_Object *o, struct pHidd_TapUnit_Init *msg)
{
	struct HIDDTapUnitData * data = OOP_INST_DATA(cl, o);
	
	EnterFunc(bug("TapUnit::Init()\n"));
	data->DataReceivedCallBack = msg->DataReceived;
	data->DataReceivedUserData = msg->DataReceivedUserData;
	data->DataWriteCallBack		= msg->WriteData;
	data->DataWriteUserData		= msg->WriteDataUserData;

	ReturnBool("TapUnit::Init()", TRUE);
}
示例#2
0
STATIC BOOL FOGadInit(struct LayoutData *ld, struct AslBase_intern *AslBase)
{    
    struct FOUserData 	*udata = ld->ld_UserData;
    struct IntFontReq 	*iforeq = (struct IntFontReq *)ld->ld_IntReq;
    STRPTR 		str[6];
#if USE_SHARED_COOLIMAGES
    struct ButtonInfo 	bi[NUMBUTS] =
    {
        { ID_BUTOK	, GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, COOL_USEIMAGE_ID    , &udata->OKBut	  },
	{ ID_BUTCANCEL  , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, COOL_CANCELIMAGE_ID , &udata->CancelBut  }
    };
#else
    struct ButtonInfo 	bi[NUMBUTS] =
    {
        { ID_BUTOK	, GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, &cool_useimage    , &udata->OKBut	  },
	{ ID_BUTCANCEL  , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, &cool_cancelimage , &udata->CancelBut  }
    };
#endif
    Object 		*gad;
    LONG		error;
    WORD 		gadrows, x, y, w, h, i, y2;
    WORD		sizelvwidth, labelwidth = 0, maxgadcolwidth = 0;
    
    NEWLIST(&udata->NameListviewList);

    udata->SizeListviewRenderHook.h_Entry      = (APTR)AROS_ASMSYMNAME(SizeListviewRenderFunc);
    udata->SizeListviewRenderHook.h_SubEntry   = NULL;
    udata->SizeListviewRenderHook.h_Data       = AslBase;

    udata->StringEditHook.h_Entry    = (APTR)AROS_ASMSYMNAME(StringEditFunc);
    udata->StringEditHook.h_SubEntry = NULL;
    udata->StringEditHook.h_Data     = AslBase;

    FOGetFonts(ld, AslBase);
    
    error = ERROR_NO_FREE_STORE;
    
    /* calc. min. size */

    w = 0;
    for(i = 0; i < NUMBUTS; i++)
    {
    	if(!bi[i].text) bi[i].text = GetString(bi[i].deftextid, GetIR(iforeq)->ir_Catalog, AslBase);

        x = TextLength(&ld->ld_DummyRP, bi[i].text, strlen(bi[i].text));

#if FOREQ_COOL_BUTTONS
#if USE_SHARED_COOLIMAGES
    	if (CoolImagesBase)
	{
	    bi[i].coolimage = (const struct CoolImage *)COOL_ObtainImageA(bi[i].coolid, NULL);
	}
	
	if (CoolImagesBase)
#endif
	if (ld->ld_TrueColor)
	{
	    x += IMAGEBUTTONEXTRAWIDTH + bi[i].coolimage->width;
	}
#endif

	if (x > w) w = x;	
    }
    
    udata->ButWidth = w + BUTTONEXTRAWIDTH;

    ld->ld_ButWidth = udata->ButWidth;
    ld->ld_NumButtons = 4;
    
#if FOREQ_COOL_BUTTONS

#if USE_SHARED_COOLIMAGES
    if (CoolImagesBase)
    {
#endif
	y  = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
	if (ld->ld_TrueColor)
	{
            y2 = IMAGEBUTTONEXTRAHEIGHT + DEF_COOLIMAGEHEIGHT;
	} else {
            y2 = 0;
	}
	udata->ButHeight = (y > y2) ? y : y2;
#if USE_SHARED_COOLIMAGES
    }
    else
    {
    	udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
    }
#endif

#else
    udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
#endif
    
    gadrows = 2; /* button row + string gadgets under listviews */
    if (iforeq->ifo_Flags & FOF_DODRAWMODE) gadrows++;
    if (iforeq->ifo_Flags & FOF_DOSTYLE) gadrows++;
    if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) gadrows++;
    
    ld->ld_MinWidth =  OUTERSPACINGX * 2 +
		       GADGETSPACINGX * 1 +
		       udata->ButWidth * NUMBUTS;

    ld->ld_MinHeight = OUTERSPACINGY * 2 +
		       (GADGETSPACINGY + udata->ButHeight) * gadrows +
		       BORDERLVSPACINGY * 2 +
		       (ld->ld_Font->tf_YSize + BORDERLVITEMSPACINGY * 2) * FOREQ_MIN_VISIBLELINES +
		       FONTPREVIEWHEIGHT + GADGETSPACINGY -
		       GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */

    /* make listview gadgets */
    
    sizelvwidth = PROPSIZE +
    	    	  FOREQ_VISIBILE_SIZE_CHARS * ld->ld_Font->tf_XSize +
		  BORDERLVSPACINGX * 2 +
		  BORDERLVITEMSPACINGX * 2;
    
    x = ld->ld_WBorLeft + OUTERSPACINGX;
    y = ld->ld_WBorTop + OUTERSPACINGY;
    w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - PROPSIZE - GADGETSPACINGX - sizelvwidth;
    h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
    	udata->ButHeight * gadrows -
	GADGETSPACINGY * gadrows -
	(FONTPREVIEWHEIGHT + GADGETSPACINGY) +
	GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */
    
    {
        struct TagItem lv_tags[] = 
	{
	    {GA_Left		, x						},
	    {GA_Top		, y						},
	    {GA_RelWidth	, w						},
	    {GA_RelHeight	, h						},
	    {GA_UserData	, (IPTR)ld					},
	    {GA_ID		, ID_NAMELISTVIEW				},
	    {GA_RelVerify	, TRUE						},
	    {ASLLV_Labels	, (IPTR)&udata->NameListviewList		},
	    {TAG_IGNORE    	, 0 	    	    	    	    	    	},
	    {TAG_IGNORE     	, (IPTR)&udata->SizeListviewRenderHook	    	},
	    {ASLLV_Font     	, (IPTR)ld->ld_Font 	    	    	    	},
	    {TAG_DONE								}
	};
	
	udata->NameListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
	if (!gad) goto failure;

    	lv_tags[0].ti_Tag  = GA_RelRight;
	lv_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
	lv_tags[2].ti_Tag  = GA_Width;
	lv_tags[2].ti_Data = sizelvwidth - PROPSIZE;
	lv_tags[5].ti_Data = ID_SIZELISTVIEW;
	lv_tags[7].ti_Data = 0;
	lv_tags[8].ti_Tag  = GA_Previous;
	lv_tags[8].ti_Data = (IPTR)gad;
	lv_tags[9].ti_Tag  = ASLLV_CallBack;
	
	udata->SizeListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
	if (!gad) goto failure;
	
    }
    
    /* make scroller gadgets for listviews */
    		       
    x = -ld->ld_WBorRight - OUTERSPACINGX - PROPSIZE - sizelvwidth - GADGETSPACINGX + 1;
    y = ld->ld_WBorTop + OUTERSPACINGY;
    w = PROPSIZE;
    h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
    	udata->ButHeight * gadrows -
	GADGETSPACINGY * gadrows -
	(FONTPREVIEWHEIGHT + GADGETSPACINGY) +
	GADGETSPACINGY;
    {
	struct TagItem scroller_tags[] =
	{
    	    {GA_RelRight	, x		    },
	    {GA_Top		, y		    },
	    {GA_Width		, w		    },
	    {GA_RelHeight	, h		    },
	    {GA_ID		, ID_NAMELISTVIEW   },
	    {PGA_NewLook	, TRUE		    },
	    {PGA_Borderless 	, TRUE		    },
	    {PGA_Freedom	, FREEVERT	    },
	    {PGA_Top		, 0		    },
	    {PGA_Total		, 20		    },
	    {PGA_Visible	, 1		    },
	    {GA_Previous	, (IPTR)gad	    },
	    {TAG_DONE				    }
	};

	if (!makescrollergadget(&udata->NameScrollGad, ld, scroller_tags, AslBase)) goto failure;
	gad = udata->NameScrollGad.arrow2;

    	scroller_tags[0].ti_Data  = x + sizelvwidth + GADGETSPACINGX;
	scroller_tags[1].ti_Data  = y;
	scroller_tags[2].ti_Data  = w;
	scroller_tags[3].ti_Data  = h;
	scroller_tags[4].ti_Data  = ID_SIZELISTVIEW;
	scroller_tags[11].ti_Data = (IPTR)gad;
	
	if (!makescrollergadget(&udata->SizeScrollGad, ld, scroller_tags, AslBase)) goto failure;
	gad = udata->SizeScrollGad.arrow2;
	
    }

    connectscrollerandlistview(&udata->NameScrollGad, udata->NameListview, AslBase);
    connectscrollerandlistview(&udata->SizeScrollGad, udata->SizeListview, AslBase);

    /* make preview gadget */

    x = ld->ld_WBorLeft + OUTERSPACINGX;
    y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight - 
    	GADGETSPACINGY - FONTPREVIEWHEIGHT;
    w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2;

    {
    	struct TagItem preview_tags[] =
	{
	    {GA_Left	    	, x 	    	    	    	    },
	    {GA_RelBottom   	, y 	    	    	    	    },
	    {GA_RelWidth    	, w 	    	    	    	    },
	    {GA_Height	    	, FONTPREVIEWHEIGHT  	    	    },
	    {GA_Previous    	, (IPTR)gad 	    	    	    },
	    {GA_ID  	    	, ID_PREVIEW     	    	    },
	    {ASLFP_SampleText	, (IPTR)iforeq->ifo_SampleText	    },
	    {ASLFP_APen     	, iforeq->ifo_FrontPen	    	    },
	    {ASLFP_BPen     	, iforeq->ifo_BackPen	    	    },
	    {TAG_DONE	    	    	    	    	    	    }
	};

	udata->Preview = gad = NewObjectA(AslBase->aslfontpreviewclass, NULL, preview_tags);
	if (!gad) goto failure;
    }
    
    /* make string gadgets */

    x = ld->ld_WBorLeft + OUTERSPACINGX;
    y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight - 
    	(udata->ButHeight + GADGETSPACINGY) * (gadrows - 1) -
	(FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
		
    w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - GADGETSPACINGX - sizelvwidth;
    
    {
    	struct TagItem string_tags[] =
	{
	    {GA_Left	    	, x 	    	    	    	    },
	    {GA_RelBottom   	, y 	    	    	    	    },
	    {GA_RelWidth    	, w 	    	    	    	    },
	    {GA_Height	    	, udata->ButHeight  	    	    },
	    {GA_Previous    	, (IPTR)gad 	    	    	    },
	    {STRINGA_TextVal	, (IPTR)""     	    	    	    },
	    {STRINGA_MaxChars	, MAXFONTNAME 	    	    	    },
	    {STRINGA_EditHook	, (IPTR)&udata->StringEditHook	    },
	    {GA_ID  	    	, ID_NAMESTRING     	    	    },
	    {GA_RelVerify   	, TRUE	    	    	    	    },
	    {GA_UserData    	, (IPTR)ld  	    	    	    },
	    {GA_TabCycle    	, TRUE	    	    	    	    },
	    {STRINGA_Font   	, (IPTR)ld->ld_Font 	    	    },
	    {TAG_DONE	    	    	    	    	    	    }
	};

	udata->NameString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
	if (!gad) goto failure;
	
   	string_tags[0].ti_Tag  = GA_RelRight;
	string_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
	string_tags[2].ti_Tag  = GA_Width;
	string_tags[2].ti_Data = sizelvwidth;
	string_tags[4].ti_Data = (IPTR)gad;
	string_tags[5].ti_Tag  = STRINGA_LongVal;
	string_tags[5].ti_Data = iforeq->ifo_TextAttr.ta_YSize;
	string_tags[6].ti_Data = 6;
	string_tags[8].ti_Data = ID_SIZESTRING;

	udata->SizeString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
	if (!gad) goto failure;
	
    }
    
    /* make button row */
    
    y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight + 1;
    
    {
        struct TagItem button_tags[] =
	{
	    {GA_Text		, 0			},
	    {GA_Previous	, 0			},
	    {GA_ID		, 0			},
#if FOREQ_COOL_BUTTONS
	    {ASLBT_CoolImage	, 0			},
#else
	    {TAG_IGNORE		, 0			},
#endif	    
	    {GA_UserData	, (IPTR)ld		},
	    {GA_Left		, 0			},
	    {GA_RelBottom	, y			},
	    {GA_Width		, udata->ButWidth	},
	    {GA_Height		, udata->ButHeight	},
	    {GA_RelVerify	, TRUE			},
	    {GA_Image		, 0			}, /* means we want a frame */
	    {TAG_DONE					}
	};

	for(i = 0; i < NUMBUTS; i++)
	{
	    button_tags[0].ti_Data = (IPTR)bi[i].text;
	    button_tags[1].ti_Data = (IPTR)gad;
	    button_tags[2].ti_Data = bi[i].gadid;
	#if USE_SHARED_COOLIMAGES
	    if (CoolImagesBase == NULL) button_tags[3].ti_Tag = TAG_IGNORE;
	#endif
	    button_tags[3].ti_Data = (IPTR)bi[i].coolimage;

	    *(bi[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, button_tags);
	    if (!gad) goto failure;
	}
	 	 
    }	 
    
    /* make labels */
        
    i = 0;

    x = ld->ld_WBorLeft + OUTERSPACINGX;
    y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight - 
    	(udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
	(FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;

    if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN))
    {
        #define FSET(x) ((iforeq->ifo_Flags & x) ? TRUE : FALSE)
	
        struct LabelInfo
	{
	    BOOL doit;
	    char *text;
	    Object **objvar;
	} li [] =
	{
	    {FSET(FOF_DOSTYLE)	    , (STRPTR)MSG_FONTREQ_STYLE_LABEL 	, &udata->StyleLabel     },
	    {FALSE  	    	    , (STRPTR)MSG_FONTREQ_COLOR_LABEL_FG, &udata->ColorLabel	 },
	    {FSET(FOF_DODRAWMODE)   , (STRPTR)MSG_FONTREQ_MODE_LABEL  	, &udata->DrawModeLabel  }
	}; 

        #undef FSET
	
        struct TagItem label_tags[] =
	{
	    {GA_Left		, 0			},
	    {GA_RelBottom	, y			},
	    {GA_Width		, 0			},
	    {GA_Height		, udata->ButHeight	},
	    {GA_Text		, 0			},
	    {GA_Previous	, (IPTR)gad		},
	    {GA_UserData	, (IPTR)ld		},
	    {GA_Disabled	, TRUE			},
	    {TAG_DONE					}
	};
    	WORD i2;
	
	if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
	{
	    li[1].doit = TRUE;
	    
	    switch(iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
	    {
	    	case FOF_DOFRONTPEN:
		    break;
		    
		case FOF_DOBACKPEN:
		    li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_BG;
		    break;
		    
		case FOF_DOFRONTPEN | FOF_DOBACKPEN:
		    li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_FGBG;
		    break;
	    }
	    
	} /* if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) */
    	for(i = 0, i2 = 0; i < 3; i++)
	{
	    if (li[i].doit)
	    {
	    	if ((i == 2) && (iforeq->ifo_ModeList))
		{
		    li[i].text = iforeq->ifo_ModeList[0];
		}
		else
		{
	    	    li[i].text = GetString((LONG)li[i].text, GetIR(iforeq)->ir_Catalog, AslBase);
		}
		str[i2++] = li[i].text;
	    }
	}
		
	w = labelwidth = BiggestTextLength(str, i2, &(ld->ld_DummyRP), AslBase);
            
	for(i = 0; i < 3;i++)
	{
	    if (!li[i].doit) continue;
	    
	    label_tags[2].ti_Data = TextLength(&ld->ld_DummyRP, li[i].text, strlen(li[i].text));
	    label_tags[0].ti_Data = x + w - label_tags[2].ti_Data;
	    label_tags[4].ti_Data = (IPTR)li[i].text;
	    label_tags[5].ti_Data = (IPTR)gad;
	    
	    *(li[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, label_tags);
	    if (!gad) goto failure;
	    
	    y += udata->ButHeight + GADGETSPACINGY;
	    label_tags[1].ti_Data = y;
	}	

    	y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight - 
    	    (udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
	    (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
	    
	x = ld->ld_WBorLeft + OUTERSPACINGX + w + LABELSPACINGX;

    	/* Make Style gadget */
	
	if (iforeq->ifo_Flags & FOF_DOSTYLE)
	{
	    STRPTR stylestrings[3];
	    
	    struct TagItem style_tags[] =
	    {
	        {GA_Previous		, (IPTR)gad			  },
		{GA_Left		, x				  },
		{GA_RelBottom		, y				  },
		{GA_Width		, 0				  },
		{GA_Height		, udata->ButHeight		  },
		{GA_RelVerify		, TRUE				  },
		{GA_UserData		, (IPTR)ld			  },
		{GA_ID			, ID_STYLE			  },
		{ASLFS_LabelArray    	, (IPTR)stylestrings	    	  },
		{ASLFS_Style		, iforeq->ifo_TextAttr.ta_Style	  },
		{TAG_DONE						  }
	    };

    	    stylestrings[0] = GetString(MSG_FONTREQ_STYLE_BOLD, GetIR(iforeq)->ir_Catalog, AslBase);
    	    stylestrings[1] = GetString(MSG_FONTREQ_STYLE_ITALIC, GetIR(iforeq)->ir_Catalog, AslBase);
    	    stylestrings[2] = GetString(MSG_FONTREQ_STYLE_UNDERLINED, GetIR(iforeq)->ir_Catalog, AslBase);
	    
	    w = BiggestTextLength(stylestrings, 3, &(ld->ld_DummyRP), AslBase);
	    w *= 2;
	    w *= 3;
	    
	    style_tags[3].ti_Data = w;
	    
	    if (w > maxgadcolwidth) maxgadcolwidth = w;
	    
	    udata->StyleGadget = gad = NewObjectA(AslBase->aslfontstyleclass, NULL, style_tags);
	    if (!gad) goto failure;
	    
	    y += udata->ButHeight + GADGETSPACINGY;
	    
	}
	
	w = udata->ButHeight * 12 / 10 + 19; /* CYCLEIMAGEWIDTH = 19 */
	
	/* Make FrontPen gadget */
	
	if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
	{
	    struct TagItem cp_tags[] =
	    {
	        {GA_Previous		, (IPTR)gad			  },
		{GA_Left		, x				  },
		{GA_RelBottom		, y				  },
		{GA_Width		, w				  },
		{GA_Height		, udata->ButHeight		  },
		{GA_RelVerify		, TRUE				  },
		{GA_UserData		, (IPTR)ld			  },
		{GA_ID			, ID_FRONTPEN			  },
		{ASLCP_Color	    	, iforeq->ifo_FrontPen	    	  },
		{ASLCP_ColorTable   	, (IPTR)iforeq->ifo_FrontPens     },
		{ASLCP_NumColors    	, iforeq->ifo_MaxFrontPen   	  },
		{TAG_DONE						  }
		
	    };
	    
	    udata->FGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
	    if (!gad) goto failure;
	    
	    x += w + GADGETSPACINGX;
	}

    	/* Make BackPen gadget */
	
	if (iforeq->ifo_Flags & FOF_DOBACKPEN)
	{
	    struct TagItem cp_tags[] =
	    {
	        {GA_Previous		, (IPTR)gad			  },
		{GA_Left		, x				  },
		{GA_RelBottom		, y				  },
		{GA_Width		, w				  },
		{GA_Height		, udata->ButHeight		  },
		{GA_RelVerify		, TRUE				  },
		{GA_UserData		, (IPTR)ld			  },
		{GA_ID			, ID_BACKPEN			  },
		{ASLCP_Color	    	, iforeq->ifo_BackPen	    	  },
		{ASLCP_ColorTable   	, (IPTR)iforeq->ifo_BackPens      },
		{ASLCP_NumColors    	, iforeq->ifo_MaxBackPen   	  },
		{TAG_DONE						  }
		
	    };
	    
	    udata->BGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
	    if (!gad) goto failure;
	    
	}

    	if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
	{
	    if ((iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) == (FOF_DOFRONTPEN | FOF_DOBACKPEN))
	    {
	    	w += GADGETSPACINGX + w;
	    }
	    
	    if (w > maxgadcolwidth) maxgadcolwidth = w;
	    
	    y += udata->ButHeight + GADGETSPACINGY;
	}
	
	
    	/* Make DrawMode gadget */

	x = ld->ld_WBorLeft + OUTERSPACINGX + labelwidth + LABELSPACINGX;

	w = -ld->ld_WBorLeft - ld->ld_WBorRight - OUTERSPACINGX * 2 -
            labelwidth - LABELSPACINGX;

	
	if (iforeq->ifo_Flags & FOF_DODRAWMODE)
	{
	    struct TagItem cycle_tags[] =
	    {
	        {GA_Previous		, (IPTR)gad			  },
		{GA_Left		, x				  },
		{GA_RelBottom		, y				  },
		{GA_RelWidth		, w				  },
		{GA_Height		, udata->ButHeight		  },
		{GA_RelVerify		, TRUE				  },
		{GA_UserData		, (IPTR)ld			  },
		{GA_ID			, ID_DRAWMODE			  },
		{ASLCY_Labels		, 0 	    	    	    	  },
		{ASLCY_Active		, iforeq->ifo_DrawMode	    	  },
		{ASLCY_Font 	    	, (IPTR)ld->ld_Font 	    	  },
		{TAG_DONE						  }
		
	    };
	    static LONG labelids[] =
	    {
		MSG_FONTREQ_MODE_TEXT,
		MSG_FONTREQ_MODE_TEXTANDFIELD,
		MSG_FONTREQ_MODE_COMPLEMENT,
	    };
	    STRPTR *labels;
	    
	    
	    if (iforeq->ifo_ModeList)
	    {
	    	labels = &iforeq->ifo_ModeList[1];
	    }
	    else
	    {
    	    	labels = (STRPTR *)&iforeq->ifo_DrawModeJAM1Text;
	    	
    		for(i = 0; i < 3; i++)
		{
	    	    labels[i] = GetString(labelids[i], GetIR(iforeq)->ir_Catalog, AslBase);
		}
	    }
	    
	    cycle_tags[8].ti_Data = (IPTR)labels;
	    
	    i = CYCLEEXTRAWIDTH +  BiggestTextLength(labels,
	    					     0x7FFF,
						     &(ld->ld_DummyRP),
						     AslBase);						     
	    if (i > maxgadcolwidth) maxgadcolwidth = i;
	    
	    udata->DrawModeGadget = gad = NewObjectA(AslBase->aslcycleclass, NULL, cycle_tags);
	    if (!gad) goto failure;
	    
	    y += udata->ButHeight + GADGETSPACINGY;
	    
	} /* if (iforeq->ifo_Flags & FOF_DODRAWMODE) */
		
    } /* if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN)) */

#if AVOID_FLICKER
    {
    	struct TagItem eraser_tags[] =
	{
	    {GA_Previous, (IPTR)gad},
	    {TAG_DONE}
	};
	
	udata->EraserGadget = gad = NewObjectA(AslBase->asleraserclass, NULL, eraser_tags);
	/* Doesn't matter if this failed */
    }
#endif
    
    w = OUTERSPACINGX + labelwidth + LABELSPACINGX + maxgadcolwidth + OUTERSPACINGX;
    if (w > ld->ld_MinWidth) ld->ld_MinWidth = w;
    
    ld->ld_GList = (struct Gadget *)udata->NameListview;							 
    
    /* Menus */
    {
        struct NewMenu nm[] =
	{
	    {NM_TITLE, (STRPTR)MSG_FONTREQ_MEN_CONTROL							},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_LASTFONT , 0, 0, 0, (APTR)FOMEN_LASTFONT		},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_NEXTFONT , 0, 0, 0, (APTR)FOMEN_NEXTFONT 	},
	     {NM_ITEM, NM_BARLABEL									},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESTORE	, 0, 0, 0, (APTR)FOMEN_RESTORE 		},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESCAN	, 0, 0, 0, (APTR)FOMEN_RESCAN		},
	     {NM_ITEM, NM_BARLABEL									},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_OK   	, 0, 0, 0, (APTR)FOMEN_OK		},
	     {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_CANCEL	, 0, 0, 0, (APTR)FOMEN_CANCEL		},
	    {NM_END																}
	};

	struct TagItem menu_tags[] =
	{
	    {GTMN_NewLookMenus  , TRUE  	    	    	    },
	    {GTMN_TextAttr	, (IPTR)GetIR(iforeq)->ir_TextAttr  },
	    {TAG_DONE   	    	    	    	    	    }
	};
	
	if (menu_tags[1].ti_Data == 0) menu_tags[1].ti_Tag = TAG_IGNORE;

	LocalizeMenus(nm, GetIR(iforeq)->ir_Catalog, AslBase);

	/* Don't fail, if menus cannot be created/layouted, because a requester
	   without menus is still better than no requester at all */
	   
	if ((ld->ld_Menu = CreateMenusA(nm, NULL)))
	{
	    if (!LayoutMenusA(ld->ld_Menu, ld->ld_VisualInfo, menu_tags))
	    {
	        FreeMenus(ld->ld_Menu);ld->ld_Menu = NULL;
	    }
	}
    }
    
    FORestore(ld, iforeq->ifo_TextAttr.ta_Name, iforeq->ifo_TextAttr.ta_YSize,  AslBase);
    
    SetIoErr(0);
    ReturnBool ("FOGadInit", TRUE);
    
failure:
    SetIoErr(error);
    
    D(bug("failure\n"));

    FOGadCleanup(ld, ASLB(AslBase));

    ReturnBool ("FOGadInit", FALSE);

}
示例#3
0
STATIC BOOL FOGadLayout(struct LayoutData *ld, struct AslBase_intern *AslBase)
{
    ReturnBool ("FOGadLayout", TRUE );
}