summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-05-13 16:10:21 (GMT)
committerjoye <joye>2014-05-13 16:10:21 (GMT)
commit06a981f108ae4898eafcbbeafd1e15c5f0cfc7e8 (patch)
tree064ea5da46932ef3d4eaa2e413e49fa7b48bcb54 /src
parent1be6e25d00f76f32f9771b91727da9fc2e9d9925 (diff)
downloadblt-06a981f108ae4898eafcbbeafd1e15c5f0cfc7e8.zip
blt-06a981f108ae4898eafcbbeafd1e15c5f0cfc7e8.tar.gz
blt-06a981f108ae4898eafcbbeafd1e15c5f0cfc7e8.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrMisc.h13
-rw-r--r--src/bltGraph.C114
-rw-r--r--src/bltGraph.h2
-rw-r--r--src/bltGraphBar.C2
-rw-r--r--src/bltGraphBar.h1
-rw-r--r--src/bltGraphLine.C2
-rw-r--r--src/bltGraphLine.h1
7 files changed, 52 insertions, 83 deletions
diff --git a/src/bltGrMisc.h b/src/bltGrMisc.h
index f5c2a38..5e1f269 100644
--- a/src/bltGrMisc.h
+++ b/src/bltGrMisc.h
@@ -38,18 +38,6 @@ using namespace std;
#include <tk.h>
/*
- * Bit flags definitions:
- *
- * All kinds of state information kept here. All these things happen
- * when the window is available to draw into (DisplayGraph). Need the
- * window width and height before we can calculate graph layout (i.e. the
- * screen coordinates of the axes, elements, titles, etc). But we want to
- * do this only when we have to, not every time the graph is redrawn.
- *
- * Same goes for maintaining a pixmap to double buffer graph elements.
- * Need to mark when the pixmap needs to updated.
- *
- *
* MAP_ITEM Indicates that the element/marker/axis
* configuration has changed such that
* its layout of the item (i.e. its
@@ -96,7 +84,6 @@ using namespace std;
* 3) titles have changed
* 4) window was resized.
*
- * GRAPH_FOCUS
*/
#define REDRAW_PENDING (1<<2) /* 0x0004 */
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 16455cb..c6ba97e 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -210,7 +210,7 @@ void Graph::configure()
adjustAxes();
// Free the pixmap if we're not buffering the display of elements anymore.
- if ((!ops->backingStore) && (cache_ != None)) {
+ if (cache_ != None) {
Tk_FreePixmap(display_, cache_);
cache_ = None;
}
@@ -259,31 +259,62 @@ void Graph::draw()
Pixmap drawable = Tk_GetPixmap(display_, Tk_WindowId(tkwin_),
width_, height_, Tk_Depth(tkwin_));
- if (ops->backingStore) {
- if ((cache_ == None)||(cacheWidth_ != width_)||(cacheHeight_ != height_)) {
- if (cache_ != None)
- Tk_FreePixmap(display_, cache_);
+ if (cache_ == None || cacheWidth_ != width_ || cacheHeight_ != height_) {
+ if (cache_ != None)
+ Tk_FreePixmap(display_, cache_);
+ cache_ = Tk_GetPixmap(display_, Tk_WindowId(tkwin_), width_, height_,
+ Tk_Depth(tkwin_));
+ cacheWidth_ = width_;
+ cacheHeight_ = height_;
+ flags |= CACHE_DIRTY;
+ }
- cache_ = Tk_GetPixmap(display_, Tk_WindowId(tkwin_), width_, height_,
- Tk_Depth(tkwin_));
- cacheWidth_ = width_;
- cacheHeight_ = height_;
- flags |= CACHE_DIRTY;
+ // Update cache if needed
+ if (flags & CACHE_DIRTY) {
+ drawMargins(cache_);
+
+ switch (legend_->position()) {
+ case Legend::TOP:
+ case Legend::BOTTOM:
+ case Legend::RIGHT:
+ case Legend::LEFT:
+ legend_->draw(cache_);
+ break;
+ default:
+ break;
}
- }
- if (ops->backingStore) {
- if (flags & CACHE_DIRTY) {
- drawPlot(cache_);
- flags &= ~CACHE_DIRTY;
+ // Draw the background of the plotting area with 3D border
+ Tk_Fill3DRectangle(tkwin_, cache_, ops->plotBg,
+ left_-ops->plotBW,
+ top_-ops->plotBW,
+ right_-left_+1+2*ops->plotBW,
+ bottom_-top_+1+2*ops->plotBW,
+ ops->plotBW, ops->plotRelief);
+
+ drawAxesGrids(cache_);
+ drawAxes(cache_);
+ drawAxesLimits(cache_);
+ drawMarkers(cache_, MARKER_UNDER);
+
+ if (!legend_->isRaised()) {
+ switch (legend_->position()) {
+ case Legend::PLOT:
+ case Legend::XY:
+ legend_->draw(cache_);
+ break;
+ default:
+ break;
+ }
}
- XCopyArea(display_, cache_, drawable, drawGC_, 0, 0, Tk_Width(tkwin_),
- Tk_Height(tkwin_), 0, 0);
+
+ flags &= ~CACHE_DIRTY;
}
- else
- drawPlot(drawable);
- // Draw markers above elements
+ XCopyArea(display_, cache_, drawable, drawGC_, 0, 0, Tk_Width(tkwin_),
+ Tk_Height(tkwin_), 0, 0);
+
+ drawElements(drawable);
drawActiveElements(drawable);
if (legend_->isRaised()) {
@@ -324,49 +355,8 @@ void Graph::draw()
flags &= ~MAP_WORLD;
flags &= ~REDRAW_WORLD;
- updateMarginTraces();
-}
-void Graph::drawPlot(Drawable drawable)
-{
- GraphOptions* ops = (GraphOptions*)ops_;
-
- drawMargins(drawable);
-
- switch (legend_->position()) {
- case Legend::TOP:
- case Legend::BOTTOM:
- case Legend::RIGHT:
- case Legend::LEFT:
- legend_->draw(drawable);
- break;
- default:
- break;
- }
-
- // Draw the background of the plotting area with 3D border
- Tk_Fill3DRectangle(tkwin_, drawable, ops->plotBg,
- left_-ops->plotBW, top_-ops->plotBW,
- right_-left_+1+2*ops->plotBW,bottom_-top_+1+2*ops->plotBW,
- ops->plotBW, ops->plotRelief);
-
- drawAxesGrids(drawable);
- drawAxes(drawable);
- drawAxesLimits(drawable);
- drawMarkers(drawable, MARKER_UNDER);
-
- if (!legend_->isRaised()) {
- switch (legend_->position()) {
- case Legend::PLOT:
- case Legend::XY:
- legend_->draw(drawable);
- break;
- default:
- break;
- }
- }
-
- drawElements(drawable);
+ updateMarginTraces();
}
int Graph::print(const char *ident, Blt_Ps ps)
diff --git a/src/bltGraph.h b/src/bltGraph.h
index b05185f..0a9f3d8 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -103,7 +103,6 @@ typedef struct {
Tk_3DBorder normalBg;
int borderWidth;
Margin margins[4];
- int backingStore;
Tk_Cursor cursor;
TextStyleOptions titleTextStyle;
int reqHeight;
@@ -176,7 +175,6 @@ class Graph {
short int cacheHeight_;
protected:
- void drawPlot(Drawable);
void layoutGraph();
void drawMargins(Drawable);
diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C
index 95bdc2d..d50f94b 100644
--- a/src/bltGraphBar.C
+++ b/src/bltGraphBar.C
@@ -94,8 +94,6 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING, "-bottomvariable", "bottomVariable", "BottomVariable",
NULL, -1, Tk_Offset(BarGraphOptions, bottomMargin.varName),
TK_OPTION_NULL_OK, NULL, 0},
- {TK_OPTION_BOOLEAN, "-bufferelements", "bufferElements", "BufferElements",
- "yes", -1, Tk_Offset(BarGraphOptions, backingStore), 0, NULL, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
"crosshair", -1, Tk_Offset(BarGraphOptions, cursor),
TK_OPTION_NULL_OK, NULL, 0},
diff --git a/src/bltGraphBar.h b/src/bltGraphBar.h
index 6af84d3..1561bdb 100644
--- a/src/bltGraphBar.h
+++ b/src/bltGraphBar.h
@@ -59,7 +59,6 @@ typedef struct {
Tk_3DBorder normalBg;
int borderWidth;
Margin margins[4];
- int backingStore;
Tk_Cursor cursor;
TextStyleOptions titleTextStyle;
int reqHeight;
diff --git a/src/bltGraphLine.C b/src/bltGraphLine.C
index 0398c2b..d0deac2 100644
--- a/src/bltGraphLine.C
+++ b/src/bltGraphLine.C
@@ -69,8 +69,6 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING, "-bottomvariable", "bottomVariable", "BottomVariable",
NULL, -1, Tk_Offset(LineGraphOptions, bottomMargin.varName),
TK_OPTION_NULL_OK, NULL, 0},
- {TK_OPTION_BOOLEAN, "-bufferelements", "bufferElements", "BufferElements",
- "yes", -1, Tk_Offset(LineGraphOptions, backingStore), 0, NULL, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
"crosshair", -1, Tk_Offset(LineGraphOptions, cursor),
TK_OPTION_NULL_OK, NULL, 0},
diff --git a/src/bltGraphLine.h b/src/bltGraphLine.h
index 1c99dea..9144edc 100644
--- a/src/bltGraphLine.h
+++ b/src/bltGraphLine.h
@@ -39,7 +39,6 @@ typedef struct {
Tk_3DBorder normalBg;
int borderWidth;
Margin margins[4];
- int backingStore;
Tk_Cursor cursor;
TextStyleOptions titleTextStyle;
int reqHeight;