summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-05-05 17:51:56 (GMT)
committerjoye <joye>2014-05-05 17:51:56 (GMT)
commit16a5c9af45ae9e810e8eebaa4e1663ea64d8c255 (patch)
tree7f9938e97f5a211acf02694df6efbbce887e0ea7 /src
parent087375001ab2d4534011ef295bedf70b89cc3986 (diff)
downloadblt-16a5c9af45ae9e810e8eebaa4e1663ea64d8c255.zip
blt-16a5c9af45ae9e810e8eebaa4e1663ea64d8c255.tar.gz
blt-16a5c9af45ae9e810e8eebaa4e1663ea64d8c255.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrAxis.C29
-rw-r--r--src/bltGrElemLine.C2
-rw-r--r--src/bltGrLegd.C4
-rw-r--r--src/bltGrMarkerText.C2
-rw-r--r--src/bltGrPenOption.C8
-rw-r--r--src/bltGrText.C30
-rw-r--r--src/bltGrText.h42
7 files changed, 57 insertions, 60 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 25f6baa..5d4fd9f 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -515,23 +515,22 @@ void Axis::draw(Drawable drawable)
TextStyle ts;
Blt_Ts_InitStyle(ts);
- ts.flags |= UPDATE_GC;
+ ts.flags_ |= UPDATE_GC;
ts.angle = titleAngle_;
ts.font = ops->titleFont;
- ts.xPad = 1;
- ts.yPad = 0;
ts.anchor = titleAnchor_;
- ts.justify = ops->titleJustify;
if (flags & ACTIVE)
ts.color = ops->activeFgColor;
else
ts.color = ops->titleColor;
-
+ ts.justify = ops->titleJustify;
+ ts.xPad_ = 1;
+ ts.yPad_ = 0;
if ((titleAngle_ == 90.0) || (titleAngle_ == 270.0))
- ts.maxLength = height_;
+ ts.maxLength_ = height_;
else
- ts.maxLength = width_;
+ ts.maxLength_ = width_;
Blt_Ts_DrawText(graphPtr_->tkwin_, drawable, ops->title, -1, &ts,
(int)titlePos_.x, (int)titlePos_.y);
@@ -601,12 +600,12 @@ void Axis::draw(Drawable drawable)
TextStyle ts;
Blt_Ts_InitStyle(ts);
- ts.flags |= UPDATE_GC;
+ ts.flags_ |= UPDATE_GC;
ts.angle = ops->tickAngle;
ts.font = ops->tickFont;
- ts.xPad = 2;
- ts.yPad = 0;
+ ts.xPad_ = 2;
+ ts.yPad_ = 0;
ts.anchor = tickAnchor_;
if (flags & ACTIVE)
ts.color = ops->activeFgColor;
@@ -656,7 +655,7 @@ void Axis::drawLimits(Drawable drawable)
int hMin = graphPtr_->bottom_ - gops->yPad - 2;
int hMax = hMin;
- ops->limitsTextStyle.flags |= UPDATE_GC;
+ ops->limitsTextStyle.flags_ |= UPDATE_GC;
const int spacing =8;
int isHoriz = isHorizontal();
@@ -1709,11 +1708,11 @@ void Axis::print(Blt_Ps ps)
ts.angle = titleAngle_;
ts.font = ops->titleFont;
- ts.xPad = 1;
- ts.yPad = 0;
ts.anchor = titleAnchor_;
ts.justify = ops->titleJustify;
ts.color = ops->titleColor;
+ ts.xPad_ = 1;
+ ts.yPad_ = 0;
Blt_Ps_DrawText(ps, ops->title, &ts, titlePos_.x, titlePos_.y);
}
@@ -1724,10 +1723,10 @@ void Axis::print(Blt_Ps ps)
ts.angle = ops->tickAngle;
ts.font = ops->tickFont;
- ts.xPad = 2;
- ts.yPad = 0;
ts.anchor = tickAnchor_;
ts.color = ops->tickColor;
+ ts.xPad_ = 2;
+ ts.yPad_ = 0;
for (Blt_ChainLink link=Blt_Chain_FirstLink(tickLabels_); link;
link = Blt_Chain_NextLink(link)) {
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index 742e94c..6113012 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -2752,7 +2752,7 @@ void LineElement::DrawValues(Drawable drawable, LinePen* penPtr,
xval = ops->coords.x->values, yval = ops->coords.y->values;
// be sure to update style->gc, things might have changed
- penOps->valueStyle.flags |= UPDATE_GC;
+ penOps->valueStyle.flags_ |= UPDATE_GC;
for (pp = points, endp = points + length; pp < endp; pp++) {
double x = xval[map[count]];
double y = yval[map[count]];
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index 8e6c282..9024d34 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -402,8 +402,8 @@ void Legend::draw(Drawable drawable)
Tk_Depth(tkwin));
// be sure to update style->gc, things might have changed
- ops->style.flags |= UPDATE_GC;
- ops->titleStyle.flags |= UPDATE_GC;
+ ops->style.flags_ |= UPDATE_GC;
+ ops->titleStyle.flags_ |= UPDATE_GC;
if (ops->normalBg)
Tk_Fill3DRectangle(tkwin, pixmap, ops->normalBg, 0, 0,
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index 62f20df..37c793a 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -149,7 +149,7 @@ void TextMarker::draw(Drawable drawable)
}
// be sure to update style->gc, things might have changed
- ops->style.flags |= UPDATE_GC;
+ ops->style.flags_ |= UPDATE_GC;
Blt_Ts_DrawText(graphPtr_->tkwin_, drawable, ops->string, -1,
&ops->style, anchorPt_.x, anchorPt_.y);
}
diff --git a/src/bltGrPenOption.C b/src/bltGrPenOption.C
index d263ffc..3aab56b 100644
--- a/src/bltGrPenOption.C
+++ b/src/bltGrPenOption.C
@@ -81,11 +81,9 @@ static Tcl_Obj* PenGetProc(ClientData clientData, Tk_Window tkwin,
static void PenFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
{
Pen* penPtr = *(Pen**)ptr;
- if (penPtr) {
- penPtr->refCount_--;
- if (penPtr->refCount_ == 0)
- delete penPtr;
- }
+ if (penPtr)
+ if (penPtr->refCount_ > 0)
+ penPtr->refCount_--;
}
diff --git a/src/bltGrText.C b/src/bltGrText.C
index 48e9738..85c5020 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -95,9 +95,9 @@ void Blt_Ts_GetExtents(TextStyle *tsPtr, const char *text,
unsigned int *widthPtr, unsigned int *heightPtr)
{
unsigned int w, h;
- Blt_GetTextExtents(tsPtr->font, tsPtr->leader, text, -1, &w, &h);
- *widthPtr = w + 2*tsPtr->xPad;
- *heightPtr = h + 2*tsPtr->yPad;
+ Blt_GetTextExtents(tsPtr->font, tsPtr->leader_, text, -1, &w, &h);
+ *widthPtr = w + 2*tsPtr->xPad_;
+ *heightPtr = h + 2*tsPtr->yPad_;
}
/*
@@ -320,14 +320,14 @@ void Blt_Ts_DrawText(Tk_Window tkwin, Drawable drawable, const char *text,
if (!text || !(*text))
return;
- if ((stylePtr->gc == NULL) || (stylePtr->flags & UPDATE_GC))
+ if ((stylePtr->gc_ == NULL) || (stylePtr->flags_ & UPDATE_GC))
Blt_Ts_ResetStyle(tkwin, stylePtr);
int w1, h1;
Tk_TextLayout layout = Tk_ComputeTextLayout(stylePtr->font, text, textLen,-1,
stylePtr->justify, 0, &w1, &h1);
Point2d rr = Rotate_Text(x, y, w1, h1, stylePtr);
- TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc, layout,
+ TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc_, layout,
rr.x, rr.y, stylePtr->angle, 0, textLen);
}
@@ -337,14 +337,14 @@ void Blt_DrawText2(Tk_Window tkwin, Drawable drawable, const char *text,
if (!text || !(*text))
return;
- if ((stylePtr->gc == NULL) || (stylePtr->flags & UPDATE_GC))
+ if ((stylePtr->gc_ == NULL) || (stylePtr->flags_ & UPDATE_GC))
Blt_Ts_ResetStyle(tkwin, stylePtr);
int w1, h1;
Tk_TextLayout layout = Tk_ComputeTextLayout(stylePtr->font, text, -1, -1,
stylePtr->justify, 0, &w1, &h1);
Point2d rr = Rotate_Text(x, y, w1, h1, stylePtr);
- TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc, layout,
+ TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc_, layout,
rr.x, rr.y, stylePtr->angle, 0, -1);
float angle = fmod(stylePtr->angle, 360.0);
@@ -369,14 +369,14 @@ void Blt_DrawText(Tk_Window tkwin, Drawable drawable, const char *text,
if (!text || (*text == '\0'))
return;
- if (!stylePtr->gc || (stylePtr->flags & UPDATE_GC))
+ if (!stylePtr->gc_ || (stylePtr->flags_ & UPDATE_GC))
Blt_Ts_ResetStyle(tkwin, stylePtr);
int w1, h1;
Tk_TextLayout layout = Tk_ComputeTextLayout(stylePtr->font, text, -1, -1,
stylePtr->justify, 0, &w1, &h1);
Point2d rr = Rotate_Text(x, y, w1, h1, stylePtr);
- TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc, layout,
+ TkDrawAngledTextLayout(Tk_Display(tkwin), drawable, stylePtr->gc_, layout,
rr.x, rr.y, stylePtr->angle, 0, -1);
}
@@ -393,15 +393,15 @@ void Blt_Ts_ResetStyle(Tk_Window tkwin, TextStyle *stylePtr)
gcValues.foreground = stylePtr->color->pixel;
}
newGC = Tk_GetGC(tkwin, gcMask, &gcValues);
- if (stylePtr->gc)
- Tk_FreeGC(Tk_Display(tkwin), stylePtr->gc);
+ if (stylePtr->gc_)
+ Tk_FreeGC(Tk_Display(tkwin), stylePtr->gc_);
- stylePtr->gc = newGC;
- stylePtr->flags &= ~UPDATE_GC;
+ stylePtr->gc_ = newGC;
+ stylePtr->flags_ &= ~UPDATE_GC;
}
void Blt_Ts_FreeStyle(Display *display, TextStyle *stylePtr)
{
- if (stylePtr->gc)
- Tk_FreeGC(display, stylePtr->gc);
+ if (stylePtr->gc_)
+ Tk_FreeGC(display, stylePtr->gc_);
}
diff --git a/src/bltGrText.h b/src/bltGrText.h
index af166e6..111b286 100644
--- a/src/bltGrText.h
+++ b/src/bltGrText.h
@@ -36,23 +36,23 @@
#define UPDATE_GC 1
-typedef struct {
- unsigned int state;
+class TextStyle {
+ public:
+ Tk_Anchor anchor;
XColor* color;
Tk_Font font;
double angle;
Tk_Justify justify;
- Tk_Anchor anchor;
- int xPad;
- int yPad;
- unsigned short int leader;
- short int underline;
- int maxLength;
- /* Private fields. */
- unsigned short flags;
- GC gc;
-} TextStyle;
+ unsigned short int leader_;
+ short int underline_;
+ int xPad_;
+ int yPad_;
+ int maxLength_;
+ unsigned int state_;
+ unsigned short flags_;
+ GC gc_;
+};
extern void Blt_GetTextExtents(Tk_Font font, int leader, const char *text,
int textLen, unsigned int *widthPtr,
@@ -79,15 +79,15 @@ extern Point2d Blt_AnchorPoint (double x, double y, double width,
((ts).anchor = TK_ANCHOR_NW, \
(ts).color = (XColor*)NULL, \
(ts).font = NULL, \
+ (ts).angle = 0.0, \
(ts).justify = TK_JUSTIFY_LEFT, \
- (ts).leader = 0, \
- (ts).underline = -1, \
- (ts).xPad = 0, \
- (ts).yPad = 0, \
- (ts).state = 0, \
- (ts).flags = 0, \
- (ts).gc = NULL, \
- (ts).maxLength = -1, \
- (ts).angle = 0.0)
+ (ts).leader_ = 0, \
+ (ts).underline_ = -1, \
+ (ts).xPad_ = 0, \
+ (ts).yPad_ = 0, \
+ (ts).maxLength_ = -1, \
+ (ts).state_ = 0, \
+ (ts).flags_ = 0, \
+ (ts).gc_ = NULL)
#endif