]> git.siccegge.de Git - frida/frida.git/commitdiff
Horizontally distribute BasicBlockWidgets
authorChristoph Egger <christoph@anonymous.siccegge.de>
Fri, 28 Nov 2014 23:19:58 +0000 (00:19 +0100)
committerChristoph Egger <christoph@anonymous.siccegge.de>
Fri, 28 Nov 2014 23:19:58 +0000 (00:19 +0100)
We still need to add a bit of space between them but the currently
used QT API doesn't trivially allow that

src/gui/Mainwindow.cxx
src/gui/widgets/CFGScene.cxx

index 9a8310c4e00bfbe500270330f37f9a02346d591d..f98cd60a226888da2f780af6c3dc924cdde6a45b 100644 (file)
@@ -102,10 +102,13 @@ namespace {
                BasicBlockWidget *tmp, *nextl(NULL), *nextr(NULL);
                BasicBlock * tmpblock;
                if (block->getNextBlock(0) != 0) {
                BasicBlockWidget *tmp, *nextl(NULL), *nextr(NULL);
                BasicBlock * tmpblock;
                if (block->getNextBlock(0) != 0) {
+                       int xshift = 0;
+                       if (block->getNextBlock(1) != 0)
+                               xshift = 1;
                        tmpblock = dis->getBasicBlock(block->getNextBlock(0));
                        tmp = local__add_basic_block(tmpblock, dis,
                                                                                 known_blocks,
                        tmpblock = dis->getBasicBlock(block->getNextBlock(0));
                        tmp = local__add_basic_block(tmpblock, dis,
                                                                                 known_blocks,
-                                                                                scene, starty, startx+1);
+                                                                                scene, starty, startx+xshift);
                        nextl = tmp;
                        tmp->addPrevious(widget);
                }
                        nextl = tmp;
                        tmp->addPrevious(widget);
                }
index 7bed8f14b9de2d924b28dc12435a882c9a42028c..a297c856f3dd7dc8aa91e5a29e8d3c9da59cb7dc 100644 (file)
@@ -59,4 +59,15 @@ void CFGScene::spaceWidgets() {
             }
         }
     } while (changed);
             }
         }
     } while (changed);
+
+    for (BasicBlockWidget * widget : widgets) {
+        for (QGraphicsItem * item : widget->collidingItems()) {
+            while (widget->collidesWithItem(item)) {
+                if (widget->scenePos().x() > item->scenePos().x())
+                    widget->moveBy(1, 0);
+                else
+                    item->moveBy(1, 0);
+            }
+        }
+    }
 }
 }