# HG changeset patch # User Chris Cannam # Date 1154710897 0 # Node ID c3ef80114040cd9117a7b5e28b494a72e9aae24f # Parent d4487202d0e8e3d7cb0b0c0d8a53b391a02c4ec9 * 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) diff -r d4487202d0e8 -r c3ef80114040 main/MainWindow.cpp --- 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 #include #include +#include #include #include @@ -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; diff -r d4487202d0e8 -r c3ef80114040 main/MainWindow.h --- a/main/MainWindow.h Thu Aug 03 16:04:00 2006 +0000 +++ b/main/MainWindow.h Fri Aug 04 17:01:37 2006 +0000 @@ -118,7 +118,9 @@ void showNoOverlays(); void showBasicOverlays(); - void showAllOverlays(); + void showAllTextOverlays(); + + void toggleZoomWheels(); void play(); void ffwd(); diff -r d4487202d0e8 -r c3ef80114040 main/main.cpp --- a/main/main.cpp Thu Aug 03 16:04:00 2006 +0000 +++ b/main/main.cpp Fri Aug 04 17:01:37 2006 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -67,6 +68,8 @@ QApplication::setOrganizationDomain("sonicvisualiser.org"); QApplication::setApplicationName("sonic-visualiser"); + QApplication::setWindowIcon(QIcon(":icons/waveform.png")); + QString language = QLocale::system().name(); QTranslator qtTranslator;