summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-26 23:16:17 +0000
committerDavid Robillard <d@drobilla.net>2012-07-26 23:16:17 +0000
commita2c351e72cc95fbda77793cf127012e3b9d43a51 (patch)
tree93edaf3e513632b3fc5f39d8636b44a441a737b8 /src
parente20155980fcbed2910ff01f0e931fb2dcea7a08f (diff)
downloadganv-a2c351e72cc95fbda77793cf127012e3b9d43a51.tar.gz
ganv-a2c351e72cc95fbda77793cf127012e3b9d43a51.tar.bz2
ganv-a2c351e72cc95fbda77793cf127012e3b9d43a51.zip
Attach arrows to correct location on ports in Graphviz output.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4563 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 96ae7ae..337cd16 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -472,7 +472,8 @@ GanvCanvasImpl::layout_dot(const std::string& filename)
nodes.gvc = gvc;
nodes.G = G;
- if (_gcanvas->direction == GANV_DIRECTION_RIGHT) {
+ const bool flow_right = _gcanvas->direction;
+ if (flow_right) {
agraphattr(G, (char*)"rankdir", (char*)"LR");
} else {
agraphattr(G, (char*)"rankdir", (char*)"TD");
@@ -522,12 +523,12 @@ GanvCanvasImpl::layout_dot(const std::string& filename)
cell += ">";
const char* label = ganv_node_get_label(GANV_NODE(port));
- if (label && _gcanvas->direction == GANV_DIRECTION_RIGHT) {
+ if (label && flow_right) {
cell += label;
}
cell += "</TD>";
- if (_gcanvas->direction == GANV_DIRECTION_RIGHT) {
+ if (flow_right) {
ports += "<TR>" + cell + "</TR>";
} else if (port->impl->is_input) {
inputs += cell;
@@ -552,8 +553,7 @@ GanvCanvasImpl::layout_dot(const std::string& filename)
// Label row
std::stringstream colspan;
- colspan << ((_gcanvas->direction == GANV_DIRECTION_RIGHT)
- ? 1 : (n_cols + 1));
+ colspan << (flow_right ? 1 : (n_cols + 1));
html += std::string("<TR><TD BORDER=\"0\" CELLPADDING=\"2\" COLSPAN=\"")
+ colspan.str()
+ "\">";
@@ -604,10 +604,10 @@ GanvCanvasImpl::layout_dot(const std::string& filename)
if (tail_i != nodes.end() && head_i != nodes.end()) {
Agedge_t* e = agedge(G, tail_i->second, head_i->second);
ss.str("");
- ss << edge->impl->tail;
+ ss << edge->impl->tail << (flow_right ? ":e" : ":s");
agsafeset(e, (char*)"tailport", (char*)ss.str().c_str(), NULL);
ss.str("");
- ss << edge->impl->head;
+ ss << edge->impl->head << (flow_right ? ":w" : ":n");
agsafeset(e, (char*)"headport", (char*)ss.str().c_str(), NULL);
} else {
std::cerr << "Unable to find graphviz node" << std::endl;