diff options
author | joye <joye> | 2014-02-12 21:51:21 (GMT) |
---|---|---|
committer | joye <joye> | 2014-02-12 21:51:21 (GMT) |
commit | 2e07f5505574577426bfef25e65e94cd0ac11616 (patch) | |
tree | b1910f91e62db2a146a1b2db862556d4ff4035be | |
parent | 5d3da478d5c9ae6351b38b46b9a716176a817c65 (diff) | |
download | blt-2e07f5505574577426bfef25e65e94cd0ac11616.zip blt-2e07f5505574577426bfef25e65e94cd0ac11616.tar.gz blt-2e07f5505574577426bfef25e65e94cd0ac11616.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltGrLegd.C | 66 | ||||
-rw-r--r-- | src/bltGraph.C | 62 | ||||
-rw-r--r-- | src/bltGraph.h | 2 |
3 files changed, 55 insertions, 75 deletions
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index aa12b5c..567992e 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -116,7 +116,7 @@ struct _Legend { int activeRelief; /* 3-D effect on active entry. */ int entryBW; /* Border width around each entry in * legend. */ - Blt_Background normalBg; /* 3-D effect of legend. */ + Tk_3DBorder normalBg; /* 3-D effect of legend. */ int borderWidth; /* Width of legend 3-D border */ int relief; /* 3-d effect of border around the * legend: TK_RELIEF_RAISED etc. */ @@ -364,9 +364,9 @@ static Tk_OptionSpec optionSpecs[] = { RESET_WORLD | CACHE_DIRTY}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, -1, 0, 0, "-background", 0}, - {TK_OPTION_CUSTOM, "-background", "background", "Background", + {TK_OPTION_BORDER, "-background", "background", "Background", DEF_LEGEND_BACKGROUND, - -1, Tk_Offset(Legend, normalBg), TK_OPTION_NULL_OK, &backgroundObjOption, + -1, Tk_Offset(Legend, normalBg), TK_OPTION_NULL_OK, NULL, RESET_WORLD | CACHE_DIRTY}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_LEGEND_BORDERWIDTH, @@ -1757,7 +1757,6 @@ void Blt_MapLegend(Graph *graphPtr, int plotWidth, int plotHeight) void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) { - Blt_Background bg; Blt_ChainLink link; Tk_FontMetrics fontMetrics; Legend *legendPtr = graphPtr->legend; @@ -1787,9 +1786,10 @@ void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) Tk_Depth(tkwin)); if (legendPtr->normalBg != NULL) { - Blt_FillBackgroundRectangle(tkwin, pixmap, legendPtr->normalBg, 0, 0, - w, h, 0, TK_RELIEF_FLAT); - } else if (legendPtr->site & LEGEND_PLOTAREA_MASK) { + Tk_Fill3DRectangle(tkwin, pixmap, legendPtr->normalBg, 0, 0, + w, h, 0, TK_RELIEF_FLAT); + } + else if (legendPtr->site & LEGEND_PLOTAREA_MASK) { /* * Legend background is transparent and is positioned over the the * plot area. Either copy the part of the background from the backing @@ -1803,17 +1803,13 @@ void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) Blt_FillBackgroundRectangle(tkwin, pixmap, graphPtr->plotBg, 0, 0, w, h, TK_RELIEF_FLAT, 0); } - } else { - int xOrigin, yOrigin; + } + else { /* * The legend is located in one of the margins or the external window. */ - Blt_GetBackgroundOrigin(graphPtr->normalBg, &xOrigin, &yOrigin); - Blt_SetBackgroundOrigin(graphPtr->tkwin, graphPtr->normalBg, - xOrigin - legendPtr->x,yOrigin - legendPtr->y); - Blt_FillBackgroundRectangle(tkwin, pixmap, graphPtr->normalBg, 0, 0, - w, h, 0, TK_RELIEF_FLAT); - Blt_SetBackgroundOrigin(tkwin, graphPtr->normalBg, xOrigin, yOrigin); + Tk_Fill3DRectangle(tkwin, pixmap, graphPtr->normalBg, 0, 0, + w, h, 0, TK_RELIEF_FLAT); } Tk_GetFontMetrics(legendPtr->style.font, &fontMetrics); @@ -1875,10 +1871,10 @@ void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) } else { Blt_Ts_SetForeground(legendPtr->style, legendPtr->fgColor); if (elemPtr->legendRelief != TK_RELIEF_FLAT) { - Blt_FillBackgroundRectangle(tkwin, pixmap, graphPtr->normalBg, - x, y, legendPtr->entryWidth, - legendPtr->entryHeight, legendPtr->entryBW, - elemPtr->legendRelief); + Tk_Fill3DRectangle(tkwin, pixmap, graphPtr->normalBg, + x, y, legendPtr->entryWidth, + legendPtr->entryHeight, legendPtr->entryBW, + elemPtr->legendRelief); } } (*elemPtr->procsPtr->drawSymbolProc) (graphPtr, pixmap, elemPtr, @@ -1916,16 +1912,16 @@ void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) /* * Draw the border and/or background of the legend. */ - bg = legendPtr->normalBg; - if (bg == NULL) { + Tk_3DBorder bg = legendPtr->normalBg; + if (bg == NULL) bg = graphPtr->normalBg; - } + /* Disable crosshairs before redisplaying to the screen */ if (legendPtr->site & LEGEND_PLOTAREA_MASK) { Blt_DisableCrosshairs(graphPtr); } - Blt_DrawBackgroundRectangle(tkwin, pixmap, bg, 0, 0, w, h, - legendPtr->borderWidth, legendPtr->relief); + Tk_Draw3DRectangle(tkwin, pixmap, bg, 0, 0, w, h, + legendPtr->borderWidth, legendPtr->relief); XCopyArea(graphPtr->display, pixmap, drawable, graphPtr->drawGC, 0, 0, w, h, legendPtr->x, legendPtr->y); if (legendPtr->site & LEGEND_PLOTAREA_MASK) { @@ -1958,19 +1954,13 @@ void Blt_LegendToPostScript(Graph *graphPtr, Blt_Ps ps) Blt_Ps_Append(ps, "% Legend\n"); graphPtr = legendPtr->graphPtr; if (graphPtr->pageSetup->flags & PS_DECORATIONS) { - if (legendPtr->normalBg != NULL) { - Tk_3DBorder border; - - border = Blt_BackgroundBorder(legendPtr->normalBg); - Blt_Ps_Fill3DRectangle(ps, border, x, y, width, height, + if (legendPtr->normalBg != NULL) + Blt_Ps_Fill3DRectangle(ps, legendPtr->normalBg, x, y, width, height, legendPtr->borderWidth, legendPtr->relief); - } else { - Tk_3DBorder border; - - border = Blt_BackgroundBorder(graphPtr->normalBg); - Blt_Ps_Draw3DRectangle(ps, border, x, y, width, height, + else + Blt_Ps_Draw3DRectangle(ps, graphPtr->normalBg, x, y, width, height, legendPtr->borderWidth, legendPtr->relief); - } + } else { Blt_Ps_SetClearBackground(ps); Blt_Ps_XFillRectangle(ps, x, y, width, height); @@ -2011,10 +2001,8 @@ void Blt_LegendToPostScript(Graph *graphPtr, Blt_Ps ps) } else { Blt_Ts_SetForeground(legendPtr->style, legendPtr->fgColor); if (elemPtr->legendRelief != TK_RELIEF_FLAT) { - Tk_3DBorder border; - - border = Blt_BackgroundBorder(graphPtr->normalBg); - Blt_Ps_Draw3DRectangle(ps, border, x, y, legendPtr->entryWidth, + Blt_Ps_Draw3DRectangle(ps, graphPtr->normalBg, x, y, + legendPtr->entryWidth, legendPtr->entryHeight, legendPtr->entryBW, elemPtr->legendRelief); } diff --git a/src/bltGraph.C b/src/bltGraph.C index d05b7c4..5ba625b 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -115,9 +115,9 @@ static Tk_OptionSpec optionSpecs[] = { DEF_GRAPH_ASPECT_RATIO, -1, Tk_Offset(Graph, aspect), 0, NULL, RESET_WORLD | CACHE_DIRTY}, - {TK_OPTION_CUSTOM, "-background", "background", "Background", + {TK_OPTION_BORDER, "-background", "background", "Background", DEF_GRAPH_BACKGROUND, - -1, Tk_Offset(Graph, normalBg), 0, &backgroundObjOption, + -1, Tk_Offset(Graph, normalBg), 0, NULL, CACHE_DIRTY}, {TK_OPTION_STRING_TABLE, "-barmode", "barMode", "BarMode", DEF_GRAPH_BAR_MODE, @@ -533,7 +533,7 @@ static void ConfigureGraph(Graph* graphPtr) graphPtr->reqHeight); } Tk_SetInternalBorder(graphPtr->tkwin, graphPtr->borderWidth); - XColor* colorPtr = Blt_BackgroundBorderColor(graphPtr->normalBg); + XColor* colorPtr = Tk_3DBorderColor(graphPtr->normalBg); graphPtr->titleWidth = graphPtr->titleHeight = 0; if (graphPtr->title != NULL) { @@ -647,12 +647,11 @@ static void DisplayGraph(ClientData clientData) } /* Draw 3D border just inside of the focus highlight ring. */ if ((graphPtr->borderWidth > 0) && (graphPtr->relief != TK_RELIEF_FLAT)) { - Blt_DrawBackgroundRectangle(graphPtr->tkwin, drawable, - graphPtr->normalBg, graphPtr->highlightWidth, - graphPtr->highlightWidth, - graphPtr->width - 2*graphPtr->highlightWidth, - graphPtr->height - 2*graphPtr->highlightWidth, - graphPtr->borderWidth, graphPtr->relief); + Tk_Draw3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + graphPtr->highlightWidth, graphPtr->highlightWidth, + graphPtr->width - 2*graphPtr->highlightWidth, + graphPtr->height - 2*graphPtr->highlightWidth, + graphPtr->borderWidth, graphPtr->relief); } /* Draw focus highlight ring. */ if ((graphPtr->highlightWidth > 0) && (graphPtr->flags & FOCUS)) { @@ -1249,22 +1248,18 @@ static void DrawMargins(Graph* graphPtr, Drawable drawable) rects[2].x = graphPtr->right; rects[2].width = graphPtr->width - graphPtr->right; - Blt_FillBackgroundRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, - rects[0].x, rects[0].y, - rects[0].width, rects[0].height, - 0, TK_RELIEF_FLAT); - Blt_FillBackgroundRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, - rects[1].x, rects[1].y, - rects[1].width, rects[1].height, - 0, TK_RELIEF_FLAT); - Blt_FillBackgroundRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, - rects[2].x, rects[2].y, - rects[2].width, rects[2].height, - 0, TK_RELIEF_FLAT); - Blt_FillBackgroundRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, - rects[3].x, rects[3].y, - rects[3].width, rects[3].height, - 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + rects[0].x, rects[0].y, rects[0].width, rects[0].height, + 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + rects[1].x, rects[1].y, rects[1].width, rects[1].height, + 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + rects[2].x, rects[2].y, rects[2].width, rects[2].height, + 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + rects[3].x, rects[3].y, rects[3].width, rects[3].height, + 0, TK_RELIEF_FLAT); /* Draw 3D border around the plotting area */ @@ -1275,10 +1270,8 @@ static void DrawMargins(Graph* graphPtr, Drawable drawable) y = graphPtr->top - graphPtr->plotBW; w = (graphPtr->right - graphPtr->left) + (2*graphPtr->plotBW); h = (graphPtr->bottom - graphPtr->top) + (2*graphPtr->plotBW); - Blt_DrawBackgroundRectangle(graphPtr->tkwin, drawable, - graphPtr->normalBg, x, y, w, h, - graphPtr->plotBW, - graphPtr->plotRelief); + Tk_Draw3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + x, y, w, h, graphPtr->plotBW, graphPtr->plotRelief); } int site = Blt_Legend_Site(graphPtr); if (site & LEGEND_MARGIN_MASK) { @@ -1359,12 +1352,11 @@ void Blt_DrawGraph(Graph* graphPtr, Drawable drawable) } /* Draw 3D border just inside of the focus highlight ring. */ if ((graphPtr->borderWidth > 0) && (graphPtr->relief != TK_RELIEF_FLAT)) { - Blt_DrawBackgroundRectangle(graphPtr->tkwin, drawable, - graphPtr->normalBg, graphPtr->highlightWidth, - graphPtr->highlightWidth, - graphPtr->width - 2*graphPtr->highlightWidth, - graphPtr->height - 2*graphPtr->highlightWidth, - graphPtr->borderWidth, graphPtr->relief); + Tk_Draw3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg, + graphPtr->highlightWidth, graphPtr->highlightWidth, + graphPtr->width - 2*graphPtr->highlightWidth, + graphPtr->height - 2*graphPtr->highlightWidth, + graphPtr->borderWidth, graphPtr->relief); } /* Draw focus highlight ring. */ if ((graphPtr->highlightWidth > 0) && (graphPtr->flags & FOCUS)) { diff --git a/src/bltGraph.h b/src/bltGraph.h index 9b5b2dd..71fdea5 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -287,7 +287,7 @@ struct _Graph { int borderWidth; /* Width of the exterior border */ int relief; /* Relief of the exterior border. */ unsigned int flags; /* Flags; see below for definitions. */ - Blt_Background normalBg; /* 3-D border used to delineate the + Tk_3DBorder normalBg; /* 3-D border used to delineate the * plot surface and outer edge of * window. */ int highlightWidth; /* Width in pixels of highlight to |