WPrefs: Added a few missing const attributes
[wmaker-crm.git] / WPrefs.app / FontSimple.c
bloba124a9817bca50ca23e28c48a288825013ca7ef2
1 /* FontSimple.c- simplified font configuration panel
2 *
3 * WPrefs - Window Maker Preferences Program
4 *
5 * Copyright (c) 1998-2004 Alfredo K. Kojima
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "WPrefs.h"
23 #include <unistd.h>
24 #include <fontconfig/fontconfig.h>
26 /* workaround for older fontconfig, that doesn't define these constants */
27 #ifndef FC_WEIGHT_NORMAL
28 /* Weights */
29 # define FC_WEIGHT_THIN 10
30 # define FC_WEIGHT_EXTRALIGHT 40
31 # define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
32 # define FC_WEIGHT_REGULAR 80
33 # define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
34 # define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
35 # define FC_WEIGHT_EXTRABOLD 205
36 # define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
37 # define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
38 /* Widths */
39 # define FC_WIDTH "width"
40 # define FC_WIDTH_ULTRACONDENSED 50
41 # define FC_WIDTH_EXTRACONDENSED 63
42 # define FC_WIDTH_CONDENSED 75
43 # define FC_WIDTH_SEMICONDENSED 87
44 # define FC_WIDTH_NORMAL 100
45 # define FC_WIDTH_SEMIEXPANDED 113
46 # define FC_WIDTH_EXPANDED 125
47 # define FC_WIDTH_EXTRAEXPANDED 150
48 # define FC_WIDTH_ULTRAEXPANDED 200
49 #endif
51 #define SAMPLE_TEXT "The Lazy Fox Jumped Ipsum Foobar 1234 - 56789"
53 typedef struct {
54 int weight;
55 int width;
56 int slant;
57 } FontStyle;
59 typedef struct {
60 char *name;
61 int stylen;
62 FontStyle *styles;
63 } FontFamily;
65 typedef struct {
66 int familyn;
67 FontFamily *families;
68 } FontList;
70 typedef struct _Panel {
71 WMBox *box;
72 char *sectionName;
74 char *description;
76 CallbackRec callbacks;
78 WMWidget *parent;
80 WMPopUpButton *optionP;
82 WMList *familyL;
83 WMList *styleL;
85 WMList *sizeL;
87 WMTextField *sampleT;
89 FontList *fonts;
90 } _Panel;
92 #define ICON_FILE "fonts"
94 static const struct {
95 const char *option;
96 const char *label;
97 } fontOptions[] = {
99 "WindowTitleFont", N_("Window Title")}, {
100 "MenuTitleFont", N_("Menu Title")}, {
101 "MenuTextFont", N_("Menu Text")}, {
102 "IconTitleFont", N_("Icon Title")}, {
103 "ClipTitleFont", N_("Clip Title")}, {
104 "LargeDisplayFont", N_("Desktop Caption")}, {
105 NULL, NULL},};
107 static const char *standardSizes[] = {
108 "6",
109 "8",
110 "9",
111 "10",
112 "11",
113 "12",
114 "13",
115 "14",
116 "15",
117 "16",
118 "18",
119 "20",
120 "22",
121 "24",
122 "28",
123 "32",
124 "36",
125 "48",
126 "64",
127 "72",
128 NULL
131 static const struct {
132 int weight;
133 const char *name;
134 } fontWeights[] = {
136 FC_WEIGHT_THIN, "Thin"}, {
137 FC_WEIGHT_EXTRALIGHT, "ExtraLight"}, {
138 FC_WEIGHT_LIGHT, "Light"}, {
139 FC_WEIGHT_NORMAL, "Normal"}, {
140 FC_WEIGHT_MEDIUM, ""}, /*"medium"}, */
142 FC_WEIGHT_DEMIBOLD, "DemiBold"}, {
143 FC_WEIGHT_BOLD, "Bold"}, {
144 FC_WEIGHT_EXTRABOLD, "ExtraBold"}, {
145 FC_WEIGHT_BLACK, "Black"}, {
146 0, NULL}
149 static const struct {
150 int slant;
151 const char *name;
152 } fontSlants[] = {
154 FC_SLANT_ROMAN, ""}, /*"Roman"}, */
156 FC_SLANT_ITALIC, "Italic"}, {
157 FC_SLANT_OBLIQUE, "Oblique"}, {
158 0, NULL}
161 static const struct {
162 int width;
163 const char *name;
164 } fontWidths[] = {
166 FC_WIDTH_ULTRACONDENSED, "UltraCondensed"}, {
167 FC_WIDTH_EXTRACONDENSED, "ExtraCondensed"}, {
168 FC_WIDTH_CONDENSED, "Condensed"}, {
169 FC_WIDTH_SEMICONDENSED, "SemiCondensed"}, {
170 FC_WIDTH_NORMAL, ""}, /*"normal"}, */
172 FC_WIDTH_SEMIEXPANDED, "SemiExpanded"}, {
173 FC_WIDTH_EXPANDED, "Expanded"}, {
174 FC_WIDTH_EXTRAEXPANDED, "ExtraExpanded"}, {
175 FC_WIDTH_ULTRAEXPANDED, "UltraExpanded"}, {
176 0, NULL}
179 static int compare_family(const void *a, const void *b)
181 FontFamily *fa = (FontFamily *) a;
182 FontFamily *fb = (FontFamily *) b;
183 return strcmp(fa->name, fb->name);
186 static int compare_styles(const void *a, const void *b)
188 FontStyle *sa = (FontStyle *) a;
189 FontStyle *sb = (FontStyle *) b;
190 int compare;
192 compare = sa->weight - sb->weight;
193 if (compare != 0)
194 return compare;
195 compare = sa->slant - sb->slant;
196 if (compare != 0)
197 return compare;
198 return (sa->width - sb->width);
201 static void lookup_available_fonts(_Panel * panel)
203 FcPattern *pat = FcPatternCreate();
204 FcObjectSet *os;
205 FcFontSet *fonts;
206 FontFamily *family;
208 os = FcObjectSetBuild(FC_FAMILY, FC_WEIGHT, FC_WIDTH, FC_SLANT, NULL);
210 fonts = FcFontList(0, pat, os);
212 if (fonts) {
213 int i;
215 panel->fonts = wmalloc(sizeof(FontList));
216 panel->fonts->familyn = 0;
217 panel->fonts->families = wmalloc(sizeof(FontFamily) * fonts->nfont);
219 for (i = 0; i < fonts->nfont; i++) {
220 char *name;
221 int weight, slant, width;
222 int j, found;
224 if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, (FcChar8 **) & name) !=
225 FcResultMatch)
226 continue;
228 if (FcPatternGetInteger(fonts->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch)
229 weight = FC_WEIGHT_MEDIUM;
231 if (FcPatternGetInteger(fonts->fonts[i], FC_WIDTH, 0, &width) != FcResultMatch)
232 width = FC_WIDTH_NORMAL;
234 if (FcPatternGetInteger(fonts->fonts[i], FC_SLANT, 0, &slant) != FcResultMatch)
235 slant = FC_SLANT_ROMAN;
237 found = -1;
238 for (j = 0; j < panel->fonts->familyn && found < 0; j++)
239 if (strcasecmp(panel->fonts->families[j].name, name) == 0)
240 found = j;
242 if (found < 0) {
243 panel->fonts->families[panel->fonts->familyn++].name = wstrdup(name);
244 family = panel->fonts->families + panel->fonts->familyn - 1;
245 family->stylen = 0;
246 family->styles = NULL;
247 } else
248 family = panel->fonts->families + found;
250 family->stylen++;
251 family->styles = wrealloc(family->styles, sizeof(FontStyle) * family->stylen);
252 family->styles[family->stylen - 1].weight = weight;
253 family->styles[family->stylen - 1].slant = slant;
254 family->styles[family->stylen - 1].width = width;
256 qsort(panel->fonts->families, panel->fonts->familyn, sizeof(FontFamily), compare_family);
258 for (i = 0; i < panel->fonts->familyn; i++) {
259 qsort(panel->fonts->families[i].styles, panel->fonts->families[i].stylen,
260 sizeof(FontStyle), compare_styles);
263 FcFontSetDestroy(fonts);
265 if (os)
266 FcObjectSetDestroy(os);
267 if (pat)
268 FcPatternDestroy(pat);
270 panel->fonts->families[panel->fonts->familyn++].name = wstrdup("sans serif");
271 family = panel->fonts->families + panel->fonts->familyn - 1;
272 family->styles = wmalloc(sizeof(FontStyle) * 2);
273 family->stylen = 2;
274 family->styles[0].weight = FC_WEIGHT_MEDIUM;
275 family->styles[0].slant = FC_SLANT_ROMAN;
276 family->styles[0].width = FC_WIDTH_NORMAL;
277 family->styles[1].weight = FC_WEIGHT_BOLD;
278 family->styles[1].slant = FC_SLANT_ROMAN;
279 family->styles[1].width = FC_WIDTH_NORMAL;
281 panel->fonts->families[panel->fonts->familyn++].name = wstrdup("serif");
282 family = panel->fonts->families + panel->fonts->familyn - 1;
283 family->styles = wmalloc(sizeof(FontStyle) * 2);
284 family->stylen = 2;
285 family->styles[0].weight = FC_WEIGHT_MEDIUM;
286 family->styles[0].slant = FC_SLANT_ROMAN;
287 family->styles[0].width = FC_WIDTH_NORMAL;
288 family->styles[1].weight = FC_WEIGHT_BOLD;
289 family->styles[1].slant = FC_SLANT_ROMAN;
290 family->styles[1].width = FC_WIDTH_NORMAL;
293 static char *getSelectedFont(_Panel * panel, FcChar8 * curfont)
295 WMListItem *item;
296 FcPattern *pat;
297 char *name;
299 if (curfont)
300 pat = FcNameParse(curfont);
301 else
302 pat = FcPatternCreate();
304 item = WMGetListSelectedItem(panel->familyL);
305 if (item) {
306 FcPatternDel(pat, FC_FAMILY);
307 FcPatternAddString(pat, FC_FAMILY, (FcChar8 *) item->text);
310 item = WMGetListSelectedItem(panel->styleL);
311 if (item) {
312 FontStyle *style = (FontStyle *) item->clientData;
314 FcPatternDel(pat, FC_WEIGHT);
315 FcPatternAddInteger(pat, FC_WEIGHT, style->weight);
317 FcPatternDel(pat, FC_WIDTH);
318 FcPatternAddInteger(pat, FC_WIDTH, style->width);
320 FcPatternDel(pat, FC_SLANT);
321 FcPatternAddInteger(pat, FC_SLANT, style->slant);
324 item = WMGetListSelectedItem(panel->sizeL);
325 if (item) {
326 FcPatternDel(pat, FC_PIXEL_SIZE);
327 FcPatternAddDouble(pat, FC_PIXEL_SIZE, atoi(item->text));
330 name = (char *)FcNameUnparse(pat);
331 FcPatternDestroy(pat);
333 return name;
336 static void updateSampleFont(_Panel * panel)
338 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP,
339 WMGetPopUpButtonSelectedItem(panel->optionP));
340 char *fn = WMGetMenuItemRepresentedObject(item);
342 if (fn) {
343 WMFont *font = WMCreateFont(WMWidgetScreen(panel->box), fn);
344 if (font) {
345 WMSetTextFieldFont(panel->sampleT, font);
346 WMReleaseFont(font);
351 static void selectedFamily(WMWidget * w, void *data)
353 _Panel *panel = (_Panel *) data;
354 WMListItem *item;
355 FontStyle *oldStyle = NULL;
356 char buffer[1024];
358 /* Parameter not used, but tell the compiler that it is ok */
359 (void) w;
361 item = WMGetListSelectedItem(panel->styleL);
362 if (item)
363 oldStyle = (FontStyle *) item->clientData;
365 item = WMGetListSelectedItem(panel->familyL);
367 if (item) {
368 FontFamily *family = (FontFamily *) item->clientData;
369 int i, oldi = 0, oldscore = 0;
371 WMClearList(panel->styleL);
372 for (i = 0; i < family->stylen; i++) {
373 int j;
374 const char *weight = "", *slant = "", *width = "";
375 WMListItem *item;
377 for (j = 0; fontWeights[j].name; j++)
378 if (fontWeights[j].weight == family->styles[i].weight) {
379 weight = fontWeights[j].name;
380 break;
382 for (j = 0; fontWidths[j].name; j++)
383 if (fontWidths[j].width == family->styles[i].width) {
384 width = fontWidths[j].name;
385 break;
387 for (j = 0; fontSlants[j].name; j++)
388 if (fontSlants[j].slant == family->styles[i].slant) {
389 slant = fontSlants[j].name;
390 break;
392 sprintf(buffer, "%s%s%s%s%s",
393 weight, *weight ? " " : "", slant, (*slant || *weight) ? " " : "", width);
394 if (!buffer[0])
395 strcpy(buffer, "Roman");
397 item = WMAddListItem(panel->styleL, buffer);
398 item->clientData = family->styles + i;
400 if (oldStyle) {
401 int score = 0;
403 if (oldStyle->width == family->styles[i].width)
404 score |= 1;
405 if (oldStyle->weight == family->styles[i].weight)
406 score |= 2;
407 if (oldStyle->slant == family->styles[i].slant)
408 score |= 4;
410 if (score > oldscore) {
411 oldi = i;
412 oldscore = score;
416 WMSelectListItem(panel->styleL, oldi);
419 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
420 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
421 FcChar8 *ofont;
422 char *nfont;
424 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
425 nfont = getSelectedFont(panel, ofont);
426 if (ofont)
427 wfree(ofont);
428 WMSetMenuItemRepresentedObject(item, nfont);
430 updateSampleFont(panel);
434 static void selected(WMWidget * w, void *data)
436 _Panel *panel = (_Panel *) data;
437 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
438 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
439 FcChar8 *ofont;
440 char *nfont;
442 /* Parameter not used, but tell the compiler that it is ok */
443 (void) w;
445 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
446 nfont = getSelectedFont(panel, ofont);
447 if (ofont)
448 wfree(ofont);
450 WMSetMenuItemRepresentedObject(item, nfont);
452 updateSampleFont(panel);
455 static void selectedOption(WMWidget * w, void *data)
457 _Panel *panel = (_Panel *) data;
458 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
459 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
460 char *font;
462 /* Parameter not used, but tell the compiler that it is ok */
463 (void) w;
465 font = (char *)WMGetMenuItemRepresentedObject(item);
466 if (font) {
467 FcPattern *pat;
469 pat = FcNameParse((FcChar8 *) font);
470 if (pat) {
471 char *name;
472 int weight, slant, width;
473 double size;
474 int distance, closest, found;
475 int i;
477 FcDefaultSubstitute(pat);
479 if (FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8 **) & name) != FcResultMatch)
480 name = "sans serif";
482 found = 0;
483 /* select family */
484 for (i = 0; i < WMGetListNumberOfRows(panel->familyL); i++) {
485 WMListItem *item = WMGetListItem(panel->familyL, i);
486 FontFamily *family = (FontFamily *) item->clientData;
488 if (strcasecmp(family->name, name) == 0) {
489 found = 1;
490 WMSelectListItem(panel->familyL, i);
491 WMSetListPosition(panel->familyL, i);
492 break;
495 if (!found)
496 WMSelectListItem(panel->familyL, -1);
497 selectedFamily(panel->familyL, panel);
499 /* select style */
500 if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch)
501 weight = FC_WEIGHT_NORMAL;
502 if (FcPatternGetInteger(pat, FC_WIDTH, 0, &width) != FcResultMatch)
503 width = FC_WIDTH_NORMAL;
504 if (FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch)
505 slant = FC_SLANT_ROMAN;
507 if (FcPatternGetDouble(pat, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
508 size = 10.0;
510 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->styleL); i++) {
511 WMListItem *item = WMGetListItem(panel->styleL, i);
512 FontStyle *style = (FontStyle *) item->clientData;
514 distance = ((abs(style->weight - weight) << 16) +
515 (abs(style->slant - slant) << 8) + (abs(style->width - width)));
517 if (i == 0 || distance < closest) {
518 closest = distance;
519 found = i;
520 if (distance == 0) {
521 break; /* perfect match */
525 WMSelectListItem(panel->styleL, found);
526 WMSetListPosition(panel->styleL, found);
528 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->sizeL); i++) {
529 WMListItem *item = WMGetListItem(panel->sizeL, i);
530 int distance;
532 distance = abs(size - atoi(item->text));
534 if (i == 0 || distance < closest) {
535 closest = distance;
536 found = i;
537 if (distance == 0) {
538 break; /* perfect match */
542 WMSelectListItem(panel->sizeL, found);
543 WMSetListPosition(panel->sizeL, found);
545 selected(NULL, panel);
546 } else
547 wwarning("Can't parse font '%s'", font);
550 updateSampleFont(panel);
553 static WMLabel *createListLabel(WMScreen * scr, WMWidget * parent, const char *text)
555 WMLabel *label;
556 WMColor *color;
557 WMFont *boldFont = WMBoldSystemFontOfSize(scr, 12);
559 label = WMCreateLabel(parent);
560 WMSetLabelFont(label, boldFont);
561 WMSetLabelText(label, text);
562 WMSetLabelRelief(label, WRSunken);
563 WMSetLabelTextAlignment(label, WACenter);
564 color = WMDarkGrayColor(scr);
565 WMSetWidgetBackgroundColor(label, color);
566 WMReleaseColor(color);
567 color = WMWhiteColor(scr);
568 WMSetLabelTextColor(label, color);
569 WMReleaseColor(color);
571 WMReleaseFont(boldFont);
573 return label;
576 static void showData(_Panel * panel)
578 int i;
579 WMMenuItem *item;
581 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
582 char *ofont, *font;
584 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
586 ofont = WMGetMenuItemRepresentedObject(item);
587 if (ofont)
588 wfree(ofont);
590 font = GetStringForKey(fontOptions[i].option);
591 if (font)
592 font = wstrdup(font);
593 WMSetMenuItemRepresentedObject(item, font);
596 WMSetPopUpButtonSelectedItem(panel->optionP, 0);
597 selectedOption(panel->optionP, panel);
600 static void storeData(_Panel * panel)
602 int i;
603 WMMenuItem *item;
604 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
605 char *font;
607 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
609 font = WMGetMenuItemRepresentedObject(item);
610 if (font && *font) {
611 SetStringForKey(font, fontOptions[i].option);
616 static void createPanel(Panel * p)
618 _Panel *panel = (_Panel *) p;
619 WMScreen *scr = WMWidgetScreen(panel->parent);
620 WMLabel *label;
621 WMBox *hbox, *vbox;
622 int i;
624 lookup_available_fonts(panel);
626 panel->box = WMCreateBox(panel->parent);
627 WMSetViewExpandsToParent(WMWidgetView(panel->box), 5, 2, 5, 5);
628 WMSetBoxHorizontal(panel->box, False);
629 WMSetBoxBorderWidth(panel->box, 8);
630 WMMapWidget(panel->box);
632 hbox = WMCreateBox(panel->box);
633 WMSetBoxHorizontal(hbox, True);
634 WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 40, 22, 8);
636 vbox = WMCreateBox(hbox);
637 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 130, 0, 10);
638 WMSetBoxHorizontal(vbox, False);
639 panel->optionP = WMCreatePopUpButton(vbox);
640 WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->optionP), False, True, 20, 0, 8);
641 for (i = 0; fontOptions[i].option; i++) {
642 WMAddPopUpButtonItem(panel->optionP, _(fontOptions[i].label));
644 WMSetPopUpButtonAction(panel->optionP, selectedOption, panel);
646 label = WMCreateLabel(hbox);
647 WMSetLabelText(label, _("Sample Text"));
648 WMSetLabelTextAlignment(label, WARight);
649 WMAddBoxSubview(hbox, WMWidgetView(label), False, True, 80, 0, 2);
651 panel->sampleT = WMCreateTextField(hbox);
652 WMSetViewExpandsToParent(WMWidgetView(panel->sampleT), 10, 18, 10, 10);
653 WMSetTextFieldText(panel->sampleT, SAMPLE_TEXT);
654 WMAddBoxSubview(hbox, WMWidgetView(panel->sampleT), True, True, 60, 0, 0);
656 hbox = WMCreateBox(panel->box);
657 WMSetBoxHorizontal(hbox, True);
658 WMAddBoxSubview(panel->box, WMWidgetView(hbox), True, True, 100, 0, 2);
660 vbox = WMCreateBox(hbox);
661 WMSetBoxHorizontal(vbox, False);
662 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 240, 20, 4);
664 label = createListLabel(scr, vbox, _("Family"));
665 WMAddBoxSubview(vbox, WMWidgetView(label), False, True, 20, 0, 2);
667 /* family */
668 panel->familyL = WMCreateList(vbox);
669 WMAddBoxSubview(vbox, WMWidgetView(panel->familyL), True, True, 0, 0, 0);
670 if (panel->fonts) {
671 WMListItem *item;
672 for (i = 0; i < panel->fonts->familyn; i++) {
673 item = WMAddListItem(panel->familyL, panel->fonts->families[i].name);
674 item->clientData = panel->fonts->families + i;
676 } else
677 WMAddListItem(panel->familyL, "sans serif");
679 WMSetListAction(panel->familyL, selectedFamily, panel);
681 vbox = WMCreateBox(hbox);
682 WMSetBoxHorizontal(vbox, False);
683 WMAddBoxSubview(hbox, WMWidgetView(vbox), True, True, 10, 0, 0);
686 WMBox *box = WMCreateBox(vbox);
687 WMSetBoxHorizontal(box, True);
688 WMAddBoxSubview(vbox, WMWidgetView(box), False, True, 20, 0, 2);
690 label = createListLabel(scr, box, _("Style"));
691 WMAddBoxSubview(box, WMWidgetView(label), True, True, 20, 0, 4);
693 label = createListLabel(scr, box, _("Size"));
694 WMAddBoxSubview(box, WMWidgetView(label), False, True, 60, 0, 0);
696 box = WMCreateBox(vbox);
697 WMSetBoxHorizontal(box, True);
698 WMAddBoxSubview(vbox, WMWidgetView(box), True, True, 20, 0, 0);
700 panel->styleL = WMCreateList(box);
701 WMAddBoxSubview(box, WMWidgetView(panel->styleL), True, True, 0, 0, 4);
702 WMSetListAction(panel->styleL, selected, panel);
704 panel->sizeL = WMCreateList(box);
705 WMAddBoxSubview(box, WMWidgetView(panel->sizeL), False, True, 60, 0, 0);
706 for (i = 0; standardSizes[i]; i++) {
707 WMAddListItem(panel->sizeL, standardSizes[i]);
709 WMSetListAction(panel->sizeL, selected, panel);
712 WMMapSubwidgets(panel->box);
713 WMMapWidget(panel->box);
714 WMRealizeWidget(panel->box);
716 showData(panel);
719 Panel *InitFontSimple(WMWidget *parent)
721 _Panel *panel;
723 panel = wmalloc(sizeof(_Panel));
725 panel->sectionName = _("Font Configuration");
727 panel->description = _("Configure fonts for Window Maker titlebars, menus etc.");
729 panel->parent = parent;
731 panel->callbacks.createWidgets = createPanel;
732 panel->callbacks.updateDomain = storeData;
734 AddSection(panel, ICON_FILE);
736 return panel;