From 937eb556b5c04d6379e0ffde2e13c3065e053a3a Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sat, 16 May 2015 14:05:10 +0200 Subject: [PATCH] Move each widget exactly once per layout iteration BasicBlocks with many incoming edges were pushed downwards faster than those with less incoming edges resulting in unnatural graph layouting. Now we move each widget exactly once (move the widget on collissions, not its successors) keeping the basic ordering by addresses. The result is not perfect -- there's quite some room for further improvements though! Ref 5 --- src/gui/widgets/CFGScene.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/CFGScene.cxx b/src/gui/widgets/CFGScene.cxx index 4e7428d..7e31acb 100644 --- a/src/gui/widgets/CFGScene.cxx +++ b/src/gui/widgets/CFGScene.cxx @@ -75,13 +75,12 @@ void CFGScene::spaceWidgets() { if (NULL != next[0] && (next[0]->getEntry() - widget->getEntry()).y() > 0 && (next[0]->getEntry() - out).y() < 50) { - next[0]->moveBy(0, 1); + widget->moveBy(0, -1); changed = true; - } - if (NULL != next[1] + } else if (NULL != next[1] && (next[1]->getEntry() - widget->getEntry()).y() > 0 && (next[1]->getEntry() - out).y() < 50) { - next[1]->moveBy(0, 1); + widget->moveBy(0, -1); changed = true; } } -- 2.39.5