Coding style cleanup in dock.c
[wmaker-crm.git] / WPrefs.app / FontSimple.c
blobcde17b020e5b4d8695b6c3fc57192d80bc449347
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 struct {
95 char *option;
96 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 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 struct {
132 int weight;
133 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 struct {
150 int slant;
151 char *name;
152 } fontSlants[] = {
154 FC_SLANT_ROMAN, ""}, /*"Roman"}, */
156 FC_SLANT_ITALIC, "Italic"}, {
157 FC_SLANT_OBLIQUE, "Oblique"}, {
158 0, NULL}
161 static struct {
162 int width;
163 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 item = WMGetListSelectedItem(panel->styleL);
359 if (item)
360 oldStyle = (FontStyle *) item->clientData;
362 item = WMGetListSelectedItem(panel->familyL);
364 if (item) {
365 FontFamily *family = (FontFamily *) item->clientData;
366 int i, oldi = 0, oldscore = 0;
368 WMClearList(panel->styleL);
369 for (i = 0; i < family->stylen; i++) {
370 int j;
371 char *weight = "", *slant = "", *width = "";
372 WMListItem *item;
374 for (j = 0; fontWeights[j].name; j++)
375 if (fontWeights[j].weight == family->styles[i].weight) {
376 weight = fontWeights[j].name;
377 break;
379 for (j = 0; fontWidths[j].name; j++)
380 if (fontWidths[j].width == family->styles[i].width) {
381 width = fontWidths[j].name;
382 break;
384 for (j = 0; fontSlants[j].name; j++)
385 if (fontSlants[j].slant == family->styles[i].slant) {
386 slant = fontSlants[j].name;
387 break;
389 sprintf(buffer, "%s%s%s%s%s",
390 weight, *weight ? " " : "", slant, (*slant || *weight) ? " " : "", width);
391 if (!buffer[0])
392 strcpy(buffer, "Roman");
394 item = WMAddListItem(panel->styleL, buffer);
395 item->clientData = family->styles + i;
397 if (oldStyle) {
398 int score = 0;
400 if (oldStyle->width == family->styles[i].width)
401 score |= 1;
402 if (oldStyle->weight == family->styles[i].weight)
403 score |= 2;
404 if (oldStyle->slant == family->styles[i].slant)
405 score |= 4;
407 if (score > oldscore) {
408 oldi = i;
409 oldscore = score;
413 WMSelectListItem(panel->styleL, oldi);
416 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
417 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
418 FcChar8 *ofont;
419 char *nfont;
421 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
422 nfont = getSelectedFont(panel, ofont);
423 if (ofont)
424 wfree(ofont);
425 WMSetMenuItemRepresentedObject(item, nfont);
427 updateSampleFont(panel);
431 static void selected(WMWidget * w, void *data)
433 _Panel *panel = (_Panel *) data;
434 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
435 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
436 FcChar8 *ofont;
437 char *nfont;
439 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
440 nfont = getSelectedFont(panel, ofont);
441 if (ofont)
442 wfree(ofont);
444 WMSetMenuItemRepresentedObject(item, nfont);
446 updateSampleFont(panel);
449 static void selectedOption(WMWidget * w, void *data)
451 _Panel *panel = (_Panel *) data;
452 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
453 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
454 char *font;
456 font = (char *)WMGetMenuItemRepresentedObject(item);
457 if (font) {
458 FcPattern *pat;
460 pat = FcNameParse((FcChar8 *) font);
461 if (pat) {
462 char *name;
463 int weight, slant, width;
464 double size;
465 int distance, closest, found;
466 int i;
468 FcDefaultSubstitute(pat);
470 if (FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8 **) & name) != FcResultMatch)
471 name = "sans serif";
473 found = 0;
474 /* select family */
475 for (i = 0; i < WMGetListNumberOfRows(panel->familyL); i++) {
476 WMListItem *item = WMGetListItem(panel->familyL, i);
477 FontFamily *family = (FontFamily *) item->clientData;
479 if (strcasecmp(family->name, name) == 0) {
480 found = 1;
481 WMSelectListItem(panel->familyL, i);
482 WMSetListPosition(panel->familyL, i);
483 break;
486 if (!found)
487 WMSelectListItem(panel->familyL, -1);
488 selectedFamily(panel->familyL, panel);
490 /* select style */
491 if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch)
492 weight = FC_WEIGHT_NORMAL;
493 if (FcPatternGetInteger(pat, FC_WIDTH, 0, &width) != FcResultMatch)
494 width = FC_WIDTH_NORMAL;
495 if (FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch)
496 slant = FC_SLANT_ROMAN;
498 if (FcPatternGetDouble(pat, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
499 size = 10.0;
501 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->styleL); i++) {
502 WMListItem *item = WMGetListItem(panel->styleL, i);
503 FontStyle *style = (FontStyle *) item->clientData;
505 distance = ((abs(style->weight - weight) << 16) +
506 (abs(style->slant - slant) << 8) + (abs(style->width - width)));
508 if (i == 0 || distance < closest) {
509 closest = distance;
510 found = i;
511 if (distance == 0) {
512 break; /* perfect match */
516 WMSelectListItem(panel->styleL, found);
517 WMSetListPosition(panel->styleL, found);
519 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->sizeL); i++) {
520 WMListItem *item = WMGetListItem(panel->sizeL, i);
521 int distance;
523 distance = abs(size - atoi(item->text));
525 if (i == 0 || distance < closest) {
526 closest = distance;
527 found = i;
528 if (distance == 0) {
529 break; /* perfect match */
533 WMSelectListItem(panel->sizeL, found);
534 WMSetListPosition(panel->sizeL, found);
536 selected(NULL, panel);
537 } else
538 wwarning("Can't parse font '%s'", font);
541 updateSampleFont(panel);
544 static WMLabel *createListLabel(WMScreen * scr, WMWidget * parent, char *text)
546 WMLabel *label;
547 WMColor *color;
548 WMFont *boldFont = WMBoldSystemFontOfSize(scr, 12);
550 label = WMCreateLabel(parent);
551 WMSetLabelFont(label, boldFont);
552 WMSetLabelText(label, text);
553 WMSetLabelRelief(label, WRSunken);
554 WMSetLabelTextAlignment(label, WACenter);
555 color = WMDarkGrayColor(scr);
556 WMSetWidgetBackgroundColor(label, color);
557 WMReleaseColor(color);
558 color = WMWhiteColor(scr);
559 WMSetLabelTextColor(label, color);
560 WMReleaseColor(color);
562 WMReleaseFont(boldFont);
564 return label;
567 static void showData(_Panel * panel)
569 int i;
570 WMMenuItem *item;
572 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
573 char *ofont, *font;
575 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
577 ofont = WMGetMenuItemRepresentedObject(item);
578 if (ofont)
579 wfree(ofont);
581 font = GetStringForKey(fontOptions[i].option);
582 if (font)
583 font = wstrdup(font);
584 WMSetMenuItemRepresentedObject(item, font);
587 WMSetPopUpButtonSelectedItem(panel->optionP, 0);
588 selectedOption(panel->optionP, panel);
591 static void storeData(_Panel * panel)
593 int i;
594 WMMenuItem *item;
595 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
596 char *font;
598 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
600 font = WMGetMenuItemRepresentedObject(item);
601 if (font && *font) {
602 SetStringForKey(font, fontOptions[i].option);
607 static void createPanel(Panel * p)
609 _Panel *panel = (_Panel *) p;
610 WMScreen *scr = WMWidgetScreen(panel->parent);
611 WMLabel *label;
612 WMBox *hbox, *vbox;
613 int i;
615 lookup_available_fonts(panel);
617 panel->box = WMCreateBox(panel->parent);
618 WMSetViewExpandsToParent(WMWidgetView(panel->box), 5, 2, 5, 5);
619 WMSetBoxHorizontal(panel->box, False);
620 WMSetBoxBorderWidth(panel->box, 8);
621 WMMapWidget(panel->box);
623 hbox = WMCreateBox(panel->box);
624 WMSetBoxHorizontal(hbox, True);
625 WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 40, 22, 8);
627 vbox = WMCreateBox(hbox);
628 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 130, 0, 10);
629 WMSetBoxHorizontal(vbox, False);
630 panel->optionP = WMCreatePopUpButton(vbox);
631 WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->optionP), False, True, 20, 0, 8);
632 for (i = 0; fontOptions[i].option; i++) {
633 WMAddPopUpButtonItem(panel->optionP, _(fontOptions[i].label));
635 WMSetPopUpButtonAction(panel->optionP, selectedOption, panel);
637 label = WMCreateLabel(hbox);
638 WMSetLabelText(label, _("Sample Text"));
639 WMSetLabelTextAlignment(label, WARight);
640 WMAddBoxSubview(hbox, WMWidgetView(label), False, True, 80, 0, 2);
642 panel->sampleT = WMCreateTextField(hbox);
643 WMSetViewExpandsToParent(WMWidgetView(panel->sampleT), 10, 18, 10, 10);
644 WMSetTextFieldText(panel->sampleT, SAMPLE_TEXT);
645 WMAddBoxSubview(hbox, WMWidgetView(panel->sampleT), True, True, 60, 0, 0);
647 hbox = WMCreateBox(panel->box);
648 WMSetBoxHorizontal(hbox, True);
649 WMAddBoxSubview(panel->box, WMWidgetView(hbox), True, True, 100, 0, 2);
651 vbox = WMCreateBox(hbox);
652 WMSetBoxHorizontal(vbox, False);
653 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 240, 20, 4);
655 label = createListLabel(scr, vbox, _("Family"));
656 WMAddBoxSubview(vbox, WMWidgetView(label), False, True, 20, 0, 2);
658 /* family */
659 panel->familyL = WMCreateList(vbox);
660 WMAddBoxSubview(vbox, WMWidgetView(panel->familyL), True, True, 0, 0, 0);
661 if (panel->fonts) {
662 WMListItem *item;
663 for (i = 0; i < panel->fonts->familyn; i++) {
664 item = WMAddListItem(panel->familyL, panel->fonts->families[i].name);
665 item->clientData = panel->fonts->families + i;
667 } else
668 WMAddListItem(panel->familyL, "sans serif");
670 WMSetListAction(panel->familyL, selectedFamily, panel);
672 vbox = WMCreateBox(hbox);
673 WMSetBoxHorizontal(vbox, False);
674 WMAddBoxSubview(hbox, WMWidgetView(vbox), True, True, 10, 0, 0);
677 WMBox *box = WMCreateBox(vbox);
678 WMSetBoxHorizontal(box, True);
679 WMAddBoxSubview(vbox, WMWidgetView(box), False, True, 20, 0, 2);
681 label = createListLabel(scr, box, _("Style"));
682 WMAddBoxSubview(box, WMWidgetView(label), True, True, 20, 0, 4);
684 label = createListLabel(scr, box, _("Size"));
685 WMAddBoxSubview(box, WMWidgetView(label), False, True, 60, 0, 0);
687 box = WMCreateBox(vbox);
688 WMSetBoxHorizontal(box, True);
689 WMAddBoxSubview(vbox, WMWidgetView(box), True, True, 20, 0, 0);
691 panel->styleL = WMCreateList(box);
692 WMAddBoxSubview(box, WMWidgetView(panel->styleL), True, True, 0, 0, 4);
693 WMSetListAction(panel->styleL, selected, panel);
695 panel->sizeL = WMCreateList(box);
696 WMAddBoxSubview(box, WMWidgetView(panel->sizeL), False, True, 60, 0, 0);
697 for (i = 0; standardSizes[i]; i++) {
698 WMAddListItem(panel->sizeL, standardSizes[i]);
700 WMSetListAction(panel->sizeL, selected, panel);
703 WMMapSubwidgets(panel->box);
704 WMMapWidget(panel->box);
705 WMRealizeWidget(panel->box);
707 showData(panel);
710 Panel *InitFontSimple(WMScreen * scr, WMWidget * parent)
712 _Panel *panel;
714 panel = wmalloc(sizeof(_Panel));
716 panel->sectionName = _("Font Configuration");
718 panel->description = _("Configure fonts for Window Maker titlebars, menus etc.");
720 panel->parent = parent;
722 panel->callbacks.createWidgets = createPanel;
723 panel->callbacks.updateDomain = storeData;
725 AddSection(panel, ICON_FILE);
727 return panel;