1 /* 2 * NeXFontSel 3 * 4 * YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp> 5 */ 6 7 /* $Id: nexfontsel.h,v 1.2 2003/11/09 20:15:57 elca Exp $ */ 8 9 #ifndef _NEXFONTSEL_H 10 #define _NEXFONTSEL_H 11 12 #define DEFAULTPATTERN "-*-*-*-*-*-*-*-*-*-*-*-*-*-*" 13 14 #define MIN_APP_DEFAULTS_VERSION 1 15 #define FIELD_COUNT 14 16 #define DELIM '-' 17 18 /* number of font names to parse in each background iteration */ 19 #ifndef PARSE_QUANTUM 20 #define PARSE_QUANTUM 25 21 #endif 22 23 #define NZ NULL,ZERO 24 #define BACKGROUND 10 25 26 /* from X11/IntrinsicP.h */ 27 typedef void (*XtProc)(/*void*/); 28 29 typedef enum {ValidateCurrentField, SkipCurrentField} ValidateAction; 30 31 typedef struct _FieldValue { 32 int field; 33 String string; 34 Widget menu_item; 35 int count; /* of fonts */ 36 int allocated; 37 int *font; 38 Boolean enable; 39 } FieldValue; 40 41 42 typedef struct _FieldValueList { 43 int count; /* of values */ 44 int allocated; 45 Boolean show_unselectable; 46 FieldValue value[1]; /* really [allocated] */ 47 } FieldValueList; 48 49 50 typedef struct _FontValues { 51 int value_index[FIELD_COUNT]; 52 } FontValues; 53 54 55 typedef struct _FieldMenu { 56 int field; 57 Widget button; 58 } FieldMenuRec; 59 60 61 typedef struct _Choice { 62 struct _Choice *prev; 63 FieldValue *value; 64 } Choice; 65 66 typedef struct _Parse { 67 char **fontNames; 68 int num_fonts; 69 int start, end; 70 FontValues *fonts; 71 FieldValueList **fieldValues; 72 } ParseRec; 73 74 typedef struct _WorkPiece { 75 struct _WorkPiece *next; 76 int priority; 77 XtProc proc; 78 XtPointer closure; 79 } WorkPieceRec, *WorkPiecePtr; 80 81 struct _appRes { 82 int app_defaults_version; 83 Cursor cursor; 84 String pattern; 85 String pixelSizeList; 86 String pointSizeList; 87 Boolean print_on_quit; 88 String sample_text; 89 String sample_text16; 90 String sample_textUCS; 91 Boolean scaled_fonts; 92 }; 93 94 static Boolean IsISO10646(Display *dpy, XFontStruct *font); 95 static void ScheduleWork(XtProc proc, XtPointer closure, int priority); 96 static void SetNoFonts(void); 97 static void SetParsingFontCount(int count); 98 static void SetCurrentFontCount(void); 99 static void EnableRemainingItems(ValidateAction current_field_action); 100 static void EnableAllItems(int field); 101 static void FlushXqueue(Display *dpy); 102 static void MarkInvalidFonts(Boolean *set, FieldValue *val); 103 static void AllAnyValue(Widget w, XtPointer closure, XtPointer callData); 104 static void Syntax(char *call); 105 static void SelectAction(Widget w, XtPointer closure, XtPointer callData); 106 107 108 static void GetFontNames(XtPointer closure); 109 static Boolean Matches(register String pattern, register String fontName, 110 Boolean fields[/*FIELD_COUNT*/], int *maxField); 111 static Boolean DoWorkPiece(XtPointer closure); 112 static void Quit(Widget w, XtPointer closure, XtPointer callData); 113 static void OwnSelection(Widget w, XtPointer closure, XtPointer callData); 114 static void SelectField(Widget w, XtPointer closure, XtPointer callData); 115 static void ParseFontNames(XtPointer closure); 116 static void SortFields(XtPointer closure); 117 static void FixScalables(XtPointer closure); 118 static void MakeFieldMenu(XtPointer closure); 119 static void SelectValue(Widget w, XtPointer closure, XtPointer callData); 120 static void AnyValue(Widget w, XtPointer closure, XtPointer callData); 121 static void EnableOtherValues(Widget w, XtPointer closure, XtPointer callData); 122 static void EnableMenu(XtPointer closure); 123 static void SetCurrentFont(XtPointer closure); 124 static Boolean IsXLFDFontName(String fontName); 125 126 #endif 127 /* end */ 128