diff options
author | joye <joye> | 2014-05-19 19:50:37 (GMT) |
---|---|---|
committer | joye <joye> | 2014-05-19 19:50:37 (GMT) |
commit | 47444bb0df327d9638736ff6b148aad786cdbf8a (patch) | |
tree | c4612b9840d5761209520af0f12dec397447430d /src | |
parent | aeb1105925a4f8422e0b89293b7a250a8927e3d3 (diff) | |
download | blt-47444bb0df327d9638736ff6b148aad786cdbf8a.zip blt-47444bb0df327d9638736ff6b148aad786cdbf8a.tar.gz blt-47444bb0df327d9638736ff6b148aad786cdbf8a.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrAxisOp.C | 10 | ||||
-rw-r--r-- | src/bltGrElemOp.C | 16 | ||||
-rw-r--r-- | src/bltGrElemOption.C | 3 | ||||
-rw-r--r-- | src/bltGrHairs.C | 4 | ||||
-rw-r--r-- | src/bltGrHairs.h | 2 | ||||
-rw-r--r-- | src/bltGrHairsOp.C | 4 | ||||
-rw-r--r-- | src/bltGrLegd.C | 4 | ||||
-rw-r--r-- | src/bltGrLegd.h | 2 | ||||
-rw-r--r-- | src/bltGrLegdOp.C | 26 | ||||
-rw-r--r-- | src/bltGrMarkerOp.C | 4 | ||||
-rw-r--r-- | src/bltGrMarkerPolygon.C | 2 | ||||
-rw-r--r-- | src/bltGrMisc.h | 22 | ||||
-rw-r--r-- | src/bltGrPenOp.C | 3 | ||||
-rw-r--r-- | src/bltGrXAxisOp.C | 3 | ||||
-rw-r--r-- | src/bltGraph.C | 71 | ||||
-rw-r--r-- | src/bltGraph.h | 2 | ||||
-rw-r--r-- | src/bltGraphBar.C | 74 | ||||
-rw-r--r-- | src/bltGraphBar.h | 2 | ||||
-rw-r--r-- | src/bltGraphLine.C | 64 | ||||
-rw-r--r-- | src/bltGraphOp.C | 10 |
20 files changed, 153 insertions, 175 deletions
diff --git a/src/bltGrAxisOp.C b/src/bltGrAxisOp.C index f10e96b..6f6cbf7 100644 --- a/src/bltGrAxisOp.C +++ b/src/bltGrAxisOp.C @@ -75,10 +75,11 @@ int AxisObjConfigure(Axis* axisPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - axisPtr->flags |= mask; - graphPtr->flags |= MAP_ALL | RESET_AXES | CACHE_DIRTY; + axisPtr->flags |= MAP_ITEM; if (axisPtr->configure() != TCL_OK) return TCL_ERROR; + + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); break; @@ -185,6 +186,7 @@ static int DeleteOp(ClientData clientData, Tcl_Interp* interp, if (axisPtr->refCount_ == 0) delete axisPtr; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; @@ -511,7 +513,7 @@ int AxisActivateOp(Axis* axisPtr, Tcl_Interp* interp, axisPtr->active_ = (string[0] == 'a') ? 1 : 0; if (!ops->hide && axisPtr->use_) { - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); } @@ -687,7 +689,7 @@ int AxisViewOp(Axis* axisPtr, Tcl_Interp* interp, ops->reqMax = EXP10(ops->reqMax); } - graphPtr->flags |= LAYOUT_NEEDED | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C index b32df22..ba099ce 100644 --- a/src/bltGrElemOp.C +++ b/src/bltGrElemOp.C @@ -67,11 +67,11 @@ int ElementObjConfigure( Element* elemPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - elemPtr->flags |= mask; elemPtr->flags |= MAP_ITEM; - graphPtr->flags |= MAP_ALL | RESET_AXES | CACHE_DIRTY; if (elemPtr->configure() != TCL_OK) return TCL_ERROR; + + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); break; @@ -183,6 +183,8 @@ static int ActivateOp(ClientData clientData, Tcl_Interp* interp, elemPtr->activeIndices_ = indices; elemPtr->active_ = 1; + + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; @@ -311,6 +313,8 @@ static int DeactivateOp(ClientData clientData, Tcl_Interp* interp, elemPtr->nActiveIndices_ = 0; elemPtr->active_ = 0; } + + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; @@ -327,7 +331,7 @@ static int DeleteOp(ClientData clientData, Tcl_Interp* interp, graphPtr->destroyElement(elemPtr); } - graphPtr->flags |= MAP_ALL | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; @@ -389,7 +393,7 @@ static int LowerOp(ClientData clientData, Tcl_Interp* interp, } Blt_Chain_Destroy(chain); - graphPtr->flags |= MAP_ALL | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); Tcl_SetObjResult(interp, DisplayListObj(graphPtr)); @@ -454,7 +458,7 @@ static int RaiseOp(ClientData clientData, Tcl_Interp* interp, } Blt_Chain_Destroy(chain); - graphPtr->flags |= MAP_ALL | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); Tcl_SetObjResult(interp, DisplayListObj(graphPtr)); @@ -501,7 +505,7 @@ static int ShowOp(ClientData clientData, Tcl_Interp* interp, elemPtr->link = link; } - graphPtr->flags |= MAP_ALL | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); Tcl_SetObjResult(interp, DisplayListObj(graphPtr)); diff --git a/src/bltGrElemOption.C b/src/bltGrElemOption.C index 82cf8ee..6a2acbb 100644 --- a/src/bltGrElemOption.C +++ b/src/bltGrElemOption.C @@ -441,8 +441,7 @@ static void VectorChangedProc(Tcl_Interp* interp, ClientData clientData, Element* elemPtr = valuesPtr->elemPtr; Graph* graphPtr = elemPtr->graphPtr_; - graphPtr->flags |= RESET_AXES; - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); } diff --git a/src/bltGrHairs.C b/src/bltGrHairs.C index 17a8ef2..0ec73ab 100644 --- a/src/bltGrHairs.C +++ b/src/bltGrHairs.C @@ -81,7 +81,7 @@ Crosshairs::~Crosshairs() // Configure -void Crosshairs::configure() +int Crosshairs::configure() { CrosshairsOptions* ops = (CrosshairsOptions*)ops_; GraphOptions* gops = (GraphOptions*)graphPtr_->ops_; @@ -124,6 +124,8 @@ void Crosshairs::configure() segArr_[1].x2 = graphPtr_->right_; enable(); + + return TCL_OK; } void Crosshairs::enable() diff --git a/src/bltGrHairs.h b/src/bltGrHairs.h index 88b659f..970d3ac 100644 --- a/src/bltGrHairs.h +++ b/src/bltGrHairs.h @@ -64,7 +64,7 @@ class Crosshairs { Crosshairs(Graph*); virtual ~Crosshairs(); - void configure(); + int configure(); void on(); void off(); void enable(); diff --git a/src/bltGrHairsOp.C b/src/bltGrHairsOp.C index af3e0ec..21f3871 100644 --- a/src/bltGrHairsOp.C +++ b/src/bltGrHairsOp.C @@ -58,8 +58,8 @@ static int CrosshairsObjConfigure(Graph* graphPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - graphPtr->flags |= mask; - chPtr->configure(); + if (chPtr->configure() != TCL_OK) + return TCL_ERROR; break; } diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 6311430..4e6a1c9 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -223,7 +223,7 @@ Legend::~Legend() free(ops_); } -void Legend::configure() +int Legend::configure() { LegendOptions* ops = (LegendOptions*)ops_; @@ -242,6 +242,8 @@ void Legend::configure() Blt_FreePrivateGC(graphPtr_->display_, focusGC_); focusGC_ = newGC; + + return TCL_OK; } void Legend::map(int plotWidth, int plotHeight) diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h index 506df98..928404f 100644 --- a/src/bltGrLegd.h +++ b/src/bltGrLegd.h @@ -147,7 +147,7 @@ class Legend { Legend(Graph*); virtual ~Legend(); - void configure(); + int configure(); void map(int, int); void draw(Drawable drawable); void print(Blt_Ps ps); diff --git a/src/bltGrLegdOp.C b/src/bltGrLegdOp.C index f8d9414..769656c 100644 --- a/src/bltGrLegdOp.C +++ b/src/bltGrLegdOp.C @@ -68,9 +68,10 @@ static int LegendObjConfigure(Graph* graphPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - graphPtr->flags |= mask; - graphPtr->flags |= MAP_ALL | RESET_AXES | CACHE_DIRTY; - legendPtr->configure(); + if (legendPtr->configure() != TCL_OK) + return TCL_ERROR; + + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); break; @@ -160,8 +161,10 @@ static int ActivateOp(ClientData clientData, Tcl_Interp* interp, } } - if (redraw && !ops->hide) - graphPtr->flags |= CACHE_DIRTY; + if (redraw && !ops->hide) { + graphPtr->flags |= LAYOUT; + graphPtr->eventuallyRedraw(); + } // List active elements in stacking order Tcl_Obj *listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL); @@ -250,7 +253,8 @@ static int FocusOp(ClientData clientData, Tcl_Interp* interp, } Blt_SetFocusItem(legendPtr->bindTable_,legendPtr->focusPtr_,CID_LEGEND_ENTRY); - graphPtr->flags |= CACHE_DIRTY; + + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); if (legendPtr->focusPtr_) @@ -313,7 +317,7 @@ static int SelectionAnchorOp(ClientData clientData, Tcl_Interp* interp, if (elemPtr) Tcl_SetStringObj(Tcl_GetObjResult(interp), elemPtr->name_, -1); - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); return TCL_OK; @@ -326,7 +330,7 @@ static int SelectionClearallOp(ClientData clientData, Tcl_Interp* interp, Legend* legendPtr = graphPtr->legend_; legendPtr->clearSelection(); - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); return TCL_OK; @@ -384,7 +388,7 @@ static int SelectionMarkOp(ClientData clientData, Tcl_Interp* interp, if (ops->selectCmd) legendPtr->eventuallyInvokeSelectCmd(); - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); } return TCL_OK; @@ -461,7 +465,7 @@ static int SelectionSetOp(ClientData clientData, Tcl_Interp* interp, if (ops->selectCmd) legendPtr->eventuallyInvokeSelectCmd(); - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); return TCL_OK; @@ -490,7 +494,7 @@ static void LostSelectionProc(ClientData clientData) if (ops->exportSelection) legendPtr->clearSelection(); - graphPtr->flags |= CACHE_DIRTY; + graphPtr->flags |= LAYOUT; graphPtr->eventuallyRedraw(); } diff --git a/src/bltGrMarkerOp.C b/src/bltGrMarkerOp.C index f598a0d..b411b0b 100644 --- a/src/bltGrMarkerOp.C +++ b/src/bltGrMarkerOp.C @@ -73,7 +73,6 @@ static int MarkerObjConfigure( Graph* graphPtr,Marker* markerPtr, Tk_RestoreSavedOptions(&savedOptions); } - markerPtr->flags |= mask; markerPtr->flags |= MAP_ITEM; if (markerPtr->configure() != TCL_OK) return TCL_ERROR; @@ -255,6 +254,7 @@ static int DeleteOp(ClientData clientData, Tcl_Interp* interp, } delete markerPtr; } + graphPtr->flags |= CACHE_DIRTY; graphPtr->eventuallyRedraw(); return TCL_OK; @@ -423,7 +423,7 @@ static int RelinkOp(ClientData clientData, Tcl_Interp* interp, if (ops->drawUnder) graphPtr->flags |= CACHE_DIRTY; - graphPtr->eventuallyRedraw(); + graphPtr->eventuallyRedraw(); return TCL_OK; } diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C index 3af9047..f3c0076 100644 --- a/src/bltGrMarkerPolygon.C +++ b/src/bltGrMarkerPolygon.C @@ -185,7 +185,7 @@ int PolygonMarker::configure() Tk_FreeGC(graphPtr_->display_, fillGC_); fillGC_ = newGC; - if ((gcMask == 0) && !(graphPtr_->flags & RESET_AXES) && ops->xorr) { + if (ops->xorr && (gcMask == 0)) { if (drawable != None) { map(); draw(drawable); diff --git a/src/bltGrMisc.h b/src/bltGrMisc.h index e8cb9d6..ba83d0d 100644 --- a/src/bltGrMisc.h +++ b/src/bltGrMisc.h @@ -37,16 +37,18 @@ using namespace std; #include <tk.h> -#define GRAPH_DELETED (1<<1) -#define REDRAW_PENDING (1<<2) -#define FOCUS (1<<3) - -#define MAP_ITEM (1<<4) - -#define MAP_ALL (1<<5) -#define LAYOUT_NEEDED (1<<6) -#define RESET_AXES (1<<7) -#define CACHE_DIRTY (1<<8) +#define GRAPH_DELETED (1<<1) +#define REDRAW_PENDING (1<<2) +#define FOCUS (1<<3) + +#define MAP_ITEM (1<<4) + +#define RESET_AXES (1<<5) +#define LAYOUT (1<<6) +#define MAP_AXES (1<<7) +#define MAP_ELEMENTS (1<<8) +#define MAP_MARKERS (1<<9) +#define CACHE_DIRTY (1<<10) #define MARGIN_NONE -1 #define MARGIN_BOTTOM 0 /* x */ diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C index d96aab0..a62c95a 100644 --- a/src/bltGrPenOp.C +++ b/src/bltGrPenOp.C @@ -57,10 +57,9 @@ int PenObjConfigure(Graph* graphPtr, Pen* penPtr, Tk_RestoreSavedOptions(&savedOptions); } - graphPtr->flags |= mask; - graphPtr->flags |= CACHE_DIRTY; if (penPtr->configure() != TCL_OK) return TCL_ERROR; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); break; diff --git a/src/bltGrXAxisOp.C b/src/bltGrXAxisOp.C index 42a35e9..482eae6 100644 --- a/src/bltGrXAxisOp.C +++ b/src/bltGrXAxisOp.C @@ -193,8 +193,7 @@ static int UseOp(ClientData clientData, Tcl_Interp* interp, axisPtr->use_ =1; } - // When any axis changes, we need to layout the entire graph. - graphPtr->flags |= MAP_ALL | RESET_AXES | LAYOUT_NEEDED; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); return TCL_OK; diff --git a/src/bltGraph.C b/src/bltGraph.C index 935bd87..5abd962 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -82,7 +82,7 @@ Graph::Graph(ClientData clientData, Tcl_Interp* interp, GraphInstCmdProc, this, GraphInstCmdDeleteProc); - flags = MAP_ALL | RESET_AXES; + flags = (RESET_AXES | LAYOUT); nextMarkerId_ = 1; legend_ = new Legend(this); @@ -171,7 +171,7 @@ Graph::~Graph() free (ops_); } -void Graph::configure() +int Graph::configure() { GraphOptions* ops = (GraphOptions*)ops_; @@ -214,31 +214,40 @@ void Graph::configure() Tk_FreePixmap(display_, cache_); cache_ = None; } + + return TCL_OK; } void Graph::map() { - if (flags & RESET_AXES) + if (flags & RESET_AXES) { + cerr << "RESET_AXES" << endl; resetAxes(); + flags &= ~RESET_AXES; + flags |= CACHE_DIRTY; + } - if (flags & LAYOUT_NEEDED) { - cerr << "LAYOUT_NEEDED" << endl; + if (flags & LAYOUT) { + cerr << "LAYOUT" << endl; layoutGraph(); - flags &= ~LAYOUT_NEEDED; + flags &= ~LAYOUT; + flags |= (MAP_AXES | MAP_ELEMENTS | MAP_MARKERS | CACHE_DIRTY); } - if ((vRange_ > 1) && (hRange_ > 1)) { - if (flags & MAP_ALL) - mapAxes(); - - mapElements(); - mapMarkers(); - flags &= ~(MAP_ALL); + if (flags & MAP_AXES) { + cerr << "MAP_AXES" << endl; + mapAxes(); + flags &= ~MAP_AXES; + flags |= CACHE_DIRTY; } + + mapElements(); + mapMarkers(); } void Graph::draw() { + cerr << endl << "flags= " << hex << flags << endl; GraphOptions* ops = (GraphOptions*)ops_; flags &= ~REDRAW_PENDING; @@ -341,19 +350,18 @@ void Graph::draw() // Draw focus highlight ring if ((ops->highlightWidth > 0) && (flags & FOCUS)) { GC gc = Tk_GCForColor(ops->highlightColor, drawable); - Tk_DrawFocusHighlight(tkwin_, gc, ops->highlightWidth, - drawable); + Tk_DrawFocusHighlight(tkwin_, gc, ops->highlightWidth, drawable); } // Disable crosshairs before redisplaying to the screen disableCrosshairs(); - XCopyArea(display_, drawable, Tk_WindowId(tkwin_), - drawGC_, 0, 0, width_, height_, 0, 0); + XCopyArea(display_, drawable, Tk_WindowId(tkwin_), drawGC_, + 0, 0, width_, height_, 0, 0); enableCrosshairs(); Tk_FreePixmap(display_, drawable); - flags &= ~(MAP_ALL | RESET_AXES); + cerr << "flags= " << hex << flags << endl; } int Graph::print(const char *ident, Blt_Ps ps) @@ -377,7 +385,7 @@ int Graph::print(const char *ident, Blt_Ps ps) height_ = Tk_ReqHeight(tkwin_); Blt_Ps_ComputeBoundingBox(setupPtr, width_, height_); - flags |= LAYOUT_NEEDED | MAP_ALL | RESET_AXES; + flags |= (RESET_AXES | LAYOUT); /* Turn on PostScript measurements when computing the graph's layout. */ Blt_Ps_SetPrinting(ps, 1); @@ -456,13 +464,12 @@ int Graph::print(const char *ident, Blt_Ps ps) error: width_ = Tk_Width(tkwin_); height_ = Tk_Height(tkwin_); - flags |= MAP_ALL | RESET_AXES; Blt_Ps_SetPrinting(ps, 0); reconfigure(); - map(); // Redraw the graph in order to re-calculate the layout as soon as // possible. This is in the case the crosshairs are active. + flags |= (RESET_AXES | LAYOUT); eventuallyRedraw(); return result; @@ -691,14 +698,18 @@ void Graph::configureElements() void Graph::mapElements() { - cerr << "mapElements()" << endl; for (Blt_ChainLink link =Blt_Chain_FirstLink(elements_.displayList); link; link = Blt_Chain_NextLink(link)) { Element* elemPtr = (Element*)Blt_Chain_GetValue(link); - if ((flags & MAP_ALL) || (elemPtr->flags & MAP_ITEM)) + if ((flags & MAP_ELEMENTS) || (elemPtr->flags & MAP_ITEM)) { + cerr << "MAP_ELEMENTS" << endl; elemPtr->map(); + elemPtr->flags &= ~MAP_ITEM; + } } + + flags &= ~MAP_ELEMENTS; } void Graph::drawElements(Drawable drawable) @@ -790,7 +801,6 @@ void Graph::configureMarkers() void Graph::mapMarkers() { - cerr << "mapMarkers()" << endl; for (Blt_ChainLink link = Blt_Chain_FirstLink(markers_.displayList); link; link = Blt_Chain_NextLink(link)) { Marker* markerPtr = (Marker*)Blt_Chain_GetValue(link); @@ -799,11 +809,14 @@ void Graph::mapMarkers() if (mops->hide) continue; - if ((flags & MAP_ALL) || (markerPtr->flags & MAP_ITEM)) { + if ((flags & MAP_MARKERS) || (markerPtr->flags & MAP_ITEM)) { + cerr << "MAP_MARKERS" << endl; markerPtr->map(); markerPtr->flags &= ~MAP_ITEM; } } + + flags &= ~MAP_MARKERS; } void Graph::drawMarkers(Drawable drawable, int under) @@ -989,7 +1002,6 @@ void Graph::configureAxes() void Graph::mapAxes() { - cerr << "mapAxes()" << endl; GraphOptions* ops = (GraphOptions*)ops_; for (int ii=0; ii<4; ii++) { @@ -1170,7 +1182,6 @@ Point2d Graph::invMap2D(double x, double y, Axis* xAxis, Axis* yAxis) void Graph::resetAxes() { - cerr << "resetAxes()" << endl; // Step 1: Reset all axes. Initialize the data limits of the axis to // impossible values. Tcl_HashSearch cursor; @@ -1217,10 +1228,6 @@ void Graph::resetAxes() else axisPtr->linearScale(min, max); } - - // When any axis changes, we need to layout the entire graph. - flags &= ~RESET_AXES; - flags |= LAYOUT_NEEDED | MAP_ALL | CACHE_DIRTY; } Axis* Graph::nearestAxis(int x, int y) @@ -1343,7 +1350,7 @@ static ClientData PickEntry(ClientData clientData, int x, int y, Graph* graphPtr = (Graph*)clientData; GraphOptions* ops = (GraphOptions*)graphPtr->ops_; - if (graphPtr->flags & MAP_ALL) { + if (graphPtr->flags & (MAP_AXES | MAP_ELEMENTS | MAP_MARKERS)) { *contextPtr = (ClientData)NULL; return NULL; } diff --git a/src/bltGraph.h b/src/bltGraph.h index 99b86c3..d3889bc 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -209,7 +209,7 @@ class Graph { Graph(ClientData, Tcl_Interp*, int, Tcl_Obj* const []); virtual ~Graph(); - virtual void configure(); + virtual int configure(); void map(); void draw(); void eventuallyRedraw(); diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C index 3dc16a8..ffaca02 100644 --- a/src/bltGraphBar.C +++ b/src/bltGraphBar.C @@ -69,49 +69,39 @@ static const char* searchAlongObjOption[] = {"x", "y", "both", NULL}; static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_DOUBLE, "-aspect", "aspect", "Aspect", - "0", -1, Tk_Offset(BarGraphOptions, aspect), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, aspect), 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - STD_NORMAL_BACKGROUND, -1, Tk_Offset(BarGraphOptions, normalBg), - 0, NULL, CACHE_DIRTY}, + STD_NORMAL_BACKGROUND, -1, Tk_Offset(BarGraphOptions, normalBg), 0, NULL, 0}, {TK_OPTION_STRING_TABLE, "-barmode", "barMode", "BarMode", - "normal", -1, Tk_Offset(BarGraphOptions, barMode), - 0, &barmodeObjOption, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "normal", -1, Tk_Offset(BarGraphOptions, barMode), 0, &barmodeObjOption, 0}, {TK_OPTION_DOUBLE, "-barwidth", "barWidth", "BarWidth", - ".9", -1, Tk_Offset(BarGraphOptions, barWidth), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + ".9", -1, Tk_Offset(BarGraphOptions, barWidth), 0, NULL, 0}, {TK_OPTION_DOUBLE, "-baseline", "baseline", "Baseline", "0", -1, Tk_Offset(BarGraphOptions, baseline), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, -1, 0, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, -1, 0, 0, "-background", 0}, {TK_OPTION_SYNONYM, "-bm", NULL, NULL, NULL, -1, 0, 0, "-bottommargin", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - STD_BORDERWIDTH, -1, Tk_Offset(BarGraphOptions, borderWidth), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_BORDERWIDTH, -1, Tk_Offset(BarGraphOptions, borderWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-bottommargin", "bottomMargin", "BottomMargin", - "0", -1, Tk_Offset(BarGraphOptions, bottomMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, bottomMargin.reqSize), 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "crosshair", -1, Tk_Offset(BarGraphOptions, cursor), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", STD_FONT_MEDIUM, -1, Tk_Offset(BarGraphOptions, titleTextStyle.font), - 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", STD_NORMAL_FOREGROUND, -1, Tk_Offset(BarGraphOptions, titleTextStyle.color), - 0, NULL, - CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_SYNONYM, "-halo", NULL, NULL, NULL, -1, 0, 0, "-searchhalo", 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - "4i", -1, Tk_Offset(BarGraphOptions, reqHeight), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "4i", -1, Tk_Offset(BarGraphOptions, reqHeight), 0, NULL, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", STD_NORMAL_BACKGROUND, -1, Tk_Offset(BarGraphOptions, highlightBgColor), - 0, NULL, - CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", STD_NORMAL_FOREGROUND, -1, Tk_Offset(BarGraphOptions, highlightColor), 0, NULL, 0}, @@ -119,35 +109,27 @@ static Tk_OptionSpec optionSpecs[] = { "HighlightThickness", "2", -1, Tk_Offset(BarGraphOptions, highlightWidth), 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-invertxy", "invertXY", "InvertXY", - "no", -1, Tk_Offset(BarGraphOptions, inverted), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "no", -1, Tk_Offset(BarGraphOptions, inverted), 0, NULL, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "center", -1, Tk_Offset(BarGraphOptions, titleTextStyle.justify), 0, NULL, 0}, {TK_OPTION_PIXELS, "-leftmargin", "leftMargin", "Margin", - "0", -1, Tk_Offset(BarGraphOptions, leftMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, leftMargin.reqSize), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-lm", NULL, NULL, NULL, -1, 0, 0, "-leftmargin", 0}, {TK_OPTION_BORDER, "-plotbackground", "plotbackground", "PlotBackground", - STD_NORMAL_BACKGROUND, -1, Tk_Offset(BarGraphOptions, plotBg), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_NORMAL_BACKGROUND, -1, Tk_Offset(BarGraphOptions, plotBg), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotborderwidth", "plotBorderWidth", "PlotBorderWidth", - STD_BORDERWIDTH, -1, Tk_Offset(BarGraphOptions, plotBW), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_BORDERWIDTH, -1, Tk_Offset(BarGraphOptions, plotBW), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotpadx", "plotPadX", "PlotPad", - "0", -1, Tk_Offset(BarGraphOptions, xPad), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, xPad), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotpady", "plotPadY", "PlotPad", - "0", -1, Tk_Offset(BarGraphOptions, yPad), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, yPad), 0, NULL, 0}, {TK_OPTION_RELIEF, "-plotrelief", "plotRelief", "Relief", - "flat", -1, Tk_Offset(BarGraphOptions, plotRelief), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "flat", -1, Tk_Offset(BarGraphOptions, plotRelief), 0, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "flat", -1, Tk_Offset(BarGraphOptions, relief), 0, NULL, 0}, {TK_OPTION_PIXELS, "-rightmargin", "rightMargin", "Margin", - "0", -1, Tk_Offset(BarGraphOptions, rightMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, rightMargin.reqSize), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-rm", NULL, NULL, NULL, -1, 0, 0, "-rightmargin", 0}, {TK_OPTION_PIXELS, "-searchhalo", "searchhalo", "SearchHalo", "2m", -1, Tk_Offset(BarGraphOptions, search.halo), 0, NULL, 0}, @@ -163,20 +145,16 @@ static Tk_OptionSpec optionSpecs[] = { NULL, -1, Tk_Offset(BarGraphOptions, takeFocus), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-title", "title", "Title", NULL, -1, Tk_Offset(BarGraphOptions, title), - TK_OPTION_NULL_OK, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_SYNONYM, "-tm", NULL, NULL, NULL, -1, 0, 0, "-topmargin", 0}, {TK_OPTION_PIXELS, "-topmargin", "topMargin", "TopMargin", - "0", -1, Tk_Offset(BarGraphOptions, topMargin.reqSize), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, topMargin.reqSize), 0, NULL, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - "5i", -1, Tk_Offset(BarGraphOptions, reqWidth), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "5i", -1, Tk_Offset(BarGraphOptions, reqWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotwidth", "plotWidth", "PlotWidth", - "0", -1, Tk_Offset(BarGraphOptions, reqPlotWidth), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, reqPlotWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotheight", "plotHeight", "PlotHeight", - "0", -1, Tk_Offset(BarGraphOptions, reqPlotHeight), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(BarGraphOptions, reqPlotHeight), 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0} }; @@ -229,14 +207,14 @@ BarGraph::~BarGraph() destroyBarSets(); } -void BarGraph::configure() +int BarGraph::configure() { BarGraphOptions* ops = (BarGraphOptions*)ops_; // Don't allow negative bar widths. Reset to an arbitrary value (0.1) if (ops->barWidth <= 0.0f) ops->barWidth = 0.9f; - Graph::configure(); + return Graph::configure(); } int BarGraph::createPen(const char* penName, int objc, Tcl_Obj* const objv[]) @@ -261,7 +239,7 @@ int BarGraph::createPen(const char* penName, int objc, Tcl_Obj* const objv[]) return TCL_ERROR; } - flags |= CACHE_DIRTY; + flags |= (RESET_AXES | LAYOUT); eventuallyRedraw(); return TCL_OK; diff --git a/src/bltGraphBar.h b/src/bltGraphBar.h index 1561bdb..9f1606e 100644 --- a/src/bltGraphBar.h +++ b/src/bltGraphBar.h @@ -108,7 +108,7 @@ class BarGraph : public Graph { BarGraph(ClientData, Tcl_Interp*, int, Tcl_Obj* const []); virtual ~BarGraph(); - void configure(); + int configure(); int createPen(const char*, int, Tcl_Obj* const []); int createElement(int, Tcl_Obj* const []); }; diff --git a/src/bltGraphLine.C b/src/bltGraphLine.C index 594b372..dd5a555 100644 --- a/src/bltGraphLine.C +++ b/src/bltGraphLine.C @@ -52,41 +52,34 @@ static const char* searchAlongObjOption[] = {"x", "y", "both", NULL}; static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_DOUBLE, "-aspect", "aspect", "Aspect", - "0", -1, Tk_Offset(LineGraphOptions, aspect), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, aspect), 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", STD_NORMAL_BACKGROUND, -1, Tk_Offset(LineGraphOptions, normalBg), - 0, NULL, CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, -1, 0, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, -1, 0, 0, "-background", 0}, {TK_OPTION_SYNONYM, "-bm", NULL, NULL, NULL, -1, 0, 0, "-bottommargin", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - STD_BORDERWIDTH, -1, Tk_Offset(LineGraphOptions, borderWidth), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_BORDERWIDTH, -1, Tk_Offset(LineGraphOptions, borderWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-bottommargin", "bottomMargin", "BottomMargin", - "0", -1, Tk_Offset(LineGraphOptions, bottomMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, bottomMargin.reqSize), 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "crosshair", -1, Tk_Offset(LineGraphOptions, cursor), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", STD_FONT_MEDIUM, -1, Tk_Offset(LineGraphOptions, titleTextStyle.font), - 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", STD_NORMAL_FOREGROUND, -1, - Tk_Offset(LineGraphOptions, titleTextStyle.color), - 0, NULL, CACHE_DIRTY}, + Tk_Offset(LineGraphOptions, titleTextStyle.color), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-halo", NULL, NULL, NULL, -1, 0, 0, "-searchhalo", 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - "4i", -1, Tk_Offset(LineGraphOptions, reqHeight), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "4i", -1, Tk_Offset(LineGraphOptions, reqHeight), 0, NULL, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", STD_NORMAL_BACKGROUND, -1, Tk_Offset(LineGraphOptions, highlightBgColor), - 0, NULL, - CACHE_DIRTY}, + 0, NULL, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", STD_NORMAL_FOREGROUND, -1, Tk_Offset(LineGraphOptions, highlightColor), 0, NULL, 0}, @@ -94,35 +87,27 @@ static Tk_OptionSpec optionSpecs[] = { "HighlightThickness", "2", -1, Tk_Offset(LineGraphOptions, highlightWidth), 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-invertxy", "invertXY", "InvertXY", - "no", -1, Tk_Offset(LineGraphOptions, inverted), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY | RESET_AXES}, + "no", -1, Tk_Offset(LineGraphOptions, inverted), 0, NULL, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "center", -1, Tk_Offset(LineGraphOptions, titleTextStyle.justify), 0, NULL, 0}, {TK_OPTION_PIXELS, "-leftmargin", "leftMargin", "Margin", - "0", -1, Tk_Offset(LineGraphOptions, leftMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, leftMargin.reqSize), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-lm", NULL, NULL, NULL, -1, 0, 0, "-leftmargin", 0}, {TK_OPTION_BORDER, "-plotbackground", "plotbackground", "PlotBackground", - STD_NORMAL_BACKGROUND, -1, Tk_Offset(LineGraphOptions, plotBg), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_NORMAL_BACKGROUND, -1, Tk_Offset(LineGraphOptions, plotBg), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotborderwidth", "plotBorderWidth", "PlotBorderWidth", - STD_BORDERWIDTH, -1, Tk_Offset(LineGraphOptions, plotBW), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + STD_BORDERWIDTH, -1, Tk_Offset(LineGraphOptions, plotBW), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotpadx", "plotPadX", "PlotPad", - "0", -1, Tk_Offset(LineGraphOptions, xPad), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, xPad), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotpady", "plotPadY", "PlotPad", - "0", -1, Tk_Offset(LineGraphOptions, yPad), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, yPad), 0, NULL, 0}, {TK_OPTION_RELIEF, "-plotrelief", "plotRelief", "Relief", - "flat", -1, Tk_Offset(LineGraphOptions, plotRelief), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "flat", -1, Tk_Offset(LineGraphOptions, plotRelief), 0, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "flat", -1, Tk_Offset(LineGraphOptions, relief), 0, NULL, 0}, {TK_OPTION_PIXELS, "-rightmargin", "rightMargin", "Margin", - "0", -1, Tk_Offset(LineGraphOptions, rightMargin.reqSize), 0, NULL, - MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, rightMargin.reqSize), 0, NULL, 0}, {TK_OPTION_SYNONYM, "-rm", NULL, NULL, NULL, -1, 0, 0, "-rightmargin", 0}, {TK_OPTION_PIXELS, "-searchhalo", "searchhalo", "SearchHalo", "2m", -1, Tk_Offset(LineGraphOptions, search.halo), 0, NULL, 0}, @@ -138,21 +123,16 @@ static Tk_OptionSpec optionSpecs[] = { NULL, -1, Tk_Offset(LineGraphOptions, takeFocus), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-title", "title", "Title", - NULL, -1, Tk_Offset(LineGraphOptions, title), - TK_OPTION_NULL_OK, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + NULL, -1, Tk_Offset(LineGraphOptions, title), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_SYNONYM, "-tm", NULL, NULL, NULL, -1, 0, 0, "-topmargin", 0}, {TK_OPTION_PIXELS, "-topmargin", "topMargin", "TopMargin", - "0", -1, Tk_Offset(LineGraphOptions, topMargin.reqSize), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, topMargin.reqSize), 0, NULL, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - "5i", -1, Tk_Offset(LineGraphOptions, reqWidth), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "5i", -1, Tk_Offset(LineGraphOptions, reqWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotwidth", "plotWidth", "PlotWidth", - "0", -1, Tk_Offset(LineGraphOptions, reqPlotWidth), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, reqPlotWidth), 0, NULL, 0}, {TK_OPTION_PIXELS, "-plotheight", "plotHeight", "PlotHeight", - "0", -1, Tk_Offset(LineGraphOptions, reqPlotHeight), - 0, NULL, MAP_ALL | RESET_AXES | CACHE_DIRTY}, + "0", -1, Tk_Offset(LineGraphOptions, reqPlotHeight), 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0} }; @@ -221,7 +201,7 @@ int LineGraph::createPen(const char* penName, int objc, Tcl_Obj* const objv[]) return TCL_ERROR; } - flags |= CACHE_DIRTY; + flags |= (RESET_AXES | LAYOUT); eventuallyRedraw(); return TCL_OK; diff --git a/src/bltGraphOp.C b/src/bltGraphOp.C index efcfe2a..427c569 100644 --- a/src/bltGraphOp.C +++ b/src/bltGraphOp.C @@ -86,8 +86,10 @@ int GraphObjConfigure(Graph* graphPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - graphPtr->flags |= mask; - graphPtr->configure(); + if (graphPtr->configure() != TCL_OK) + return TCL_ERROR; + + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); break; @@ -424,7 +426,6 @@ void GraphEventProc(ClientData clientData, XEvent* eventPtr) if (eventPtr->xexpose.count == 0) { graphPtr->eventuallyRedraw(); } - } else if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) { if (eventPtr->xfocus.detail != NotifyInferior) { @@ -434,7 +435,6 @@ void GraphEventProc(ClientData clientData, XEvent* eventPtr) graphPtr->flags &= ~FOCUS; graphPtr->eventuallyRedraw(); } - } else if (eventPtr->type == DestroyNotify) { if (!(graphPtr->flags & GRAPH_DELETED)) { @@ -446,7 +446,7 @@ void GraphEventProc(ClientData clientData, XEvent* eventPtr) } } else if (eventPtr->type == ConfigureNotify) { - graphPtr->flags |= MAP_ALL | RESET_AXES; + graphPtr->flags |= (RESET_AXES | LAYOUT); graphPtr->eventuallyRedraw(); } } |