grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / asl / fontreqhooks.c
blob68c64d4680d1a40a0863d54edb1176e164cb5fb8
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 Font requester specific code.
6 */
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/utility.h>
12 #include <proto/intuition.h>
13 #include <proto/graphics.h>
14 #include <proto/gadtools.h>
15 #include <exec/memory.h>
16 #include <dos/dos.h>
17 #include <intuition/screens.h>
18 #include <intuition/icclass.h>
19 #include <intuition/imageclass.h>
20 #include <graphics/gfx.h>
21 #include <devices/rawkeycodes.h>
22 #include <libraries/gadtools.h>
23 #include <workbench/startup.h>
24 #include <string.h>
25 #include <stdio.h>
27 #include "asl_intern.h"
28 #include "fontreqhooks.h"
29 #include "fontreqsupport.h"
30 #include "layout.h"
32 #if USE_SHARED_COOLIMAGES
33 #include <libraries/coolimages.h>
34 #include <proto/coolimages.h>
35 #else
36 #include "coolimages.h"
37 #endif
39 #define CATCOMP_NUMBERS
40 #include "strings.h"
42 #define SDEBUG 0
43 #define DEBUG 0
45 #include <aros/debug.h>
47 /*****************************************************************************************/
49 STATIC BOOL FOGadInit(struct LayoutData *, struct AslBase_intern *);
50 STATIC VOID FOWindowOpened(struct LayoutData *, struct AslBase_intern *);
51 STATIC BOOL FOGadLayout(struct LayoutData *, struct AslBase_intern *);
52 STATIC VOID FOGadCleanup(struct LayoutData *, struct AslBase_intern *);
53 STATIC ULONG FOHandleEvents(struct LayoutData *, struct AslBase_intern *);
54 STATIC ULONG FOGetSelectedFont(struct LayoutData *, struct AslBase_intern *AslBase);
56 /*****************************************************************************************/
58 #define ID_BUTOK ID_MAINBUTTON_OK
59 #define ID_BUTCANCEL ID_MAINBUTTON_CANCEL
61 #define ID_NAMELISTVIEW 1
62 #define ID_SIZELISTVIEW 2
63 #define ID_NAMESTRING 3
64 #define ID_SIZESTRING 4
65 #define ID_PREVIEW 5
66 #define ID_DRAWMODE 6
67 #define ID_STYLE 7
68 #define ID_FRONTPEN 8
69 #define ID_BACKPEN 9
71 #undef NUMBUTS
72 #define NUMBUTS 2L
74 #define FONTPREVIEWHEIGHT 40
76 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
77 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
79 #define AslBase HOOK_ASLBASE
81 /*****************************************************************************************/
83 AROS_UFH3(IPTR, SizeListviewRenderFunc,
84 AROS_UFHA(struct Hook *, hook, A0),
85 AROS_UFHA(struct Node *, node, A2),
86 AROS_UFHA(struct ASLLVDrawMsg *, msg, A1)
89 AROS_USERFUNC_INIT
91 IPTR retval;
93 if (msg->lvdm_MethodID == LV_DRAW)
95 struct DrawInfo *dri = msg->lvdm_DrawInfo;
96 struct RastPort *rp = msg->lvdm_RastPort;
98 WORD min_x = msg->lvdm_Bounds.MinX;
99 WORD min_y = msg->lvdm_Bounds.MinY;
100 WORD max_x = msg->lvdm_Bounds.MaxX;
101 WORD max_y = msg->lvdm_Bounds.MaxY;
103 UWORD erasepen = BACKGROUNDPEN;
104 UWORD textpen = TEXTPEN;
106 SetDrMd(rp, JAM1);
109 switch (msg->lvdm_State)
111 case ASLLVR_SELECTED:
112 erasepen = FILLPEN;
113 textpen = FILLTEXTPEN;
115 /* Fall through */
117 case ASLLVR_NORMAL:
119 struct TextExtent te;
120 WORD numfit;
121 UBYTE s[10];
123 SetAPen(rp, dri->dri_Pens[erasepen]);
124 RectFill(rp, min_x, min_y, max_x, max_y);
126 if (node)
128 sprintf(s, "%ld", (long)node->ln_Name);
130 numfit = TextFit(rp,
132 strlen(s),
133 &te,
134 NULL,
136 max_x - min_x + 1 - BORDERLVITEMSPACINGX * 2,
137 max_y - min_y + 1);
139 SetAPen(rp, dri->dri_Pens[textpen]);
141 /* Render text */
142 Move(rp, min_x + BORDERLVITEMSPACINGX,
143 min_y + BORDERLVITEMSPACINGY + rp->Font->tf_Baseline);
144 Text(rp, s, numfit);
147 } break;
150 retval = ASLLVCB_OK;
152 else
154 retval = ASLLVCB_UNKNOWN;
157 return retval;
159 AROS_USERFUNC_EXIT
162 /*****************************************************************************************/
164 #undef AslBase
166 /*****************************************************************************************/
168 AROS_UFH3(VOID, FOTagHook,
169 AROS_UFHA(struct Hook *, hook, A0),
170 AROS_UFHA(struct ParseTagArgs *, pta, A2),
171 AROS_UFHA(struct AslBase_intern *, AslBase, A1)
174 AROS_USERFUNC_INIT
176 struct TagItem *tag;
177 struct TagItem *tstate;
178 struct IntFontReq *iforeq;
180 EnterFunc(bug("FOTagHook(hook=%p, pta=%p)\n", hook, pta));
182 iforeq = (struct IntFontReq *)pta->pta_IntReq;
184 tstate = pta->pta_Tags;
185 while ((tag = NextTagItem(&tstate)) != NULL)
187 IPTR tidata = tag->ti_Data;
189 switch (tag->ti_Tag)
191 case ASLFO_InitialName:
192 if (tidata)
193 iforeq->ifo_TextAttr.ta_Name = (STRPTR)tidata;
194 break;
196 case ASLFO_InitialSize:
197 iforeq->ifo_TextAttr.ta_YSize = (UWORD)tidata;
198 break;
200 case ASLFO_InitialStyle:
201 iforeq->ifo_TextAttr.ta_Style = (UBYTE)tidata;
202 break;
204 case ASLFO_InitialFlags:
205 iforeq->ifo_TextAttr.ta_Flags = (UBYTE)tidata;
206 break;
208 case ASLFO_InitialFrontPen:
209 iforeq->ifo_FrontPen = (UBYTE)tidata;
210 break;
212 case ASLFO_InitialBackPen:
213 iforeq->ifo_BackPen = (UBYTE)tidata;
214 break;
216 case ASLFO_InitialDrawMode:
217 iforeq->ifo_DrawMode = (UBYTE)tidata;
218 break;
220 case ASLFO_Flags:
221 iforeq->ifo_Flags = (UBYTE)tidata;
222 break;
224 case ASLFO_DoFrontPen:
225 if (tidata)
226 iforeq->ifo_Flags |= FOF_DOFRONTPEN;
227 else
228 iforeq->ifo_Flags &= ~FOF_DOFRONTPEN;
229 break;
231 case ASLFO_DoBackPen:
232 if (tidata)
233 iforeq->ifo_Flags |= FOF_DOBACKPEN;
234 else
235 iforeq->ifo_Flags &= ~FOF_DOBACKPEN;
236 break;
238 case ASLFO_DoStyle:
239 if (tidata)
240 iforeq->ifo_Flags |= FOF_DOSTYLE;
241 else
242 iforeq->ifo_Flags &= ~FOF_DOSTYLE;
243 break;
245 case ASLFO_DoDrawMode:
246 if (tidata)
247 iforeq->ifo_Flags |= FOF_DODRAWMODE;
248 else
249 iforeq->ifo_Flags &= ~FOF_DODRAWMODE;
250 break;
252 case ASLFO_FixedWidthOnly:
253 if (tidata)
254 iforeq->ifo_Flags |= FOF_FIXEDWIDTHONLY;
255 else
256 iforeq->ifo_Flags &= ~FOF_FIXEDWIDTHONLY;
257 break;
259 case ASLFO_MinHeight:
260 iforeq->ifo_MinHeight = (UWORD)tidata;
261 break;
263 case ASLFO_MaxHeight:
264 iforeq->ifo_MaxHeight = (UWORD)tidata;
265 break;
267 case ASLFO_FilterFunc:
268 iforeq->ifo_FilterFunc = (struct Hook *)tidata;
269 break;
271 case ASLFO_HookFunc:
272 iforeq->ifo_HookFunc = (APTR)tidata;
273 break;
275 case ASLFO_MaxFrontPen:
276 iforeq->ifo_MaxFrontPen = (UWORD)tidata;
277 break;
279 case ASLFO_MaxBackPen:
280 iforeq->ifo_MaxBackPen = (UWORD)tidata;
281 break;
283 case ASLFO_ModeList:
284 iforeq->ifo_ModeList = (STRPTR *)tidata;
285 break;
287 case ASLFO_FrontPens:
288 iforeq->ifo_FrontPens = (UBYTE *)tidata;
289 break;
291 case ASLFO_BackPens:
292 iforeq->ifo_BackPens = (UBYTE *)tidata;
293 break;
295 case ASLFO_SampleText:
296 iforeq->ifo_SampleText = (STRPTR)tidata;
297 break;
299 default:
300 break;
302 } /* switch (tag->ti_Tag) */
304 } /* while ((tag = NextTagItem(&tstate)) != 0) */
306 ReturnVoid("FOTagHook");
308 AROS_USERFUNC_EXIT
311 /*****************************************************************************************/
313 AROS_UFH3(ULONG, FOGadgetryHook,
314 AROS_UFHA(struct Hook *, hook, A0),
315 AROS_UFHA(struct LayoutData *, ld, A2),
316 AROS_UFHA(struct AslBase_intern *, AslBase, A1)
319 AROS_USERFUNC_INIT
321 ULONG retval;
323 switch (ld->ld_Command)
325 case LDCMD_INIT:
326 retval = (ULONG)FOGadInit(ld, ASLB(AslBase));
327 break;
329 case LDCMD_WINDOWOPENED:
330 FOWindowOpened(ld, ASLB(AslBase));
331 retval = GHRET_OK;
332 break;
334 case LDCMD_LAYOUT:
335 retval = (ULONG)FOGadLayout(ld, ASLB(AslBase));
336 break;
338 case LDCMD_HANDLEEVENTS:
339 retval = (ULONG)FOHandleEvents(ld, ASLB(AslBase));
340 break;
342 case LDCMD_CLEANUP:
343 FOGadCleanup(ld, ASLB(AslBase));
344 retval = GHRET_OK;
345 break;
347 default:
348 retval = GHRET_FAIL;
349 break;
352 return (retval);
354 AROS_USERFUNC_EXIT
357 /*****************************************************************************************/
359 struct ButtonInfo
361 WORD gadid;
362 STRPTR text;
363 LONG deftextid;
364 #if USE_SHARED_COOLIMAGES
365 ULONG coolid;
366 Object **objvar;
367 const struct CoolImage *coolimage;
368 #else
369 const struct CoolImage *coolimage;
370 Object **objvar;
371 #endif
374 /*****************************************************************************************/
376 STATIC BOOL FOGadInit(struct LayoutData *ld, struct AslBase_intern *AslBase)
378 struct FOUserData *udata = ld->ld_UserData;
379 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
380 STRPTR str[6];
381 #if USE_SHARED_COOLIMAGES
382 struct ButtonInfo bi[NUMBUTS] =
384 { ID_BUTOK , GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, COOL_USEIMAGE_ID , &udata->OKBut },
385 { ID_BUTCANCEL , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, COOL_CANCELIMAGE_ID , &udata->CancelBut }
387 #else
388 struct ButtonInfo bi[NUMBUTS] =
390 { ID_BUTOK , GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, &cool_useimage , &udata->OKBut },
391 { ID_BUTCANCEL , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, &cool_cancelimage , &udata->CancelBut }
393 #endif
394 Object *gad;
395 LONG error;
396 WORD gadrows, x, y, w, h, i, y2;
397 WORD sizelvwidth, labelwidth = 0, maxgadcolwidth = 0;
399 NEWLIST(&udata->NameListviewList);
401 udata->SizeListviewRenderHook.h_Entry = (APTR)AROS_ASMSYMNAME(SizeListviewRenderFunc);
402 udata->SizeListviewRenderHook.h_SubEntry = NULL;
403 udata->SizeListviewRenderHook.h_Data = AslBase;
405 udata->StringEditHook.h_Entry = (APTR)AROS_ASMSYMNAME(StringEditFunc);
406 udata->StringEditHook.h_SubEntry = NULL;
407 udata->StringEditHook.h_Data = AslBase;
409 FOGetFonts(ld, AslBase);
411 error = ERROR_NO_FREE_STORE;
413 /* calc. min. size */
415 w = 0;
416 for(i = 0; i < NUMBUTS; i++)
418 if(!bi[i].text) bi[i].text = GetString(bi[i].deftextid, GetIR(iforeq)->ir_Catalog, AslBase);
420 x = TextLength(&ld->ld_DummyRP, bi[i].text, strlen(bi[i].text));
422 #if FOREQ_COOL_BUTTONS
423 #if USE_SHARED_COOLIMAGES
424 if (CoolImagesBase)
426 bi[i].coolimage = (const struct CoolImage *)COOL_ObtainImageA(bi[i].coolid, NULL);
429 if (CoolImagesBase)
430 #endif
431 if (ld->ld_TrueColor)
433 x += IMAGEBUTTONEXTRAWIDTH + bi[i].coolimage->width;
435 #endif
437 if (x > w) w = x;
440 udata->ButWidth = w + BUTTONEXTRAWIDTH;
442 ld->ld_ButWidth = udata->ButWidth;
443 ld->ld_NumButtons = 4;
445 #if FOREQ_COOL_BUTTONS
447 #if USE_SHARED_COOLIMAGES
448 if (CoolImagesBase)
450 #endif
451 y = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
452 if (ld->ld_TrueColor)
454 y2 = IMAGEBUTTONEXTRAHEIGHT + DEF_COOLIMAGEHEIGHT;
455 } else {
456 y2 = 0;
458 udata->ButHeight = (y > y2) ? y : y2;
459 #if USE_SHARED_COOLIMAGES
461 else
463 udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
465 #endif
467 #else
468 udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
469 #endif
471 gadrows = 2; /* button row + string gadgets under listviews */
472 if (iforeq->ifo_Flags & FOF_DODRAWMODE) gadrows++;
473 if (iforeq->ifo_Flags & FOF_DOSTYLE) gadrows++;
474 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) gadrows++;
476 ld->ld_MinWidth = OUTERSPACINGX * 2 +
477 GADGETSPACINGX * 1 +
478 udata->ButWidth * NUMBUTS;
480 ld->ld_MinHeight = OUTERSPACINGY * 2 +
481 (GADGETSPACINGY + udata->ButHeight) * gadrows +
482 BORDERLVSPACINGY * 2 +
483 (ld->ld_Font->tf_YSize + BORDERLVITEMSPACINGY * 2) * FOREQ_MIN_VISIBLELINES +
484 FONTPREVIEWHEIGHT + GADGETSPACINGY -
485 GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */
487 /* make listview gadgets */
489 sizelvwidth = PROPSIZE +
490 FOREQ_VISIBILE_SIZE_CHARS * ld->ld_Font->tf_XSize +
491 BORDERLVSPACINGX * 2 +
492 BORDERLVITEMSPACINGX * 2;
494 x = ld->ld_WBorLeft + OUTERSPACINGX;
495 y = ld->ld_WBorTop + OUTERSPACINGY;
496 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - PROPSIZE - GADGETSPACINGX - sizelvwidth;
497 h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
498 udata->ButHeight * gadrows -
499 GADGETSPACINGY * gadrows -
500 (FONTPREVIEWHEIGHT + GADGETSPACINGY) +
501 GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */
504 struct TagItem lv_tags[] =
506 {GA_Left , x },
507 {GA_Top , y },
508 {GA_RelWidth , w },
509 {GA_RelHeight , h },
510 {GA_UserData , (IPTR)ld },
511 {GA_ID , ID_NAMELISTVIEW },
512 {GA_RelVerify , TRUE },
513 {ASLLV_Labels , (IPTR)&udata->NameListviewList },
514 {TAG_IGNORE , 0 },
515 {TAG_IGNORE , (IPTR)&udata->SizeListviewRenderHook },
516 {ASLLV_Font , (IPTR)ld->ld_Font },
517 {TAG_DONE }
520 udata->NameListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
521 if (!gad) goto failure;
523 lv_tags[0].ti_Tag = GA_RelRight;
524 lv_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
525 lv_tags[2].ti_Tag = GA_Width;
526 lv_tags[2].ti_Data = sizelvwidth - PROPSIZE;
527 lv_tags[5].ti_Data = ID_SIZELISTVIEW;
528 lv_tags[7].ti_Data = 0;
529 lv_tags[8].ti_Tag = GA_Previous;
530 lv_tags[8].ti_Data = (IPTR)gad;
531 lv_tags[9].ti_Tag = ASLLV_CallBack;
533 udata->SizeListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
534 if (!gad) goto failure;
538 /* make scroller gadgets for listviews */
540 x = -ld->ld_WBorRight - OUTERSPACINGX - PROPSIZE - sizelvwidth - GADGETSPACINGX + 1;
541 y = ld->ld_WBorTop + OUTERSPACINGY;
542 w = PROPSIZE;
543 h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
544 udata->ButHeight * gadrows -
545 GADGETSPACINGY * gadrows -
546 (FONTPREVIEWHEIGHT + GADGETSPACINGY) +
547 GADGETSPACINGY;
549 struct TagItem scroller_tags[] =
551 {GA_RelRight , x },
552 {GA_Top , y },
553 {GA_Width , w },
554 {GA_RelHeight , h },
555 {GA_ID , ID_NAMELISTVIEW },
556 {PGA_NewLook , TRUE },
557 {PGA_Borderless , TRUE },
558 {PGA_Freedom , FREEVERT },
559 {PGA_Top , 0 },
560 {PGA_Total , 20 },
561 {PGA_Visible , 1 },
562 {GA_Previous , (IPTR)gad },
563 {TAG_DONE }
566 if (!makescrollergadget(&udata->NameScrollGad, ld, scroller_tags, AslBase)) goto failure;
567 gad = udata->NameScrollGad.arrow2;
569 scroller_tags[0].ti_Data = x + sizelvwidth + GADGETSPACINGX;
570 scroller_tags[1].ti_Data = y;
571 scroller_tags[2].ti_Data = w;
572 scroller_tags[3].ti_Data = h;
573 scroller_tags[4].ti_Data = ID_SIZELISTVIEW;
574 scroller_tags[11].ti_Data = (IPTR)gad;
576 if (!makescrollergadget(&udata->SizeScrollGad, ld, scroller_tags, AslBase)) goto failure;
577 gad = udata->SizeScrollGad.arrow2;
581 connectscrollerandlistview(&udata->NameScrollGad, udata->NameListview, AslBase);
582 connectscrollerandlistview(&udata->SizeScrollGad, udata->SizeListview, AslBase);
584 /* make preview gadget */
586 x = ld->ld_WBorLeft + OUTERSPACINGX;
587 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
588 GADGETSPACINGY - FONTPREVIEWHEIGHT;
589 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2;
592 struct TagItem preview_tags[] =
594 {GA_Left , x },
595 {GA_RelBottom , y },
596 {GA_RelWidth , w },
597 {GA_Height , FONTPREVIEWHEIGHT },
598 {GA_Previous , (IPTR)gad },
599 {GA_ID , ID_PREVIEW },
600 {ASLFP_SampleText , (IPTR)iforeq->ifo_SampleText },
601 {ASLFP_APen , iforeq->ifo_FrontPen },
602 {ASLFP_BPen , iforeq->ifo_BackPen },
603 {TAG_DONE }
606 udata->Preview = gad = NewObjectA(AslBase->aslfontpreviewclass, NULL, preview_tags);
607 if (!gad) goto failure;
610 /* make string gadgets */
612 x = ld->ld_WBorLeft + OUTERSPACINGX;
613 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
614 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 1) -
615 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
617 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - GADGETSPACINGX - sizelvwidth;
620 struct TagItem string_tags[] =
622 {GA_Left , x },
623 {GA_RelBottom , y },
624 {GA_RelWidth , w },
625 {GA_Height , udata->ButHeight },
626 {GA_Previous , (IPTR)gad },
627 {STRINGA_TextVal , (IPTR)"" },
628 {STRINGA_MaxChars , MAXASLFONTNAME },
629 {STRINGA_EditHook , (IPTR)&udata->StringEditHook },
630 {GA_ID , ID_NAMESTRING },
631 {GA_RelVerify , TRUE },
632 {GA_UserData , (IPTR)ld },
633 {GA_TabCycle , TRUE },
634 {STRINGA_Font , (IPTR)ld->ld_Font },
635 {TAG_DONE }
638 udata->NameString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
639 if (!gad) goto failure;
641 string_tags[0].ti_Tag = GA_RelRight;
642 string_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
643 string_tags[2].ti_Tag = GA_Width;
644 string_tags[2].ti_Data = sizelvwidth;
645 string_tags[4].ti_Data = (IPTR)gad;
646 string_tags[5].ti_Tag = STRINGA_LongVal;
647 string_tags[5].ti_Data = iforeq->ifo_TextAttr.ta_YSize;
648 string_tags[6].ti_Data = 6;
649 string_tags[8].ti_Data = ID_SIZESTRING;
651 udata->SizeString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
652 if (!gad) goto failure;
656 /* make button row */
658 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight + 1;
661 struct TagItem button_tags[] =
663 {GA_Text , 0 },
664 {GA_Previous , 0 },
665 {GA_ID , 0 },
666 #if FOREQ_COOL_BUTTONS
667 {ASLBT_CoolImage , 0 },
668 #else
669 {TAG_IGNORE , 0 },
670 #endif
671 {GA_UserData , (IPTR)ld },
672 {GA_Left , 0 },
673 {GA_RelBottom , y },
674 {GA_Width , udata->ButWidth },
675 {GA_Height , udata->ButHeight },
676 {GA_RelVerify , TRUE },
677 {GA_Image , 0 }, /* means we want a frame */
678 {TAG_DONE }
681 for(i = 0; i < NUMBUTS; i++)
683 button_tags[0].ti_Data = (IPTR)bi[i].text;
684 button_tags[1].ti_Data = (IPTR)gad;
685 button_tags[2].ti_Data = bi[i].gadid;
686 #if USE_SHARED_COOLIMAGES
687 if (CoolImagesBase == NULL) button_tags[3].ti_Tag = TAG_IGNORE;
688 #endif
689 button_tags[3].ti_Data = (IPTR)bi[i].coolimage;
691 *(bi[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, button_tags);
692 if (!gad) goto failure;
697 /* make labels */
699 i = 0;
701 x = ld->ld_WBorLeft + OUTERSPACINGX;
702 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
703 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
704 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
706 if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN))
708 #define FSET(x) ((iforeq->ifo_Flags & x) ? TRUE : FALSE)
710 struct LabelInfo
712 BOOL doit;
713 char *text;
714 Object **objvar;
715 } li [] =
717 {FSET(FOF_DOSTYLE) , (STRPTR)MSG_FONTREQ_STYLE_LABEL , &udata->StyleLabel },
718 {FALSE , (STRPTR)MSG_FONTREQ_COLOR_LABEL_FG, &udata->ColorLabel },
719 {FSET(FOF_DODRAWMODE) , (STRPTR)MSG_FONTREQ_MODE_LABEL , &udata->DrawModeLabel }
722 #undef FSET
724 struct TagItem label_tags[] =
726 {GA_Left , 0 },
727 {GA_RelBottom , y },
728 {GA_Width , 0 },
729 {GA_Height , udata->ButHeight },
730 {GA_Text , 0 },
731 {GA_Previous , (IPTR)gad },
732 {GA_UserData , (IPTR)ld },
733 {GA_Disabled , TRUE },
734 {TAG_DONE }
736 WORD i2;
738 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
740 li[1].doit = TRUE;
742 switch(iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
744 case FOF_DOFRONTPEN:
745 break;
747 case FOF_DOBACKPEN:
748 li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_BG;
749 break;
751 case FOF_DOFRONTPEN | FOF_DOBACKPEN:
752 li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_FGBG;
753 break;
756 } /* if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) */
757 for(i = 0, i2 = 0; i < 3; i++)
759 if (li[i].doit)
761 if ((i == 2) && (iforeq->ifo_ModeList))
763 li[i].text = iforeq->ifo_ModeList[0];
765 else
767 li[i].text = GetString((IPTR)li[i].text, GetIR(iforeq)->ir_Catalog, AslBase);
769 str[i2++] = li[i].text;
773 w = labelwidth = BiggestTextLength(str, i2, &(ld->ld_DummyRP), AslBase);
775 for(i = 0; i < 3;i++)
777 if (!li[i].doit) continue;
779 label_tags[2].ti_Data = TextLength(&ld->ld_DummyRP, li[i].text, strlen(li[i].text));
780 label_tags[0].ti_Data = x + w - label_tags[2].ti_Data;
781 label_tags[4].ti_Data = (IPTR)li[i].text;
782 label_tags[5].ti_Data = (IPTR)gad;
784 *(li[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, label_tags);
785 if (!gad) goto failure;
787 y += udata->ButHeight + GADGETSPACINGY;
788 label_tags[1].ti_Data = y;
791 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
792 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
793 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
795 x = ld->ld_WBorLeft + OUTERSPACINGX + w + LABELSPACINGX;
797 /* Make Style gadget */
799 if (iforeq->ifo_Flags & FOF_DOSTYLE)
801 STRPTR stylestrings[3];
803 struct TagItem style_tags[] =
805 {GA_Previous , (IPTR)gad },
806 {GA_Left , x },
807 {GA_RelBottom , y },
808 {GA_Width , 0 },
809 {GA_Height , udata->ButHeight },
810 {GA_RelVerify , TRUE },
811 {GA_UserData , (IPTR)ld },
812 {GA_ID , ID_STYLE },
813 {ASLFS_LabelArray , (IPTR)stylestrings },
814 {ASLFS_Style , iforeq->ifo_TextAttr.ta_Style },
815 {TAG_DONE }
818 stylestrings[0] = GetString(MSG_FONTREQ_STYLE_BOLD, GetIR(iforeq)->ir_Catalog, AslBase);
819 stylestrings[1] = GetString(MSG_FONTREQ_STYLE_ITALIC, GetIR(iforeq)->ir_Catalog, AslBase);
820 stylestrings[2] = GetString(MSG_FONTREQ_STYLE_UNDERLINED, GetIR(iforeq)->ir_Catalog, AslBase);
822 w = BiggestTextLength(stylestrings, 3, &(ld->ld_DummyRP), AslBase);
823 w *= 2;
824 w *= 3;
826 style_tags[3].ti_Data = w;
828 if (w > maxgadcolwidth) maxgadcolwidth = w;
830 udata->StyleGadget = gad = NewObjectA(AslBase->aslfontstyleclass, NULL, style_tags);
831 if (!gad) goto failure;
833 y += udata->ButHeight + GADGETSPACINGY;
837 w = udata->ButHeight * 12 / 10 + 19; /* CYCLEIMAGEWIDTH = 19 */
839 /* Make FrontPen gadget */
841 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
843 struct TagItem cp_tags[] =
845 {GA_Previous , (IPTR)gad },
846 {GA_Left , x },
847 {GA_RelBottom , y },
848 {GA_Width , w },
849 {GA_Height , udata->ButHeight },
850 {GA_RelVerify , TRUE },
851 {GA_UserData , (IPTR)ld },
852 {GA_ID , ID_FRONTPEN },
853 {ASLCP_Color , iforeq->ifo_FrontPen },
854 {ASLCP_ColorTable , (IPTR)iforeq->ifo_FrontPens },
855 {ASLCP_NumColors , iforeq->ifo_MaxFrontPen },
856 {TAG_DONE }
860 udata->FGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
861 if (!gad) goto failure;
863 x += w + GADGETSPACINGX;
866 /* Make BackPen gadget */
868 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
870 struct TagItem cp_tags[] =
872 {GA_Previous , (IPTR)gad },
873 {GA_Left , x },
874 {GA_RelBottom , y },
875 {GA_Width , w },
876 {GA_Height , udata->ButHeight },
877 {GA_RelVerify , TRUE },
878 {GA_UserData , (IPTR)ld },
879 {GA_ID , ID_BACKPEN },
880 {ASLCP_Color , iforeq->ifo_BackPen },
881 {ASLCP_ColorTable , (IPTR)iforeq->ifo_BackPens },
882 {ASLCP_NumColors , iforeq->ifo_MaxBackPen },
883 {TAG_DONE }
887 udata->BGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
888 if (!gad) goto failure;
892 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
894 if ((iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) == (FOF_DOFRONTPEN | FOF_DOBACKPEN))
896 w += GADGETSPACINGX + w;
899 if (w > maxgadcolwidth) maxgadcolwidth = w;
901 y += udata->ButHeight + GADGETSPACINGY;
905 /* Make DrawMode gadget */
907 x = ld->ld_WBorLeft + OUTERSPACINGX + labelwidth + LABELSPACINGX;
909 w = -ld->ld_WBorLeft - ld->ld_WBorRight - OUTERSPACINGX * 2 -
910 labelwidth - LABELSPACINGX;
913 if (iforeq->ifo_Flags & FOF_DODRAWMODE)
915 struct TagItem cycle_tags[] =
917 {GA_Previous , (IPTR)gad },
918 {GA_Left , x },
919 {GA_RelBottom , y },
920 {GA_RelWidth , w },
921 {GA_Height , udata->ButHeight },
922 {GA_RelVerify , TRUE },
923 {GA_UserData , (IPTR)ld },
924 {GA_ID , ID_DRAWMODE },
925 {ASLCY_Labels , 0 },
926 {ASLCY_Active , iforeq->ifo_DrawMode },
927 {ASLCY_Font , (IPTR)ld->ld_Font },
928 {TAG_DONE }
931 static LONG labelids[] =
933 MSG_FONTREQ_MODE_TEXT,
934 MSG_FONTREQ_MODE_TEXTANDFIELD,
935 MSG_FONTREQ_MODE_COMPLEMENT,
937 STRPTR *labels;
940 if (iforeq->ifo_ModeList)
942 labels = &iforeq->ifo_ModeList[1];
944 else
946 labels = (STRPTR *)&iforeq->ifo_DrawModeJAM1Text;
948 for(i = 0; i < 3; i++)
950 labels[i] = GetString(labelids[i], GetIR(iforeq)->ir_Catalog, AslBase);
954 cycle_tags[8].ti_Data = (IPTR)labels;
956 i = CYCLEEXTRAWIDTH + BiggestTextLength(labels,
957 0x7FFF,
958 &(ld->ld_DummyRP),
959 AslBase);
960 if (i > maxgadcolwidth) maxgadcolwidth = i;
962 udata->DrawModeGadget = gad = NewObjectA(AslBase->aslcycleclass, NULL, cycle_tags);
963 if (!gad) goto failure;
965 y += udata->ButHeight + GADGETSPACINGY;
967 } /* if (iforeq->ifo_Flags & FOF_DODRAWMODE) */
969 } /* if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN)) */
971 #if AVOID_FLICKER
973 struct TagItem eraser_tags[] =
975 {GA_Previous, (IPTR)gad},
976 {TAG_DONE}
979 udata->EraserGadget = gad = NewObjectA(AslBase->asleraserclass, NULL, eraser_tags);
980 /* Doesn't matter if this failed */
982 #endif
984 w = OUTERSPACINGX + labelwidth + LABELSPACINGX + maxgadcolwidth + OUTERSPACINGX;
985 if (w > ld->ld_MinWidth) ld->ld_MinWidth = w;
987 ld->ld_GList = (struct Gadget *)udata->NameListview;
989 /* Menus */
991 struct NewMenu nm[] =
993 {NM_TITLE, (STRPTR)MSG_FONTREQ_MEN_CONTROL },
994 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_LASTFONT , 0, 0, 0, (APTR)FOMEN_LASTFONT },
995 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_NEXTFONT , 0, 0, 0, (APTR)FOMEN_NEXTFONT },
996 {NM_ITEM, NM_BARLABEL },
997 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESTORE , 0, 0, 0, (APTR)FOMEN_RESTORE },
998 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESCAN , 0, 0, 0, (APTR)FOMEN_RESCAN },
999 {NM_ITEM, NM_BARLABEL },
1000 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_OK , 0, 0, 0, (APTR)FOMEN_OK },
1001 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_CANCEL , 0, 0, 0, (APTR)FOMEN_CANCEL },
1002 {NM_END }
1005 struct TagItem menu_tags[] =
1007 {GTMN_NewLookMenus , TRUE },
1008 {GTMN_TextAttr , (IPTR)GetIR(iforeq)->ir_TextAttr },
1009 {TAG_DONE }
1012 if (menu_tags[1].ti_Data == 0) menu_tags[1].ti_Tag = TAG_IGNORE;
1014 LocalizeMenus(nm, GetIR(iforeq)->ir_Catalog, AslBase);
1016 /* Don't fail, if menus cannot be created/layouted, because a requester
1017 without menus is still better than no requester at all */
1019 if ((ld->ld_Menu = CreateMenusA(nm, NULL)))
1021 if (!LayoutMenusA(ld->ld_Menu, ld->ld_VisualInfo, menu_tags))
1023 FreeMenus(ld->ld_Menu);ld->ld_Menu = NULL;
1028 FORestore(ld, iforeq->ifo_TextAttr.ta_Name, iforeq->ifo_TextAttr.ta_YSize, AslBase);
1030 SetIoErr(0);
1031 ReturnBool ("FOGadInit", TRUE);
1033 failure:
1034 SetIoErr(error);
1036 D(bug("failure\n"));
1038 FOGadCleanup(ld, ASLB(AslBase));
1040 ReturnBool ("FOGadInit", FALSE);
1044 /*****************************************************************************************/
1046 STATIC VOID FOWindowOpened(struct LayoutData *ld, struct AslBase_intern *AslBase)
1048 // struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
1051 /*****************************************************************************************/
1053 STATIC BOOL FOGadLayout(struct LayoutData *ld, struct AslBase_intern *AslBase)
1055 ReturnBool ("FOGadLayout", TRUE );
1058 /*****************************************************************************************/
1060 STATIC ULONG FOHandleEvents(struct LayoutData *ld, struct AslBase_intern *AslBase)
1062 struct IntuiMessage *imsg = ld->ld_Event;
1063 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1064 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
1065 WORD gadid;
1066 ULONG retval = GHRET_OK;
1068 EnterFunc(bug("FOHandleEvents: Class: %d\n", imsg->Class));
1070 switch (imsg->Class)
1072 case IDCMP_CLOSEWINDOW:
1073 retval = FALSE;
1074 break;
1076 case IDCMP_RAWKEY:
1077 switch (imsg->Code)
1079 case CURSORUP:
1080 FOChangeActiveFont(ld, -1, imsg->Qualifier, FALSE, AslBase);
1081 break;
1083 case RAWKEY_PAGEUP:
1084 FOChangeActiveFont(ld, -1, IEQUALIFIER_LSHIFT, FALSE, AslBase);
1085 break;
1087 case RAWKEY_HOME:
1088 FOChangeActiveFont(ld, -1, IEQUALIFIER_LALT, FALSE, AslBase);
1089 break;
1091 case RAWKEY_NM_WHEEL_UP:
1092 FOChangeActiveFont(ld, -3, imsg->Qualifier, FALSE, AslBase);
1093 break;
1095 case CURSORDOWN:
1096 FOChangeActiveFont(ld, 1, imsg->Qualifier, FALSE, AslBase);
1097 break;
1099 case RAWKEY_PAGEDOWN:
1100 FOChangeActiveFont(ld, 1, IEQUALIFIER_LSHIFT, FALSE, AslBase);
1101 break;
1103 case RAWKEY_END:
1104 FOChangeActiveFont(ld, 1, IEQUALIFIER_LALT, FALSE, AslBase);
1105 break;
1107 case RAWKEY_NM_WHEEL_DOWN:
1108 FOChangeActiveFont(ld, 3, imsg->Qualifier, FALSE, AslBase);
1109 break;
1111 break;
1113 case IDCMP_VANILLAKEY:
1114 switch(imsg->Code)
1116 case 27:
1117 retval = FALSE;
1118 break;
1120 break;
1122 case IDCMP_GADGETUP:
1123 gadid = ((struct Gadget *)imsg->IAddress)->GadgetID;
1125 D(bug("GADGETUP! gadgetid=%d code=%d\n", gadid, imsg->Code));
1127 switch (gadid)
1129 case ID_BUTCANCEL:
1130 retval = FALSE;
1131 break;
1133 case ID_BUTOK:
1134 retval = FOGetSelectedFont(ld, AslBase);
1135 break;
1137 case ID_NAMELISTVIEW:
1139 struct ASLLVFontReqNode *fontnode;
1140 IPTR active;
1141 IPTR size;
1143 GetAttr(ASLLV_Active, udata->NameListview, &active);
1144 GetAttr(STRINGA_LongVal, udata->SizeString, &size);
1146 if ((fontnode = (struct ASLLVFontReqNode *)FindListNode(&udata->NameListviewList, (WORD)active)))
1148 FOActivateFont(ld, active, (LONG)size, AslBase);
1150 if (imsg->Code) /* TRUE if double clicked */
1152 retval = FOGetSelectedFont(ld, AslBase);
1155 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1157 break;
1159 case ID_SIZELISTVIEW:
1160 if (udata->ActiveFont)
1162 struct Node *node;
1163 IPTR active;
1165 GetAttr(ASLLV_Active, udata->SizeListview, &active);
1167 if ((node = FindListNode(&udata->ActiveFont->SizeList, (WORD)active)))
1169 FOSetSizeString((IPTR)node->ln_Name, ld, AslBase);
1170 FOUpdatePreview(ld, AslBase);
1172 if (imsg->Code) /* TRUE if double clicked */
1174 retval = FOGetSelectedFont(ld, AslBase);
1177 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1179 break;
1181 case ID_NAMESTRING:
1182 if (imsg->Code == STRINGCODE_CURSORUP)
1184 FOChangeActiveFont(ld, -1, imsg->Qualifier, TRUE, AslBase);
1185 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1186 break;
1188 else if (imsg->Code == STRINGCODE_CURSORDOWN)
1190 FOChangeActiveFont(ld, 1, imsg->Qualifier, TRUE, AslBase);
1191 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1192 break;
1194 else if ((imsg->Code == 0) || (imsg->Code == 9))
1196 FOUpdatePreview(ld, AslBase);
1197 break;
1199 break;
1201 case ID_SIZESTRING:
1202 if (imsg->Code == STRINGCODE_CURSORUP)
1204 FOChangeActiveSize(ld, -1, imsg->Qualifier, AslBase);
1205 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1206 break;
1208 else if (imsg->Code == STRINGCODE_CURSORDOWN)
1210 FOChangeActiveSize(ld, 1, imsg->Qualifier, AslBase);
1211 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1212 break;
1214 else if ((imsg->Code == 0) || (imsg->Code == 9))
1216 IPTR val;
1217 LONG size;
1219 GetAttr(STRINGA_LongVal, udata->SizeString, (IPTR *)&val);
1220 size = (LONG)val;
1222 if ((size < iforeq->ifo_MinHeight) || (size > iforeq->ifo_MaxHeight))
1224 if (size < iforeq->ifo_MinHeight) size = iforeq->ifo_MinHeight;
1225 if (size > iforeq->ifo_MaxHeight) size = iforeq->ifo_MaxHeight;
1226 FOSetSizeString(size, ld, AslBase);
1229 FOActivateSize(ld, -size, AslBase);
1231 break;
1233 break;
1235 case ID_STYLE:
1236 case ID_FRONTPEN:
1237 case ID_BACKPEN:
1238 FOUpdatePreview(ld, AslBase);
1239 break;
1241 } /* switch (gadget ID) */
1243 break; /* case IDCMP_GADGETUP: */
1245 case IDCMP_MENUPICK:
1246 if (ld->ld_Menu)
1248 UWORD men = imsg->Code;
1250 while(men != MENUNULL)
1252 struct MenuItem *item;
1254 if ((item = ItemAddress(ld->ld_Menu, men)))
1256 switch((IPTR)GTMENUITEM_USERDATA(item))
1258 /* Control menu */
1260 case FOMEN_LASTFONT:
1261 FOChangeActiveFont(ld, -1, 0, FALSE, AslBase);
1262 break;
1264 case FOMEN_NEXTFONT:
1265 FOChangeActiveFont(ld, 1, 0, FALSE, AslBase);
1266 break;
1268 case FOMEN_RESTORE:
1269 FORestore(ld, iforeq->ifo_TextAttr.ta_Name, iforeq->ifo_TextAttr.ta_YSize, AslBase);
1270 break;
1272 case FOMEN_RESCAN:
1273 FOGetFonts(ld, AslBase);
1274 break;
1276 case FOMEN_OK:
1277 retval = FOGetSelectedFont(ld, AslBase);
1278 break;
1280 case FOMEN_CANCEL:
1281 retval = FALSE;
1282 break;
1284 } /* switch id */
1286 men = item->NextSelect;
1287 } /* if ((item = ItemAddress(ld->ld_Menu, men))) */
1288 else
1290 men = MENUNULL;
1293 } /* while(men != MENUNULL) */
1295 } /* if (ld->ld_Menu) */
1297 break; /* case IDCMP_MENUPICK: */
1299 } /* switch (imsg->Class) */
1301 ReturnInt ("FOHandleEvents", ULONG, retval);
1304 /*****************************************************************************************/
1306 STATIC VOID FOGadCleanup(struct LayoutData *ld, struct AslBase_intern *AslBase)
1308 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1309 struct FontRequester *req = (struct FontRequester *)ld->ld_Req;
1310 struct IntReq *intreq = ld->ld_IntReq;
1311 // struct IntFontReq *iforeq = (struct IntFontReq *)intreq;
1313 EnterFunc(bug("FOGadCleanup(ld=%p)\n", ld));
1315 if (ld->ld_Window && ld->ld_GList)
1317 RemoveGList(ld->ld_Window, ld->ld_GList, -1);
1320 killscrollergadget(&udata->NameScrollGad, AslBase);
1321 killscrollergadget(&udata->SizeScrollGad, AslBase);
1323 FreeObjects(&FOREQ_FIRST_OBJECT(udata), &FOREQ_LAST_OBJECT(udata), AslBase);
1325 FOFreeFonts(ld, AslBase);
1327 if (udata->PreviewFont) CloseFont(udata->PreviewFont);
1329 if (ld->ld_Window)
1331 req->fo_LeftEdge = intreq->ir_LeftEdge = ld->ld_Window->LeftEdge;
1332 req->fo_TopEdge = intreq->ir_TopEdge = ld->ld_Window->TopEdge;
1333 req->fo_Width = intreq->ir_Width = ld->ld_Window->Width;
1334 req->fo_Height = intreq->ir_Height = ld->ld_Window->Height;
1337 ReturnVoid("FOGadCleanup");
1340 /*****************************************************************************************/
1342 STATIC ULONG FOGetSelectedFont(struct LayoutData *ld, struct AslBase_intern *AslBase)
1344 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1345 struct IntReq *intreq = ld->ld_IntReq;
1346 struct IntFontReq *iforeq = (struct IntFontReq *)intreq;
1347 struct FontRequester *req = (struct FontRequester *)ld->ld_Req;
1348 STRPTR name;
1349 IPTR val;
1350 ULONG retval = GHRET_OK;
1352 GetAttr(STRINGA_TextVal, udata->NameString, (IPTR *)&name);
1353 if (!(req->fo_TAttr.tta_Name = VecPooledCloneString(name, ".font", intreq->ir_MemPool, AslBase))) goto bye;
1354 iforeq->ifo_TextAttr.ta_Name = req->fo_TAttr.tta_Name;
1356 GetAttr(STRINGA_LongVal, udata->SizeString, &val);
1357 req->fo_TAttr.tta_YSize = iforeq->ifo_TextAttr.ta_YSize = (UWORD)val;
1359 /* DrawMode */
1361 if (iforeq->ifo_Flags & FOF_DODRAWMODE)
1363 iforeq->ifo_DrawMode = FOGetDrawMode(ld, AslBase);
1365 req->fo_DrawMode = iforeq->ifo_DrawMode;
1367 /* Style */
1370 if (iforeq->ifo_Flags & FOF_DOSTYLE)
1372 iforeq->ifo_TextAttr.ta_Style = FOGetStyle(ld, AslBase);
1374 req->fo_TAttr.tta_Style = iforeq->ifo_TextAttr.ta_Style;
1376 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
1378 iforeq->ifo_FrontPen = FOGetFGColor(ld, AslBase);
1380 req->fo_FrontPen = iforeq->ifo_FrontPen;
1382 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
1384 iforeq->ifo_BackPen = FOGetBGColor(ld, AslBase);
1386 req->fo_BackPen = iforeq->ifo_BackPen;
1388 /* Hmm ... there is also a struct TextAttr fo_Attr in
1389 FontRequester structure. Just put the same values in!? */
1391 req->fo_Attr.ta_Name = req->fo_TAttr.tta_Name;
1392 req->fo_Attr.ta_YSize = req->fo_TAttr.tta_YSize;
1393 req->fo_Attr.ta_Style = req->fo_TAttr.tta_Style;
1394 req->fo_Attr.ta_Flags = req->fo_TAttr.tta_Flags;
1396 retval = GHRET_FINISHED_OK;
1398 bye:
1399 return retval;
1402 /*****************************************************************************************/