X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=e6f1a5e156c5fa36b72194e9cc6394c704a7a4f5;hp=6d28194bb87cbed491e00a3aa2bc21436e8976b3;hb=3d87310109576c77819c4c592d41bc1d9731978b;hpb=c7b03d9daa9574bd633fbac2d5976716f58027f5 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 6d28194b..e6f1a5e1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -401,6 +401,7 @@ void MainWindow::setup_ui() QString::fromUtf8("actionViewZoomOut")); menu_view->addAction(action_view_zoom_out_); + action_view_zoom_fit_->setCheckable(true); action_view_zoom_fit_->setText(tr("Zoom to &Fit")); action_view_zoom_fit_->setIcon(QIcon::fromTheme("zoom-fit", QIcon(":/icons/zoom-fit.png"))); @@ -495,7 +496,8 @@ void MainWindow::setup_ui() // Setup view_ events connect(view_, SIGNAL(sticky_scrolling_changed(bool)), this, SLOT(sticky_scrolling_changed(bool))); - + connect(view_, SIGNAL(always_zoom_to_fit_changed(bool)), this, + SLOT(always_zoom_to_fit_changed(bool))); } void MainWindow::select_init_device() { @@ -730,7 +732,7 @@ void MainWindow::on_actionViewZoomOut_triggered() void MainWindow::on_actionViewZoomFit_triggered() { - view_->zoom_fit(); + view_->zoom_fit(action_view_zoom_fit_->isChecked()); } void MainWindow::on_actionViewZoomOneToOne_triggered() @@ -748,7 +750,7 @@ void MainWindow::on_actionViewShowCursors_triggered() assert(view_); const bool show = !view_->cursors_shown(); - if(show) + if (show) view_->centre_cursors(); view_->show_cursors(show); @@ -765,6 +767,11 @@ void MainWindow::sticky_scrolling_changed(bool state) action_view_sticky_scrolling_->setChecked(state); } +void MainWindow::always_zoom_to_fit_changed(bool state) +{ + action_view_zoom_fit_->setChecked(state); +} + void MainWindow::add_decoder(srd_decoder *decoder) { #ifdef ENABLE_DECODE