diff options
author | joye <joye> | 2014-05-30 21:16:38 (GMT) |
---|---|---|
committer | joye <joye> | 2014-05-30 21:16:38 (GMT) |
commit | b4e1bb34955d01729ee9e29bae532c06b71b1afa (patch) | |
tree | f9bc91e6f71c5c3063108333b91478ed7063ebe7 /src | |
parent | 29c03bcc9df76650f217afa91a739490a5e394bc (diff) | |
download | blt-b4e1bb34955d01729ee9e29bae532c06b71b1afa.zip blt-b4e1bb34955d01729ee9e29bae532c06b71b1afa.tar.gz blt-b4e1bb34955d01729ee9e29bae532c06b71b1afa.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrAxis.C | 12 | ||||
-rw-r--r-- | src/bltGrHairs.C | 6 | ||||
-rw-r--r-- | src/bltGrLegd.C | 6 | ||||
-rw-r--r-- | src/bltGrMarkerLine.C | 6 | ||||
-rw-r--r-- | src/bltGrMarkerPolygon.C | 6 | ||||
-rw-r--r-- | src/bltGrMisc.C | 21 | ||||
-rw-r--r-- | src/bltGrMisc.h | 5 | ||||
-rw-r--r-- | src/bltGrPSOutput.h | 3 | ||||
-rw-r--r-- | src/bltGrPenLine.C | 6 | ||||
-rw-r--r-- | src/bltGraph.C | 21 | ||||
-rw-r--r-- | src/bltGraph.h | 5 |
11 files changed, 47 insertions, 50 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index 80caa0d..367c55e 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -290,12 +290,12 @@ Axis::~Axis() if (ops->major.segments) free(ops->major.segments); if (ops->major.gc) - Blt_FreePrivateGC(graphPtr_->display_, ops->major.gc); + graphPtr_->freePrivateGC(ops->major.gc); if (ops->minor.segments) free(ops->minor.segments); if (ops->minor.gc) - Blt_FreePrivateGC(graphPtr_->display_, ops->minor.gc); + graphPtr_->freePrivateGC(ops->minor.gc); if (t1Ptr_) free(t1Ptr_); @@ -1149,12 +1149,12 @@ void Axis::resetTextStyles() gcValues.line_style = LineOnOffDash; gcMask |= GCLineStyle; } - newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (LineIsDashed(ops->major.dashes)) Blt_SetDashes(graphPtr_->display_, newGC, &ops->major.dashes); if (ops->major.gc) - Blt_FreePrivateGC(graphPtr_->display_, ops->major.gc); + graphPtr_->freePrivateGC(ops->major.gc); ops->major.gc = newGC; @@ -1165,12 +1165,12 @@ void Axis::resetTextStyles() gcValues.line_style = LineOnOffDash; gcMask |= GCLineStyle; } - newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (LineIsDashed(ops->minor.dashes)) Blt_SetDashes(graphPtr_->display_, newGC, &ops->minor.dashes); if (ops->minor.gc) - Blt_FreePrivateGC(graphPtr_->display_, ops->minor.gc); + graphPtr_->freePrivateGC(ops->minor.gc); ops->minor.gc = newGC; } diff --git a/src/bltGrHairs.C b/src/bltGrHairs.C index 0ec73ab..db8799a 100644 --- a/src/bltGrHairs.C +++ b/src/bltGrHairs.C @@ -73,7 +73,7 @@ Crosshairs::Crosshairs(Graph* graphPtr) Crosshairs::~Crosshairs() { if (gc_) - Blt_FreePrivateGC(graphPtr_->display_, gc_); + graphPtr_->freePrivateGC(gc_); Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_); free(ops_); @@ -104,12 +104,12 @@ int Crosshairs::configure() gcValues.line_style = LineOnOffDash; gcMask |= GCLineStyle; } - GC newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + GC newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (LineIsDashed(ops->dashes)) Blt_SetDashes(graphPtr_->display_, newGC, &ops->dashes); if (gc_ != NULL) - Blt_FreePrivateGC(graphPtr_->display_, gc_); + graphPtr_->freePrivateGC(gc_); gc_ = newGC; diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 9f4f486..5c6a607 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -211,7 +211,7 @@ Legend::~Legend() delete bindTable_; if (focusGC_) - Blt_FreePrivateGC(graphPtr_->display_, focusGC_); + graphPtr_->freePrivateGC(focusGC_); if (graphPtr_->tkwin_) Tk_DeleteSelHandler(graphPtr_->tkwin_, XA_PRIMARY, XA_STRING); @@ -232,13 +232,13 @@ int Legend::configure() gcValues.foreground = ops->focusColor->pixel; gcValues.line_style = (LineIsDashed(ops->focusDashes)) ? LineOnOffDash : LineSolid; - GC newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + GC newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (LineIsDashed(ops->focusDashes)) { ops->focusDashes.offset = 2; Blt_SetDashes(graphPtr_->display_, newGC, &ops->focusDashes); } if (focusGC_) - Blt_FreePrivateGC(graphPtr_->display_, focusGC_); + graphPtr_->freePrivateGC(focusGC_); focusGC_ = newGC; diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C index 995e165..e0e5f3f 100644 --- a/src/bltGrMarkerLine.C +++ b/src/bltGrMarkerLine.C @@ -105,7 +105,7 @@ LineMarker::LineMarker(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr) LineMarker::~LineMarker() { if (gc_) - Blt_FreePrivateGC(graphPtr_->display_, gc_); + graphPtr_->freePrivateGC(gc_); if (segments_) delete [] segments_; } @@ -148,9 +148,9 @@ int LineMarker::configure() draw(drawable); } - GC newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + GC newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (gc_) - Blt_FreePrivateGC(graphPtr_->display_, gc_); + graphPtr_->freePrivateGC(gc_); if (LineIsDashed(ops->dashes)) Blt_SetDashes(graphPtr_->display_, newGC, &ops->dashes); diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C index de839f7..c8e614e 100644 --- a/src/bltGrMarkerPolygon.C +++ b/src/bltGrMarkerPolygon.C @@ -113,7 +113,7 @@ PolygonMarker::~PolygonMarker() if (fillGC_) Tk_FreeGC(graphPtr_->display_, fillGC_); if (outlineGC_) - Blt_FreePrivateGC(graphPtr_->display_, outlineGC_); + graphPtr_->freePrivateGC(outlineGC_); if (fillPts_) delete [] fillPts_; if (outlinePts_) @@ -163,11 +163,11 @@ int PolygonMarker::configure() } // outlineGC - GC newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + GC newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (LineIsDashed(ops->dashes)) Blt_SetDashes(graphPtr_->display_, newGC, &ops->dashes); if (outlineGC_) - Blt_FreePrivateGC(graphPtr_->display_, outlineGC_); + graphPtr_->freePrivateGC(outlineGC_); outlineGC_ = newGC; // fillGC diff --git a/src/bltGrMisc.C b/src/bltGrMisc.C index b04c8c6..c59b9f3 100644 --- a/src/bltGrMisc.C +++ b/src/bltGrMisc.C @@ -363,27 +363,6 @@ Point2d Blt_GetProjection(int x, int y, Point2d *p, Point2d *q) return t; } -GC Blt_GetPrivateGC(Tk_Window tkwin, unsigned long gcMask, XGCValues *valuePtr) -{ - Pixmap pixmap = None; - Drawable drawable = Tk_WindowId(tkwin); - Display* display = Tk_Display(tkwin); - if (drawable == None) - drawable = RootWindow(Tk_Display(tkwin),Tk_ScreenNumber(tkwin)); - - GC gc = XCreateGC(display, drawable, gcMask, valuePtr); - if (pixmap != None) - Tk_FreePixmap(display, pixmap); - - return gc; -} - -void Blt_FreePrivateGC(Display *display, GC gc) -{ - Tk_FreeXId(display, (XID) XGContextFromGC(gc)); - XFreeGC(display, gc); -} - void Blt_SetDashes(Display *display, GC gc, Blt_Dashes *dashesPtr) { XSetDashes(display, gc, dashesPtr->offset, (const char*)dashesPtr->values, diff --git a/src/bltGrMisc.h b/src/bltGrMisc.h index 851c55d..f000899 100644 --- a/src/bltGrMisc.h +++ b/src/bltGrMisc.h @@ -68,11 +68,6 @@ typedef struct { double bottom; } Region2d; -typedef struct { - Point2d p; - Point2d q; -} Segment2d; - typedef enum { CID_NONE, CID_AXIS_X, CID_AXIS_Y, CID_ELEM_BAR, CID_ELEM_LINE, CID_MARKER_BITMAP, CID_MARKER_IMAGE, CID_MARKER_LINE, CID_MARKER_POLYGON, diff --git a/src/bltGrPSOutput.h b/src/bltGrPSOutput.h index da12229..422faa2 100644 --- a/src/bltGrPSOutput.h +++ b/src/bltGrPSOutput.h @@ -100,9 +100,6 @@ extern void Blt_Ps_XDrawSegments(Blt_Ps ps, XSegment *segments, extern void Blt_Ps_DrawPolyline(Blt_Ps ps, Point2d *points, int n); -extern void Blt_Ps_Draw2DSegments(Blt_Ps ps, Segment2d *segments, - int nSegments); - extern void Blt_Ps_Draw3DRectangle(Blt_Ps ps, Tk_3DBorder border, double x, double y, int width, int height, int borderWidth, int relief); diff --git a/src/bltGrPenLine.C b/src/bltGrPenLine.C index 4d590d2..d0ddb8d 100644 --- a/src/bltGrPenLine.C +++ b/src/bltGrPenLine.C @@ -278,7 +278,7 @@ LinePen::~LinePen() Tk_FreeGC(graphPtr_->display_, errorBarGC_); if (traceGC_) - Blt_FreePrivateGC(graphPtr_->display_, traceGC_); + graphPtr_->freePrivateGC(traceGC_); if (ops->symbol.outlineGC) Tk_FreeGC(graphPtr_->display_, ops->symbol.outlineGC); @@ -371,9 +371,9 @@ int LinePen::configure() gcValues.line_width = ops->traceWidth; gcValues.line_style = !colorPtr ? LineOnOffDash : LineDoubleDash; } - GC newGC = Blt_GetPrivateGC(graphPtr_->tkwin_, gcMask, &gcValues); + GC newGC = graphPtr_->getPrivateGC(gcMask, &gcValues); if (traceGC_) - Blt_FreePrivateGC(graphPtr_->display_, traceGC_); + graphPtr_->freePrivateGC(traceGC_); if (LineIsDashed(ops->traceDashes)) { ops->traceDashes.offset = ops->traceDashes.values[0] / 2; diff --git a/src/bltGraph.C b/src/bltGraph.C index a2f289d..ab4eae0 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -1436,3 +1436,24 @@ void Graph::printSegments(Blt_Ps ps, Segment2d* segments, int nSegments) } } +GC Graph::getPrivateGC(unsigned long gcMask, XGCValues *valuePtr) +{ + Pixmap pixmap = None; + Drawable drawable = Tk_WindowId(tkwin_); + Display* display = Tk_Display(tkwin_); + if (drawable == None) + drawable = RootWindow(Tk_Display(tkwin_),Tk_ScreenNumber(tkwin_)); + + GC gc = XCreateGC(display, drawable, gcMask, valuePtr); + if (pixmap != None) + Tk_FreePixmap(display, pixmap); + + return gc; +} + +void Graph::freePrivateGC(GC gc) +{ + Tk_FreeXId(display_, (XID)XGContextFromGC(gc)); + XFreeGC(display_, gc); +} + diff --git a/src/bltGraph.h b/src/bltGraph.h index c23468a..c2bcf11 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -54,6 +54,11 @@ namespace Blt { class Marker; }; +typedef struct { + Point2d p; + Point2d q; +} Segment2d; + typedef struct Ensemble { const char *name; Tcl_ObjCmdProc *proc; |