]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/widgets/CFGScene.cxx
Highlight jumptargets
[frida/frida.git] / src / gui / widgets / CFGScene.cxx
index ec33463c835c5c1a3ee8856e1bf8dc445bb55835..c40e2498494a85a403156feb0c1d83864da93d5e 100644 (file)
@@ -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;
                        }
                }
@@ -93,6 +92,7 @@ void CFGScene::spaceWidgets() {
                relevantRect.adjust(-20, -20, 20, 20);
                for (QGraphicsItem * item : items(relevantRect)) {
                        if (item == widget) continue;
+                       if (std::find(widgets.begin(), widgets.end(), item) == widgets.end()) continue;
                        QRectF itemrect = item->boundingRect();
                        itemrect.moveTo(item->scenePos());
                        while (relevantRect.intersects(itemrect)) {
@@ -107,3 +107,15 @@ void CFGScene::spaceWidgets() {
                }
        }
 }
+
+void CFGScene::highlightBlock(BasicBlockWidget* block) {
+       QGraphicsView* view = *(views().begin());
+       if (highlightedBlock) {
+               highlightedBlock->setColor(highlightedBlock->defaultColor);
+               update(highlightedBlock->boundingRect());
+       }
+       highlightedBlock = block;
+       view->centerOn(block);
+       block->setColor(block->highlightColor);
+       update(block->boundingRect());
+}