diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 4c4d08ce..f18a4d0b 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -42,14 +42,18 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent) shortcut_escape->setContext(Qt::WidgetShortcut); connect(shortcut_escape, SIGNAL(activated()), this, SLOT(seekPrev())); + // Zoom shortcuts QShortcut *shortcut_zoom_in = new QShortcut(QKeySequence(Qt::Key_Plus), this); shortcut_zoom_in->setContext(Qt::WidgetShortcut); connect(shortcut_zoom_in, SIGNAL(activated()), this, SLOT(zoomIn())); - QShortcut *shortcut_zoom_out = new QShortcut(QKeySequence(Qt::Key_Minus), this); - shortcut_zoom_in->setContext(Qt::WidgetShortcut); + shortcut_zoom_out->setContext(Qt::WidgetShortcut); connect(shortcut_zoom_out, SIGNAL(activated()), this, SLOT(zoomOut())); + QShortcut *shortcut_zoom_reset = new QShortcut(QKeySequence(Qt::Key_Equal), this); + shortcut_zoom_reset->setContext(Qt::WidgetShortcut); + connect(shortcut_zoom_reset, SIGNAL(activated()), this, SLOT(zoomReset())); + // Branch shortcuts QShortcut *shortcut_take_true = new QShortcut(QKeySequence(Qt::Key_T), this); shortcut_take_true->setContext(Qt::WidgetShortcut); connect(shortcut_take_true, SIGNAL(activated()), this, SLOT(takeTrue())); @@ -450,6 +454,14 @@ void DisassemblerGraphView::zoomOut() this->viewport()->update(); } +void DisassemblerGraphView::zoomReset() +{ + current_scale = 1.0; + auto areaSize = this->viewport()->size(); + this->adjustSize(areaSize.width(), areaSize.height()); + this->viewport()->update(); +} + void DisassemblerGraphView::takeTrue() { DisassemblyBlock *db = blockForAddress(Core()->getOffset()); diff --git a/src/widgets/DisassemblerGraphView.h b/src/widgets/DisassemblerGraphView.h index 43f8a0ee..a944d221 100644 --- a/src/widgets/DisassemblerGraphView.h +++ b/src/widgets/DisassemblerGraphView.h @@ -153,6 +153,7 @@ public slots: void zoomIn(); void zoomOut(); + void zoomReset(); void takeTrue(); void takeFalse();