summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bltGrMarkerBitmap.C12
-rw-r--r--bltGrMarkerBitmap.h2
-rw-r--r--src/bltGrMarkerLine.h2
-rw-r--r--src/bltGrMarkerPolygon.h2
-rw-r--r--src/bltGrMarkerText.C12
-rw-r--r--src/bltGrMarkerText.h2
-rw-r--r--tests/all.tcl28
-rw-r--r--tests/bitmapmarker.tcl5
-rw-r--r--tests/textmarker.tcl5
9 files changed, 36 insertions, 34 deletions
diff --git a/bltGrMarkerBitmap.C b/bltGrMarkerBitmap.C
index da754bb..19fff04 100644
--- a/bltGrMarkerBitmap.C
+++ b/bltGrMarkerBitmap.C
@@ -45,6 +45,9 @@ static Tk_OptionSpec optionSpecs[] = {
TK_OPTION_NULL_OK, &listObjOption, 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
NULL, -1, Tk_Offset(BitmapMarker, bitmap), TK_OPTION_NULL_OK, NULL, 0},
+ {TK_OPTION_CUSTOM, "-coords", "coords", "Coords",
+ NULL, -1, Tk_Offset(BitmapMarker, worldPts),
+ TK_OPTION_NULL_OK, &coordsObjOption, MAP_ITEM},
{TK_OPTION_STRING, "-element", "element", "Element",
NULL, -1, Tk_Offset(BitmapMarker, elemName), TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0},
@@ -63,12 +66,8 @@ static Tk_OptionSpec optionSpecs[] = {
"normal", -1, Tk_Offset(BitmapMarker, state), 0, &stateObjOption, 0},
{TK_OPTION_BOOLEAN, "-under", "under", "Under",
"no", -1, Tk_Offset(BitmapMarker, drawUnder), 0, NULL, 0},
- {TK_OPTION_DOUBLE, "-x", "x", "X",
- "0", -1, Tk_Offset(BitmapMarker, world.x), 0, NULL, 0},
{TK_OPTION_PIXELS, "-xoffset", "xOffset", "XOffset",
"0", -1, Tk_Offset(BitmapMarker, xOffset), 0, NULL, 0},
- {TK_OPTION_DOUBLE, "-y", "y", "Y",
- "0", -1, Tk_Offset(BitmapMarker, world.y), 0, NULL, 0},
{TK_OPTION_PIXELS, "-yoffset", "yOffset", "YOffset",
"0", -1, Tk_Offset(BitmapMarker, yOffset), 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0}
@@ -163,10 +162,13 @@ static void MapBitmapProc(Marker* markerPtr)
if (bmPtr->bitmap == None)
return;
+ if (!bmPtr->worldPts || (bmPtr->worldPts->num < 1))
+ return;
+
int width, height;
Tk_SizeOfBitmap(graphPtr->display, bmPtr->bitmap, &width, &height);
- Point2d anchorPt = Blt_MapPoint(&bmPtr->world, &markerPtr->axes);
+ Point2d anchorPt = Blt_MapPoint(bmPtr->worldPts->points, &markerPtr->axes);
anchorPt = Blt_AnchorPoint(anchorPt.x, anchorPt.y, width, height,
bmPtr->anchor);
anchorPt.x += markerPtr->xOffset;
diff --git a/bltGrMarkerBitmap.h b/bltGrMarkerBitmap.h
index 7233d0c..14ff730 100644
--- a/bltGrMarkerBitmap.h
+++ b/bltGrMarkerBitmap.h
@@ -48,10 +48,10 @@ class BitmapMarker {
int xOffset;
int yOffset;
int state;
+ Coords* worldPts;
// Fields specific to bitmap
- Point2d world;
Pixmap bitmap;
Tk_Anchor anchor;
Point2d anchorPt;
diff --git a/src/bltGrMarkerLine.h b/src/bltGrMarkerLine.h
index f2f28c3..36a1837 100644
--- a/src/bltGrMarkerLine.h
+++ b/src/bltGrMarkerLine.h
@@ -48,10 +48,10 @@ class LineMarker {
int xOffset;
int yOffset;
int state;
+ Coords* worldPts;
// Fields specific to line
- Coords* worldPts;
XColor* fillColor;
XColor* outlineColor;
int lineWidth;
diff --git a/src/bltGrMarkerPolygon.h b/src/bltGrMarkerPolygon.h
index 7a29481..559c5a9 100644
--- a/src/bltGrMarkerPolygon.h
+++ b/src/bltGrMarkerPolygon.h
@@ -48,10 +48,10 @@ class PolygonMarker {
int xOffset;
int yOffset;
int state;
+ Coords* worldPts;
// Fields specific to polygon
- Coords* worldPts;
Point2d *screenPts;
XColor* outline;
XColor* outlineBg;
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index 224368a..fbcfa0b 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -43,6 +43,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_CUSTOM, "-bindtags", "bindTags", "BindTags",
"Text all", -1, Tk_Offset(TextMarker, obj.tags),
TK_OPTION_NULL_OK, &listObjOption, 0},
+ {TK_OPTION_CUSTOM, "-coords", "coords", "Coords",
+ NULL, -1, Tk_Offset(TextMarker, worldPts),
+ TK_OPTION_NULL_OK, &coordsObjOption, MAP_ITEM},
{TK_OPTION_STRING, "-element", "element", "Element",
NULL, -1, Tk_Offset(TextMarker, elemName), TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0},
@@ -68,12 +71,8 @@ static Tk_OptionSpec optionSpecs[] = {
NULL, -1, Tk_Offset(TextMarker, string), TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_BOOLEAN, "-under", "under", "Under",
"no", -1, Tk_Offset(TextMarker, drawUnder), 0, NULL, 0},
- {TK_OPTION_DOUBLE, "-x", "x", "X",
- "0", -1, Tk_Offset(TextMarker, world.x), 0, NULL, 0},
{TK_OPTION_PIXELS, "-xoffset", "xOffset", "XOffset",
"0", -1, Tk_Offset(TextMarker, xOffset), 0, NULL, 0},
- {TK_OPTION_DOUBLE, "-y", "y", "Y",
- "0", -1, Tk_Offset(TextMarker, world.y), 0, NULL, 0},
{TK_OPTION_PIXELS, "-yoffset", "yOffset", "YOffset",
"0", -1, Tk_Offset(TextMarker, yOffset), 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0}
@@ -147,6 +146,9 @@ static void MapTextProc(Marker* markerPtr)
if (!tmPtr->string)
return;
+ if (!tmPtr->worldPts || (tmPtr->worldPts->num < 1))
+ return;
+
tmPtr->width =0;
tmPtr->height =0;
@@ -164,7 +166,7 @@ static void MapTextProc(Marker* markerPtr)
tmPtr->outline[4].x = tmPtr->outline[0].x;
tmPtr->outline[4].y = tmPtr->outline[0].y;
- Point2d anchorPt = Blt_MapPoint(&tmPtr->world, &markerPtr->axes);
+ Point2d anchorPt = Blt_MapPoint(tmPtr->worldPts->points, &markerPtr->axes);
anchorPt = Blt_AnchorPoint(anchorPt.x, anchorPt.y, tmPtr->width,
tmPtr->height, tmPtr->anchor);
anchorPt.x += markerPtr->xOffset;
diff --git a/src/bltGrMarkerText.h b/src/bltGrMarkerText.h
index 7c26501..1a33519 100644
--- a/src/bltGrMarkerText.h
+++ b/src/bltGrMarkerText.h
@@ -48,10 +48,10 @@ class TextMarker {
int xOffset;
int yOffset;
int state;
+ Coords* worldPts;
// Fields specific to text
- Point2d world;
const char* string;
Tk_Anchor anchor;
Point2d anchorPt;
diff --git a/tests/all.tcl b/tests/all.tcl
index 02c1fe4..4318d49 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -1,14 +1,14 @@
-graph.tcl
-xaxis.tcl
-axis.tcl
-line.tcl
-bar.tcl
-element.tcl
-pen.tcl
-crosshairs.tcl
-legend.tcl
-marker.tcl
-bitmapmarker.tcl
-linemarker.tcl
-polygonmarker.tcl
-textmarker.tcl
+source graph.tcl
+source xaxis.tcl
+source axis.tcl
+source line.tcl
+source bar.tcl
+source element.tcl
+source pen.tcl
+source crosshairs.tcl
+source legend.tcl
+source marker.tcl
+source bitmapmarker.tcl
+source linemarker.tcl
+source polygonmarker.tcl
+source textmarker.tcl
diff --git a/tests/bitmapmarker.tcl b/tests/bitmapmarker.tcl
index 8d8f108..1c780dc 100644
--- a/tests/bitmapmarker.tcl
+++ b/tests/bitmapmarker.tcl
@@ -4,13 +4,14 @@ set w .line
set graph [bltLineGraph $w]
set mm [$graph marker create bitmap tt -element data1 \
- -x 1.5 -y 100 -bitmap error]
+ -coords {1.5 100} -bitmap error]
bltTest3 $graph marker $mm -anchor nw
bltTest3 $graph marker $mm -background yellow
bltTest3 $graph marker $mm -bg red
bltTest3 $graph marker $mm -bindtags {aa}
bltTest3 $graph marker $mm -bitmap hourglass
+bltTest3 $graph marker $mm -coords {1 50}
bltTest3 $graph marker $mm -element data2
bltTest3 $graph marker $mm -fg cyan
bltTest3 $graph marker $mm -fill yellow
@@ -21,9 +22,7 @@ bltTest3 $graph marker $mm -mapy y
bltTest3 $graph marker $mm -outline green
bltTest3 $graph marker $mm -state disabled
bltTest3 $graph marker $mm -under yes
-bltTest3 $graph marker $mm -x 1
bltTest3 $graph marker $mm -xoffset 20
-bltTest3 $graph marker $mm -y 150
bltTest3 $graph marker $mm -yoffset 20
echo "done"
diff --git a/tests/textmarker.tcl b/tests/textmarker.tcl
index 3d1fa2a..ad885c5 100644
--- a/tests/textmarker.tcl
+++ b/tests/textmarker.tcl
@@ -4,12 +4,13 @@ set w .line
set graph [bltLineGraph $w]
set mm [$graph marker create text tt -element data1 \
- -x 1.5 -y 100 -text {Text Marker} -font {24}]
+ -coords {1.5 100} -text {Text Marker} -font {24}]
bltTest3 $graph marker $mm -anchor nw
bltTest3 $graph marker $mm -background blue
bltTest3 $graph marker $mm -bg red
bltTest3 $graph marker $mm -bindtags {aa}
+bltTest3 $graph marker $mm -coords {1 50}
bltTest3 $graph marker $mm -element data2
bltTest3 $graph marker $mm -fg cyan
bltTest3 $graph marker $mm -fill yellow
@@ -24,9 +25,7 @@ bltTest3 $graph marker $mm -rotate 45
bltTest3 $graph marker $mm -state disabled
bltTest3 $graph marker $mm -text {Hello World}
bltTest3 $graph marker $mm -under yes
-bltTest3 $graph marker $mm -x 1
bltTest3 $graph marker $mm -xoffset 20
-bltTest3 $graph marker $mm -y 50
bltTest3 $graph marker $mm -yoffset 20
echo "done"