Added graph zoom reset

This commit is contained in:
xarkes 2017-12-13 23:57:36 +01:00
parent 86d467daf9
commit dcf0996293
2 changed files with 15 additions and 2 deletions

View File

@ -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());

View File

@ -153,6 +153,7 @@ public slots:
void zoomIn();
void zoomOut();
void zoomReset();
void takeTrue();
void takeFalse();