Mercurial > hg > tony
diff src/MainWindow.cpp @ 260:46d59edfd18a
Much fiddling toward getting sessions and individual audio files to load cleanly when they need quite different handling after load
author | Chris Cannam |
---|---|
date | Wed, 02 Apr 2014 21:25:56 +0100 |
parents | fa329ca6d75e |
children | 2dccb28a421f |
line wrap: on
line diff
--- a/src/MainWindow.cpp Wed Apr 02 18:22:41 2014 +0100 +++ b/src/MainWindow.cpp Wed Apr 02 21:25:56 2014 +0100 @@ -366,6 +366,8 @@ connect(this, SIGNAL(activity(QString)), m_activityLog, SLOT(activityHappened(QString))); connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced())); + connect(this, SIGNAL(sessionLoaded()), this, SLOT(analyseNewMainModel())); + connect(this, SIGNAL(audioFileLoaded()), this, SLOT(analyseNewMainModel())); m_activityLog->hide(); newSession(); @@ -2597,12 +2599,6 @@ .arg(startStr).arg(endStr).arg(durationStr); } - // scale Y axis - FlexiNoteLayer *fnl = dynamic_cast<FlexiNoteLayer *>(p->getLayer(2)); - if (fnl) { - fnl->setVerticalRangeToNoteRange(p); - } - statusBar()->showMessage(m_myStatusMessage); } @@ -2685,36 +2681,43 @@ connect(m_fader, SIGNAL(valueChanged(float)), m_playTarget, SLOT(setOutputGain(float))); } - - analyseNewMainModel(); } void MainWindow::analyseNewMainModel() { WaveFileModel *model = getMainModel(); + + cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl; + + cerr << "(document is " << m_document << ", it says main model is " << m_document->getMainModel() << ")" << endl; if (model) { + cerr << "pane stack is " << m_paneStack << " with " << m_paneStack->getPaneCount() << " panes" << endl; + if (m_paneStack) { int pc = m_paneStack->getPaneCount(); Pane *pane = 0; - - if (pc < 1) { + Pane *selectionStrip = 0; + + if (pc < 2) { pane = m_paneStack->addPane(); - - Pane *selectionStrip = m_paneStack->addPane(); - selectionStrip->setFixedHeight(26); + selectionStrip = m_paneStack->addPane(); m_document->addLayerToView (selectionStrip, m_document->createMainModelLayer(LayerFactory::TimeRuler)); + } else { + pane = m_paneStack->getPane(0); + selectionStrip = m_paneStack->getPane(1); + } + + if (selectionStrip) { + selectionStrip->setFixedHeight(26); m_paneStack->sizePanesEqually(); - m_viewManager->clearToolModeOverrides(); m_viewManager->setToolModeFor(selectionStrip, ViewManager::SelectMode); - } else { - pane = m_paneStack->getPane(0); } if (pane) {