Improve dockapp recognition
[wmaker-crm.git] / WPrefs.app / FontSimple.c
blob765a476dd50a72fd840c9762a49fcbedab818bf8
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
23 #include "WPrefs.h"
24 #include <unistd.h>
25 #include <fontconfig/fontconfig.h>
27 /* workaround for older fontconfig, that doesn't define these constants */
28 #ifndef FC_WEIGHT_NORMAL
29 /* Weights */
30 # define FC_WEIGHT_THIN 10
31 # define FC_WEIGHT_EXTRALIGHT 40
32 # define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
33 # define FC_WEIGHT_REGULAR 80
34 # define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
35 # define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
36 # define FC_WEIGHT_EXTRABOLD 205
37 # define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
38 # define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
39 /* Widths */
40 # define FC_WIDTH "width"
41 # define FC_WIDTH_ULTRACONDENSED 50
42 # define FC_WIDTH_EXTRACONDENSED 63
43 # define FC_WIDTH_CONDENSED 75
44 # define FC_WIDTH_SEMICONDENSED 87
45 # define FC_WIDTH_NORMAL 100
46 # define FC_WIDTH_SEMIEXPANDED 113
47 # define FC_WIDTH_EXPANDED 125
48 # define FC_WIDTH_EXTRAEXPANDED 150
49 # define FC_WIDTH_ULTRAEXPANDED 200
50 #endif
52 #define SAMPLE_TEXT "The Lazy Fox Jumped Ipsum Foobar 1234 - 56789"
54 typedef struct {
55 int weight;
56 int width;
57 int slant;
58 } FontStyle;
60 typedef struct {
61 char *name;
62 int stylen;
63 FontStyle *styles;
64 } FontFamily;
66 typedef struct {
67 int familyn;
68 FontFamily *families;
69 } FontList;
71 typedef struct _Panel {
72 WMBox *box;
73 char *sectionName;
75 char *description;
77 CallbackRec callbacks;
79 WMWidget *parent;
81 WMPopUpButton *optionP;
83 WMList *familyL;
84 WMList *styleL;
86 WMList *sizeL;
88 WMTextField *sampleT;
90 FontList *fonts;
91 } _Panel;
93 #define ICON_FILE "fonts"
95 static struct {
96 char *option;
97 char *label;
98 } fontOptions[] = {
100 "WindowTitleFont", N_("Window Title")}, {
101 "MenuTitleFont", N_("Menu Title")}, {
102 "MenuTextFont", N_("Menu Text")}, {
103 "IconTitleFont", N_("Icon Title")}, {
104 "ClipTitleFont", N_("Clip Title")}, {
105 "LargeDisplayFont", N_("Desktop Caption")}, {
106 NULL, NULL},};
108 static char *standardSizes[] = {
109 "6",
110 "8",
111 "9",
112 "10",
113 "11",
114 "12",
115 "13",
116 "14",
117 "15",
118 "16",
119 "18",
120 "20",
121 "22",
122 "24",
123 "28",
124 "32",
125 "36",
126 "48",
127 "64",
128 "72",
129 NULL
132 static struct {
133 int weight;
134 char *name;
135 } fontWeights[] = {
137 FC_WEIGHT_THIN, "Thin"}, {
138 FC_WEIGHT_EXTRALIGHT, "ExtraLight"}, {
139 FC_WEIGHT_LIGHT, "Light"}, {
140 FC_WEIGHT_NORMAL, "Normal"}, {
141 FC_WEIGHT_MEDIUM, ""}, /*"medium"}, */
143 FC_WEIGHT_DEMIBOLD, "DemiBold"}, {
144 FC_WEIGHT_BOLD, "Bold"}, {
145 FC_WEIGHT_EXTRABOLD, "ExtraBold"}, {
146 FC_WEIGHT_BLACK, "Black"}, {
147 0, NULL}
150 static struct {
151 int slant;
152 char *name;
153 } fontSlants[] = {
155 FC_SLANT_ROMAN, ""}, /*"Roman"}, */
157 FC_SLANT_ITALIC, "Italic"}, {
158 FC_SLANT_OBLIQUE, "Oblique"}, {
159 0, NULL}
162 static struct {
163 int width;
164 char *name;
165 } fontWidths[] = {
167 FC_WIDTH_ULTRACONDENSED, "UltraCondensed"}, {
168 FC_WIDTH_EXTRACONDENSED, "ExtraCondensed"}, {
169 FC_WIDTH_CONDENSED, "Condensed"}, {
170 FC_WIDTH_SEMICONDENSED, "SemiCondensed"}, {
171 FC_WIDTH_NORMAL, ""}, /*"normal"}, */
173 FC_WIDTH_SEMIEXPANDED, "SemiExpanded"}, {
174 FC_WIDTH_EXPANDED, "Expanded"}, {
175 FC_WIDTH_EXTRAEXPANDED, "ExtraExpanded"}, {
176 FC_WIDTH_ULTRAEXPANDED, "UltraExpanded"}, {
177 0, NULL}
180 static int compare_family(const void *a, const void *b)
182 FontFamily *fa = (FontFamily *) a;
183 FontFamily *fb = (FontFamily *) b;
184 return strcmp(fa->name, fb->name);
187 static int compare_styles(const void *a, const void *b)
189 FontStyle *sa = (FontStyle *) a;
190 FontStyle *sb = (FontStyle *) b;
191 int compare;
193 compare = sa->weight - sb->weight;
194 if (compare != 0)
195 return compare;
196 compare = sa->slant - sb->slant;
197 if (compare != 0)
198 return compare;
199 return (sa->width - sb->width);
202 static void lookup_available_fonts(_Panel * panel)
204 FcPattern *pat = FcPatternCreate();
205 FcObjectSet *os;
206 FcFontSet *fonts;
207 FontFamily *family;
209 os = FcObjectSetBuild(FC_FAMILY, FC_WEIGHT, FC_WIDTH, FC_SLANT, NULL);
211 fonts = FcFontList(0, pat, os);
213 if (fonts) {
214 int i;
216 panel->fonts = wmalloc(sizeof(FontList));
217 panel->fonts->familyn = 0;
218 panel->fonts->families = wmalloc(sizeof(FontFamily) * fonts->nfont);
220 for (i = 0; i < fonts->nfont; i++) {
221 char *name;
222 int weight, slant, width;
223 int j, found;
225 if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, (FcChar8 **) & name) !=
226 FcResultMatch)
227 continue;
229 if (FcPatternGetInteger(fonts->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch)
230 weight = FC_WEIGHT_MEDIUM;
232 if (FcPatternGetInteger(fonts->fonts[i], FC_WIDTH, 0, &width) != FcResultMatch)
233 width = FC_WIDTH_NORMAL;
235 if (FcPatternGetInteger(fonts->fonts[i], FC_SLANT, 0, &slant) != FcResultMatch)
236 slant = FC_SLANT_ROMAN;
238 found = -1;
239 for (j = 0; j < panel->fonts->familyn && found < 0; j++)
240 if (strcasecmp(panel->fonts->families[j].name, name) == 0)
241 found = j;
243 if (found < 0) {
244 panel->fonts->families[panel->fonts->familyn++].name = wstrdup(name);
245 family = panel->fonts->families + panel->fonts->familyn - 1;
246 family->stylen = 0;
247 family->styles = NULL;
248 } else
249 family = panel->fonts->families + found;
251 family->stylen++;
252 family->styles = wrealloc(family->styles, sizeof(FontStyle) * family->stylen);
253 family->styles[family->stylen - 1].weight = weight;
254 family->styles[family->stylen - 1].slant = slant;
255 family->styles[family->stylen - 1].width = width;
257 qsort(panel->fonts->families, panel->fonts->familyn, sizeof(FontFamily), compare_family);
259 for (i = 0; i < panel->fonts->familyn; i++) {
260 qsort(panel->fonts->families[i].styles, panel->fonts->families[i].stylen,
261 sizeof(FontStyle), compare_styles);
264 FcFontSetDestroy(fonts);
266 if (os)
267 FcObjectSetDestroy(os);
268 if (pat)
269 FcPatternDestroy(pat);
271 panel->fonts->families[panel->fonts->familyn++].name = wstrdup("sans serif");
272 family = panel->fonts->families + panel->fonts->familyn - 1;
273 family->styles = wmalloc(sizeof(FontStyle) * 2);
274 family->stylen = 2;
275 family->styles[0].weight = FC_WEIGHT_MEDIUM;
276 family->styles[0].slant = FC_SLANT_ROMAN;
277 family->styles[0].width = FC_WIDTH_NORMAL;
278 family->styles[1].weight = FC_WEIGHT_BOLD;
279 family->styles[1].slant = FC_SLANT_ROMAN;
280 family->styles[1].width = FC_WIDTH_NORMAL;
282 panel->fonts->families[panel->fonts->familyn++].name = wstrdup("serif");
283 family = panel->fonts->families + panel->fonts->familyn - 1;
284 family->styles = wmalloc(sizeof(FontStyle) * 2);
285 family->stylen = 2;
286 family->styles[0].weight = FC_WEIGHT_MEDIUM;
287 family->styles[0].slant = FC_SLANT_ROMAN;
288 family->styles[0].width = FC_WIDTH_NORMAL;
289 family->styles[1].weight = FC_WEIGHT_BOLD;
290 family->styles[1].slant = FC_SLANT_ROMAN;
291 family->styles[1].width = FC_WIDTH_NORMAL;
294 static char *getSelectedFont(_Panel * panel, FcChar8 * curfont)
296 WMListItem *item;
297 FcPattern *pat;
298 char *name;
300 if (curfont)
301 pat = FcNameParse(curfont);
302 else
303 pat = FcPatternCreate();
305 item = WMGetListSelectedItem(panel->familyL);
306 if (item) {
307 FcPatternDel(pat, FC_FAMILY);
308 FcPatternAddString(pat, FC_FAMILY, (FcChar8 *) item->text);
311 item = WMGetListSelectedItem(panel->styleL);
312 if (item) {
313 FontStyle *style = (FontStyle *) item->clientData;
315 FcPatternDel(pat, FC_WEIGHT);
316 FcPatternAddInteger(pat, FC_WEIGHT, style->weight);
318 FcPatternDel(pat, FC_WIDTH);
319 FcPatternAddInteger(pat, FC_WIDTH, style->width);
321 FcPatternDel(pat, FC_SLANT);
322 FcPatternAddInteger(pat, FC_SLANT, style->slant);
325 item = WMGetListSelectedItem(panel->sizeL);
326 if (item) {
327 FcPatternDel(pat, FC_PIXEL_SIZE);
328 FcPatternAddDouble(pat, FC_PIXEL_SIZE, atoi(item->text));
331 name = (char *)FcNameUnparse(pat);
332 FcPatternDestroy(pat);
334 return name;
337 static void updateSampleFont(_Panel * panel)
339 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP,
340 WMGetPopUpButtonSelectedItem(panel->optionP));
341 char *fn = WMGetMenuItemRepresentedObject(item);
343 if (fn) {
344 WMFont *font = WMCreateFont(WMWidgetScreen(panel->box), fn);
345 if (font) {
346 WMSetTextFieldFont(panel->sampleT, font);
347 WMReleaseFont(font);
352 static void selectedFamily(WMWidget * w, void *data)
354 _Panel *panel = (_Panel *) data;
355 WMListItem *item;
356 FontStyle *oldStyle = NULL;
357 char buffer[1024];
359 item = WMGetListSelectedItem(panel->styleL);
360 if (item)
361 oldStyle = (FontStyle *) item->clientData;
363 item = WMGetListSelectedItem(panel->familyL);
365 if (item) {
366 FontFamily *family = (FontFamily *) item->clientData;
367 int i, oldi = 0, oldscore = 0;
369 WMClearList(panel->styleL);
370 for (i = 0; i < family->stylen; i++) {
371 int j;
372 char *weight = "", *slant = "", *width = "";
373 WMListItem *item;
375 for (j = 0; fontWeights[j].name; j++)
376 if (fontWeights[j].weight == family->styles[i].weight) {
377 weight = fontWeights[j].name;
378 break;
380 for (j = 0; fontWidths[j].name; j++)
381 if (fontWidths[j].width == family->styles[i].width) {
382 width = fontWidths[j].name;
383 break;
385 for (j = 0; fontSlants[j].name; j++)
386 if (fontSlants[j].slant == family->styles[i].slant) {
387 slant = fontSlants[j].name;
388 break;
390 sprintf(buffer, "%s%s%s%s%s",
391 weight, *weight ? " " : "", slant, (*slant || *weight) ? " " : "", width);
392 if (!buffer[0])
393 strcpy(buffer, "Roman");
395 item = WMAddListItem(panel->styleL, buffer);
396 item->clientData = family->styles + i;
398 if (oldStyle) {
399 int score = 0;
401 if (oldStyle->width == family->styles[i].width)
402 score |= 1;
403 if (oldStyle->weight == family->styles[i].weight)
404 score |= 2;
405 if (oldStyle->slant == family->styles[i].slant)
406 score |= 4;
408 if (score > oldscore) {
409 oldi = i;
410 oldscore = score;
414 WMSelectListItem(panel->styleL, oldi);
417 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
418 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
419 FcChar8 *ofont;
420 char *nfont;
422 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
423 nfont = getSelectedFont(panel, ofont);
424 if (ofont)
425 wfree(ofont);
426 WMSetMenuItemRepresentedObject(item, nfont);
428 updateSampleFont(panel);
432 static void selected(WMWidget * w, void *data)
434 _Panel *panel = (_Panel *) data;
435 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
436 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
437 FcChar8 *ofont;
438 char *nfont;
440 ofont = (FcChar8 *) WMGetMenuItemRepresentedObject(item);
441 nfont = getSelectedFont(panel, ofont);
442 if (ofont)
443 wfree(ofont);
445 WMSetMenuItemRepresentedObject(item, nfont);
447 updateSampleFont(panel);
450 static void selectedOption(WMWidget * w, void *data)
452 _Panel *panel = (_Panel *) data;
453 int index = WMGetPopUpButtonSelectedItem(panel->optionP);
454 WMMenuItem *item = WMGetPopUpButtonMenuItem(panel->optionP, index);
455 char *font;
457 font = (char *)WMGetMenuItemRepresentedObject(item);
458 if (font) {
459 FcPattern *pat;
461 pat = FcNameParse((FcChar8 *) font);
462 if (pat) {
463 char *name;
464 int weight, slant, width;
465 double size;
466 int distance, closest, found;
467 int i;
469 FcDefaultSubstitute(pat);
471 if (FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8 **) & name) != FcResultMatch)
472 name = "sans serif";
474 found = 0;
475 /* select family */
476 for (i = 0; i < WMGetListNumberOfRows(panel->familyL); i++) {
477 WMListItem *item = WMGetListItem(panel->familyL, i);
478 FontFamily *family = (FontFamily *) item->clientData;
480 if (strcasecmp(family->name, name) == 0) {
481 found = 1;
482 WMSelectListItem(panel->familyL, i);
483 WMSetListPosition(panel->familyL, i);
484 break;
487 if (!found)
488 WMSelectListItem(panel->familyL, -1);
489 selectedFamily(panel->familyL, panel);
491 /* select style */
492 if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch)
493 weight = FC_WEIGHT_NORMAL;
494 if (FcPatternGetInteger(pat, FC_WIDTH, 0, &width) != FcResultMatch)
495 width = FC_WIDTH_NORMAL;
496 if (FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch)
497 slant = FC_SLANT_ROMAN;
499 if (FcPatternGetDouble(pat, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
500 size = 10.0;
502 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->styleL); i++) {
503 WMListItem *item = WMGetListItem(panel->styleL, i);
504 FontStyle *style = (FontStyle *) item->clientData;
506 distance = ((abs(style->weight - weight) << 16) +
507 (abs(style->slant - slant) << 8) + (abs(style->width - width)));
509 if (i == 0 || distance < closest) {
510 closest = distance;
511 found = i;
512 if (distance == 0) {
513 break; /* perfect match */
517 WMSelectListItem(panel->styleL, found);
518 WMSetListPosition(panel->styleL, found);
520 for (i = 0, found = 0, closest = 0; i < WMGetListNumberOfRows(panel->sizeL); i++) {
521 WMListItem *item = WMGetListItem(panel->sizeL, i);
522 int distance;
524 distance = abs(size - atoi(item->text));
526 if (i == 0 || distance < closest) {
527 closest = distance;
528 found = i;
529 if (distance == 0) {
530 break; /* perfect match */
534 WMSelectListItem(panel->sizeL, found);
535 WMSetListPosition(panel->sizeL, found);
537 selected(NULL, panel);
538 } else
539 wwarning("Can't parse font '%s'", font);
542 updateSampleFont(panel);
545 static WMLabel *createListLabel(WMScreen * scr, WMWidget * parent, char *text)
547 WMLabel *label;
548 WMColor *color;
549 WMFont *boldFont = WMBoldSystemFontOfSize(scr, 12);
551 label = WMCreateLabel(parent);
552 WMSetLabelFont(label, boldFont);
553 WMSetLabelText(label, text);
554 WMSetLabelRelief(label, WRSunken);
555 WMSetLabelTextAlignment(label, WACenter);
556 color = WMDarkGrayColor(scr);
557 WMSetWidgetBackgroundColor(label, color);
558 WMReleaseColor(color);
559 color = WMWhiteColor(scr);
560 WMSetLabelTextColor(label, color);
561 WMReleaseColor(color);
563 WMReleaseFont(boldFont);
565 return label;
568 static void showData(_Panel * panel)
570 int i;
571 WMMenuItem *item;
573 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
574 char *ofont, *font;
576 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
578 ofont = WMGetMenuItemRepresentedObject(item);
579 if (ofont)
580 wfree(ofont);
582 font = GetStringForKey(fontOptions[i].option);
583 if (font)
584 font = wstrdup(font);
585 WMSetMenuItemRepresentedObject(item, font);
588 WMSetPopUpButtonSelectedItem(panel->optionP, 0);
589 selectedOption(panel->optionP, panel);
592 static void storeData(_Panel * panel)
594 int i;
595 WMMenuItem *item;
596 for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
597 char *font;
599 item = WMGetPopUpButtonMenuItem(panel->optionP, i);
601 font = WMGetMenuItemRepresentedObject(item);
602 if (font && *font) {
603 SetStringForKey(font, fontOptions[i].option);
608 static void createPanel(Panel * p)
610 _Panel *panel = (_Panel *) p;
611 WMScreen *scr = WMWidgetScreen(panel->parent);
612 WMLabel *label;
613 WMBox *hbox, *vbox;
614 int i;
616 lookup_available_fonts(panel);
618 panel->box = WMCreateBox(panel->parent);
619 WMSetViewExpandsToParent(WMWidgetView(panel->box), 5, 2, 5, 5);
620 WMSetBoxHorizontal(panel->box, False);
621 WMSetBoxBorderWidth(panel->box, 8);
622 WMMapWidget(panel->box);
624 hbox = WMCreateBox(panel->box);
625 WMSetBoxHorizontal(hbox, True);
626 WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 40, 22, 8);
628 vbox = WMCreateBox(hbox);
629 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 130, 0, 10);
630 WMSetBoxHorizontal(vbox, False);
631 panel->optionP = WMCreatePopUpButton(vbox);
632 WMAddBoxSubviewAtEnd(vbox, WMWidgetView(panel->optionP), False, True, 20, 0, 8);
633 for (i = 0; fontOptions[i].option; i++) {
634 WMAddPopUpButtonItem(panel->optionP, _(fontOptions[i].label));
636 WMSetPopUpButtonAction(panel->optionP, selectedOption, panel);
638 label = WMCreateLabel(hbox);
639 WMSetLabelText(label, _("Sample Text"));
640 WMSetLabelTextAlignment(label, WARight);
641 WMAddBoxSubview(hbox, WMWidgetView(label), False, True, 80, 0, 2);
643 panel->sampleT = WMCreateTextField(hbox);
644 WMSetViewExpandsToParent(WMWidgetView(panel->sampleT), 10, 18, 10, 10);
645 WMSetTextFieldText(panel->sampleT, SAMPLE_TEXT);
646 WMAddBoxSubview(hbox, WMWidgetView(panel->sampleT), True, True, 60, 0, 0);
648 hbox = WMCreateBox(panel->box);
649 WMSetBoxHorizontal(hbox, True);
650 WMAddBoxSubview(panel->box, WMWidgetView(hbox), True, True, 100, 0, 2);
652 vbox = WMCreateBox(hbox);
653 WMSetBoxHorizontal(vbox, False);
654 WMAddBoxSubview(hbox, WMWidgetView(vbox), False, True, 240, 20, 4);
656 label = createListLabel(scr, vbox, _("Family"));
657 WMAddBoxSubview(vbox, WMWidgetView(label), False, True, 20, 0, 2);
659 /* family */
660 panel->familyL = WMCreateList(vbox);
661 WMAddBoxSubview(vbox, WMWidgetView(panel->familyL), True, True, 0, 0, 0);
662 if (panel->fonts) {
663 WMListItem *item;
664 for (i = 0; i < panel->fonts->familyn; i++) {
665 item = WMAddListItem(panel->familyL, panel->fonts->families[i].name);
666 item->clientData = panel->fonts->families + i;
668 } else
669 WMAddListItem(panel->familyL, "sans serif");
671 WMSetListAction(panel->familyL, selectedFamily, panel);
673 vbox = WMCreateBox(hbox);
674 WMSetBoxHorizontal(vbox, False);
675 WMAddBoxSubview(hbox, WMWidgetView(vbox), True, True, 10, 0, 0);
678 WMBox *box = WMCreateBox(vbox);
679 WMSetBoxHorizontal(box, True);
680 WMAddBoxSubview(vbox, WMWidgetView(box), False, True, 20, 0, 2);
682 label = createListLabel(scr, box, _("Style"));
683 WMAddBoxSubview(box, WMWidgetView(label), True, True, 20, 0, 4);
685 label = createListLabel(scr, box, _("Size"));
686 WMAddBoxSubview(box, WMWidgetView(label), False, True, 60, 0, 0);
688 box = WMCreateBox(vbox);
689 WMSetBoxHorizontal(box, True);
690 WMAddBoxSubview(vbox, WMWidgetView(box), True, True, 20, 0, 0);
692 panel->styleL = WMCreateList(box);
693 WMAddBoxSubview(box, WMWidgetView(panel->styleL), True, True, 0, 0, 4);
694 WMSetListAction(panel->styleL, selected, panel);
696 panel->sizeL = WMCreateList(box);
697 WMAddBoxSubview(box, WMWidgetView(panel->sizeL), False, True, 60, 0, 0);
698 for (i = 0; standardSizes[i]; i++) {
699 WMAddListItem(panel->sizeL, standardSizes[i]);
701 WMSetListAction(panel->sizeL, selected, panel);
704 WMMapSubwidgets(panel->box);
705 WMMapWidget(panel->box);
706 WMRealizeWidget(panel->box);
708 showData(panel);
711 Panel *InitFontSimple(WMScreen * scr, WMWidget * parent)
713 _Panel *panel;
715 panel = wmalloc(sizeof(_Panel));
716 memset(panel, 0, sizeof(_Panel));
718 panel->sectionName = _("Font Configuration");
720 panel->description = _("Configure fonts for Window Maker titlebars, menus etc.");
722 panel->parent = parent;
724 panel->callbacks.createWidgets = createPanel;
725 panel->callbacks.updateDomain = storeData;
727 AddSection(panel, ICON_FILE);
729 return panel;