Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / asl / fontreqsupport.c
blob005d3cbd78030774d01683ae13ae0039db861116
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 /*****************************************************************************************/
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include <proto/intuition.h>
14 #include <proto/graphics.h>
15 #include <proto/utility.h>
16 #include <proto/diskfont.h>
17 #include <exec/memory.h>
18 #include <exec/initializers.h>
19 #include <intuition/imageclass.h>
20 #include <dos/dos.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdlib.h>
25 #include <clib/macros.h>
27 #include "asl_intern.h"
28 #include "fontreqsupport.h"
29 #include "fontreqhooks.h"
30 #include "layout.h"
32 #define SDEBUG 0
33 #define DEBUG 0
34 //#define ADEBUG 0
36 #include <aros/debug.h>
38 /*****************************************************************************************/
40 static WORD FOCompareFontNodes(struct IntFontReq *iforeq, struct Node *node1,
41 struct Node *node2, struct AslBase_intern *AslBase)
43 return Stricmp(node1->ln_Name, node2->ln_Name);
46 /*****************************************************************************************/
48 static WORD FOCompareSizeNodes(struct IntFontReq *iforeq, struct Node *node1,
49 struct Node *node2, struct AslBase_intern *AslBase)
51 return ((IPTR)node1->ln_Name) - ((IPTR)node2->ln_Name);
54 /*****************************************************************************************/
56 static int AVFCompare(struct AvailFonts *one, struct AvailFonts *two)
58 int retval = strcmp(one->af_Attr.ta_Name, two->af_Attr.ta_Name);
60 if (!retval) retval = ((int)one->af_Attr.ta_YSize) -
61 ((int)two->af_Attr.ta_YSize);
63 return retval;
66 /*****************************************************************************************/
68 static void SortAvailFonts(struct AvailFontsHeader *afh, struct AslBase_intern *AslBase)
70 struct AvailFonts *avf;
71 WORD numentries;
73 avf = (struct AvailFonts *)&afh[1];
74 numentries = afh->afh_NumEntries;
75 if (numentries < 2) return;
77 qsort(avf,
78 numentries,
79 sizeof(*avf),
80 (int (*)(const void *, const void *))AVFCompare);
83 /*****************************************************************************************/
85 LONG FOGetFonts(struct LayoutData *ld, struct AslBase_intern *AslBase)
87 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
88 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
89 struct AvailFonts *avf;
90 ULONG afshortage = 0, afsize = 100;
91 WORD i;
93 FOFreeFonts(ld, AslBase);
97 udata->AFH = (struct AvailFontsHeader *)AllocVec(afsize, MEMF_ANY);
98 if (udata->AFH)
100 afshortage = AvailFonts((STRPTR)udata->AFH, afsize, AFF_MEMORY | AFF_DISK);
102 if (afshortage)
104 FreeVec(udata->AFH);
105 afsize += afshortage;
109 } while (udata->AFH && afshortage);
111 if (!udata->AFH) return ERROR_NO_FREE_STORE;
113 SortAvailFonts(udata->AFH, AslBase);
115 avf = (struct AvailFonts *)&udata->AFH[1];
117 for(i = 0; i < udata->AFH->afh_NumEntries;)
119 struct AvailFonts *avf_start = avf;
120 struct ASLLVFontReqNode *fontnode;
121 UWORD num_sizes = 1;
122 WORD i2 = i;
124 while (i2 < udata->AFH->afh_NumEntries - 1)
126 i2++; avf++;
127 if (strcmp(avf_start->af_Attr.ta_Name, avf->af_Attr.ta_Name)) break;
128 num_sizes++;
131 i += num_sizes; avf = avf_start + num_sizes;
133 if (iforeq->ifo_Flags & FOF_FIXEDWIDTHONLY)
135 if (avf_start->af_Attr.ta_Flags & FPF_PROPORTIONAL) continue;
138 if (strlen(avf_start->af_Attr.ta_Name) >= sizeof fontnode->Name)
140 D(bug("[ASL] Font %s ignored because name too long\n", avf_start->af_Attr.ta_Name));
141 continue;
144 if (iforeq->ifo_FilterFunc)
146 #ifdef __MORPHOS__
148 ULONG ret;
150 REG_A4 = (ULONG)iforeq->ifo_IntReq.ir_BasePtr; /* Compatability */
151 REG_A0 = (ULONG)iforeq->ifo_FilterFunc;
152 REG_A2 = (ULONG)ld->ld_Req;
153 REG_A1 = (ULONG)&avf_start->af_Attr;
154 ret = (*MyEmulHandle->EmulCallDirect68k)(iforeq->ifo_FilterFunc->h_Entry);
156 if (!ret) continue;
158 #else
159 if (!(CallHookPkt(iforeq->ifo_FilterFunc, ld->ld_Req, &avf_start->af_Attr))) continue;
160 #endif
163 if (iforeq->ifo_HookFunc && (iforeq->ifo_Flags & FOF_FILTERFUNC))
165 #ifdef __MORPHOS__
167 ULONG ret;
168 UWORD *funcptr = iforeq->ifo_HookFunc;
169 ULONG *p = (ULONG *)REG_A7 - 3;
171 p[0] = (ULONG)FOF_FILTERFUNC;
172 p[1] = (ULONG)&avf_start->af_Attr;
173 p[2] = (ULONG)ld->ld_Req;
174 REG_A7 = (ULONG)p;
176 if (*funcptr >= (UWORD)0xFF00)
177 REG_A7 -= 4;
179 REG_A4 = (ULONG)iforeq->ifo_IntReq.ir_BasePtr; /* Compatability */
181 ret = (ULONG)(*MyEmulHandle->EmulCallDirect68k)(funcptr);
183 if (*funcptr >= (UWORD)0xFF00)
184 REG_A7 += 4;
186 REG_A7 += (3*4);
188 if (!ret) continue;
190 #else
191 if (!(iforeq->ifo_HookFunc(FOF_FILTERFUNC,
192 &avf_start->af_Attr,
193 (struct FontRequester *)ld->ld_Req))) continue;
194 #endif
197 fontnode = MyAllocVecPooled(ld->ld_IntReq->ir_MemPool,
198 sizeof(*fontnode) + sizeof(struct Node) * num_sizes,
199 AslBase);
201 if (fontnode)
203 char *sp;
204 WORD len;
205 UWORD prevsize = 0;
207 sp = strchr(avf_start->af_Attr.ta_Name, '.');
208 if (sp)
210 len = (IPTR)sp - (IPTR)avf_start->af_Attr.ta_Name - 1;;
212 else
214 /* Paranoia: Should never happen */
215 len = strlen(avf_start->af_Attr.ta_Name);
218 strncpy(fontnode->Name, avf_start->af_Attr.ta_Name, len + 1);
219 fontnode->node.ln_Name = fontnode->Name;
220 fontnode->TAttr = avf_start->af_Attr;
221 fontnode->TAttr.ta_Name = fontnode->Name;
223 fontnode->NumSizes = num_sizes;
225 NEWLIST(&fontnode->SizeList);
227 for(i2 = 0; i2 < num_sizes; i2++, avf_start++)
229 UWORD size = avf_start->af_Attr.ta_YSize;
231 if (size == prevsize) continue;
233 if ((size < iforeq->ifo_MinHeight) ||
234 (size > iforeq->ifo_MaxHeight)) continue;
236 fontnode->SizeNode[i2].ln_Name = (char *)(IPTR)size;
237 SortInNode(iforeq, &fontnode->SizeList, &fontnode->SizeNode[i2], (APTR)FOCompareSizeNodes, AslBase);
239 prevsize = size;
242 SortInNode(iforeq, &udata->NameListviewList, &fontnode->node, (APTR)FOCompareFontNodes, AslBase);
246 } /* for(i = 0; i < udata->AFH->afh_NumEntries; ) */
248 if (udata->NameListview)
250 struct TagItem set_tags[] =
252 {ASLLV_Labels, (IPTR)&udata->NameListviewList },
253 {TAG_DONE }
255 STRPTR fontname;
256 IPTR fontsize;
258 SetGadgetAttrsA((struct Gadget *)udata->NameListview, ld->ld_Window, NULL, set_tags);
260 GetAttr(STRINGA_TextVal, udata->NameString, (IPTR *)&fontname);
261 GetAttr(STRINGA_LongVal, udata->SizeString, (IPTR *)&fontsize);
263 FORestore(ld, fontname, fontsize, AslBase);
267 return IsListEmpty(&udata->NameListviewList) ? ERROR_NO_MORE_ENTRIES : 0;
271 /*****************************************************************************************/
273 void FOFreeFonts(struct LayoutData *ld, struct AslBase_intern *AslBase)
275 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
276 struct ASLVFontReqNode *node, *succ;
277 struct TagItem set_tags[] =
279 {ASLLV_Labels, 0 },
280 {TAG_DONE }
283 udata->ActiveFont = NULL;
285 if (udata->NameListview) SetGadgetAttrsA((struct Gadget *)udata->NameListview, ld->ld_Window, NULL, set_tags);
286 if (udata->SizeListview) SetGadgetAttrsA((struct Gadget *)udata->SizeListview, ld->ld_Window, NULL, set_tags);
288 ForeachNodeSafe(&udata->NameListviewList, node, succ)
290 MyFreeVecPooled(node, AslBase);
293 NEWLIST(&udata->NameListviewList);
295 if (udata->AFH)
297 FreeVec(udata->AFH);
298 udata->AFH = NULL;
302 /*****************************************************************************************/
304 VOID FOUpdatePreview(struct LayoutData *ld, struct AslBase_intern *AslBase)
306 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
307 struct IntReq *intreq = ld->ld_IntReq;
308 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
309 struct TextAttr ta;
310 struct TextFont *font;
311 IPTR val;
312 STRPTR name;
314 GetAttr(STRINGA_LongVal, udata->SizeString, &val);
315 ta.ta_YSize = (WORD)val;
316 ta.ta_Flags = 0;
317 ta.ta_Style = 0;
319 GetAttr(STRINGA_TextVal, udata->NameString, (IPTR *)&name);
320 if ((name = VecPooledCloneString(name, ".font", intreq->ir_MemPool, AslBase)))
322 UBYTE style = FS_NORMAL;
323 UBYTE apen = iforeq->ifo_FrontPen;
324 UBYTE bpen = iforeq->ifo_BackPen;
326 ta.ta_Name = name;
328 if (iforeq->ifo_Flags & FOF_DOSTYLE)
330 style = FOGetStyle(ld, AslBase);
333 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
335 apen = FOGetFGColor(ld, AslBase);
338 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
340 bpen = FOGetBGColor(ld, AslBase);
343 font = OpenDiskFont(&ta);
345 struct TagItem settags[] =
347 {ASLFP_Font , (IPTR)font },
348 {ASLFP_Style, style },
349 {ASLFP_APen , apen },
350 {ASLFP_BPen , bpen },
351 {TAG_DONE }
354 SetGadgetAttrsA((struct Gadget *)udata->Preview, ld->ld_Window, NULL, settags);
357 if (udata->PreviewFont) CloseFont(udata->PreviewFont);
358 udata->PreviewFont = font;
360 MyFreeVecPooled(name, AslBase);
364 /*****************************************************************************************/
366 struct ASLLVFontReqNode *FOGetActiveFont(struct LayoutData *ld, struct AslBase_intern *AslBase)
368 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
369 IPTR active;
371 GetAttr(ASLLV_Active, udata->NameListview, &active);
373 return (struct ASLLVFontReqNode *)FindListNode(&udata->NameListviewList, active);
376 /*****************************************************************************************/
378 void FOChangeActiveFont(struct LayoutData *ld, WORD delta, UWORD quali, BOOL jump, struct AslBase_intern *AslBase)
380 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
381 IPTR active, total, visible, size;
383 GetAttr(ASLLV_Active , udata->NameListview, &active );
384 GetAttr(ASLLV_Total , udata->NameListview, &total );
385 GetAttr(ASLLV_Visible , udata->NameListview, &visible);
386 GetAttr(STRINGA_LongVal, udata->SizeString , &size );
388 if (total)
390 if (quali & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
392 delta *= (visible - 1);
394 else if (quali & (IEQUALIFIER_LALT | IEQUALIFIER_RALT | IEQUALIFIER_CONTROL))
396 delta *= total;
398 else if (jump)
400 /* try to jump to first item which matches text in name string gadget,
401 but only if text in string gadget mismatches actual active
402 item's text (in this case move normally = one step)) */
404 struct ASLLVFontReqNode *node;
405 UBYTE buffer[MAXASLFONTNAME + 6];
406 STRPTR val;
407 WORD i, len;
408 BOOL dojump = TRUE;
410 GetAttr(STRINGA_TextVal, udata->NameString, (IPTR *)&val);
411 strlcpy(buffer, val, sizeof buffer);
413 len = strlen(buffer);
415 if (len)
417 if (((LONG)active) >= 0)
419 if ((node = (struct ASLLVFontReqNode *)FindListNode(&udata->NameListviewList, (WORD)active)))
421 if (stricmp(node->node.ln_Name, buffer) == 0) dojump = FALSE;
425 if (dojump)
427 i = 0;
428 ForeachNode(&udata->NameListviewList, node)
430 if (Strnicmp((CONST_STRPTR)node->node.ln_Name, (CONST_STRPTR)buffer, len) == 0)
432 active = i;
433 delta = 0;
434 break;
436 i++;
439 } /* if (dojump) */
441 } /* if (len) */
444 active += delta;
446 if (((LONG)active) < 0) active = 0;
447 if (active >= total) active = total - 1;
449 FOActivateFont(ld, active, (LONG)size, AslBase);
453 /*****************************************************************************************/
455 void FOChangeActiveSize(struct LayoutData *ld, WORD delta, UWORD quali, struct AslBase_intern *AslBase)
457 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
458 IPTR active, total, visible;
460 GetAttr(ASLLV_Active , udata->SizeListview, &active );
461 GetAttr(ASLLV_Total , udata->SizeListview, &total );
462 GetAttr(ASLLV_Visible, udata->SizeListview, &visible);
464 if (total)
466 if (quali & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
468 delta *= (visible - 1);
470 else if (quali & (IEQUALIFIER_LALT | IEQUALIFIER_RALT | IEQUALIFIER_CONTROL))
472 delta *= total;
475 active += delta;
477 if (((LONG)active) < 0) active = 0;
478 if (active >= total) active = total - 1;
480 FOActivateSize(ld, active, AslBase);
484 /*****************************************************************************************/
486 void FOActivateFont(struct LayoutData *ld, WORD which, LONG size, struct AslBase_intern *AslBase)
488 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
489 // struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
490 struct ASLLVFontReqNode *fontnode;
491 struct Node *node;
492 struct TagItem name_tags[] =
494 {ASLLV_Active , 0 },
495 {ASLLV_MakeVisible , 0 },
496 {TAG_DONE }
498 struct TagItem size_tags[] =
500 {ASLLV_Labels , 0 },
501 {ASLLV_Active , (IPTR)-1 },
502 {ASLLV_MakeVisible , 0 },
503 {TAG_DONE }
505 WORD sizelvindex = 0;
507 fontnode = (struct ASLLVFontReqNode *)FindListNode(&udata->NameListviewList, which);
508 udata->ActiveFont = fontnode;
510 if (!fontnode)
512 SetGadgetAttrsA((struct Gadget *)udata->SizeListview, ld->ld_Window, NULL, size_tags);
514 name_tags[0].ti_Data = (IPTR)-1;
515 name_tags[1].ti_Tag = TAG_IGNORE;
516 SetGadgetAttrsA((struct Gadget *)udata->NameListview, ld->ld_Window, NULL, name_tags);
518 else
520 name_tags[0].ti_Data = name_tags[1].ti_Data = which;
521 SetGadgetAttrsA((struct Gadget *)udata->NameListview, ld->ld_Window, NULL, name_tags);
523 size_tags[0].ti_Data = (IPTR)&fontnode->SizeList;
524 ForeachNode(&fontnode->SizeList, node)
526 MARK_UNSELECTED(node);
527 if ((IPTR)node->ln_Name == size)
529 size_tags[1].ti_Data = size_tags[2].ti_Data = sizelvindex;
531 sizelvindex++;
533 SetGadgetAttrsA((struct Gadget *)udata->SizeListview, ld->ld_Window, NULL, size_tags);
535 FOSetFontString(fontnode->node.ln_Name, ld, AslBase);
538 FOUpdatePreview(ld, AslBase);
541 /*****************************************************************************************/
543 void FOActivateSize(struct LayoutData *ld, WORD which, struct AslBase_intern *AslBase)
545 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
546 // struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
547 struct Node *node;
548 struct TagItem size_tags[] =
550 {ASLLV_Active , 0 },
551 {ASLLV_MakeVisible , 0 },
552 {TAG_DONE }
555 if (!udata->ActiveFont) return;
557 if (which >= 0)
559 node = FindListNode(&udata->ActiveFont->SizeList, which);
561 else
563 LONG size = -which;
564 BOOL found = FALSE;
566 which = 0;
567 ForeachNode(&udata->ActiveFont->SizeList, node)
569 if ((IPTR)node->ln_Name == size)
571 found = TRUE;
572 break;
574 which++;
577 if (!found) node = NULL;
580 size_tags[0].ti_Data = node ? which : -1;
581 size_tags[1].ti_Data = node ? which : 0;
583 SetGadgetAttrsA((struct Gadget *)udata->SizeListview, ld->ld_Window, NULL, size_tags);
585 if (node) FOSetSizeString((IPTR)node->ln_Name, ld, AslBase);
587 FOUpdatePreview(ld, AslBase);
590 /*****************************************************************************************/
592 void FORestore(struct LayoutData *ld, STRPTR fontname, LONG fontsize, struct AslBase_intern *AslBase)
594 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
595 struct IntFontReq *iforeq = (struct IntFontReq *)ld->ld_IntReq;
596 struct ASLLVFontReqNode *fontnode;
597 struct TagItem set_tags[] =
599 {ASLLV_Labels , 0 },
600 {TAG_DONE }
602 UBYTE initialfontname[MAXASLFONTNAME + 6];
603 char *sp;
604 WORD i = 0;
606 strlcpy(initialfontname, fontname, sizeof initialfontname);
607 if ((sp = strchr(initialfontname, '.'))) *sp = '\0';
609 FOSetSizeString(fontsize, ld, AslBase);
611 SetGadgetAttrsA((struct Gadget *)udata->SizeListview, ld->ld_Window, NULL, set_tags);
613 ForeachNode(&udata->NameListviewList, fontnode)
615 if (stricmp(fontnode->node.ln_Name, initialfontname) == 0) break;
616 i++;
619 if (iforeq->ifo_Flags & FOF_DODRAWMODE)
621 FOSetDrawMode(ld, iforeq->ifo_DrawMode, AslBase);
624 if (iforeq->ifo_Flags & FOF_DOSTYLE)
626 FOSetStyle(ld, iforeq->ifo_TextAttr.ta_Style, AslBase);
629 if (iforeq->ifo_Flags & FOF_DOFRONTPEN)
631 FOSetFGColor(ld, iforeq->ifo_FrontPen, AslBase);
634 if (iforeq->ifo_Flags & FOF_DOBACKPEN)
636 FOSetBGColor(ld, iforeq->ifo_BackPen, AslBase);
639 FOActivateFont(ld, i, fontsize, AslBase);
642 /*****************************************************************************************/
644 void FOSetFontString(STRPTR name, struct LayoutData *ld, struct AslBase_intern *AslBase)
646 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
647 struct TagItem set_tags[] =
649 {STRINGA_TextVal , (IPTR)name },
650 {TAG_DONE }
653 SetGadgetAttrsA((struct Gadget *)udata->NameString, ld->ld_Window, NULL, set_tags);
656 /*****************************************************************************************/
658 void FOSetSizeString(LONG size, struct LayoutData *ld, struct AslBase_intern *AslBase)
660 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
661 struct TagItem set_tags[] =
663 {STRINGA_LongVal , (IPTR)size },
664 {TAG_DONE }
667 SetGadgetAttrsA((struct Gadget *)udata->SizeString, ld->ld_Window, NULL, set_tags);
670 /*****************************************************************************************/
672 LONG FOGetDrawMode(struct LayoutData *ld, struct AslBase_intern *AslBase)
674 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
675 IPTR active;
677 ASSERT(udata->DrawModeGadget);
679 GetAttr(ASLCY_Active, udata->DrawModeGadget, &active);
681 return (LONG)active;
684 /*****************************************************************************************/
686 void FOSetDrawMode(struct LayoutData *ld, UWORD id, struct AslBase_intern *AslBase)
688 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
689 struct TagItem set_tags[] =
691 {ASLCY_Active , id },
692 {TAG_DONE }
695 ASSERT(udata->DrawModeGadget);
697 SetGadgetAttrsA((struct Gadget *)udata->DrawModeGadget, ld->ld_Window, NULL, set_tags);
701 /*****************************************************************************************/
703 UBYTE FOGetStyle(struct LayoutData *ld, struct AslBase_intern *AslBase)
705 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
706 IPTR style;
708 ASSERT(udata->StyleGadget);
710 GetAttr(ASLFS_Style, udata->StyleGadget, &style);
712 return (UBYTE)style;
715 /*****************************************************************************************/
717 void FOSetStyle(struct LayoutData *ld, UBYTE style, struct AslBase_intern *AslBase)
719 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
720 struct TagItem set_tags[] =
722 {ASLFS_Style , style },
723 {TAG_DONE }
726 ASSERT(udata->StyleGadget);
728 SetGadgetAttrsA((struct Gadget *)udata->StyleGadget, ld->ld_Window, NULL, set_tags);
732 /*****************************************************************************************/
734 UBYTE FOGetFGColor(struct LayoutData *ld, struct AslBase_intern *AslBase)
736 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
737 IPTR color;
739 ASSERT(udata->FGColorGadget);
741 GetAttr(ASLCP_Color, udata->FGColorGadget, &color);
743 return (UBYTE)color;
746 /*****************************************************************************************/
748 void FOSetFGColor(struct LayoutData *ld, UBYTE color, struct AslBase_intern *AslBase)
750 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
751 struct TagItem set_tags[] =
753 {ASLCP_Color , color },
754 {TAG_DONE }
757 ASSERT(udata->FGColorGadget);
759 SetGadgetAttrsA((struct Gadget *)udata->FGColorGadget, ld->ld_Window, NULL, set_tags);
763 /*****************************************************************************************/
765 UBYTE FOGetBGColor(struct LayoutData *ld, struct AslBase_intern *AslBase)
767 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
768 IPTR color;
770 ASSERT(udata->BGColorGadget);
772 GetAttr(ASLCP_Color, udata->BGColorGadget, &color);
774 return (UBYTE)color;
777 /*****************************************************************************************/
779 void FOSetBGColor(struct LayoutData *ld, UBYTE color, struct AslBase_intern *AslBase)
781 struct FOUserData *udata = (struct FOUserData *)ld->ld_UserData;
782 struct TagItem set_tags[] =
784 {ASLCP_Color , color },
785 {TAG_DONE }
788 ASSERT(udata->BGColorGadget);
790 SetGadgetAttrsA((struct Gadget *)udata->BGColorGadget, ld->ld_Window, NULL, set_tags);
794 /*****************************************************************************************/