diff main/MainWindow.cpp @ 7:c3ef80114040

* Add zoom thumbwheels to Pane. Implement horizontal thumbwheel, and vertical depending on layer type (supported for waveform and spectrogram, though wrong for log-scale spectrogram at the moment). * Add bare bones of a spectrum layer. * Add window icon * Add shortcut for "insert time instant" on laptops without keypad enter (";") * Delete FFT processing thread when it exits (at least, next time we're asked for something interesting) * Get audio file extensions from the file readers, and thus from libsndfile for the wave file reader -- leads to rather a wide combo box in file dialog though * Better refresh order for spectrogram (redraw centre section first)
author Chris Cannam
date Fri, 04 Aug 2006 17:01:37 +0000
parents 0a687ed1b50f
children 92cb01225e7a
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Aug 03 16:04:00 2006 +0000
+++ b/main/MainWindow.cpp	Fri Aug 04 17:01:37 2006 +0000
@@ -74,6 +74,7 @@
 #include <QFile>
 #include <QTextStream>
 #include <QProcess>
+#include <QShortcut>
 #include <QSettings>
 
 #include <iostream>
@@ -179,7 +180,7 @@
     setupMenus();
     setupToolbars();
 
-//    statusBar()->addWidget(m_descriptionLabel);
+    statusBar()->addWidget(m_descriptionLabel);
 
     newSession();
 }
@@ -405,6 +406,10 @@
 	connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool)));
 	menu->addAction(action);
 
+        // Laptop shortcut (no keypad Enter key)
+        connect(new QShortcut(tr(";"), this), SIGNAL(activated()),
+                this, SLOT(insertInstant()));
+
 	menu = menuBar()->addMenu(tr("&View"));
 
         QActionGroup *overlayGroup = new QActionGroup(this);
@@ -430,7 +435,7 @@
         action = new QAction(tr("&All Text Overlays"), this);
 	action->setShortcut(tr("8"));
 	action->setStatusTip(tr("Show texts for frame times, layer names etc"));
-	connect(action, SIGNAL(triggered()), this, SLOT(showAllOverlays()));
+	connect(action, SIGNAL(triggered()), this, SLOT(showAllTextOverlays()));
         action->setCheckable(true);
         action->setChecked(false);
         overlayGroup->addAction(action);
@@ -494,6 +499,14 @@
 	connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
 	connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
 	menu->addAction(action);
+        
+        action = new QAction(tr("Show &Zoom Wheels"), this);
+	action->setShortcut(tr("Z"));
+	action->setStatusTip(tr("Show thumbwheels for zooming horizontally and vertically"));
+	connect(action, SIGNAL(triggered()), this, SLOT(toggleZoomWheels()));
+        action->setCheckable(true);
+        action->setChecked(m_viewManager->getZoomWheelsEnabled());
+	menu->addAction(action);
 
 /*!!! This one doesn't work properly yet
 
@@ -612,7 +625,8 @@
 	LayerFactory::Waveform,
 	LayerFactory::Spectrogram,
 	LayerFactory::MelodicRangeSpectrogram,
-	LayerFactory::PeakFrequencySpectrogram
+	LayerFactory::PeakFrequencySpectrogram,
+        LayerFactory::Spectrum
     };
 
     for (unsigned int i = 0;
@@ -685,6 +699,16 @@
 		    }
 		    break;
 
+                case LayerFactory::Spectrum:
+                    mainText = tr("Add Spectr&um");
+		    if (menuType == 0) {
+			shortcutText = tr("Alt+U");
+			tipText = tr("Add a new pane showing a frequency spectrum");
+		    } else {
+			tipText = tr("Add a new layer showing a frequency spectrum");
+		    }
+                    break;
+
 		default: break;
 		}
 
@@ -2382,12 +2406,22 @@
 }
 
 void
-MainWindow::showAllOverlays()
+MainWindow::showAllTextOverlays()
 {
     m_viewManager->setOverlayMode(ViewManager::AllOverlays);
 }
 
 void
+MainWindow::toggleZoomWheels()
+{
+    if (m_viewManager->getZoomWheelsEnabled()) {
+        m_viewManager->setZoomWheelsEnabled(false);
+    } else {
+        m_viewManager->setZoomWheelsEnabled(true);
+    }
+}
+
+void
 MainWindow::play()
 {
     if (m_playSource->isPlaying()) {
@@ -2493,6 +2527,10 @@
 
     Pane *pane = command->getPane();
 
+    if (i->second.layer == LayerFactory::Spectrum) {
+        pane->setPlaybackFollow(View::PlaybackScrollContinuous);
+    }
+
     if (i->second.layer != LayerFactory::TimeRuler) {
 	if (!m_timeRulerLayer) {
 //	    std::cerr << "no time ruler layer, creating one" << std::endl;