---
 pv/mainwindow.cpp | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp
index 95d2d56..b6f2706 100644
--- a/pv/mainwindow.cpp
+++ b/pv/mainwindow.cpp
@@ -44,6 +44,7 @@
 
 #include "devicemanager.h"
 #include "device/device.h"
+#include "device/file.h"
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
 #include "dialogs/storeprogress.h"
@@ -62,6 +63,7 @@
 #include <glib.h>
 #include <libsigrok/libsigrok.h>
 
+using boost::dynamic_pointer_cast;
 using boost::shared_ptr;
 using std::list;
 
@@ -473,7 +475,19 @@ void MainWindow::run_stop()
 
 void MainWindow::capture_state_changed(int state)
 {
-       _sampling_bar->set_capture_state((pv::SigSession::capture_state)state);
+       pv::SigSession::capture_state s = (pv::SigSession::capture_state)state;
+
+       _sampling_bar->set_capture_state(s);
+
+       // Zoom fit if we opened a capture file
+       //
+       // It would be better to set the zoom level before loading the file,
+       // but until that is possible this does the job (see bug #236).
+       if (pv::SigSession::Stopped == s) {
+               if 
(dynamic_pointer_cast<pv::device::File>(_session.get_device())) {
+                       _view->zoom_fit();
+               }
+       }
 }
 
 } // namespace pv
-- 
1.9.0


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to