added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / libs / asl / fontreqhooks.c
blobc688e6da9d66e041afe8a5f17b7a7085c2d10c9d
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 const 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 break;
333 case LDCMD_LAYOUT:
334 retval = (ULONG)FOGadLayout(ld, ASLB(AslBase));
335 break;
337 case LDCMD_HANDLEEVENTS:
338 retval = (ULONG)FOHandleEvents(ld, ASLB(AslBase));
339 break;
341 case LDCMD_CLEANUP:
342 FOGadCleanup(ld, ASLB(AslBase));
343 retval = GHRET_OK;
344 break;
346 default:
347 retval = GHRET_FAIL;
348 break;
351 return (retval);
353 AROS_USERFUNC_EXIT
356 /*****************************************************************************************/
358 struct ButtonInfo
360 WORD gadid;
361 STRPTR text;
362 LONG deftextid;
363 #if USE_SHARED_COOLIMAGES
364 ULONG coolid;
365 Object **objvar;
366 const struct CoolImage *coolimage;
367 #else
368 const struct CoolImage *coolimage;
369 Object **objvar;
370 #endif
373 /*****************************************************************************************/
375 STATIC BOOL FOGadInit(struct LayoutData *ld, struct AslBase_intern *AslBase)
377 struct FOUserData *udata = ld->ld_UserData;
378 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
379 STRPTR str[6];
380 #if USE_SHARED_COOLIMAGES
381 struct ButtonInfo bi[NUMBUTS] =
383 { ID_BUTOK , GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, COOL_USEIMAGE_ID , &udata->OKBut },
384 { ID_BUTCANCEL , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, COOL_CANCELIMAGE_ID , &udata->CancelBut }
386 #else
387 struct ButtonInfo bi[NUMBUTS] =
389 { ID_BUTOK , GetIR(iforeq)->ir_PositiveText , MSG_FONTREQ_POSITIVE_GAD, &cool_useimage , &udata->OKBut },
390 { ID_BUTCANCEL , GetIR(iforeq)->ir_NegativeText , MSG_FONTREQ_NEGATIVE_GAD, &cool_cancelimage , &udata->CancelBut }
392 #endif
393 Object *gad;
394 LONG error;
395 WORD gadrows, x, y, w, h, i, y2;
396 WORD sizelvwidth, labelwidth = 0, maxgadcolwidth = 0;
398 NEWLIST(&udata->NameListviewList);
400 udata->SizeListviewRenderHook.h_Entry = (APTR)AROS_ASMSYMNAME(SizeListviewRenderFunc);
401 udata->SizeListviewRenderHook.h_SubEntry = NULL;
402 udata->SizeListviewRenderHook.h_Data = AslBase;
404 udata->StringEditHook.h_Entry = (APTR)AROS_ASMSYMNAME(StringEditFunc);
405 udata->StringEditHook.h_SubEntry = NULL;
406 udata->StringEditHook.h_Data = AslBase;
408 FOGetFonts(ld, AslBase);
410 error = ERROR_NO_FREE_STORE;
412 /* calc. min. size */
414 w = 0;
415 for(i = 0; i < NUMBUTS; i++)
417 if(!bi[i].text) bi[i].text = GetString(bi[i].deftextid, GetIR(iforeq)->ir_Catalog, AslBase);
419 x = TextLength(&ld->ld_DummyRP, bi[i].text, strlen(bi[i].text));
421 #if FOREQ_COOL_BUTTONS
422 #if USE_SHARED_COOLIMAGES
423 if (CoolImagesBase)
425 bi[i].coolimage = (const struct CoolImage *)COOL_ObtainImageA(bi[i].coolid, NULL);
428 if (CoolImagesBase)
429 #endif
430 if (ld->ld_TrueColor)
432 x += IMAGEBUTTONEXTRAWIDTH + bi[i].coolimage->width;
434 #endif
436 if (x > w) w = x;
439 udata->ButWidth = w + BUTTONEXTRAWIDTH;
441 ld->ld_ButWidth = udata->ButWidth;
442 ld->ld_NumButtons = 4;
444 #if FOREQ_COOL_BUTTONS
446 #if USE_SHARED_COOLIMAGES
447 if (CoolImagesBase)
449 #endif
450 y = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
451 if (ld->ld_TrueColor)
453 y2 = IMAGEBUTTONEXTRAHEIGHT + DEF_COOLIMAGEHEIGHT;
454 } else {
455 y2 = 0;
457 udata->ButHeight = (y > y2) ? y : y2;
458 #if USE_SHARED_COOLIMAGES
460 else
462 udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
464 #endif
466 #else
467 udata->ButHeight = BUTTONEXTRAHEIGHT + ld->ld_Font->tf_YSize;
468 #endif
470 gadrows = 2; /* button row + string gadgets under listviews */
471 if (iforeq->ifo_Flags & FOF_DODRAWMODE) gadrows++;
472 if (iforeq->ifo_Flags & FOF_DOSTYLE) gadrows++;
473 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) gadrows++;
475 ld->ld_MinWidth = OUTERSPACINGX * 2 +
476 GADGETSPACINGX * 1 +
477 udata->ButWidth * NUMBUTS;
479 ld->ld_MinHeight = OUTERSPACINGY * 2 +
480 (GADGETSPACINGY + udata->ButHeight) * gadrows +
481 BORDERLVSPACINGY * 2 +
482 (ld->ld_Font->tf_YSize + BORDERLVITEMSPACINGY * 2) * FOREQ_MIN_VISIBLELINES +
483 FONTPREVIEWHEIGHT + GADGETSPACINGY -
484 GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */
486 /* make listview gadgets */
488 sizelvwidth = PROPSIZE +
489 FOREQ_VISIBILE_SIZE_CHARS * ld->ld_Font->tf_XSize +
490 BORDERLVSPACINGX * 2 +
491 BORDERLVITEMSPACINGX * 2;
493 x = ld->ld_WBorLeft + OUTERSPACINGX;
494 y = ld->ld_WBorTop + OUTERSPACINGY;
495 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - PROPSIZE - GADGETSPACINGX - sizelvwidth;
496 h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
497 udata->ButHeight * gadrows -
498 GADGETSPACINGY * gadrows -
499 (FONTPREVIEWHEIGHT + GADGETSPACINGY) +
500 GADGETSPACINGY; /* because the string gadgets are attached to listview gadgets */
503 struct TagItem lv_tags[] =
505 {GA_Left , x },
506 {GA_Top , y },
507 {GA_RelWidth , w },
508 {GA_RelHeight , h },
509 {GA_UserData , (IPTR)ld },
510 {GA_ID , ID_NAMELISTVIEW },
511 {GA_RelVerify , TRUE },
512 {ASLLV_Labels , (IPTR)&udata->NameListviewList },
513 {TAG_IGNORE , 0 },
514 {TAG_IGNORE , (IPTR)&udata->SizeListviewRenderHook },
515 {ASLLV_Font , (IPTR)ld->ld_Font },
516 {TAG_DONE }
519 udata->NameListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
520 if (!gad) goto failure;
522 lv_tags[0].ti_Tag = GA_RelRight;
523 lv_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
524 lv_tags[2].ti_Tag = GA_Width;
525 lv_tags[2].ti_Data = sizelvwidth - PROPSIZE;
526 lv_tags[5].ti_Data = ID_SIZELISTVIEW;
527 lv_tags[7].ti_Data = 0;
528 lv_tags[8].ti_Tag = GA_Previous;
529 lv_tags[8].ti_Data = (IPTR)gad;
530 lv_tags[9].ti_Tag = ASLLV_CallBack;
532 udata->SizeListview = gad = NewObjectA(AslBase->asllistviewclass, NULL, lv_tags);
533 if (!gad) goto failure;
537 /* make scroller gadgets for listviews */
539 x = -ld->ld_WBorRight - OUTERSPACINGX - PROPSIZE - sizelvwidth - GADGETSPACINGX + 1;
540 y = ld->ld_WBorTop + OUTERSPACINGY;
541 w = PROPSIZE;
542 h = -ld->ld_WBorBottom - ld->ld_WBorTop - OUTERSPACINGY * 2 -
543 udata->ButHeight * gadrows -
544 GADGETSPACINGY * gadrows -
545 (FONTPREVIEWHEIGHT + GADGETSPACINGY) +
546 GADGETSPACINGY;
548 struct TagItem scroller_tags[] =
550 {GA_RelRight , x },
551 {GA_Top , y },
552 {GA_Width , w },
553 {GA_RelHeight , h },
554 {GA_ID , ID_NAMELISTVIEW },
555 {PGA_NewLook , TRUE },
556 {PGA_Borderless , TRUE },
557 {PGA_Freedom , FREEVERT },
558 {PGA_Top , 0 },
559 {PGA_Total , 20 },
560 {PGA_Visible , 1 },
561 {GA_Previous , (IPTR)gad },
562 {TAG_DONE }
565 if (!makescrollergadget(&udata->NameScrollGad, ld, scroller_tags, AslBase)) goto failure;
566 gad = udata->NameScrollGad.arrow2;
568 scroller_tags[0].ti_Data = x + sizelvwidth + GADGETSPACINGX;
569 scroller_tags[1].ti_Data = y;
570 scroller_tags[2].ti_Data = w;
571 scroller_tags[3].ti_Data = h;
572 scroller_tags[4].ti_Data = ID_SIZELISTVIEW;
573 scroller_tags[11].ti_Data = (IPTR)gad;
575 if (!makescrollergadget(&udata->SizeScrollGad, ld, scroller_tags, AslBase)) goto failure;
576 gad = udata->SizeScrollGad.arrow2;
580 connectscrollerandlistview(&udata->NameScrollGad, udata->NameListview, AslBase);
581 connectscrollerandlistview(&udata->SizeScrollGad, udata->SizeListview, AslBase);
583 /* make preview gadget */
585 x = ld->ld_WBorLeft + OUTERSPACINGX;
586 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
587 GADGETSPACINGY - FONTPREVIEWHEIGHT;
588 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2;
591 struct TagItem preview_tags[] =
593 {GA_Left , x },
594 {GA_RelBottom , y },
595 {GA_RelWidth , w },
596 {GA_Height , FONTPREVIEWHEIGHT },
597 {GA_Previous , (IPTR)gad },
598 {GA_ID , ID_PREVIEW },
599 {ASLFP_SampleText , (IPTR)iforeq->ifo_SampleText },
600 {ASLFP_APen , iforeq->ifo_FrontPen },
601 {ASLFP_BPen , iforeq->ifo_BackPen },
602 {TAG_DONE }
605 udata->Preview = gad = NewObjectA(AslBase->aslfontpreviewclass, NULL, preview_tags);
606 if (!gad) goto failure;
609 /* make string gadgets */
611 x = ld->ld_WBorLeft + OUTERSPACINGX;
612 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
613 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 1) -
614 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
616 w = -ld->ld_WBorRight - ld->ld_WBorLeft - OUTERSPACINGX * 2 - GADGETSPACINGX - sizelvwidth;
619 struct TagItem string_tags[] =
621 {GA_Left , x },
622 {GA_RelBottom , y },
623 {GA_RelWidth , w },
624 {GA_Height , udata->ButHeight },
625 {GA_Previous , (IPTR)gad },
626 {STRINGA_TextVal , (IPTR)"" },
627 {STRINGA_MaxChars , MAXFONTNAME },
628 {STRINGA_EditHook , (IPTR)&udata->StringEditHook },
629 {GA_ID , ID_NAMESTRING },
630 {GA_RelVerify , TRUE },
631 {GA_UserData , (IPTR)ld },
632 {GA_TabCycle , TRUE },
633 {STRINGA_Font , (IPTR)ld->ld_Font },
634 {TAG_DONE }
637 udata->NameString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
638 if (!gad) goto failure;
640 string_tags[0].ti_Tag = GA_RelRight;
641 string_tags[0].ti_Data = -ld->ld_WBorRight - OUTERSPACINGX - sizelvwidth + 1;
642 string_tags[2].ti_Tag = GA_Width;
643 string_tags[2].ti_Data = sizelvwidth;
644 string_tags[4].ti_Data = (IPTR)gad;
645 string_tags[5].ti_Tag = STRINGA_LongVal;
646 string_tags[5].ti_Data = iforeq->ifo_TextAttr.ta_YSize;
647 string_tags[6].ti_Data = 6;
648 string_tags[8].ti_Data = ID_SIZESTRING;
650 udata->SizeString = gad = NewObjectA(AslBase->aslstringclass, NULL, string_tags);
651 if (!gad) goto failure;
655 /* make button row */
657 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight + 1;
660 struct TagItem button_tags[] =
662 {GA_Text , 0 },
663 {GA_Previous , 0 },
664 {GA_ID , 0 },
665 #if FOREQ_COOL_BUTTONS
666 {ASLBT_CoolImage , 0 },
667 #else
668 {TAG_IGNORE , 0 },
669 #endif
670 {GA_UserData , (IPTR)ld },
671 {GA_Left , 0 },
672 {GA_RelBottom , y },
673 {GA_Width , udata->ButWidth },
674 {GA_Height , udata->ButHeight },
675 {GA_RelVerify , TRUE },
676 {GA_Image , 0 }, /* means we want a frame */
677 {TAG_DONE }
680 for(i = 0; i < NUMBUTS; i++)
682 button_tags[0].ti_Data = (IPTR)bi[i].text;
683 button_tags[1].ti_Data = (IPTR)gad;
684 button_tags[2].ti_Data = bi[i].gadid;
685 #if USE_SHARED_COOLIMAGES
686 if (CoolImagesBase == NULL) button_tags[3].ti_Tag = TAG_IGNORE;
687 #endif
688 button_tags[3].ti_Data = (IPTR)bi[i].coolimage;
690 *(bi[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, button_tags);
691 if (!gad) goto failure;
696 /* make labels */
698 i = 0;
700 x = ld->ld_WBorLeft + OUTERSPACINGX;
701 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
702 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
703 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
705 if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN))
707 #define FSET(x) ((iforeq->ifo_Flags & x) ? TRUE : FALSE)
709 struct LabelInfo
711 BOOL doit;
712 char *text;
713 Object **objvar;
714 } li [] =
716 {FSET(FOF_DOSTYLE) , (STRPTR)MSG_FONTREQ_STYLE_LABEL , &udata->StyleLabel },
717 {FALSE , (STRPTR)MSG_FONTREQ_COLOR_LABEL_FG, &udata->ColorLabel },
718 {FSET(FOF_DODRAWMODE) , (STRPTR)MSG_FONTREQ_MODE_LABEL , &udata->DrawModeLabel }
721 #undef FSET
723 struct TagItem label_tags[] =
725 {GA_Left , 0 },
726 {GA_RelBottom , y },
727 {GA_Width , 0 },
728 {GA_Height , udata->ButHeight },
729 {GA_Text , 0 },
730 {GA_Previous , (IPTR)gad },
731 {GA_UserData , (IPTR)ld },
732 {GA_Disabled , TRUE },
733 {TAG_DONE }
735 WORD i2;
737 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
739 li[1].doit = TRUE;
741 switch(iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
743 case FOF_DOFRONTPEN:
744 break;
746 case FOF_DOBACKPEN:
747 li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_BG;
748 break;
750 case FOF_DOFRONTPEN | FOF_DOBACKPEN:
751 li[1].text = (STRPTR)MSG_FONTREQ_COLOR_LABEL_FGBG;
752 break;
755 } /* if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) */
756 for(i = 0, i2 = 0; i < 3; i++)
758 if (li[i].doit)
760 if ((i == 2) && (iforeq->ifo_ModeList))
762 li[i].text = iforeq->ifo_ModeList[0];
764 else
766 li[i].text = GetString((LONG)li[i].text, GetIR(iforeq)->ir_Catalog, AslBase);
768 str[i2++] = li[i].text;
772 w = labelwidth = BiggestTextLength(str, i2, &(ld->ld_DummyRP), AslBase);
774 for(i = 0; i < 3;i++)
776 if (!li[i].doit) continue;
778 label_tags[2].ti_Data = TextLength(&ld->ld_DummyRP, li[i].text, strlen(li[i].text));
779 label_tags[0].ti_Data = x + w - label_tags[2].ti_Data;
780 label_tags[4].ti_Data = (IPTR)li[i].text;
781 label_tags[5].ti_Data = (IPTR)gad;
783 *(li[i].objvar) = gad = NewObjectA(AslBase->aslbuttonclass, NULL, label_tags);
784 if (!gad) goto failure;
786 y += udata->ButHeight + GADGETSPACINGY;
787 label_tags[1].ti_Data = y;
790 y = -ld->ld_WBorBottom - OUTERSPACINGY - udata->ButHeight -
791 (udata->ButHeight + GADGETSPACINGY) * (gadrows - 2) -
792 (FONTPREVIEWHEIGHT + GADGETSPACINGY) + 1;
794 x = ld->ld_WBorLeft + OUTERSPACINGX + w + LABELSPACINGX;
796 /* Make Style gadget */
798 if (iforeq->ifo_Flags & FOF_DOSTYLE)
800 STRPTR stylestrings[3];
802 struct TagItem style_tags[] =
804 {GA_Previous , (IPTR)gad },
805 {GA_Left , x },
806 {GA_RelBottom , y },
807 {GA_Width , 0 },
808 {GA_Height , udata->ButHeight },
809 {GA_RelVerify , TRUE },
810 {GA_UserData , (IPTR)ld },
811 {GA_ID , ID_STYLE },
812 {ASLFS_LabelArray , (IPTR)stylestrings },
813 {ASLFS_Style , iforeq->ifo_TextAttr.ta_Style },
814 {TAG_DONE }
817 stylestrings[0] = GetString(MSG_FONTREQ_STYLE_BOLD, GetIR(iforeq)->ir_Catalog, AslBase);
818 stylestrings[1] = GetString(MSG_FONTREQ_STYLE_ITALIC, GetIR(iforeq)->ir_Catalog, AslBase);
819 stylestrings[2] = GetString(MSG_FONTREQ_STYLE_UNDERLINED, GetIR(iforeq)->ir_Catalog, AslBase);
821 w = BiggestTextLength(stylestrings, 3, &(ld->ld_DummyRP), AslBase);
822 w *= 2;
823 w *= 3;
825 style_tags[3].ti_Data = w;
827 if (w > maxgadcolwidth) maxgadcolwidth = w;
829 udata->StyleGadget = gad = NewObjectA(AslBase->aslfontstyleclass, NULL, style_tags);
830 if (!gad) goto failure;
832 y += udata->ButHeight + GADGETSPACINGY;
836 w = udata->ButHeight * 12 / 10 + 19; /* CYCLEIMAGEWIDTH = 19 */
838 /* Make FrontPen gadget */
840 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
842 struct TagItem cp_tags[] =
844 {GA_Previous , (IPTR)gad },
845 {GA_Left , x },
846 {GA_RelBottom , y },
847 {GA_Width , w },
848 {GA_Height , udata->ButHeight },
849 {GA_RelVerify , TRUE },
850 {GA_UserData , (IPTR)ld },
851 {GA_ID , ID_FRONTPEN },
852 {ASLCP_Color , iforeq->ifo_FrontPen },
853 {ASLCP_ColorTable , (IPTR)iforeq->ifo_FrontPens },
854 {ASLCP_NumColors , iforeq->ifo_MaxFrontPen },
855 {TAG_DONE }
859 udata->FGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
860 if (!gad) goto failure;
862 x += w + GADGETSPACINGX;
865 /* Make BackPen gadget */
867 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
869 struct TagItem cp_tags[] =
871 {GA_Previous , (IPTR)gad },
872 {GA_Left , x },
873 {GA_RelBottom , y },
874 {GA_Width , w },
875 {GA_Height , udata->ButHeight },
876 {GA_RelVerify , TRUE },
877 {GA_UserData , (IPTR)ld },
878 {GA_ID , ID_BACKPEN },
879 {ASLCP_Color , iforeq->ifo_BackPen },
880 {ASLCP_ColorTable , (IPTR)iforeq->ifo_BackPens },
881 {ASLCP_NumColors , iforeq->ifo_MaxBackPen },
882 {TAG_DONE }
886 udata->BGColorGadget = gad = NewObjectA(AslBase->aslcolorpickerclass, NULL, cp_tags);
887 if (!gad) goto failure;
891 if (iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN))
893 if ((iforeq->ifo_Flags & (FOF_DOFRONTPEN | FOF_DOBACKPEN)) == (FOF_DOFRONTPEN | FOF_DOBACKPEN))
895 w += GADGETSPACINGX + w;
898 if (w > maxgadcolwidth) maxgadcolwidth = w;
900 y += udata->ButHeight + GADGETSPACINGY;
904 /* Make DrawMode gadget */
906 x = ld->ld_WBorLeft + OUTERSPACINGX + labelwidth + LABELSPACINGX;
908 w = -ld->ld_WBorLeft - ld->ld_WBorRight - OUTERSPACINGX * 2 -
909 labelwidth - LABELSPACINGX;
912 if (iforeq->ifo_Flags & FOF_DODRAWMODE)
914 struct TagItem cycle_tags[] =
916 {GA_Previous , (IPTR)gad },
917 {GA_Left , x },
918 {GA_RelBottom , y },
919 {GA_RelWidth , w },
920 {GA_Height , udata->ButHeight },
921 {GA_RelVerify , TRUE },
922 {GA_UserData , (IPTR)ld },
923 {GA_ID , ID_DRAWMODE },
924 {ASLCY_Labels , 0 },
925 {ASLCY_Active , iforeq->ifo_DrawMode },
926 {ASLCY_Font , (IPTR)ld->ld_Font },
927 {TAG_DONE }
930 static LONG labelids[] =
932 MSG_FONTREQ_MODE_TEXT,
933 MSG_FONTREQ_MODE_TEXTANDFIELD,
934 MSG_FONTREQ_MODE_COMPLEMENT,
936 STRPTR *labels;
939 if (iforeq->ifo_ModeList)
941 labels = &iforeq->ifo_ModeList[1];
943 else
945 labels = (STRPTR *)&iforeq->ifo_DrawModeJAM1Text;
947 for(i = 0; i < 3; i++)
949 labels[i] = GetString(labelids[i], GetIR(iforeq)->ir_Catalog, AslBase);
953 cycle_tags[8].ti_Data = (IPTR)labels;
955 i = CYCLEEXTRAWIDTH + BiggestTextLength(labels,
956 0x7FFF,
957 &(ld->ld_DummyRP),
958 AslBase);
959 if (i > maxgadcolwidth) maxgadcolwidth = i;
961 udata->DrawModeGadget = gad = NewObjectA(AslBase->aslcycleclass, NULL, cycle_tags);
962 if (!gad) goto failure;
964 y += udata->ButHeight + GADGETSPACINGY;
966 } /* if (iforeq->ifo_Flags & FOF_DODRAWMODE) */
968 } /* if (iforeq->ifo_Flags & (FOF_DODRAWMODE | FOF_DOSTYLE | FOF_DOFRONTPEN | FOF_DOBACKPEN)) */
970 #if AVOID_FLICKER
972 struct TagItem eraser_tags[] =
974 {GA_Previous, (IPTR)gad},
975 {TAG_DONE}
978 udata->EraserGadget = gad = NewObjectA(AslBase->asleraserclass, NULL, eraser_tags);
979 /* Doesn't matter if this failed */
981 #endif
983 w = OUTERSPACINGX + labelwidth + LABELSPACINGX + maxgadcolwidth + OUTERSPACINGX;
984 if (w > ld->ld_MinWidth) ld->ld_MinWidth = w;
986 ld->ld_GList = (struct Gadget *)udata->NameListview;
988 /* Menus */
990 struct NewMenu nm[] =
992 {NM_TITLE, (STRPTR)MSG_FONTREQ_MEN_CONTROL },
993 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_LASTFONT , 0, 0, 0, (APTR)FOMEN_LASTFONT },
994 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_NEXTFONT , 0, 0, 0, (APTR)FOMEN_NEXTFONT },
995 {NM_ITEM, NM_BARLABEL },
996 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESTORE , 0, 0, 0, (APTR)FOMEN_RESTORE },
997 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_RESCAN , 0, 0, 0, (APTR)FOMEN_RESCAN },
998 {NM_ITEM, NM_BARLABEL },
999 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_OK , 0, 0, 0, (APTR)FOMEN_OK },
1000 {NM_ITEM, (STRPTR)MSG_FONTREQ_MEN_CONTROL_CANCEL , 0, 0, 0, (APTR)FOMEN_CANCEL },
1001 {NM_END }
1004 struct TagItem menu_tags[] =
1006 {GTMN_NewLookMenus , TRUE },
1007 {GTMN_TextAttr , (IPTR)GetIR(iforeq)->ir_TextAttr },
1008 {TAG_DONE }
1011 if (menu_tags[1].ti_Data == 0) menu_tags[1].ti_Tag = TAG_IGNORE;
1013 LocalizeMenus(nm, GetIR(iforeq)->ir_Catalog, AslBase);
1015 /* Don't fail, if menus cannot be created/layouted, because a requester
1016 without menus is still better than no requester at all */
1018 if ((ld->ld_Menu = CreateMenusA(nm, NULL)))
1020 if (!LayoutMenusA(ld->ld_Menu, ld->ld_VisualInfo, menu_tags))
1022 FreeMenus(ld->ld_Menu);ld->ld_Menu = NULL;
1027 FORestore(ld, iforeq->ifo_TextAttr.ta_Name, iforeq->ifo_TextAttr.ta_YSize, AslBase);
1029 SetIoErr(0);
1030 ReturnBool ("FOGadInit", TRUE);
1032 failure:
1033 SetIoErr(error);
1035 D(bug("failure\n"));
1037 FOGadCleanup(ld, ASLB(AslBase));
1039 ReturnBool ("FOGadInit", FALSE);
1043 /*****************************************************************************************/
1045 STATIC VOID FOWindowOpened(struct LayoutData *ld, struct AslBase_intern *AslBase)
1047 // struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
1050 /*****************************************************************************************/
1052 STATIC BOOL FOGadLayout(struct LayoutData *ld, struct AslBase_intern *AslBase)
1054 ReturnBool ("FOGadLayout", TRUE );
1057 /*****************************************************************************************/
1059 STATIC ULONG FOHandleEvents(struct LayoutData *ld, struct AslBase_intern *AslBase)
1061 struct IntuiMessage *imsg = ld->ld_Event;
1062 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1063 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
1064 WORD gadid;
1065 ULONG retval = GHRET_OK;
1067 EnterFunc(bug("FOHandleEvents: Class: %d\n", imsg->Class));
1069 switch (imsg->Class)
1071 case IDCMP_CLOSEWINDOW:
1072 retval = FALSE;
1073 break;
1075 case IDCMP_RAWKEY:
1076 switch (imsg->Code)
1078 case CURSORUP:
1079 FOChangeActiveFont(ld, -1, imsg->Qualifier, FALSE, AslBase);
1080 break;
1082 case RAWKEY_PAGEUP:
1083 FOChangeActiveFont(ld, -1, IEQUALIFIER_LSHIFT, FALSE, AslBase);
1084 break;
1086 case RAWKEY_HOME:
1087 FOChangeActiveFont(ld, -1, IEQUALIFIER_LALT, FALSE, AslBase);
1088 break;
1090 case RAWKEY_NM_WHEEL_UP:
1091 FOChangeActiveFont(ld, -3, imsg->Qualifier, FALSE, AslBase);
1092 break;
1094 case CURSORDOWN:
1095 FOChangeActiveFont(ld, 1, imsg->Qualifier, FALSE, AslBase);
1096 break;
1098 case RAWKEY_PAGEDOWN:
1099 FOChangeActiveFont(ld, 1, IEQUALIFIER_LSHIFT, FALSE, AslBase);
1100 break;
1102 case RAWKEY_END:
1103 FOChangeActiveFont(ld, 1, IEQUALIFIER_LALT, FALSE, AslBase);
1104 break;
1106 case RAWKEY_NM_WHEEL_DOWN:
1107 FOChangeActiveFont(ld, 3, imsg->Qualifier, FALSE, AslBase);
1108 break;
1110 break;
1112 case IDCMP_VANILLAKEY:
1113 switch(imsg->Code)
1115 case 27:
1116 retval = FALSE;
1117 break;
1119 break;
1121 case IDCMP_GADGETUP:
1122 gadid = ((struct Gadget *)imsg->IAddress)->GadgetID;
1124 D(bug("GADGETUP! gadgetid=%d code=%d\n", gadid, imsg->Code));
1126 switch (gadid)
1128 case ID_BUTCANCEL:
1129 retval = FALSE;
1130 break;
1132 case ID_BUTOK:
1133 retval = FOGetSelectedFont(ld, AslBase);
1134 break;
1136 case ID_NAMELISTVIEW:
1138 struct ASLLVFontReqNode *fontnode;
1139 IPTR active;
1140 IPTR size;
1142 GetAttr(ASLLV_Active, udata->NameListview, &active);
1143 GetAttr(STRINGA_LongVal, udata->SizeString, &size);
1145 if ((fontnode = (struct ASLLVFontReqNode *)FindListNode(&udata->NameListviewList, (WORD)active)))
1147 FOActivateFont(ld, active, (LONG)size, AslBase);
1149 if (imsg->Code) /* TRUE if double clicked */
1151 retval = FOGetSelectedFont(ld, AslBase);
1154 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1156 break;
1158 case ID_SIZELISTVIEW:
1159 if (udata->ActiveFont)
1161 struct Node *node;
1162 IPTR active;
1164 GetAttr(ASLLV_Active, udata->SizeListview, &active);
1166 if ((node = FindListNode(&udata->ActiveFont->SizeList, (WORD)active)))
1168 FOSetSizeString((LONG)node->ln_Name, ld, AslBase);
1169 FOUpdatePreview(ld, AslBase);
1171 if (imsg->Code) /* TRUE if double clicked */
1173 retval = FOGetSelectedFont(ld, AslBase);
1176 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1178 break;
1180 case ID_NAMESTRING:
1181 if (imsg->Code == STRINGCODE_CURSORUP)
1183 FOChangeActiveFont(ld, -1, imsg->Qualifier, TRUE, AslBase);
1184 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1185 break;
1187 else if (imsg->Code == STRINGCODE_CURSORDOWN)
1189 FOChangeActiveFont(ld, 1, imsg->Qualifier, TRUE, AslBase);
1190 ActivateGadget((struct Gadget *)udata->NameString, ld->ld_Window, NULL);
1191 break;
1193 else if ((imsg->Code == 0) || (imsg->Code == 9))
1195 FOUpdatePreview(ld, AslBase);
1196 break;
1198 break;
1200 case ID_SIZESTRING:
1201 if (imsg->Code == STRINGCODE_CURSORUP)
1203 FOChangeActiveSize(ld, -1, imsg->Qualifier, AslBase);
1204 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1205 break;
1207 else if (imsg->Code == STRINGCODE_CURSORDOWN)
1209 FOChangeActiveSize(ld, 1, imsg->Qualifier, AslBase);
1210 ActivateGadget((struct Gadget *)udata->SizeString, ld->ld_Window, NULL);
1211 break;
1213 else if ((imsg->Code == 0) || (imsg->Code == 9))
1215 IPTR val;
1216 LONG size;
1218 GetAttr(STRINGA_LongVal, udata->SizeString, (IPTR *)&val);
1219 size = (LONG)val;
1221 if ((size < iforeq->ifo_MinHeight) || (size > iforeq->ifo_MaxHeight))
1223 if (size < iforeq->ifo_MinHeight) size = iforeq->ifo_MinHeight;
1224 if (size > iforeq->ifo_MaxHeight) size = iforeq->ifo_MaxHeight;
1225 FOSetSizeString(size, ld, AslBase);
1228 FOActivateSize(ld, -size, AslBase);
1230 break;
1232 break;
1234 case ID_STYLE:
1235 case ID_FRONTPEN:
1236 case ID_BACKPEN:
1237 FOUpdatePreview(ld, AslBase);
1238 break;
1240 } /* switch (gadget ID) */
1242 break; /* case IDCMP_GADGETUP: */
1244 case IDCMP_MENUPICK:
1245 if (ld->ld_Menu)
1247 UWORD men = imsg->Code;
1249 while(men != MENUNULL)
1251 struct MenuItem *item;
1253 if ((item = ItemAddress(ld->ld_Menu, men)))
1255 switch((IPTR)GTMENUITEM_USERDATA(item))
1257 /* Control menu */
1259 case FOMEN_LASTFONT:
1260 FOChangeActiveFont(ld, -1, 0, FALSE, AslBase);
1261 break;
1263 case FOMEN_NEXTFONT:
1264 FOChangeActiveFont(ld, 1, 0, FALSE, AslBase);
1265 break;
1267 case FOMEN_RESTORE:
1268 FORestore(ld, iforeq->ifo_TextAttr.ta_Name, iforeq->ifo_TextAttr.ta_YSize, AslBase);
1269 break;
1271 case FOMEN_RESCAN:
1272 FOGetFonts(ld, AslBase);
1273 break;
1275 case FOMEN_OK:
1276 retval = FOGetSelectedFont(ld, AslBase);
1277 break;
1279 case FOMEN_CANCEL:
1280 retval = FALSE;
1281 break;
1283 } /* switch id */
1285 men = item->NextSelect;
1286 } /* if ((item = ItemAddress(ld->ld_Menu, men))) */
1287 else
1289 men = MENUNULL;
1292 } /* while(men != MENUNULL) */
1294 } /* if (ld->ld_Menu) */
1296 break; /* case IDCMP_MENUPICK: */
1298 } /* switch (imsg->Class) */
1300 ReturnInt ("FOHandleEvents", ULONG, retval);
1303 /*****************************************************************************************/
1305 STATIC VOID FOGadCleanup(struct LayoutData *ld, struct AslBase_intern *AslBase)
1307 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1308 struct FontRequester *req = (struct FontRequester *)ld->ld_Req;
1309 struct IntReq *intreq = ld->ld_IntReq;
1310 // struct IntFontReq *iforeq = (struct IntFontReq *)intreq;
1312 EnterFunc(bug("FOGadCleanup(ld=%p)\n", ld));
1314 if (ld->ld_Window && ld->ld_GList)
1316 RemoveGList(ld->ld_Window, ld->ld_GList, -1);
1319 killscrollergadget(&udata->NameScrollGad, AslBase);
1320 killscrollergadget(&udata->SizeScrollGad, AslBase);
1322 FreeObjects(&FOREQ_FIRST_OBJECT(udata), &FOREQ_LAST_OBJECT(udata), AslBase);
1324 FOFreeFonts(ld, AslBase);
1326 if (udata->PreviewFont) CloseFont(udata->PreviewFont);
1328 if (ld->ld_Window)
1330 req->fo_LeftEdge = intreq->ir_LeftEdge = ld->ld_Window->LeftEdge;
1331 req->fo_TopEdge = intreq->ir_TopEdge = ld->ld_Window->TopEdge;
1332 req->fo_Width = intreq->ir_Width = ld->ld_Window->Width;
1333 req->fo_Height = intreq->ir_Height = ld->ld_Window->Height;
1336 ReturnVoid("FOGadCleanup");
1339 /*****************************************************************************************/
1341 STATIC ULONG FOGetSelectedFont(struct LayoutData *ld, struct AslBase_intern *AslBase)
1343 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
1344 struct IntReq *intreq = ld->ld_IntReq;
1345 struct IntFontReq *iforeq = (struct IntFontReq *)intreq;
1346 struct FontRequester *req = (struct FontRequester *)ld->ld_Req;
1347 STRPTR name;
1348 IPTR val;
1349 ULONG retval = GHRET_OK;
1351 GetAttr(STRINGA_TextVal, udata->NameString, (IPTR *)&name);
1352 if (!(req->fo_TAttr.tta_Name = VecPooledCloneString(name, ".font", intreq->ir_MemPool, AslBase))) goto bye;
1353 iforeq->ifo_TextAttr.ta_Name = req->fo_TAttr.tta_Name;
1355 GetAttr(STRINGA_LongVal, udata->SizeString, &val);
1356 req->fo_TAttr.tta_YSize = iforeq->ifo_TextAttr.ta_YSize = (UWORD)val;
1358 /* DrawMode */
1360 if (iforeq->ifo_Flags & FOF_DODRAWMODE)
1362 iforeq->ifo_DrawMode = FOGetDrawMode(ld, AslBase);
1364 req->fo_DrawMode = iforeq->ifo_DrawMode;
1366 /* Style */
1369 if (iforeq->ifo_Flags & FOF_DOSTYLE)
1371 iforeq->ifo_TextAttr.ta_Style = FOGetStyle(ld, AslBase);
1373 req->fo_TAttr.tta_Style = iforeq->ifo_TextAttr.ta_Style;
1375 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
1377 iforeq->ifo_FrontPen = FOGetFGColor(ld, AslBase);
1379 req->fo_FrontPen = iforeq->ifo_FrontPen;
1381 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
1383 iforeq->ifo_BackPen = FOGetBGColor(ld, AslBase);
1385 req->fo_BackPen = iforeq->ifo_BackPen;
1387 /* Hmm ... there is also a struct TextAttr fo_Attr in
1388 FontRequester structure. Just put the same values in!? */
1390 req->fo_Attr.ta_Name = req->fo_TAttr.tta_Name;
1391 req->fo_Attr.ta_YSize = req->fo_TAttr.tta_YSize;
1392 req->fo_Attr.ta_Style = req->fo_TAttr.tta_Style;
1393 req->fo_Attr.ta_Flags = req->fo_TAttr.tta_Flags;
1395 retval = GHRET_FINISHED_OK;
1397 bye:
1398 return retval;
1401 /*****************************************************************************************/