summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-12 04:36:25 +0000
committerDavid Robillard <d@drobilla.net>2013-01-12 04:36:25 +0000
commitb7b1445db9b15a918a42e9da7df9d3b3ed223333 (patch)
tree95ded479fe4f5bbe9dd1fde3d8bd0eec19224f35 /src
parent3d9771152b9fd27bea66cbba3af2fbbb79ccf68e (diff)
downloadganv-b7b1445db9b15a918a42e9da7df9d3b3ed223333.tar.gz
ganv-b7b1445db9b15a918a42e9da7df9d3b3ed223333.tar.bz2
ganv-b7b1445db9b15a918a42e9da7df9d3b3ed223333.zip
Fix arrange with circles on the canvas.
Add ganv_circle_get_radius(). git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4931 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp17
-rw-r--r--src/circle.c6
2 files changed, 18 insertions, 5 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 13a326a..7ac9745 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -600,9 +600,10 @@ GanvCanvasImpl::layout_dot(const std::string& filename)
agsafeset(node, (char*)"width", (char*)"1.0", NULL);
agsafeset(node, (char*)"height", (char*)"1.0", NULL);
agsafeset(node, (char*)"shape", (char*)"ellipse", NULL);
- agsafeset(node, (char*)"label",
- (char*)ganv_node_get_label(GANV_NODE(*i)),
- NULL);
+ const char* label = ganv_node_get_label(GANV_NODE(*i));
+ if (label) {
+ agsafeset(node, (char*)"label", (char*)label, NULL);
+ }
nodes.insert(std::make_pair(*i, node));
} else {
std::cerr << "Unable to arrange item of unknown type" << std::endl;
@@ -2123,8 +2124,14 @@ ganv_canvas_arrange(GanvCanvas* canvas)
const string y_str = pos.substr(pos.find(",") + 1);
const double cx = lrint(strtod(x_str.c_str(), NULL) * dpp);
const double cy = lrint(strtod(y_str.c_str(), NULL) * dpp);
- const double w = ganv_box_get_width(GANV_BOX(i->first));
- const double h = ganv_box_get_height(GANV_BOX(i->first));
+
+ double w, h;
+ if (GANV_IS_BOX(i->first)) {
+ w = ganv_box_get_width(GANV_BOX(i->first));
+ h = ganv_box_get_height(GANV_BOX(i->first));
+ } else {
+ w = h = ganv_circle_get_radius(GANV_CIRCLE(i->first));
+ }
/* Dot node positions are supposedly node centers, but things only
match up if x is interpreted as center and y as top...
diff --git a/src/circle.c b/src/circle.c
index 11c389f..f7c7ab3 100644
--- a/src/circle.c
+++ b/src/circle.c
@@ -391,3 +391,9 @@ ganv_circle_new(GanvCanvas* canvas,
return circle;
}
+
+double
+ganv_circle_get_radius(const GanvCircle* circle)
+{
+ return circle->impl->coords.radius;
+}