summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltConfig.C2
-rw-r--r--src/bltGrAxis.C13
-rw-r--r--src/bltGrMarker.C32
-rw-r--r--src/bltGrMarkerLine.C55
4 files changed, 45 insertions, 57 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C
index b05094d..dbe357f 100644
--- a/src/bltConfig.C
+++ b/src/bltConfig.C
@@ -241,7 +241,7 @@ static Tcl_Obj* ListGetProc(ClientData clientData, Tk_Window tkwin,
Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
for (int ii=0; ii<cnt; ii++)
- ll[ii] = Tcl_NewStringObj(*listPtr[ii], -1);
+ ll[ii] = Tcl_NewStringObj((*listPtr)[ii], -1);
Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
free(ll);
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 65ded79..7cafce7 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -3309,10 +3309,10 @@ static int GetAxisFromObj(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr,
return TCL_OK;
}
}
- if (interp) {
+ if (interp)
Tcl_AppendResult(interp, "can't find axis \"", name, "\" in \"",
Tk_PathName(graphPtr->tkwin), "\"", NULL);
- }
+
return TCL_ERROR;
}
@@ -3330,11 +3330,10 @@ static int GetAxisByClass(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr,
Blt_GraphSetObjectClass(&axisPtr->obj, classId);
else if (axisPtr->obj.classId != classId) {
- if (!interp)
- Tcl_AppendResult(interp, "axis \"", Tcl_GetString(objPtr),
- "\" is already in use on an opposite ",
- axisPtr->obj.className, "-axis",
- NULL);
+ Tcl_AppendResult(interp, "axis \"", Tcl_GetString(objPtr),
+ "\" is already in use on an opposite ",
+ axisPtr->obj.className, "-axis",
+ NULL);
return TCL_ERROR;
}
axisPtr->refCount++;
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index 18da1c6..d6f17c7 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -433,22 +433,19 @@ static int DeleteOp(Graph* graphPtr, Tcl_Interp* interp,
static int GetOp(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
- Marker *markerPtr;
- const char* string;
+ const char* string = Tcl_GetString(objv[3]);
+ if (!strcmp(string, "current")) {
+ Marker* markerPtr = (Marker*)Blt_GetCurrentItem(graphPtr->bindTable);
- string = Tcl_GetString(objv[3]);
- if ((string[0] == 'c') && (strcmp(string, "current") == 0)) {
- markerPtr = (Marker *)Blt_GetCurrentItem(graphPtr->bindTable);
- if (markerPtr == NULL) {
- return TCL_OK; /* Report only on markers. */
+ if (markerPtr == NULL)
+ return TCL_OK;
- }
+ // Report only on markers
if ((markerPtr->obj.classId >= CID_MARKER_BITMAP) &&
- (markerPtr->obj.classId <= CID_MARKER_WINDOW)) {
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- markerPtr->obj.name, -1);
- }
+ (markerPtr->obj.classId <= CID_MARKER_WINDOW))
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), markerPtr->obj.name, -1);
}
+
return TCL_OK;
}
@@ -458,6 +455,7 @@ static int ExistsOp(Graph* graphPtr, Tcl_Interp* interp,
Tcl_HashEntry* hPtr =
Tcl_FindHashEntry(&graphPtr->markers.table, Tcl_GetString(objv[3]));
Tcl_SetBooleanObj(Tcl_GetObjResult(interp), (hPtr));
+
return TCL_OK;
}
@@ -491,14 +489,16 @@ static int FindOp(Graph* graphPtr, Tcl_Interp* interp,
if (left < right) {
extents.left = (double)left;
extents.right = (double)right;
- } else {
+ }
+ else {
extents.left = (double)right;
extents.right = (double)left;
}
if (top < bottom) {
extents.top = (double)top;
extents.bottom = (double)bottom;
- } else {
+ }
+ else {
extents.top = (double)bottom;
extents.bottom = (double)top;
}
@@ -514,9 +514,7 @@ static int FindOp(Graph* graphPtr, Tcl_Interp* interp,
continue;
if ((*markerPtr->classPtr->regionProc)(markerPtr, &extents, enclosed)) {
- Tcl_Obj *objPtr;
-
- objPtr = Tcl_GetObjResult(interp);
+ Tcl_Obj* objPtr = Tcl_GetObjResult(interp);
Tcl_SetStringObj(objPtr, markerPtr->obj.name, -1);
return TCL_OK;
}
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 87818a4..4314196 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -117,37 +117,31 @@ static int PointInLineProc(Marker *markerPtr, Point2d *samplePtr)
static int RegionInLineProc(Marker *markerPtr, Region2d *extsPtr, int enclosed)
{
- if (markerPtr->nWorldPts < 2) {
+ if (markerPtr->nWorldPts < 2)
return FALSE;
- }
+
if (enclosed) {
Point2d *pp, *pend;
for (pp = markerPtr->worldPts, pend = pp + markerPtr->nWorldPts;
pp < pend; pp++) {
- Point2d p;
-
- p = Blt_MapPoint(pp, &markerPtr->axes);
+ Point2d p = Blt_MapPoint(pp, &markerPtr->axes);
if ((p.x < extsPtr->left) && (p.x > extsPtr->right) &&
(p.y < extsPtr->top) && (p.y > extsPtr->bottom)) {
return FALSE;
}
}
return TRUE; /* All points inside bounding box. */
- } else {
- int count;
+ }
+ else {
Point2d *pp, *pend;
-
- count = 0;
+ int count = 0;
for (pp = markerPtr->worldPts, pend = pp + (markerPtr->nWorldPts - 1);
pp < pend; pp++) {
- Point2d p, q;
-
- p = Blt_MapPoint(pp, &markerPtr->axes);
- q = Blt_MapPoint(pp + 1, &markerPtr->axes);
- if (Blt_LineRectClip(extsPtr, &p, &q)) {
+ Point2d p = Blt_MapPoint(pp, &markerPtr->axes);
+ Point2d q = Blt_MapPoint(pp + 1, &markerPtr->axes);
+ if (Blt_LineRectClip(extsPtr, &p, &q))
count++;
- }
}
return (count > 0); /* At least 1 segment passes through
* region. */
@@ -172,13 +166,10 @@ static int ConfigureLineProc(Marker *markerPtr)
{
Graph* graphPtr = markerPtr->obj.graphPtr;
LineMarker *lmPtr = (LineMarker *)markerPtr;
- GC newGC;
- XGCValues gcValues;
- unsigned long gcMask;
- Drawable drawable;
- drawable = Tk_WindowId(graphPtr->tkwin);
- gcMask = (GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle);
+ Drawable drawable = Tk_WindowId(graphPtr->tkwin);
+ unsigned long gcMask = (GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle);
+ XGCValues gcValues;
if (lmPtr->outlineColor) {
gcMask |= GCForeground;
gcValues.foreground = lmPtr->outlineColor->pixel;
@@ -201,21 +192,21 @@ static int ConfigureLineProc(Marker *markerPtr)
gcMask |= GCFunction;
pixel = Tk_3DBorderColor(graphPtr->plotBg)->pixel;
- if (gcMask & GCBackground) {
+ if (gcMask & GCBackground)
gcValues.background ^= pixel;
- }
+
gcValues.foreground ^= pixel;
- if (drawable != None) {
+ if (drawable != None)
DrawLineProc(markerPtr, drawable);
- }
}
- newGC = Blt_GetPrivateGC(graphPtr->tkwin, gcMask, &gcValues);
- if (lmPtr->gc) {
+
+ GC newGC = Blt_GetPrivateGC(graphPtr->tkwin, gcMask, &gcValues);
+ if (lmPtr->gc)
Blt_FreePrivateGC(graphPtr->display, lmPtr->gc);
- }
- if (LineIsDashed(lmPtr->dashes)) {
+
+ if (LineIsDashed(lmPtr->dashes))
Blt_SetDashes(graphPtr->display, newGC, &lmPtr->dashes);
- }
+
lmPtr->gc = newGC;
if (lmPtr->xorr) {
if (drawable != None) {
@@ -225,9 +216,9 @@ static int ConfigureLineProc(Marker *markerPtr)
return TCL_OK;
}
markerPtr->flags |= MAP_ITEM;
- if (markerPtr->drawUnder) {
+ if (markerPtr->drawUnder)
graphPtr->flags |= CACHE_DIRTY;
- }
+
Blt_EventuallyRedrawGraph(graphPtr);
return TCL_OK;
}