mikew@wyse.wyse.com (Mike Wexler) (02/17/89)
Submitted-by: dana@thumper.bellcore.com (Dana A. Chee) Posting-number: Volume 3, Issue 13 Archive-name: xfig/patch6 Third patch for the R3 distribution of xfig Dana Chee, Bellcore, dana@thumper.bellcore.com * This is patchlevel 6 * main.c - added settable fonts for text (-normalFont, xfig*normalFont) and (-boldFont, xfig*boldFont) * font.c - added settable fonts for text * popup.c - made menus handle changed fonts correctly * panel.c - fixed problem with *BorderWidth causing icons to display incorrectly (single line). * xfig.1 - added info on font arguments. *** /tmp/d13364 Wed Feb 8 11:21:08 1989 --- patchlevel.h Wed Feb 8 10:41:11 1989 *************** *** 1 ! #define PATCHLEVEL 5 --- 1 ----- ! #define PATCHLEVEL 6 *** /tmp/d13368 Wed Feb 8 11:21:09 1989 --- main.c Wed Feb 8 11:01:03 1989 *************** *** 29,34 #ifdef X11 #include "fig.icon.X" Pixmap fig_icon; #else #include "fig.icon" #define FIG_ICON_WIDTH MY_ICON_WIDTH --- 29,36 ----- #ifdef X11 #include "fig.icon.X" Pixmap fig_icon; + extern char *boldFont; + extern char *normalFont; #else #include "fig.icon" #define FIG_ICON_WIDTH MY_ICON_WIDTH *************** *** 199,204 (Cardinal)&TRACKING, XtRBoolean, (caddr_t)&true}, {"inches", "Inches", XtRBoolean, sizeof(int), (Cardinal)&INCHES, XtRBoolean, (caddr_t)&true}, }; static XrmOptionDescRec options[] = --- 201,210 ----- (Cardinal)&TRACKING, XtRBoolean, (caddr_t)&true}, {"inches", "Inches", XtRBoolean, sizeof(int), (Cardinal)&INCHES, XtRBoolean, (caddr_t)&true}, + {"boldFont", "BoldFont", XtRString, sizeof(caddr_t), + (Cardinal)&boldFont, XtRString, (caddr_t)NULL}, + {"normalFont", "NormalFont", XtRString, sizeof(caddr_t), + (Cardinal)&normalFont, XtRString, (caddr_t)NULL}, }; static XrmOptionDescRec options[] = *************** *** 219,224 {"-imperial", ".inches", XrmoptionNoArg, "True"}, {"-centimeters", ".inches", XrmoptionNoArg, "False"}, {"-metric", ".inches", XrmoptionNoArg, "False"}, }; static XtCallbackRec callbacks[] = --- 225,232 ----- {"-imperial", ".inches", XrmoptionNoArg, "True"}, {"-centimeters", ".inches", XrmoptionNoArg, "False"}, {"-metric", ".inches", XrmoptionNoArg, "False"}, + {"-boldFont", ".boldFont", XrmoptionSepArg, 0}, + {"-normalFont", ".normalFont", XrmoptionSepArg, 0}, }; static XtCallbackRec callbacks[] = *** /tmp/d13371 Wed Feb 8 11:21:10 1989 --- popup.c Wed Feb 8 10:34:54 1989 *************** *** 90,96 int init_menu(tool) TOOL tool; { ! TOOL panes, pane; register int i, tlen, rlen = 0; register MENUITEM *mi; XtTranslations popdown_actions, pane_actions; --- 90,96 ----- int init_menu(tool) TOOL tool; { ! TOOL panes, pane, title; register int i, tlen, rlen = 0; register MENUITEM *mi; XtTranslations popdown_actions, pane_actions; *************** *** 94,100 register int i, tlen, rlen = 0; register MENUITEM *mi; XtTranslations popdown_actions, pane_actions; ! menu = XtCreatePopupShell("popup_menu", overrideShellWidgetClass, tool, menu_args, XtNumber(menu_args)); popdown_actions = XtParseTranslationTable( --- 94,102 ----- register int i, tlen, rlen = 0; register MENUITEM *mi; XtTranslations popdown_actions, pane_actions; ! Arg my_list; ! PIX_FONT temp_font; ! menu = XtCreatePopupShell("popup_menu", overrideShellWidgetClass, tool, menu_args, XtNumber(menu_args)); popdown_actions = XtParseTranslationTable( *************** *** 114,121 rlen = tlen; } - pane_args[3].value = char_width(canvas_font) * rlen + 10; - pane_args[2].value = (XtArgVal)"COMMANDS"; pane = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); --- 116,121 ----- rlen = tlen; } pane_args[2].value = (XtArgVal)"COMMANDS"; title = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); *************** *** 117,123 pane_args[3].value = char_width(canvas_font) * rlen + 10; pane_args[2].value = (XtArgVal)"COMMANDS"; ! pane = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); for (i = 0; i < XtNumber(pumenu_items); ++i) { --- 117,123 ----- } pane_args[2].value = (XtArgVal)"COMMANDS"; ! title = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); /* create the first pane */ *************** *** 119,125 pane_args[2].value = (XtArgVal)"COMMANDS"; pane = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); ! for (i = 0; i < XtNumber(pumenu_items); ++i) { mi = &pumenu_items[i]; pane_args[2].value = (XtArgVal)mi->label; --- 119,144 ----- pane_args[2].value = (XtArgVal)"COMMANDS"; title = XtCreateManagedWidget("title", labelWidgetClass, panes, pane_args, 4); ! ! /* create the first pane */ ! mi = &pumenu_items[0]; ! pane_args[2].value = (XtArgVal)mi->label; ! pane_callbacks[0].closure = (caddr_t)mi; ! pane = XtCreateManagedWidget("pane", commandWidgetClass, ! panes, pane_args, XtNumber(pane_args)); ! XtOverrideTranslations(pane, pane_actions); ! ! /* get the default font */ ! my_list.value = (XtArgVal)&temp_font; ! my_list.name = XtNfont; ! XtGetValues(pane, &my_list, 1); ! ! /* set the width of this pane and the title to the correct width */ ! pane_args[3].value = char_width(temp_font) * rlen + 10; ! XtSetValues(title, &pane_args[3], 1); ! XtSetValues(pane, &pane_args[3], 1); ! ! for (i = 1; i < XtNumber(pumenu_items); ++i) { mi = &pumenu_items[i]; pane_args[2].value = (XtArgVal)mi->label; *** /tmp/d13375 Wed Feb 8 11:21:11 1989 --- font.c Wed Feb 8 10:13:22 1989 *************** *** 25,30 canvas_font = roman_font; } #else init_font() { canvas_font = roman_font = XLoadQueryFont(tool_d, NORMAL_FONT); --- 25,32 ----- canvas_font = roman_font; } #else + char *boldFont = NULL; + char *normalFont = NULL; init_font() { if( boldFont == NULL || *boldFont == NULL) *************** *** 27,33 #else init_font() { ! canvas_font = roman_font = XLoadQueryFont(tool_d, NORMAL_FONT); ! bold_font = XLoadQueryFont(tool_d, BOLD_FONT); } #endif X11 --- 29,40 ----- char *normalFont = NULL; init_font() { ! if( boldFont == NULL || *boldFont == NULL) ! boldFont = BOLD_FONT; ! if( normalFont == NULL || *normalFont == NULL) ! normalFont = NORMAL_FONT; ! ! canvas_font = roman_font = XLoadQueryFont(tool_d, normalFont); ! bold_font = XLoadQueryFont(tool_d, boldFont); } #endif X11 *** /tmp/d13379 Wed Feb 8 11:21:12 1989 --- panel.c Wed Feb 8 10:53:01 1989 *************** *** 159,164 { XtNbackgroundPixmap, (XtArgVal)NULL }, { XtNcallback, (XtArgVal)button_callbacks }, { XtNresizable, (XtArgVal) FALSE }, }; extern int PANEL_LEFT, PANEL_TOP, PANEL_HEIGHT, PANEL_WID; --- 159,165 ----- { XtNbackgroundPixmap, (XtArgVal)NULL }, { XtNcallback, (XtArgVal)button_callbacks }, { XtNresizable, (XtArgVal) FALSE }, + { XtNborderWidth, (XtArgVal) 1}, }; extern int PANEL_LEFT, PANEL_TOP, PANEL_HEIGHT, PANEL_WID; *** /tmp/d13382 Wed Feb 8 11:21:14 1989 --- xfig.1 Wed Feb 8 11:17:57 1989 *************** *** 9,15 [ \fB-P[ortrait]\fP ] [ \fB-w[idth]\fP \fIunits\fP ] [ \fB-h[eight]\fP \fIunits\fP ] ! [ \fB-no[track]\fP ] [ \fB-tr[ack]\fP ] [ \fB-inc[hes]\fP ] [ \fB-me[tric]\fP ] --- 9,15 ----- [ \fB-P[ortrait]\fP ] [ \fB-w[idth]\fP \fIunits\fP ] [ \fB-h[eight]\fP \fIunits\fP ] ! [ \fB-not[rack]\fP ] [ \fB-tr[ack]\fP ] [ \fB-inc[hes]\fP ] [ \fB-me[tric]\fP ] *************** *** 15,20 [ \fB-me[tric]\fP ] [ \fB-inv[erse]\fP ] [ \fB-de[bug]\fP ] [ \fIfile\fP ] .SH DESCRIPTION .I Xfig --- 15,22 ----- [ \fB-me[tric]\fP ] [ \fB-inv[erse]\fP ] [ \fB-de[bug]\fP ] + [ \fB-normal[Font]\fP \fIfont\fP ] + [ \fB-bold[Font]\fP \fIfont\fP ] [ \fIfile\fP ] .SH DESCRIPTION .I Xfig *************** *** 111,116 .TP \fB-de\fP Turn on debugging mode. .SH "GRAPHICAL OBJECTS" The objects in \fIxfig\fP are divided into \fBprimitive objects\fP and \fBcompound object\fP. The primitive objects are: \fIARC\fP, \fICIRCLE\fP, --- 113,124 ----- .TP \fB-de\fP Turn on debugging mode. + .TP + \fB-normal\fP \fIfont\fP + Cause the font used for drawing on the canvas to be \fIfont\fP. + .TP + \fB-bold\fP \fIfont\fP + Cause the font used for displaying messages to be \fIfont\fP. .SH "GRAPHICAL OBJECTS" The objects in \fIxfig\fP are divided into \fBprimitive objects\fP and \fBcompound object\fP. The primitive objects are: \fIARC\fP, \fICIRCLE\fP, *************** *** 420,425 .TP debug (boolean:off) -debug argument .PP These arguments correspond to the widgets which make up \fIxfig\fP. .TP 1.5i --- 428,439 ----- .TP debug (boolean:off) -debug argument + .TP + normalFont + (string:fixed) -normal argument + .TP + boldFont + (string:8x13bold) -bold argument .PP These arguments correspond to the widgets which make up \fIxfig\fP. .TP 1.5i -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x