make MrEd for X work when traditional X11 fonts are unavailable (but when Xft fonts are available)

svn: r5692
This commit is contained in:
Matthew Flatt 2007-02-26 17:01:29 +00:00
parent 10f882b1b4
commit 84c0505899
11 changed files with 29 additions and 24 deletions

View File

@ -70,8 +70,10 @@ static void make_gc(self)Widget self;
values.background = ((XfwfLabelWidget)self)->xfwfLabel.text_bg;
if (!((XfwfLabelWidget)self)->xfwfLabel.xfont) {
values.foreground = ((XfwfLabelWidget)self)->xfwfLabel.foreground;
values.font = ((XfwfLabelWidget)self)->xfwfLabel.font->fid;
fnt = GCFont;
if (((XfwfLabelWidget)self)->xfwfLabel.font) {
values.font = ((XfwfLabelWidget)self)->xfwfLabel.font->fid;
fnt = GCFont;
}
} else {
if (((XfwfLabelWidget)self)->xfwfLabel.pixmap)
values.foreground = ((XfwfLabelWidget)self)->xfwfLabel.foreground;

View File

@ -404,8 +404,10 @@ text.
values.background = $text_bg;
if (!$xfont) {
values.foreground = $foreground;
values.font = $font->fid;
fnt = GCFont;
if ($font) {
values.font = $font->fid;
fnt = GCFont;
}
} else {
if ($pixmap)
values.foreground = $foreground;

View File

@ -1084,7 +1084,7 @@ static void DrawTextItem(MenuWidget mw, menu_state *ms, menu_item *item,
label, strlen(label), NULL,
mw->menu.font, wxEXT_FONT(mw->menu.xft_font),
(on ? -1 : (item->enabled || item->type==MENU_TEXT)),
1, NULL);
1, NULL, 1);
}
if (wxUseMenuHiliteBorder()) {
@ -1133,7 +1133,7 @@ static void DrawButtonItem(MenuWidget mw, menu_state *ms, menu_item *item,
mw->menu.xft_font),
key, strlen(key), NULL, mw->menu.font,
wxEXT_FONT(mw->menu.xft_font),
(on ? -1 : item->enabled), 1, NULL);
(on ? -1 : item->enabled), 1, NULL, 1);
}
}

View File

@ -869,7 +869,7 @@ int row,column;
strlen(MultiListItemString(item)),
MultiListTabs(mlw), NULL,
MultiListXftFont(mlw), xmode,
0, NULL);
0, NULL, 0);
}
} /* End RedrawRowColumn */

View File

@ -124,8 +124,7 @@ static void create_gc(self)Widget self;
if (((XfwfSlider2Widget)self)->xfwfLabel.gc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.gc);
values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
values.foreground = ((XfwfSlider2Widget)self)->xfwfLabel.foreground;
values.font = ((XfwfSlider2Widget)self)->xfwfLabel.font->fid;
mask = GCFont | GCBackground | GCForeground;
mask = GCBackground | GCForeground;
((XfwfSlider2Widget)self)->xfwfLabel.gc = XtGetGC(self, mask, &values);
}
/*ARGSUSED*/

View File

@ -602,8 +602,7 @@ position of the thumb.
if ($gc != NULL) XtReleaseGC($, $gc);
values.background = $thumbColor;
values.foreground = $foreground;
values.font = $font->fid;
mask = GCFont | GCBackground | GCForeground;
mask = GCBackground | GCForeground;
$gc = XtGetGC($, mask, &values);
}

View File

