summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2013-09-11 20:09:28 (GMT)
committerjoye <joye>2013-09-11 20:09:28 (GMT)
commit2d3335d906b130949a686e22e09b7189b14b3b89 (patch)
tree57806ffc0f0676c03ca56552410276782d8e7f77
parent364532e1f297d1ba09753aba79bb7a35bef497f2 (diff)
downloadblt-2d3335d906b130949a686e22e09b7189b14b3b89.zip
blt-2d3335d906b130949a686e22e09b7189b14b3b89.tar.gz
blt-2d3335d906b130949a686e22e09b7189b14b3b89.tar.bz2
*** empty log message ***
-rwxr-xr-xconfigure2
-rwxr-xr-xconfigure.in2
-rw-r--r--src/bltGrText.C265
-rw-r--r--src/bltGrText.h21
4 files changed, 2 insertions, 288 deletions
diff --git a/configure b/configure
index 59e2a51..0dfd032 100755
--- a/configure
+++ b/configure
@@ -5639,7 +5639,7 @@ done
- PKG_CFLAGS="$PKG_CFLAGS "
+ PKG_CFLAGS="$PKG_CFLAGS -Wunused"
diff --git a/configure.in b/configure.in
index 6fbddc5..94c7b44 100755
--- a/configure.in
+++ b/configure.in
@@ -117,7 +117,7 @@ TEA_ADD_SOURCES([
TEA_ADD_HEADERS([generic/bltVector.h])
TEA_ADD_INCLUDES([-I. -I\"`${CYGPATH} ${srcdir}/generic`\" -I/usr/X11/include/freetype2])
TEA_ADD_LIBS([])
-TEA_ADD_CFLAGS([])
+TEA_ADD_CFLAGS([-Wunused])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([library/graph.tcl library/bltGraph.pro])
diff --git a/src/bltGrText.C b/src/bltGrText.C
index 0b7582c..7b974fc 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -448,83 +448,6 @@ Blt_AnchorPoint(
/*
*---------------------------------------------------------------------------
*
- * Blt_MeasureText --
- *
- * Draw a string of characters on the screen. Blt_DrawChars()
- * expands control characters that occur in the string to
- * \xNN sequences.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Information gets drawn on the screen.
- *
- *---------------------------------------------------------------------------
- */
-int
-Blt_MeasureText(
- Blt_Font font, /* Font in which characters will be drawn;
- * must be the same as font used in GC. */
- const char *text, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
- * (tabs, control characters, and newlines)
- * should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
- * regular printing characters. */
- int textLen, /* # of bytes to draw in text string. */
- int maxLength,
- int *countPtr)
-{
- int elWidth;
- const char *s, *send;
- int accum, count, threshold;
- int nBytes;
-
- if (maxLength < 0) {
- if (countPtr != NULL) {
- nBytes = textLen;
- }
- return Blt_TextWidth(font, text, textLen);
- }
- elWidth = Blt_TextWidth(font, "...", 3);
- threshold = maxLength - elWidth;
- if (threshold <= 0) {
- return 0;
- }
-#if !HAVE_UTF
- nBytes = 1;
-#endif /* !HAVE_UTF */
- count = accum = 0;
- for (s = text, send = s + textLen; s < send; s += nBytes) {
-#if HAVE_UTF
- Tcl_UniChar ch;
-#endif /* HAVE_UTF */
- int w;
-#if HAVE_UTF
- nBytes = Tcl_UtfToUniChar (s, &ch);
-#endif /* HAVE_UTF */
- w = Blt_TextWidth(font, s, nBytes);
- if ((accum + w) > threshold) {
- if (countPtr != NULL) {
- *countPtr = count;
- }
- return accum + elWidth;
- }
- accum += w;
- count += nBytes;
- }
- if (countPtr != NULL) {
- *countPtr = count;
- }
- return accum;
-}
-
-
-/*
- *---------------------------------------------------------------------------
- *
* Blt_Ts_CreateLayout --
*
* Get the extents of a possibly multiple-lined text string.
@@ -806,29 +729,6 @@ Blt_Ts_Bitmap(
return bitmap;
}
-void
-Blt_Ts_SetDrawStyle(
- TextStyle *stylePtr,
- Blt_Font font,
- GC gc,
- XColor *normalColor,
- float angle,
- Tk_Anchor anchor,
- Tk_Justify justify,
- int leader)
-{
- stylePtr->xPad.side1 = stylePtr->xPad.side2 = 0;
- stylePtr->yPad.side1 = stylePtr->yPad.side2 = 0;
- stylePtr->state = 0;
- stylePtr->anchor = anchor;
- stylePtr->color = normalColor;
- stylePtr->font = font;
- stylePtr->gc = gc;
- stylePtr->justify = justify;
- stylePtr->leader = leader;
- stylePtr->angle = (float)angle;
-}
-
static void
DrawStandardLayout(Tk_Window tkwin, Drawable drawable, TextStyle *stylePtr,
TextLayout *layoutPtr, int x, int y)
@@ -1295,122 +1195,6 @@ Blt_FreeTextLayout(Tk_TextLayout textLayout)
/*
*---------------------------------------------------------------------------
*
- * NewChunk --
- *
- * Helper function for Blt_ComputeTextLayout(). Encapsulates a
- * measured set of characters in a chunk that can be quickly
- * drawn.
- *
- * Results:
- * A pointer to the new chunk in the text layout.
- *
- * Side effects:
- * The text layout is reallocated to hold more chunks as necessary.
- *
- * Currently, Tk_ComputeTextLayout() stores contiguous ranges of
- * "normal" characters in a chunk, along with individual tab
- * and newline chars in their own chunks. All characters in the
- * text layout are accounted for.
- *
- *---------------------------------------------------------------------------
- */
-static LayoutChunk *
-NewChunk(TkTextLayout **layoutPtrPtr, int *maxPtr, const char *start,
- int numBytes, int curX, int newX, int y)
-{
- TkTextLayout *layoutPtr;
- LayoutChunk *chunkPtr;
- int maxChunks, numChars;
- size_t s;
-
- layoutPtr = *layoutPtrPtr;
- maxChunks = *maxPtr;
- if (layoutPtr->numChunks == maxChunks) {
- maxChunks *= 2;
- s = sizeof(TkTextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
- layoutPtr = realloc(layoutPtr, s);
- *layoutPtrPtr = layoutPtr;
- *maxPtr = maxChunks;
- }
- numChars = Tcl_NumUtfChars(start, numBytes);
- chunkPtr = &layoutPtr->chunks[layoutPtr->numChunks];
- chunkPtr->start = start;
- chunkPtr->numBytes = numBytes;
- chunkPtr->numChars = numChars;
- chunkPtr->numDisplayChars = numChars;
- chunkPtr->x = curX;
- chunkPtr->y = y;
- chunkPtr->totalWidth = newX - curX;
- chunkPtr->displayWidth = newX - curX;
- layoutPtr->numChunks++;
-
- return chunkPtr;
-}
-
-void
-Blt_DrawTextLayout(
- Display *display, /* Display on which to draw. */
- Drawable drawable, /* Window or pixmap in which to draw. */
- GC gc, /* Graphics context to use for drawing text. */
- Tk_TextLayout layout, /* Layout information, from a previous call
- * to Blt_ComputeTextLayout(). */
- int x, int y, /* Upper-left hand corner of rectangle in
- * which to draw (pixels). */
- int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
- * beginning. */
- int lastChar) /* The index just after the last character
- * to draw from the given text item. A number
- * < 0 means to draw all characters. */
-{
- TkTextLayout *layoutPtr;
- int i, numDisplayChars, drawX;
- const char *firstByte;
- const char *lastByte;
- LayoutChunk *chunkPtr;
- int depth = 24;
-
- layoutPtr = (TkTextLayout *) layout;
- if (layoutPtr == NULL) {
- return;
- }
-
- if (lastChar < 0) {
- lastChar = 100000000;
- }
- chunkPtr = layoutPtr->chunks;
- for (i = 0; i < layoutPtr->numChunks; i++) {
- numDisplayChars = chunkPtr->numDisplayChars;
- if ((numDisplayChars > 0) && (firstChar < numDisplayChars)) {
- if (firstChar <= 0) {
- drawX = 0;
- firstChar = 0;
- firstByte = chunkPtr->start;
- } else {
- firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
- Blt_MeasureChars(layoutPtr->font, chunkPtr->start,
- firstByte - chunkPtr->start, -1, 0, &drawX);
- }
- if (lastChar < numDisplayChars) {
- numDisplayChars = lastChar;
- }
- lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
- Blt_DrawChars(display, drawable, gc, layoutPtr->font, depth, 0.0f,
- firstByte, lastByte - firstByte,
- x + chunkPtr->x + drawX, y + chunkPtr->y);
- }
- firstChar -= chunkPtr->numChars;
- lastChar -= chunkPtr->numChars;
- if (lastChar <= 0) {
- break;
- }
- chunkPtr++;
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
* Tk_CharBbox --
*
* Use the information in the Tk_TextLayout token to return the
@@ -1537,52 +1321,3 @@ Blt_CharBbox(
return 1;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_UnderlineTextLayout --
- *
- * Use the information in the Tk_TextLayout token to display an
- * underline below an individual character. This procedure does
- * not draw the text, just the underline.
- *
- * This procedure is useful for simple widgets that need to
- * display single-font, multi-line text with an individual
- * character underlined and want Tk to handle the details.
- * To display larger amounts of underlined text, construct
- * and use an underlined font.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Underline drawn on the screen.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-Blt_UnderlineTextLayout(
- Display *display, /* Display on which to draw. */
- Drawable drawable, /* Window or pixmap in which to draw. */
- GC gc, /* Graphics context to use for drawing text. */
- Tk_TextLayout layout, /* Layout information, from a previous call
- * to Tk_ComputeTextLayout(). */
- int x, int y, /* Upper-left hand corner of rectangle in
- * which to draw (pixels). */
- int underline) /* Index of the single character to
- * underline, or -1 for no underline. */
-{
- TkTextLayout *layoutPtr;
- int xx, yy, width, height;
-
- if ((Blt_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0)
- && (width != 0)) {
- Blt_FontMetrics fm;
- layoutPtr = (TkTextLayout *) layout;
- Blt_GetFontMetrics(layoutPtr->font, &fm);
- XFillRectangle(display, drawable, gc, x + xx,
- y + yy + fm.ascent + fm.underlinePos,
- (unsigned int) width, fm.underlineHeight);
- }
-}
diff --git a/src/bltGrText.h b/src/bltGrText.h
index dbf2516..f59953b 100644
--- a/src/bltGrText.h
+++ b/src/bltGrText.h
@@ -165,14 +165,6 @@ extern void Blt_Ts_ResetStyle(Tk_Window tkwin, TextStyle *tsPtr);
extern void Blt_Ts_FreeStyle(Display *display, TextStyle *tsPtr);
-extern void Blt_Ts_SetDrawStyle (TextStyle *tsPtr, Blt_Font font, GC gc,
- XColor *fgColor, float angle, Tk_Anchor anchor, Tk_Justify justify,
- int leader);
-
-extern void Blt_Ts_SetPrintStyle(TextStyle *tsPtr, Blt_Font font,
- XColor *fgColor, XColor *bgColor, float angle, Tk_Anchor anchor,
- Tk_Justify justify, int leader);
-
extern void Blt_DrawText(Tk_Window tkwin, Drawable drawable,
const char *string, TextStyle *tsPtr, int x, int y);
@@ -195,25 +187,12 @@ extern void Blt_GetTextExtents(Blt_Font font, int leader, const char *text,
extern void Blt_RotateStartingTextPositions(TextLayout *textPtr,
float angle);
-extern Tk_TextLayout Blt_ComputeTextLayout(Blt_Font font,
- const char *string, int numChars, int wrapLength, Tk_Justify justify,
- int flags, int *widthPtr, int *heightPtr);
-
-extern void Blt_DrawTextLayout(Display *display, Drawable drawable, GC gc,
- Tk_TextLayout layout, int x, int y, int firstChar, int lastChar);
-
extern int Blt_CharBbox(Tk_TextLayout layout, int index, int *xPtr,
int *yPtr, int *widthPtr, int *heightPtr);
-extern void Blt_UnderlineTextLayout(Display *display, Drawable drawable,
- GC gc, Tk_TextLayout layout, int x, int y, int underline);
-
extern void Blt_Ts_DrawText(Tk_Window tkwin, Drawable drawable,
const char *text, int textLen, TextStyle *tsPtr, int x, int y);
-extern int Blt_MeasureText(Blt_Font font, const char *text, int textLen,
- int maxLength, int *nBytesPtr);
-
extern void Blt_FreeTextLayout(Tk_TextLayout layout);
#define Blt_Ts_GetAnchor(ts) ((ts).anchor)