15 char *WMFontPanelFontChangedNotification
= "WMFontPanelFontChangedNotification";
20 typedef struct W_FontPanel
{
47 #define MIN_UPPER_HEIGHT 20
48 #define MIN_LOWER_HEIGHT 140
51 #define MAX_FONTS_TO_RETRIEVE 2000
53 #define BUTTON_SPACE_HEIGHT 40
56 #define MIN_HEIGHT (MIN_UPPER_HEIGHT+MIN_LOWER_HEIGHT+BUTTON_SPACE_HEIGHT)
58 #define DEF_UPPER_HEIGHT 60
59 #define DEF_LOWER_HEIGHT 310
62 #define DEF_HEIGHT (DEF_UPPER_HEIGHT+DEF_LOWER_HEIGHT)
67 static int scalableFontSizes
[] = {
84 static void getSelectedFont(FontPanel
*panel
, char buffer
[], int bufsize
);
87 static void arrangeLowerFrame(FontPanel
*panel
);
89 static void familyClick(WMWidget
*, void *);
90 static void typefaceClick(WMWidget
*, void *);
91 static void sizeClick(WMWidget
*, void *);
94 static void listFamilies(WMScreen
*scr
, WMFontPanel
*panel
);
98 splitViewConstrainCallback(WMSplitView
*sPtr
, int indView
, int *min
, int *max
)
101 *min
= MIN_UPPER_HEIGHT
;
103 *min
= MIN_LOWER_HEIGHT
;
107 notificationObserver(void *self
, WMNotification
*notif
)
109 WMFontPanel
*panel
= (WMFontPanel
*)self
;
110 void *object
= WMGetNotificationObject(notif
);
112 if (WMGetNotificationName(notif
) == WMViewSizeDidChangeNotification
) {
113 if (object
== WMWidgetView(panel
->win
)) {
114 int h
= WMWidgetHeight(panel
->win
);
115 int w
= WMWidgetWidth(panel
->win
);
117 WMResizeWidget(panel
->split
, w
, h
-BUTTON_SPACE_HEIGHT
);
119 WMMoveWidget(panel
->setB
, w
-80, h
-(BUTTON_SPACE_HEIGHT
-5));
121 WMMoveWidget(panel
->revertB
, w
-240, h
-(BUTTON_SPACE_HEIGHT
-5));
123 } else if (object
== WMWidgetView(panel
->upperF
)) {
125 if (WMWidgetHeight(panel
->upperF
) < MIN_UPPER_HEIGHT
) {
126 WMResizeWidget(panel
->upperF
, WMWidgetWidth(panel
->upperF
),
129 WMResizeWidget(panel
->sampleT
, WMWidgetWidth(panel
->upperF
)-20,
130 WMWidgetHeight(panel
->upperF
)-10);
133 } else if (object
== WMWidgetView(panel
->lowerF
)) {
135 if (WMWidgetHeight(panel
->lowerF
) < MIN_LOWER_HEIGHT
) {
136 WMResizeWidget(panel
->upperF
, WMWidgetWidth(panel
->upperF
),
139 WMMoveWidget(panel
->lowerF
, 0, WMWidgetHeight(panel
->upperF
)
140 + WMGetSplitViewDividerThickness(panel
->split
));
142 WMResizeWidget(panel
->lowerF
, WMWidgetWidth(panel
->lowerF
),
143 WMWidgetWidth(panel
->split
) - MIN_UPPER_HEIGHT
144 - WMGetSplitViewDividerThickness(panel
->split
));
146 arrangeLowerFrame(panel
);
154 closeWindow(WMWidget
*w
, void *data
)
156 FontPanel
*panel
= (FontPanel
*)data
;
158 WMHideFontPanel(panel
);
165 setClickedAction(WMWidget
*w
, void *data
)
167 FontPanel
*panel
= (FontPanel
*)data
;
170 (*panel
->action
)(panel
, panel
->data
);
175 revertClickedAction(WMWidget
*w
, void *data
)
177 FontPanel
*panel
= (FontPanel
*)data
;
184 WMGetFontPanel(WMScreen
*scr
)
187 WMColor
*dark
, *white
;
191 if (scr
->sharedFontPanel
)
192 return scr
->sharedFontPanel
;
195 panel
= wmalloc(sizeof(FontPanel
));
196 memset(panel
, 0, sizeof(FontPanel
));
198 panel
->win
= WMCreateWindow(scr
, "fontPanel");
199 /* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
200 WMResizeWidget(panel
->win
, DEF_WIDTH
, DEF_HEIGHT
);
201 WMSetWindowMinSize(panel
->win
, MIN_WIDTH
, MIN_HEIGHT
);
202 WMSetViewNotifySizeChanges(WMWidgetView(panel
->win
), True
);
204 WMSetWindowCloseAction(panel
->win
, closeWindow
, panel
);
206 panel
->split
= WMCreateSplitView(panel
->win
);
207 WMResizeWidget(panel
->split
, DEF_WIDTH
, DEF_HEIGHT
- BUTTON_SPACE_HEIGHT
);
208 WMSetSplitViewConstrainProc(panel
->split
, splitViewConstrainCallback
);
210 divThickness
= WMGetSplitViewDividerThickness(panel
->split
);
212 panel
->upperF
= WMCreateFrame(panel
->win
);
213 WMSetFrameRelief(panel
->upperF
, WRFlat
);
214 WMSetViewNotifySizeChanges(WMWidgetView(panel
->upperF
), True
);
215 panel
->lowerF
= WMCreateFrame(panel
->win
);
216 /* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
217 WMSetFrameRelief(panel
->lowerF
, WRFlat
);
218 WMSetViewNotifySizeChanges(WMWidgetView(panel
->lowerF
), True
);
220 WMAddSplitViewSubview(panel
->split
, W_VIEW(panel
->upperF
));
221 WMAddSplitViewSubview(panel
->split
, W_VIEW(panel
->lowerF
));
223 WMResizeWidget(panel
->upperF
, DEF_WIDTH
, DEF_UPPER_HEIGHT
);
225 WMResizeWidget(panel
->lowerF
, DEF_WIDTH
, DEF_LOWER_HEIGHT
);
227 WMMoveWidget(panel
->lowerF
, 0, 60+divThickness
);
229 white
= WMWhiteColor(scr
);
230 dark
= WMDarkGrayColor(scr
);
232 panel
->sampleT
= WMCreateTextField(panel
->upperF
);
233 WMResizeWidget(panel
->sampleT
, DEF_WIDTH
- 20, 50);
234 WMMoveWidget(panel
->sampleT
, 10, 10);
235 WMSetTextFieldText(panel
->sampleT
, _("Test!!!"));
237 font
= WMBoldSystemFontOfSize(scr
, 12);
239 panel
->famL
= WMCreateLabel(panel
->lowerF
);
240 WMSetWidgetBackgroundColor(panel
->famL
, dark
);
241 WMSetLabelText(panel
->famL
, _("Family"));
242 WMSetLabelFont(panel
->famL
, font
);
243 WMSetLabelTextColor(panel
->famL
, white
);
244 WMSetLabelRelief(panel
->famL
, WRSunken
);
245 WMSetLabelTextAlignment(panel
->famL
, WACenter
);
247 panel
->famLs
= WMCreateList(panel
->lowerF
);
248 WMSetListAction(panel
->famLs
, familyClick
, panel
);
250 panel
->typL
= WMCreateLabel(panel
->lowerF
);
251 WMSetWidgetBackgroundColor(panel
->typL
, dark
);
252 WMSetLabelText(panel
->typL
, _("Typeface"));
253 WMSetLabelFont(panel
->typL
, font
);
254 WMSetLabelTextColor(panel
->typL
, white
);
255 WMSetLabelRelief(panel
->typL
, WRSunken
);
256 WMSetLabelTextAlignment(panel
->typL
, WACenter
);
258 panel
->typLs
= WMCreateList(panel
->lowerF
);
259 WMSetListAction(panel
->typLs
, typefaceClick
, panel
);
261 panel
->sizL
= WMCreateLabel(panel
->lowerF
);
262 WMSetWidgetBackgroundColor(panel
->sizL
, dark
);
263 WMSetLabelText(panel
->sizL
, _("Size"));
264 WMSetLabelFont(panel
->sizL
, font
);
265 WMSetLabelTextColor(panel
->sizL
, white
);
266 WMSetLabelRelief(panel
->sizL
, WRSunken
);
267 WMSetLabelTextAlignment(panel
->sizL
, WACenter
);
269 panel
->sizT
= WMCreateTextField(panel
->lowerF
);
270 /* WMSetTextFieldAlignment(panel->sizT, WARight);*/
272 panel
->sizLs
= WMCreateList(panel
->lowerF
);
273 WMSetListAction(panel
->sizLs
, sizeClick
, panel
);
276 WMReleaseColor(white
);
277 WMReleaseColor(dark
);
279 panel
->setB
= WMCreateCommandButton(panel
->win
);
280 WMResizeWidget(panel
->setB
, 70, 24);
281 WMMoveWidget(panel
->setB
, 240, DEF_HEIGHT
- (BUTTON_SPACE_HEIGHT
-5));
282 WMSetButtonText(panel
->setB
, _("Set"));
283 WMSetButtonAction(panel
->setB
, setClickedAction
, panel
);
285 panel
->revertB
= WMCreateCommandButton(panel
->win
);
286 WMResizeWidget(panel
->revertB
, 70, 24);
287 WMMoveWidget(panel
->revertB
, 80, DEF_HEIGHT
- (BUTTON_SPACE_HEIGHT
-5));
288 WMSetButtonText(panel
->revertB
, _("Revert"));
289 WMSetButtonAction(panel
->revertB
, revertClickedAction
, panel
);
292 WMRealizeWidget(panel
->win
);
294 WMMapSubwidgets(panel
->upperF
);
295 WMMapSubwidgets(panel
->lowerF
);
296 WMMapSubwidgets(panel
->split
);
297 WMMapSubwidgets(panel
->win
);
299 WMUnmapWidget(panel
->revertB
);
301 arrangeLowerFrame(panel
);
303 scr
->sharedFontPanel
= panel
;
306 /* register notification observers */
307 WMAddNotificationObserver(notificationObserver
, panel
,
308 WMViewSizeDidChangeNotification
,
309 WMWidgetView(panel
->win
));
310 WMAddNotificationObserver(notificationObserver
, panel
,
311 WMViewSizeDidChangeNotification
,
312 WMWidgetView(panel
->upperF
));
313 WMAddNotificationObserver(notificationObserver
, panel
,
314 WMViewSizeDidChangeNotification
,
315 WMWidgetView(panel
->lowerF
));
318 listFamilies(scr
, panel
);
326 WMFreeFontPanel(WMFontPanel
*panel
)
328 if (panel
== WMWidgetScreen(panel
->win
)->sharedFontPanel
) {
329 WMWidgetScreen(panel
->win
)->sharedFontPanel
= NULL
;
331 WMRemoveNotificationObserver(panel
);
332 WMUnmapWidget(panel
->win
);
333 WMDestroyWidget(panel
->win
);
339 WMShowFontPanel(WMFontPanel
*panel
)
341 WMMapWidget(panel
->win
);
346 WMHideFontPanel(WMFontPanel
*panel
)
348 WMUnmapWidget(panel
->win
);
353 WMSetFontPanelFont(WMFontPanel
*panel
, WMFont
*font
)
360 WMSetFontPanelFontName(WMFontPanel
*panel
, char *fontName
)
368 WMGetFontPanelFont(WMFontPanel
*panel
)
370 return WMGetTextFieldFont(panel
->sampleT
);
375 WMGetFontPanelFontName(WMFontPanel
*panel
)
379 getSelectedFont(panel
, name
, sizeof(name
));
381 return wstrdup(name
);
387 WMSetFontPanelAction(WMFontPanel
*panel
, WMAction2
*action
, void *data
)
389 panel
->action
= action
;
398 arrangeLowerFrame(FontPanel
*panel
)
400 int width
= WMWidgetWidth(panel
->lowerF
) - 55 - 30;
401 int height
= WMWidgetHeight(panel
->split
) - WMWidgetHeight(panel
->upperF
);
404 #define LABEL_HEIGHT 20
406 height
-= WMGetSplitViewDividerThickness(panel
->split
);
409 height
-= LABEL_HEIGHT
+ 8;
411 fw
= (125*width
) / 235;
412 tw
= (110*width
) / 235;
415 WMMoveWidget(panel
->famL
, 10, 0);
416 WMResizeWidget(panel
->famL
, fw
, LABEL_HEIGHT
);
418 WMMoveWidget(panel
->famLs
, 10, 23);
419 WMResizeWidget(panel
->famLs
, fw
, height
);
421 WMMoveWidget(panel
->typL
, 10+fw
+3, 0);
422 WMResizeWidget(panel
->typL
, tw
, LABEL_HEIGHT
);
424 WMMoveWidget(panel
->typLs
, 10+fw
+3, 23);
425 WMResizeWidget(panel
->typLs
, tw
, height
);
427 WMMoveWidget(panel
->sizL
, 10+fw
+3+tw
+3, 0);
428 WMResizeWidget(panel
->sizL
, sw
+4, LABEL_HEIGHT
);
430 WMMoveWidget(panel
->sizT
, 10+fw
+3+tw
+3, 23);
431 WMResizeWidget(panel
->sizT
, sw
+4, 20);
433 WMMoveWidget(panel
->sizLs
, 10+fw
+3+tw
+3, 46);
434 WMResizeWidget(panel
->sizLs
, sw
+4, height
-23);
440 #define ALL_FONTS_MASK "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
457 #define NUM_FIELDS 14
462 parseFont(char *font
, char values
[NUM_FIELDS
][256])
466 char buffer
[256], *bptr
;
470 ptr
++; /* skip first - */
475 strcpy(values
[part
], buffer
);
484 strcpy(values
[part
], buffer
);
492 isXLFD(char *font
, int *length_ret
)
503 return c
==NUM_FIELDS
;
516 char showSetWidth
; /* when duplicated */
517 char showAddStyle
; /* when duplicated */
527 char *registry
, *encoding
;
529 char showFoundry
; /* when duplicated */
530 char showRegistry
; /* when duplicated */
539 compare_int(const void *a
, const void *b
)
555 addSizeToTypeface(Typeface
*face
, int size
)
560 for (j
= 0; j
< sizeof(scalableFontSizes
)/sizeof(int); j
++) {
561 size
= scalableFontSizes
[j
];
563 if (!WMCountInArray(face
->sizes
, (void*)size
)) {
564 WMAddToArray(face
->sizes
, (void*)size
);
567 WMSortArray(face
->sizes
, compare_int
);
569 if (!WMCountInArray(face
->sizes
, (void*)size
)) {
570 WMAddToArray(face
->sizes
, (void*)size
);
571 WMSortArray(face
->sizes
, compare_int
);
579 addTypefaceToFamily(Family
*family
, char fontFields
[NUM_FIELDS
][256])
584 if (family
->typefaces
) {
585 WM_ITERATE_ARRAY(family
->typefaces
, face
, i
) {
588 if (strcmp(face
->weight
, fontFields
[WEIGHT
]) != 0) {
591 if (strcmp(face
->slant
, fontFields
[SLANT
]) != 0) {
595 size
= atoi(fontFields
[PIXEL_SIZE
]);
597 addSizeToTypeface(face
, size
);
602 family
->typefaces
= WMCreateArray(4);
605 face
= wmalloc(sizeof(Typeface
));
606 memset(face
, 0, sizeof(Typeface
));
608 face
->weight
= wstrdup(fontFields
[WEIGHT
]);
609 face
->slant
= wstrdup(fontFields
[SLANT
]);
610 face
->setWidth
= wstrdup(fontFields
[SETWIDTH
]);
611 face
->addStyle
= wstrdup(fontFields
[ADD_STYLE
]);
613 face
->sizes
= WMCreateArray(4);
614 addSizeToTypeface(face
, atoi(fontFields
[PIXEL_SIZE
]));
616 WMAddToArray(family
->typefaces
, face
);
621 * families (same family name) (Hashtable of family -> array)
622 * registries (same family but different registries)
627 addFontToFamily(WMHashTable
*families
, char fontFields
[NUM_FIELDS
][256])
634 family
= WMHashGet(families
, fontFields
[FAMILY
]);
637 /* look for same encoding/registry and foundry */
638 WM_ITERATE_ARRAY(family
, fam
, i
) {
641 enc
= (strcmp(fam
->encoding
, fontFields
[ENCODING
]) == 0);
642 reg
= (strcmp(fam
->registry
, fontFields
[REGISTRY
]) == 0);
643 found
= (strcmp(fam
->foundry
, fontFields
[FOUNDRY
]) == 0);
645 if (enc
&& reg
&& found
) {
646 addTypefaceToFamily(fam
, fontFields
);
650 /* look for same encoding/registry */
651 WM_ITERATE_ARRAY(family
, fam
, i
) {
654 enc
= (strcmp(fam
->encoding
, fontFields
[ENCODING
]) == 0);
655 reg
= (strcmp(fam
->registry
, fontFields
[REGISTRY
]) == 0);
658 /* has the same encoding, but the foundry is different */
659 fam
->showFoundry
= 1;
661 fam
= wmalloc(sizeof(Family
));
662 memset(fam
, 0, sizeof(Family
));
664 fam
->name
= wstrdup(fontFields
[FAMILY
]);
665 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
666 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
667 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
668 fam
->showFoundry
= 1;
670 addTypefaceToFamily(fam
, fontFields
);
672 WMAddToArray(family
, fam
);
676 /* look for same foundry */
677 WM_ITERATE_ARRAY(family
, fam
, i
) {
680 found
= (strcmp(fam
->foundry
, fontFields
[FOUNDRY
]) == 0);
683 /* has the same foundry, but encoding is different */
684 fam
->showRegistry
= 1;
686 fam
= wmalloc(sizeof(Family
));
687 memset(fam
, 0, sizeof(Family
));
689 fam
->name
= wstrdup(fontFields
[FAMILY
]);
690 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
691 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
692 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
693 fam
->showRegistry
= 1;
695 addTypefaceToFamily(fam
, fontFields
);
697 WMAddToArray(family
, fam
);
701 /* foundry and encoding do not match anything known */
702 fam
= wmalloc(sizeof(Family
));
703 memset(fam
, 0, sizeof(Family
));
705 fam
->name
= wstrdup(fontFields
[FAMILY
]);
706 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
707 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
708 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
709 fam
->showFoundry
= 1;
710 fam
->showRegistry
= 1;
712 addTypefaceToFamily(fam
, fontFields
);
714 WMAddToArray(family
, fam
);
718 family
= WMCreateArray(8);
720 fam
= wmalloc(sizeof(Family
));
721 memset(fam
, 0, sizeof(Family
));
723 fam
->name
= wstrdup(fontFields
[FAMILY
]);
724 fam
->foundry
= wstrdup(fontFields
[FOUNDRY
]);
725 fam
->registry
= wstrdup(fontFields
[REGISTRY
]);
726 fam
->encoding
= wstrdup(fontFields
[ENCODING
]);
728 addTypefaceToFamily(fam
, fontFields
);
730 WMAddToArray(family
, fam
);
732 WMHashInsert(families
, fam
->name
, family
);
738 listFamilies(WMScreen
*scr
, WMFontPanel
*panel
)
741 WMHashTable
*families
;
742 char fields
[NUM_FIELDS
][256];
743 WMHashEnumerator enumer
;
747 fontList
= XListFonts(scr
->display
, ALL_FONTS_MASK
, MAX_FONTS_TO_RETRIEVE
,
750 WMRunAlertPanel(scr
, panel
->win
, _("Error"),
751 _("Could not retrieve font list"), _("OK"), NULL
, NULL
);
755 families
= WMCreateHashTable(WMStringPointerHashCallbacks
);
757 for (i
= 0; i
< count
; i
++) {
760 if (!isXLFD(fontList
[i
], &fname_len
)) {
764 if (fname_len
> 255) {
765 wwarning(_("font name %s is longer than 256, which is invalid."),
770 if (!parseFont(fontList
[i
], fields
)) {
774 addFontToFamily(families
, fields
);
777 enumer
= WMEnumerateHashTable(families
);
779 while ((array
= WMNextHashEnumeratorItem(&enumer
))) {
785 WM_ITERATE_ARRAY(array
, fam
, i
) {
786 strcpy(buffer
, fam
->name
);
788 if (fam
->showFoundry
) {
790 strcat(buffer
, fam
->foundry
);
793 if (fam
->showRegistry
) {
794 strcat(buffer
, " (");
795 strcat(buffer
, fam
->registry
);
797 strcat(buffer
, fam
->encoding
);
800 item
= WMAddListItem(panel
->famLs
, buffer
);
802 item
->clientData
= fam
;
806 WMSortListItems(panel
->famLs
);
808 WMFreeHashTable(families
);
813 getSelectedFont(FontPanel
*panel
, char buffer
[], int bufsize
)
821 item
= WMGetListSelectedItem(panel
->famLs
);
824 family
= (Family
*)item
->clientData
;
826 item
= WMGetListSelectedItem(panel
->typLs
);
829 face
= (Typeface
*)item
->clientData
;
831 size
= WMGetTextFieldText(panel
->sizT
);
833 snprintf(buffer
, bufsize
, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
848 preview(FontPanel
*panel
)
853 getSelectedFont(panel
, buffer
, sizeof(buffer
));
855 font
= WMCreateFont(WMWidgetScreen(panel
->win
), buffer
);
857 WMSetTextFieldFont(panel
->sampleT
, font
);
865 familyClick(WMWidget
*w
, void *data
)
867 WMList
*lPtr
= (WMList
*)w
;
870 FontPanel
*panel
= (FontPanel
*)data
;
873 /* current typeface and size */
879 /* must try to keep the same typeface and size for the new family */
880 item
= WMGetListSelectedItem(panel
->typLs
);
882 oface
= wstrdup(item
->text
);
884 osize
= WMGetTextFieldText(panel
->sizT
);
887 item
= WMGetListSelectedItem(lPtr
);
888 family
= (Family
*)item
->clientData
;
890 WMClearList(panel
->typLs
);
893 WM_ITERATE_ARRAY(family
->typefaces
, face
, i
) {
898 if (strcmp(face
->weight
, "medium") == 0) {
902 strcpy(buffer
, face
->weight
);
903 buffer
[0] = toupper(buffer
[0]);
910 if (strcmp(face
->slant
, "r") == 0) {
911 strcat(buffer
, _("Roman"));
913 } else if (strcmp(face
->slant
, "i") == 0) {
914 strcat(buffer
, _("Italic"));
915 } else if (strcmp(face
->slant
, "o") == 0) {
916 strcat(buffer
, _("Oblique"));
917 } else if (strcmp(face
->slant
, "ri") == 0) {
918 strcat(buffer
, _("Rev Italic"));
919 } else if (strcmp(face
->slant
, "ro") == 0) {
920 strcat(buffer
, _("Rev Oblique"));
922 strcat(buffer
, face
->slant
);
925 if (buffer
[0] == 0) {
926 strcpy(buffer
, _("Normal"));
930 fitem
= WMInsertListItem(panel
->typLs
, 0, buffer
);
932 fitem
= WMAddListItem(panel
->typLs
, buffer
);
933 fitem
->clientData
= face
;
937 facei
= WMFindRowOfListItemWithTitle(panel
->typLs
, oface
);
943 WMSelectListItem(panel
->typLs
, facei
);
944 typefaceClick(panel
->typLs
, panel
);
947 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, osize
);
950 WMSelectListItem(panel
->sizLs
, sizei
);
951 sizeClick(panel
->sizLs
, panel
);
963 typefaceClick(WMWidget
*w
, void *data
)
965 FontPanel
*panel
= (FontPanel
*)data
;
975 osize
= WMGetTextFieldText(panel
->sizT
);
978 item
= WMGetListSelectedItem(panel
->typLs
);
979 face
= (Typeface
*)item
->clientData
;
981 WMClearList(panel
->sizLs
);
983 WM_ITERATE_ARRAY(face
->sizes
, size
, i
) {
984 if ((int)size
!= 0) {
985 sprintf(buffer
, "%i", (int)size
);
987 WMAddListItem(panel
->sizLs
, buffer
);
992 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, osize
);
995 sizei
= WMFindRowOfListItemWithTitle(panel
->sizLs
, "12");
1000 WMSelectListItem(panel
->sizLs
, sizei
);
1001 WMSetListPosition(panel
->sizLs
, sizei
);
1002 sizeClick(panel
->sizLs
, panel
);
1012 sizeClick(WMWidget
*w
, void *data
)
1014 FontPanel
*panel
= (FontPanel
*)data
;
1017 item
= WMGetListSelectedItem(panel
->sizLs
);
1019 WMSetTextFieldText(panel
->sizT
, item
->text
);
1021 WMSelectTextFieldRange(panel
->sizT
, wmkrange(0, strlen(item
->text
)));