@ -176,7 +176,7 @@ static int xdoDraw(measure, font,
* counterpart.
*/
static void
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, font, xfont, line, image, xon, clip)
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, font, xfont, line, image, xon, clip, doamps)
Display *display;
Drawable drawable;
GC gc;
@ -191,6 +191,7 @@ doDrawImageString(display, drawable, gc, x, y, string, length, tabs, font, xfont
int image;
int xon;
Region clip;
int doamps;
{
register char *p, *ep, *ap;
register int tx, tab;
@ -242,7 +243,7 @@ doDrawImageString(display, drawable, gc, x, y, string, length, tabs, font, xfont
ep = strnchr(p, '\t', length);
else
ep = NULL;
if (font)
if (doamps)
ap = strnchr(p, '&', length);
else
ap = NULL;
@ -312,11 +313,11 @@ XfwfDrawImageString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt
int xon;
Region clip;
{
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, 1, 1, xon, clip);
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, 1, 1, xon, clip, 1);
}
void
XfwfDrawString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, xon, line, clip)
XfwfDrawString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, xon, line, clip, doamps)
Display *display;
Drawable drawable;
GC gc;
@ -330,8 +331,9 @@ XfwfDrawString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, xon
int line;
int xon;
Region clip;
int doamps;
{
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, line, 0, xon, clip);
doDrawImageString(display, drawable, gc, x, y, string, length, tabs, fnt, xfnt, line, 0, xon, clip, doamps);
}
/*

View File

@ -11,8 +11,8 @@
#ifdef WX_USE_XFT
# define wxExtFont XftFont*
# define wxEXT_FONT(x) x
# define wx_ASCENT(f, xf) (xf ? xf->ascent : f->ascent)
# define wx_DESCENT(f, xf) (xf ? xf->descent : f->descent)
# define wx_ASCENT(f, xf) (xf ? xf->ascent : (f ? f->ascent : 10))
# define wx_DESCENT(f, xf) (xf ? xf->descent : (f ? f->descent : 4))
#else
# define wxExtFont void*
# define wxEXT_FONT(x) NULL
@ -27,7 +27,7 @@ extern void XfwfDrawImageString(Display *display, Drawable drawable,
extern void XfwfDrawString(Display *display, Drawable drawable,
GC gc, int x, int y, String string, int length,
int *tabs, XFontStruct *fnt, wxExtFont f,
int xon, int drawLine, Region clip);
int xon, int drawLine, Region clip, int doamps);
extern int * XfwfTablist2Tabs(char *tablist);
extern int XfwfTextWidth(Display *display, XFontStruct *font, wxExtFont f, String str, int length,
int *tabs);

View File

@ -197,7 +197,7 @@ XfwfToggleClassRec xfwfToggleClassRec = {
/* num_resources */ 7,
/* xrm_class */ NULLQUARK,
/* compres_motion */ True ,
/* compress_exposure */ XtExposeCompressMultiple ,
/* compress_exposure */ XtExposeCompressMaximal ,
/* compress_enterleave */ True ,
/* visible_interest */ False ,
/* destroy */ destroy,
@ -309,8 +309,8 @@ static void initialize(request,self,args,num_args)Widget request;Widget self;Ar
if (!((XfwfToggleWidget)self)->xfwfToggle.indicatorSize || ((XfwfToggleWidget)self)->xfwfToggle.indicatorSize > wx_ASCENT(((XfwfToggleWidget)self)->xfwfLabel.font, ((wxExtFont)((XfwfToggleWidget)self)->xfwfLabel.xfont)))
((XfwfToggleWidget)self)->xfwfToggle.indicatorSize = wx_ASCENT(((XfwfToggleWidget)self)->xfwfLabel.font, ((wxExtFont)((XfwfToggleWidget)self)->xfwfLabel.xfont));
} else {
if (!((XfwfToggleWidget)self)->xfwfToggle.indicatorSize || ((XfwfToggleWidget)self)->xfwfToggle.indicatorSize > ((XfwfToggleWidget)self)->xfwfLabel.font->ascent)
((XfwfToggleWidget)self)->xfwfToggle.indicatorSize = ((XfwfToggleWidget)self)->xfwfLabel.font->ascent + 2;
if (!((XfwfToggleWidget)self)->xfwfToggle.indicatorSize || ((XfwfToggleWidget)self)->xfwfToggle.indicatorSize > (((XfwfToggleWidget)self)->xfwfLabel.font ? ((XfwfToggleWidget)self)->xfwfLabel.font->ascent : 10))
((XfwfToggleWidget)self)->xfwfToggle.indicatorSize = (((XfwfToggleWidget)self)->xfwfLabel.font ? ((XfwfToggleWidget)self)->xfwfLabel.font->ascent : 10) + 2;
}
((XfwfToggleWidget)self)->xfwfToggle.indicator_gc = NULL;

View File

@ -131,8 +131,8 @@ increased to make room for the indicators.
if (!$indicatorSize || $indicatorSize > wx_ASCENT($font, ((wxExtFont)$xfont)))
$indicatorSize = wx_ASCENT($font, ((wxExtFont)$xfont));
} else {
if (!$indicatorSize || $indicatorSize > $font->ascent)
$indicatorSize = $font->ascent + 2;
if (!$indicatorSize || $indicatorSize > ($font ? $font->ascent : 10))
$indicatorSize = ($font ? $font->ascent : 10) + 2;
}
$indicator_gc = NULL;

View File

@ -798,6 +798,7 @@ inline static void private_methods(FILE *f, tagpair *tag, Class c)
macro(f, tag, s);
break;
default:
break;
}
}
fputs(tclose(t_section), f);