12 typedef struct W_FontPanel
{
36 #define MIN_UPPER_HEIGHT 20
37 #define MIN_LOWER_HEIGHT 140
40 #define MAX_FONTS_TO_RETRIEVE 2000
42 #define BUTTON_SPACE_HEIGHT 40
45 #define MIN_HEIGHT (MIN_UPPER_HEIGHT+MIN_LOWER_HEIGHT+BUTTON_SPACE_HEIGHT)
47 #define DEF_UPPER_HEIGHT 60
48 #define DEF_LOWER_HEIGHT 310
51 #define DEF_HEIGHT (DEF_UPPER_HEIGHT+DEF_LOWER_HEIGHT)
56 static int scalableFontSizes
[] = {
73 static void getSelectedFont(FontPanel
*panel
, char buffer
[]);
76 static void arrangeLowerFrame(FontPanel
*panel
);
78 static void familyClick(WMWidget
*, void *);
79 static void typefaceClick(WMWidget
*, void *);
80 static void sizeClick(WMWidget
*, void *);
83 static void listFamilies(WMScreen
*scr
, WMFontPanel
*panel
);
86 splitViewConstrainCallback(WMSplitView
*sPtr
, int divIndex
, int *min
, int *max
)
88 *min
= MIN_UPPER_HEIGHT
;
89 *max
= WMWidgetHeight(sPtr
)-BUTTON_SPACE_HEIGHT
-MIN_LOWER_HEIGHT
;
94 notificationObserver(void *self
, WMNotification
*notif
)
96 WMFontPanel
*panel
= (WMFontPanel
*)self
;
97 void *object
= WMGetNotificationObject(notif
);
99 if (WMGetNotificationName(notif
) == WMViewSizeDidChangeNotification
) {
100 if (object
== WMWidgetView(panel
->win
)) {
101 int h
= WMWidgetHeight(panel
->win
);
102 int w
= WMWidgetWidth(panel
->win
);
104 WMResizeWidget(panel
->split
, w
, h
-BUTTON_SPACE_HEIGHT
);
106 WMMoveWidget(panel
->setB
, w
-80, h
-(BUTTON_SPACE_HEIGHT
-5));
108 WMMoveWidget(panel
->revertB
, w
-240, h
-(BUTTON_SPACE_HEIGHT
-5));
110 } else if (object
== WMWidgetView(panel
->upperF
)) {
112 if (WMWidgetHeight(panel
->upperF
) < MIN_UPPER_HEIGHT
) {
113 WMResizeWidget(panel
->upperF
, WMWidgetWidth(panel
->upperF
),
116 WMResizeWidget(panel
->sampleT
, WMWidgetWidth(panel
->upperF
)-20,
117 WMWidgetHeight(panel
->upperF
)-10);
120 } else if (object
== WMWidgetView(panel
->lowerF
)) {
122 if (WMWidgetHeight(panel
->lowerF
) < MIN_LOWER_HEIGHT
) {
123 WMResizeWidget(panel
->upperF
, WMWidgetWidth(panel
->upperF
),
126 WMMoveWidget(panel
->lowerF
, 0, WMWidgetHeight(panel
->upperF
)
127 + WMGetSplitViewDividerThickness(panel
->split
));
129 WMResizeWidget(panel
->lowerF
, WMWidgetWidth(panel
->lowerF
),
130 WMWidgetWidth(panel
->split
) - MIN_UPPER_HEIGHT
131 - WMGetSplitViewDividerThickness(panel
->split
));
133 arrangeLowerFrame(panel
);
141 closeWindow(WMWidget
*w
, void *data
)
143 FontPanel
*panel
= (FontPanel
*)data
;
145 WMHideFontPanel(panel
);
151 WMGetFontPanel(WMScreen
*scr
)
154 WMColor
*dark
, *white
;
158 if (scr
->sharedFontPanel
)
159 return scr
->sharedFontPanel
;
162 panel
= wmalloc(sizeof(FontPanel
));
163 memset(panel
, 0, sizeof(FontPanel
));
165 panel
->win
= WMCreateWindow(scr
, "fontPanel");
166 /* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
167 WMResizeWidget(panel
->win
, DEF_WIDTH
, DEF_HEIGHT
);
168 WMSetWindowMinSize(panel
->win
, MIN_WIDTH
, MIN_HEIGHT
);
169 WMSetViewNotifySizeChanges(WMWidgetView(panel
->win
), True
);
171 WMSetWindowCloseAction(panel
->win
, closeWindow
, panel
);
173 panel
->split
= WMCreateSplitView(panel
->win
);
174 WMResizeWidget(panel
->split
, DEF_WIDTH
, DEF_HEIGHT
- BUTTON_SPACE_HEIGHT
);
175 WMSetSplitViewConstrainProc(panel
->split
, splitViewConstrainCallback
);
177 divThickness
= WMGetSplitViewDividerThickness(panel
->split
);
179 panel
->upperF
= WMCreateFrame(panel
->win
);
180 WMSetFrameRelief(panel
->upperF
, WRFlat
);
181 WMSetViewNotifySizeChanges(WMWidgetView(panel
->upperF
), True
);
182 panel
->lowerF
= WMCreateFrame(panel
->win
);
183 /* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
184 WMSetFrameRelief(panel
->lowerF
, WRFlat
);
185 WMSetViewNotifySizeChanges(WMWidgetView(panel
->lowerF
), True
);
187 WMAddSplitViewSubview(panel
->split
, W_VIEW(panel
->upperF
));
188 WMAddSplitViewSubview(panel
->split
, W_VIEW(panel
->lowerF
));
190 WMResizeWidget(panel
->upperF
, DEF_WIDTH
, DEF_UPPER_HEIGHT
);
192 WMResizeWidget(panel
->lowerF
, DEF_WIDTH
, DEF_LOWER_HEIGHT
);
194 WMMoveWidget(panel
->lowerF
, 0, 60+divThickness
);
196 white
= WMWhiteColor(scr
);
197 dark
= WMDarkGrayColor(scr
);
199 panel
->sampleT
= WMCreateTextField(panel
->upperF
);
200 WMResizeWidget(panel
->sampleT
, DEF_WIDTH
- 20, 50);
201 WMMoveWidget(panel
->sampleT
, 10, 10);
202 WMSetTextFieldText(panel
->sampleT
, "Test!!!");
204 font
= WMBoldSystemFontOfSize(scr
, 12);
206 panel
->famL
= WMCreateLabel(panel
->lowerF
);
207 WMSetWidgetBackgroundColor(panel
->famL
, dark
);
208 WMSetLabelText(panel
->famL
, "Family");
209 WMSetLabelFont(panel
->famL
, font
);
210 WMSetLabelTextColor(panel
->famL
, white
);
211 WMSetLabelRelief(panel
->famL
, WRSunken
);
212 WMSetLabelTextAlignment(panel
->famL
, WACenter
);
214 panel
->famLs
= WMCreateList(panel
->lowerF
);
215 WMSetListAction(panel
->famLs
, familyClick
, panel
);
217 panel
->typL
= WMCreateLabel(panel
->lowerF
);
218 WMSetWidgetBackgroundColor(panel
->typL
, dark
);
219 WMSetLabelText(panel
->typL
, "Typeface");
220 WMSetLabelFont(panel
->typL
, font
);
221 WMSetLabelTextColor(panel
->typL
, white
);
222 WMSetLabelRelief(panel
->typL
, WRSunken
);
223 WMSetLabelTextAlignment(panel
->typL
, WACenter
);
225 panel
->typLs
= WMCreateList(panel
->lowerF
);
226 WMSetListAction(panel
->typLs
, typefaceClick
, panel
);
228 panel
->sizL
= WMCreateLabel(panel
->lowerF
);
229 WMSetWidgetBackgroundColor(panel
->sizL
, dark
);
230 WMSetLabelText(panel
->sizL
, "Size");
231 WMSetLabelFont(panel
->sizL
, font
);
232 WMSetLabelTextColor(panel
->sizL
, white
);
233 WMSetLabelRelief(panel
->sizL
, WRSunken
);
234 WMSetLabelTextAlignment(panel
->sizL
, WACenter
);
236 panel
->sizT
= WMCreateTextField(panel
->lowerF
);
237 /* WMSetTextFieldAlignment(panel->sizT, WARight);*/
239 panel
->sizLs
= WMCreateList(panel
->lowerF
);
240 WMSetListAction(panel
->sizLs
, sizeClick
, panel
);
243 WMReleaseColor(white
);
244 WMReleaseColor(dark
);
246 panel
->setB
= WMCreateCommandButton(panel
->win
);
247 WMResizeWidget(panel
->setB
, 70, 24);
248 WMMoveWidget(panel
->setB
, 240, DEF_HEIGHT
- (BUTTON_SPACE_HEIGHT
-5));
249 WMSetButtonText(panel
->setB
, "Set");
251 panel
->revertB
= WMCreateCommandButton(panel
->win
);
252 WMResizeWidget(panel
->revertB
, 70, 24);
253 WMMoveWidget(panel
->revertB
, 80, DEF_HEIGHT
- (BUTTON_SPACE_HEIGHT
-5));
254 WMSetButtonText(panel
->revertB
, "Revert");
256 WMRealizeWidget(panel
->win
);
258 WMMapSubwidgets(panel
->upperF
);
259 WMMapSubwidgets(panel
->lowerF
);
260 WMMapSubwidgets(panel
->split
);
261 WMMapSubwidgets(panel
->win
);
263 WMUnmapWidget(panel
->revertB
);
265 arrangeLowerFrame(panel
);
267 scr
->sharedFontPanel
= panel
;
270 /* register notification observers */
271 WMAddNotificationObserver(notificationObserver
, panel
,
272 WMViewSizeDidChangeNotification
,
273 WMWidgetView(panel
->win
));
274 WMAddNotificationObserver(notificationObserver
, panel
,
275 WMViewSizeDidChangeNotification
,
276 WMWidgetView(panel
->upperF
));
277 WMAddNotificationObserver(notificationObserver
, panel
,
278 WMViewSizeDidChangeNotification
,
279 WMWidgetView(panel
->lowerF
));
282 listFamilies(scr
, panel
);
290 WMFreeFontPanel(WMFontPanel
*panel
)
292 if (panel
== WMWidgetScreen(panel
->win
)->sharedFontPanel
) {
293 WMWidgetScreen(panel
->win
)->sharedFontPanel
= NULL
;
295 WMRemoveNotificationObserver(panel
);
296 WMUnmapWidget(panel
->win
);
297 WMDestroyWidget(panel
->win
);
303 WMShowFontPanel(WMFontPanel
*panel
)
305 WMMapWidget(panel
->win
);
310 WMHideFontPanel(WMFontPanel
*panel
)
312 WMUnmapWidget(panel
->win
);
317 WMSetFontPanelFont(WMFontPanel
*panel
, WMFont
*font
)
324 WMSetFontPanelFontName(WMFontPanel
*panel
, char *fontName
)
332 WMGetFontPanelFont(WMFontPanel
*panel
)
334 return WMGetTextFieldFont(panel
->sampleT
);
339 WMGetFontPanelFontName(WMFontPanel
*panel
)
343 getSelectedFont(panel
, name
);
345 return wstrdup(name
);
351 arrangeLowerFrame(FontPanel
*panel
)
353 int width
= WMWidgetWidth(panel
->lowerF
) - 55 - 30;
354 int height
= WMWidgetHeight(panel
->split
) - WMWidgetHeight(panel
->upperF
);
357 #define LABEL_HEIGHT 20
359 height
-= WMGetSplitViewDividerThickness(panel
->split
);
362 height
-= LABEL_HEIGHT
+ 8;
364 fw
= (125*width
) / 235;
365 tw
= (110*width
) / 235;
368 WMMoveWidget(panel
->famL
, 10, 0);
369 WMResizeWidget(panel
->famL
, fw
, LABEL_HEIGHT
);
371 WMMoveWidget(panel
->famLs
, 10, 23);
372 WMResizeWidget(panel
->famLs
, fw
, height
);
374 WMMoveWidget(panel
->typL
, 10+fw
+3, 0);
375 WMResizeWidget(panel
->typL
, tw
, LABEL_HEIGHT
);
377 WMMoveWidget(panel
->typLs
, 10+fw
+3, 23);
378 WMResizeWidget(panel
->typLs
, tw
, height
);
380 WMMoveWidget(panel
->sizL
, 10+fw
+3+tw
+3, 0);
381 WMResizeWidget(panel
->sizL
, sw
+4, LABEL_HEIGHT
);
383 WMMoveWidget(panel
->sizT
, 10+fw
+3+tw
+3, 23);
384 WMResizeWidget(panel
->sizT
, sw
+4, 20);
386 WMMoveWidget(panel
->sizLs
, 10+fw
+3+tw
+3, 46);
387 WMResizeWidget(panel
->sizLs
, sw
+4, height
-23);
393 #define ALL_FONTS_MASK "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
410 #define NUM_FIELDS 14
415 parseFont(char *font
, char values
[NUM_FIELDS
][256])
419 char buffer
[256], *bptr
;
423 ptr
++; /* skip first - */
428 strcpy(values
[part
], buffer
);
437 strcpy(values
[part
], buffer
);
445 isXLFD(char *font
, int *length_ret
)
456 return c
==NUM_FIELDS
;
469 char showSetWidth
; /* when duplicated */
470 char showAddStyle
; /* when duplicated */
480 char *registry
, *encoding
;
482 char showFoundry
; /* when duplicated */
483 char showRegistry
; /* when duplicated */
492 compare_int(const void *a
, const void *b
)
508 addSizeToTypeface(Typeface
*face
, int size
)
513 for (j
= 0; j
< sizeof(scalableFontSizes
)/sizeof(int); j
++) {
514 size
= scalableFontSizes
[j
];
516 if (!WMCountInBag(face
->sizes
, (void*)size
)) {
517 WMPutInBag(face
->sizes
, (void*)size
);
520 WMSortBag(face
->sizes
, compare_int
);
522 if (!WMCountInBag(face
->sizes
, (void*)size
)) {
523 WMPutInBag(face
->sizes
, (void*)size
);
524 WMSortBag(face
->sizes
, compare_int
);
532 addTypefaceToFamily(Family
*family
, char fontFields
[NUM_FIELDS
][256])
537 if (family
->typefaces
) {
538 for (i
= 0; i
< WMGetBagItemCount(family
->typefaces
); i
++) {
541 face
= WMGetFromBag(family
->typefaces
, i
);
543 if (strcmp(face
->weight
, fontFields
[WEIGHT
]) != 0) {
546 if (strcmp(face
->slant
, fontFields
[SLANT
]) != 0) {
550 size
= atoi(fontFields
[PIXEL_SIZE
]);
552 addSizeToTypeface(face
, size
);
557 family
->typefaces
= WMCreateBag(4);
560 face
= wmalloc(sizeof(Typeface
));
561 memset(face
, 0, sizeof(Typeface
));
563 face
->weight
= wstrdup(fontFields
[WEIGHT
]);
564 face
->slant
= wstrdup(fontFields
[SLANT
]);
565 face
->setWidth
= wstrdup(fontFields
[SETWIDTH
]);
566 face
->addStyle
= wstrdup(fontFields
[ADD_STYLE
]);
568 face
->sizes
= WMCreateBag(4);
569 addSizeToTypeface(face
, atoi(fontFields
[PIXEL_SIZE
]));
571 WMPutInBag(family
->typefaces
, face
);
577 * families (same family name) (Hashtable of family -> bag)
578 * registries (same family but different registries)
583 addFontToFamily(WMHashTable
*families
, char fontFields
[NUM_FIELDS
][256])
590 family
= WMHashGet(families
, fontFields
[FAMILY
]);
593 /* look for same encoding/registry and foundry */
594 for (i
= 0; i
< WMGetBagItemCount(family
); i
++) {
597 fam
= WMGetFromBag(family
, i
);
599 enc
= (strcmp(fam
->encoding
, fontFields
[ENCODING
]) == 0);
600 reg
= (strcmp(fam
->registry
, fontFields
[REGISTRY
]) == 0);
601 found
= (strcmp(fam
->foundry
, fontFields
[FOUNDRY
]) == 0);
603 if (enc
&& reg
&& found
) {
604 addTypefaceToFamily(fam
, fontFields
);
608 /* look for same encoding/registry */
609 for (i
= 0; i
< WMGetBagItemCount(family
); i
++) {
612 fam
= WMGetFromBag(family
, i
);
614 enc
= (strcmp(fam
->encoding
, fontFields
[ENCODING
]) == 0);
615 reg
= (strcmp(fam
->registry
, fontFields
[REGISTRY
]) == 0);
618 /* has the same encoding, but the foundry is different */
619 fam
->showFoundry
= 1;
621 fam
= wmalloc(sizeof(Family
));
622 memset(fam
, 0, sizeof(Family
));
624 fam
->name
= wstrdup(fontFields
[FAMILY
]);
625 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
626 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
627 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
628 fam
->showFoundry
= 1;
630 addTypefaceToFamily(fam
, fontFields
);
632 WMPutInBag(family
, fam
);
636 /* look for same foundry */
637 for (i
= 0; i
< WMGetBagItemCount(family
); i
++) {
640 fam
= WMGetFromBag(family
, i
);
642 found
= (strcmp(fam
->foundry
, fontFields
[FOUNDRY
]) == 0);
645 /* has the same foundry, but encoding is different */
646 fam
->showRegistry
= 1;
648 fam
= wmalloc(sizeof(Family
));
649 memset(fam
, 0, sizeof(Family
));
651 fam
->name
= wstrdup(fontFields
[FAMILY
]);
652 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
653 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
654 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
655 fam
->showRegistry
= 1;
657 addTypefaceToFamily(fam
, fontFields
);
659 WMPutInBag(family
, fam
);
663 /* foundry and encoding do not match anything known */
664 fam
= wmalloc(sizeof(Family
));
665 memset(fam
, 0, sizeof(Family
));
667 fam
->name
= wstrdup(fontFields
[FAMILY
]);
668 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
669 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
670 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
671 fam
->showFoundry
= 1;
672 fam
->showRegistry
= 1;
674 addTypefaceToFamily(fam
, fontFields
);
676 WMPutInBag(family
, fam
);
680 family
= WMCreateBag(8);
682 fam
= wmalloc(sizeof(Family
));
683 memset(fam
, 0, sizeof(Family
));
685 fam
->name
= wstrdup(fontFields
[FAMILY
]);
686 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
687 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
688 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
690 addTypefaceToFamily(fam
, fontFields
);
692 WMPutInBag(family
, fam
);
694 WMHashInsert(families
, fam
->name
, family
);
700 listFamilies(WMScreen
*scr
, WMFontPanel
*panel
)
705 WMHashTable
*families
= WMCreateHashTable(WMStringPointerHashCallbacks
);
706 char fields
[NUM_FIELDS
][256];
707 WMHashEnumerator enumer
;
710 fontList
= XListFonts(scr
->display
, ALL_FONTS_MASK
, MAX_FONTS_TO_RETRIEVE
,
713 WMRunAlertPanel(scr
, panel
->win
, "Error",
714 "Could not retrieve font list", "OK", NULL
, NULL
);
718 for (i
= 0; i
< count
; i
++) {
721 if (!isXLFD(fontList
[i
], &fname_len
)) {
725 if (fname_len
> 255) {
726 wwarning("font name %s is longer than 256, which is invalid.",
731 if (!parseFont(fontList
[i
], fields
)) {
735 addFontToFamily(families
, fields
);
738 enumer
= WMEnumerateHashTable(families
);
740 while ((bag
= WMNextHashEnumeratorItem(&enumer
))) {
746 for (i
= 0; i
< WMGetBagItemCount(bag
); i
++) {
747 fam
= WMGetFromBag(bag
, i
);
749 strcpy(buffer
, fam
->name
);
751 if (fam
->showFoundry
) {
753 strcat(buffer
, fam
->foundry
);
756 if (fam
->showRegistry
) {
757 strcat(buffer
, " (");
758 strcat(buffer
, fam
->registry
);
760 strcat(buffer
, fam
->encoding
);
763 item
= WMAddListItem(panel
->famLs
, buffer
);
765 item
->clientData
= fam
;
769 WMSortListItems(panel
->famLs
);
771 WMFreeHashTable(families
);
776 getSelectedFont(FontPanel
*panel
, char buffer
[])
784 item
= WMGetListSelectedItem(panel
->famLs
);
787 family
= (Family
*)item
->clientData
;
789 item
= WMGetListSelectedItem(panel
->typLs
);
792 face
= (Typeface
*)item
->clientData
;
794 size
= WMGetTextFieldText(panel
->sizT
);
796 sprintf(buffer
, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
811 preview(FontPanel
*panel
)
816 getSelectedFont(panel
, buffer
);
818 font
= WMCreateFont(WMWidgetScreen(panel
->win
), buffer
);
820 WMSetTextFieldFont(panel
->sampleT
, font
);
828 familyClick(WMWidget
*w
, void *data
)
830 WMList
*lPtr
= (WMList
*)w
;
833 FontPanel
*panel
= (FontPanel
*)data
;
836 /* current typeface and size */
842 /* must try to keep the same typeface and size for the new family */
843 item
= WMGetListSelectedItem(panel
->typLs
);
845 oface
= wstrdup(item
->text
);
847 osize
= WMGetTextFieldText(panel
->sizT
);
850 item
= WMGetListSelectedItem(lPtr
);
851 family
= (Family
*)item
->clientData
;
853 WMClearList(panel
->typLs
);
855 for (i
= 0; i
< WMGetBagItemCount(family
->typefaces
); i
++) {
860 face
= WMGetFromBag(family
->typefaces
, i
);
862 if (strcmp(face
->weight
, "medium") == 0) {
866 strcpy(buffer
, face
->weight
);
867 buffer
[0] = toupper(buffer
[0]);
874 if (strcmp(face
->slant
, "r") == 0) {
875 strcat(buffer
, "Roman");
877 } else if (strcmp(face
->slant
, "i") == 0) {
878 strcat(buffer
, "Italic");
879 } else if (strcmp(face
->slant
, "o") == 0) {
880 strcat(buffer
, "Oblique");
881 } else if (strcmp(face
->slant
, "ri") == 0) {
882 strcat(buffer
, "Rev Italic");
883 } else if (strcmp(face
->slant
, "ro") == 0) {
884 strcat(buffer
, "Rev Oblique");
886 strcat(buffer
, face
->slant
);
889 if (buffer
[0] == 0) {
890 strcpy(buffer
, "Normal");
894 fitem
= WMInsertListItem(panel
->typLs
, 0, buffer
);
896 fitem
= WMAddListItem(panel
->typLs
, buffer
);
897 fitem
->clientData
= face
;
901 facei
= WMFindRowOfListItemWithTitle(panel
->typLs
, oface
);
907 WMSelectListItem(panel
->typLs
, facei
);
908 typefaceClick(panel
->typLs
, panel
);
911 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, osize
);
914 WMSelectListItem(panel
->sizLs
, sizei
);
915 sizeClick(panel
->sizLs
, panel
);
927 typefaceClick(WMWidget
*w
, void *data
)
929 FontPanel
*panel
= (FontPanel
*)data
;
938 osize
= WMGetTextFieldText(panel
->sizT
);
941 item
= WMGetListSelectedItem(panel
->typLs
);
942 face
= (Typeface
*)item
->clientData
;
944 WMClearList(panel
->sizLs
);
946 for (i
= 0; i
< WMGetBagItemCount(face
->sizes
); i
++) {
949 size
= (int)WMGetFromBag(face
->sizes
, i
);
952 sprintf(buffer
, "%i", size
);
954 WMAddListItem(panel
->sizLs
, buffer
);
959 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, osize
);
962 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, "12");
967 WMSelectListItem(panel
->sizLs
, sizei
);
968 WMSetListPosition(panel
->sizLs
, sizei
);
969 sizeClick(panel
->sizLs
, panel
);
979 sizeClick(WMWidget
*w
, void *data
)
981 FontPanel
*panel
= (FontPanel
*)data
;
984 item
= WMGetListSelectedItem(panel
->sizLs
);
986 WMSetTextFieldText(panel
->sizT
, item
->text
);
988 WMSelectTextFieldRange(panel
->sizT
, wmkrange(0, strlen(item
->text
)));