[BACK]Return to patch-ab CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mbone / vat / patches

File: [cvs.NetBSD.org] / pkgsrc / mbone / vat / patches / patch-ab (download)

Revision 1.2, Fri Aug 7 11:10:03 1998 UTC (22 years, 1 month ago) by agc
Branch: MAIN
CVS Tags: pkgviews-base, pkgviews, pkgsrc-2020Q2-base, pkgsrc-2020Q2, pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3, pkgsrc-2009Q2-base, pkgsrc-2009Q2, pkgsrc-2009Q1-base, pkgsrc-2009Q1, pkgsrc-2008Q4-base, pkgsrc-2008Q4, pkgsrc-2008Q3-base, pkgsrc-2008Q3, pkgsrc-2008Q2-base, pkgsrc-2008Q2, pkgsrc-2008Q1-base, pkgsrc-2008Q1, pkgsrc-2007Q4-base, pkgsrc-2007Q4, pkgsrc-2007Q3-base, pkgsrc-2007Q3, pkgsrc-2007Q2-base, pkgsrc-2007Q2, pkgsrc-2007Q1-base, pkgsrc-2007Q1, pkgsrc-2006Q4-base, pkgsrc-2006Q4, pkgsrc-2006Q3-base, pkgsrc-2006Q3, pkgsrc-2006Q2-base, pkgsrc-2006Q2, pkgsrc-2006Q1-base, pkgsrc-2006Q1, pkgsrc-2005Q4-base, pkgsrc-2005Q4, pkgsrc-2005Q3-base, pkgsrc-2005Q3, pkgsrc-2005Q2-base, pkgsrc-2005Q2, pkgsrc-2005Q1-base, pkgsrc-2005Q1, pkgsrc-2004Q4-base, pkgsrc-2004Q4, pkgsrc-2004Q3-base, pkgsrc-2004Q3, pkgsrc-2004Q2-base, pkgsrc-2004Q2, pkgsrc-2004Q1-base, pkgsrc-2004Q1, pkgsrc-2003Q4-base, pkgsrc-2003Q4, netbsd-1-6-RELEASE-base, netbsd-1-6-1-base, netbsd-1-6-1, netbsd-1-6, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH001, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-3-PATCH003, cwrapper, cube-native-xorg-base, cube-native-xorg, comdex-fall-1999, buildlink2-base, buildlink2, HEAD
Changes since 1.1: +2 -0 lines

Add NetBSD RCS Ids.

$NetBSD: patch-ab,v 1.2 1998/08/07 11:10:03 agc Exp $

--- tkStripchart.c.orig	Tue Sep  9 11:00:42 1997
+++ tkStripchart.c	Tue Sep  9 10:52:30 1997
@@ -148,7 +148,7 @@
 	int scrollrequired;
 	int guarantee_draw;
 	int grow_up;
-	XFontStruct *fontPtr;	/* Information about text font, or NULL. */
+	Tk_Font tkfont;		/* Information about text font, or NULL. */
 	XColor *textColorPtr;	/* Color for drawing text. */
 	GC textGC;		/* GC for drawing text. */
 	XColor *tickColorPtr;	/* Color for drawing ticks. */
@@ -257,7 +257,7 @@
 	{TK_CONFIG_SYNONYM, "-fg", "stripcolor", 0,
 	 0, 0, 0},
 	{TK_CONFIG_FONT, "-font", "font", "Font",
-	 DEF_STRIPCHART_FONT, Tk_Offset(Stripchart, fontPtr),
+	 DEF_STRIPCHART_FONT, Tk_Offset(Stripchart, tkfont),
 	 0},
 	{TK_CONFIG_BOOLEAN, "-guaranteedrawing", "guaranteedrawing",
 	 "Guaranteedrawing", DEF_GUARANTEE_DRAW,
@@ -570,8 +570,8 @@
 	if (StripchartPtr->value != NULL)
 		free(StripchartPtr->value);
 
-	if (StripchartPtr->fontPtr != NULL)
-		Tk_FreeFontStruct(StripchartPtr->fontPtr);
+	if (StripchartPtr->tkfont != NULL)
+		Tk_FreeFont(StripchartPtr->tkfont);
 
 	if (StripchartPtr->textColorPtr != NULL)
 		Tk_FreeColor(StripchartPtr->textColorPtr);
@@ -631,7 +631,7 @@
 
 	Tk_SetBackgroundFromBorder(StripchartPtr->tkwin, StripchartPtr->border);
 
-	gcValues.font = StripchartPtr->fontPtr->fid;
+	gcValues.font = Tk_FontId(StripchartPtr->tkfont);
 	gcValues.foreground = StripchartPtr->textColorPtr->pixel;
 	newGC = Tk_GetGC(StripchartPtr->tkwin, GCForeground|GCFont, &gcValues);
 	if (StripchartPtr->textGC != None && StripchartPtr->tkwin) {
@@ -692,8 +692,11 @@
  {
 	int tt = hasatitle(StripchartPtr);
 	int bd = StripchartPtr->borderWidth;
-	int lineHeight = StripchartPtr->fontPtr->ascent +
-	StripchartPtr->fontPtr->descent;
+	Tk_FontMetrics fm;
+	int lineHeight;
+
+	Tk_GetFontMetrics(StripchartPtr->tkfont, &fm);
+	lineHeight = fm.ascent + fm.descent;
 
 	Tk_GeometryRequest(StripchartPtr->tkwin,
 			   2 * (bd + PADDING) + StripchartPtr->num_strips *
@@ -726,11 +729,13 @@
 	/*
 	 * Variable declarations used in the title drawing routines
 	 */
-	XFontStruct *fp = StripchartPtr->fontPtr;
-	XCharStruct bbox;
-	int x, dummy;
-	int lineHeight = StripchartPtr->fontPtr->ascent +
-	StripchartPtr->fontPtr->descent;
+	Tk_Font tkf = StripchartPtr->tkfont;
+	int x;
+	Tk_FontMetrics fm;
+	int lineHeight;
+
+	Tk_GetFontMetrics(tkf, &fm);
+	lineHeight = fm.ascent + fm.descent;
 
 	StripchartPtr->displaybits &= ~REDRAW_PENDING;
 	if ((StripchartPtr->tkwin == NULL) || !Tk_IsMapped(tkwin))
@@ -747,18 +752,17 @@
 	 * space. Otherwise left justified and clipped on the right.
 	 */
 	if (tt && StripchartPtr->displaybits & DISPLAY_TITLE) {
-		XTextExtents(fp, StripchartPtr->title,
-			     strlen(StripchartPtr->title),
-			     &dummy, &dummy, &dummy, &bbox);
-		if (bbox.lbearing + bbox.rbearing < Tk_Width(tkwin) - 2 * bd)
-			x = (Tk_Width(tkwin) - bbox.lbearing - bbox.rbearing)/2;
+		int width = Tk_TextWidth(tkf, StripchartPtr->title,
+			     strlen(StripchartPtr->title));
+		if (width < Tk_Width(tkwin) - 2 * bd)
+			x = (Tk_Width(tkwin) - width)/2;
 		else
 			x = bd + PADDING;
 
 		XClearArea(Tk_Display(tkwin), Tk_WindowId(tkwin), bd, bd,
 		     Tk_Width(tkwin) - 2 * bd, lineHeight + PADDING, False);
 		XDrawString(Tk_Display(tkwin), Tk_WindowId(tkwin),
-		       StripchartPtr->textGC, x, fp->max_bounds.ascent + bd,
+		       StripchartPtr->textGC, x, fm.ascent + bd,	/*XXX no max_bounds */
 			StripchartPtr->title, strlen(StripchartPtr->title));
 	}
 	/*
@@ -1057,7 +1061,8 @@
 DrawStripi(Stripchart* SPtr, int i)
 {
 	Tk_Window tkwin = SPtr->tkwin;
-	int lineHeight = SPtr->fontPtr->ascent + SPtr->fontPtr->descent;
+	Tk_FontMetrics fm;
+	int lineHeight;
 	int x = SPtr->borderWidth + PADDING + (i - 1) * SPtr->strip_width;
 	int y = SPtr->borderWidth + PADDING +
 		hasatitle(SPtr) * (lineHeight + PADDING);
@@ -1066,6 +1071,9 @@
 	double maxv = SPtr->max_value;
 	double minv = SPtr->min_value;
 
+	Tk_GetFontMetrics(SPtr->tkfont, &fm);
+	lineHeight = fm.ascent + fm.descent;
+
 	if (i < 1 || i > SPtr->num_strips)
 		return;
 
@@ -1136,7 +1144,8 @@
 ScrollStrips(Stripchart* SPtr)
 {
 	Tk_Window tkwin = SPtr->tkwin;
-	int lineHeight = SPtr->fontPtr->ascent + SPtr->fontPtr->descent;
+	Tk_FontMetrics fm;
+	int lineHeight;
 	int src_x = SPtr->borderWidth + PADDING + SPtr->strip_width;
 	int src_y = SPtr->borderWidth + PADDING +
 		    hasatitle(SPtr) * (lineHeight + PADDING);
@@ -1144,6 +1153,8 @@
 	int dest_y = src_y;
 	int w = (SPtr->num_strips - 1) * SPtr->strip_width;
 	int h = SPtr->max_height;
+
+	Tk_GetFontMetrics(SPtr->tkfont, &fm);
 
 	XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin),
 	          Tk_GetGC(tkwin, 0, NULL), src_x, src_y, w, h, dest_x, dest_y);