Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 644:6fd0ebfd2bbe
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:25:09 +0000 |
parents | 713b9a6b284a 8c5379570f36 |
children | 3168deb50199 |
comparison
equal
deleted
inserted
replaced
643:713b9a6b284a | 644:6fd0ebfd2bbe |
---|---|
135 } | 135 } |
136 #undef Window | 136 #undef Window |
137 #endif | 137 #endif |
138 | 138 |
139 MainWindowBase::MainWindowBase(SoundOptions options) : | 139 MainWindowBase::MainWindowBase(SoundOptions options) : |
140 m_document(0), | 140 m_document(nullptr), |
141 m_paneStack(0), | 141 m_paneStack(nullptr), |
142 m_viewManager(0), | 142 m_viewManager(nullptr), |
143 m_timeRulerLayer(0), | 143 m_timeRulerLayer(nullptr), |
144 m_soundOptions(options), | 144 m_soundOptions(options), |
145 m_playSource(0), | 145 m_playSource(nullptr), |
146 m_recordTarget(0), | 146 m_recordTarget(nullptr), |
147 m_resamplerWrapper(0), | 147 m_resamplerWrapper(nullptr), |
148 m_playTarget(0), | 148 m_playTarget(nullptr), |
149 m_audioIO(0), | 149 m_audioIO(nullptr), |
150 m_oscQueue(0), | 150 m_oscQueue(nullptr), |
151 m_oscQueueStarter(0), | 151 m_oscQueueStarter(nullptr), |
152 m_midiInput(0), | 152 m_midiInput(nullptr), |
153 m_recentFiles("RecentFiles", 20), | 153 m_recentFiles("RecentFiles", 20), |
154 m_recentTransforms("RecentTransforms", 20), | 154 m_recentTransforms("RecentTransforms", 20), |
155 m_documentModified(false), | 155 m_documentModified(false), |
156 m_openingAudioFile(false), | 156 m_openingAudioFile(false), |
157 m_abandoning(false), | 157 m_abandoning(false), |
158 m_labeller(0), | 158 m_labeller(nullptr), |
159 m_lastPlayStatusSec(0), | 159 m_lastPlayStatusSec(0), |
160 m_initialDarkBackground(false), | 160 m_initialDarkBackground(false), |
161 m_defaultFfwdRwdStep(2, 0), | 161 m_defaultFfwdRwdStep(2, 0), |
162 m_audioRecordMode(RecordCreateAdditionalModel), | 162 m_audioRecordMode(RecordCreateAdditionalModel), |
163 m_statusLabel(0), | 163 m_statusLabel(nullptr), |
164 m_iconsVisibleInMenus(true), | 164 m_iconsVisibleInMenus(true), |
165 m_menuShortcutMapper(0) | 165 m_menuShortcutMapper(nullptr) |
166 { | 166 { |
167 Profiler profiler("MainWindowBase::MainWindowBase"); | 167 Profiler profiler("MainWindowBase::MainWindowBase"); |
168 | 168 |
169 SVDEBUG << "MainWindowBase::MainWindowBase" << endl; | 169 SVDEBUG << "MainWindowBase::MainWindowBase" << endl; |
170 | 170 |
217 m_viewManager->setGlobalDarkBackground | 217 m_viewManager->setGlobalDarkBackground |
218 (mode == Preferences::DarkBackground); | 218 (mode == Preferences::DarkBackground); |
219 } | 219 } |
220 #endif | 220 #endif |
221 | 221 |
222 m_paneStack = new PaneStack(0, m_viewManager); | 222 m_paneStack = new PaneStack(nullptr, m_viewManager); |
223 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), | 223 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), |
224 this, SLOT(currentPaneChanged(Pane *))); | 224 this, SLOT(currentPaneChanged(Pane *))); |
225 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), | 225 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), |
226 this, SLOT(currentLayerChanged(Pane *, Layer *))); | 226 this, SLOT(currentLayerChanged(Pane *, Layer *))); |
227 connect(m_paneStack, SIGNAL(rightButtonMenuRequested(Pane *, QPoint)), | 227 connect(m_paneStack, SIGNAL(rightButtonMenuRequested(Pane *, QPoint)), |
327 | 327 |
328 delete m_viewManager; | 328 delete m_viewManager; |
329 delete m_midiInput; | 329 delete m_midiInput; |
330 | 330 |
331 if (m_oscQueueStarter) { | 331 if (m_oscQueueStarter) { |
332 disconnect(m_oscQueueStarter, 0, 0, 0); | 332 disconnect(m_oscQueueStarter, nullptr, nullptr, nullptr); |
333 m_oscQueueStarter->wait(1000); | 333 m_oscQueueStarter->wait(1000); |
334 if (m_oscQueueStarter->isRunning()) { | 334 if (m_oscQueueStarter->isRunning()) { |
335 m_oscQueueStarter->terminate(); | 335 m_oscQueueStarter->terminate(); |
336 m_oscQueueStarter->wait(1000); | 336 m_oscQueueStarter->wait(1000); |
337 } | 337 } |
353 MainWindowBase::finaliseMenus() | 353 MainWindowBase::finaliseMenus() |
354 { | 354 { |
355 SVDEBUG << "MainWindowBase::finaliseMenus called" << endl; | 355 SVDEBUG << "MainWindowBase::finaliseMenus called" << endl; |
356 | 356 |
357 delete m_menuShortcutMapper; | 357 delete m_menuShortcutMapper; |
358 m_menuShortcutMapper = 0; | 358 m_menuShortcutMapper = nullptr; |
359 | 359 |
360 foreach (QShortcut *sc, m_appShortcuts) { | 360 foreach (QShortcut *sc, m_appShortcuts) { |
361 delete sc; | 361 delete sc; |
362 } | 362 } |
363 m_appShortcuts.clear(); | 363 m_appShortcuts.clear(); |
524 MainWindowBase::getOpenFileName(FileFinder::FileType type) | 524 MainWindowBase::getOpenFileName(FileFinder::FileType type) |
525 { | 525 { |
526 FileFinder *ff = FileFinder::getInstance(); | 526 FileFinder *ff = FileFinder::getInstance(); |
527 | 527 |
528 if (type == FileFinder::AnyFile) { | 528 if (type == FileFinder::AnyFile) { |
529 if (getMainModel() != 0 && | 529 if (getMainModel() != nullptr && |
530 m_paneStack != 0 && | 530 m_paneStack != nullptr && |
531 m_paneStack->getCurrentPane() != 0) { // can import a layer | 531 m_paneStack->getCurrentPane() != nullptr) { // can import a layer |
532 return ff->getOpenFileName(FileFinder::AnyFile, m_sessionFile); | 532 return ff->getOpenFileName(FileFinder::AnyFile, m_sessionFile); |
533 } else { | 533 } else { |
534 return ff->getOpenFileName(FileFinder::SessionOrAudioFile, | 534 return ff->getOpenFileName(FileFinder::SessionOrAudioFile, |
535 m_sessionFile); | 535 m_sessionFile); |
536 } | 536 } |
584 } | 584 } |
585 | 585 |
586 void | 586 void |
587 MainWindowBase::updateMenuStates() | 587 MainWindowBase::updateMenuStates() |
588 { | 588 { |
589 Pane *currentPane = 0; | 589 Pane *currentPane = nullptr; |
590 Layer *currentLayer = 0; | 590 Layer *currentLayer = nullptr; |
591 | 591 |
592 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); | 592 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); |
593 if (currentPane) currentLayer = currentPane->getSelectedLayer(); | 593 if (currentPane) currentLayer = currentPane->getSelectedLayer(); |
594 | 594 |
595 bool havePrevPane = false, haveNextPane = false; | 595 bool havePrevPane = false, haveNextPane = false; |
612 haveNextLayer = true; | 612 haveNextLayer = true; |
613 } | 613 } |
614 } | 614 } |
615 | 615 |
616 bool haveCurrentPane = | 616 bool haveCurrentPane = |
617 (currentPane != 0); | 617 (currentPane != nullptr); |
618 bool haveCurrentLayer = | 618 bool haveCurrentLayer = |
619 (haveCurrentPane && | 619 (haveCurrentPane && |
620 (currentLayer != 0)); | 620 (currentLayer != nullptr)); |
621 bool haveMainModel = | 621 bool haveMainModel = |
622 (getMainModel() != 0); | 622 (getMainModel() != nullptr); |
623 bool havePlayTarget = | 623 bool havePlayTarget = |
624 (m_playTarget != 0 || m_audioIO != 0); | 624 (m_playTarget != nullptr || m_audioIO != nullptr); |
625 bool haveSelection = | 625 bool haveSelection = |
626 (m_viewManager && | 626 (m_viewManager && |
627 !m_viewManager->getSelections().empty()); | 627 !m_viewManager->getSelections().empty()); |
628 bool haveCurrentEditableLayer = | 628 bool haveCurrentEditableLayer = |
629 (haveCurrentLayer && | 629 (haveCurrentLayer && |
764 } | 764 } |
765 | 765 |
766 if (m_viewManager->getPlaySoloMode()) { | 766 if (m_viewManager->getPlaySoloMode()) { |
767 currentPaneChanged(m_paneStack->getCurrentPane()); | 767 currentPaneChanged(m_paneStack->getCurrentPane()); |
768 } else { | 768 } else { |
769 m_viewManager->setPlaybackModel(0); | 769 m_viewManager->setPlaybackModel(nullptr); |
770 if (m_playSource) { | 770 if (m_playSource) { |
771 m_playSource->clearSoloModelSet(); | 771 m_playSource->clearSoloModelSet(); |
772 } | 772 } |
773 } | 773 } |
774 } | 774 } |
782 if (!p) return; | 782 if (!p) return; |
783 | 783 |
784 if (!(m_viewManager && | 784 if (!(m_viewManager && |
785 m_playSource && | 785 m_playSource && |
786 m_viewManager->getPlaySoloMode())) { | 786 m_viewManager->getPlaySoloMode())) { |
787 if (m_viewManager) m_viewManager->setPlaybackModel(0); | 787 if (m_viewManager) m_viewManager->setPlaybackModel(nullptr); |
788 return; | 788 return; |
789 } | 789 } |
790 | 790 |
791 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); | 791 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); |
792 | 792 |
1166 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { | 1166 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { |
1167 command->deletePoint(prevPoint); | 1167 command->deletePoint(prevPoint); |
1168 } | 1168 } |
1169 | 1169 |
1170 m_labeller->label<SparseOneDimensionalModel::Point> | 1170 m_labeller->label<SparseOneDimensionalModel::Point> |
1171 (point, havePrevPoint ? &prevPoint : 0); | 1171 (point, havePrevPoint ? &prevPoint : nullptr); |
1172 | 1172 |
1173 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { | 1173 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { |
1174 command->addPoint(prevPoint); | 1174 command->addPoint(prevPoint); |
1175 } | 1175 } |
1176 } | 1176 } |
1216 sv_frame_t alignedStart = pane->alignFromReference(frame); | 1216 sv_frame_t alignedStart = pane->alignFromReference(frame); |
1217 sv_frame_t alignedEnd = pane->alignFromReference(frame + duration); | 1217 sv_frame_t alignedEnd = pane->alignFromReference(frame + duration); |
1218 if (alignedStart >= alignedEnd) return; | 1218 if (alignedStart >= alignedEnd) return; |
1219 sv_frame_t alignedDuration = alignedEnd - alignedStart; | 1219 sv_frame_t alignedDuration = alignedEnd - alignedStart; |
1220 | 1220 |
1221 Command *c = 0; | 1221 Command *c = nullptr; |
1222 | 1222 |
1223 QString name = tr("Add Item at %1 s") | 1223 QString name = tr("Add Item at %1 s") |
1224 .arg(RealTime::frame2RealTime | 1224 .arg(RealTime::frame2RealTime |
1225 (alignedStart, | 1225 (alignedStart, |
1226 getMainModel()->getSampleRate()) | 1226 getMainModel()->getSampleRate()) |
1377 FileOpenStatus status; | 1377 FileOpenStatus status; |
1378 | 1378 |
1379 if (!source.isAvailable()) return FileOpenFailed; | 1379 if (!source.isAvailable()) return FileOpenFailed; |
1380 source.waitForData(); | 1380 source.waitForData(); |
1381 | 1381 |
1382 bool canImportLayer = (getMainModel() != 0 && | 1382 bool canImportLayer = (getMainModel() != nullptr && |
1383 m_paneStack != 0 && | 1383 m_paneStack != nullptr && |
1384 m_paneStack->getCurrentPane() != 0); | 1384 m_paneStack->getCurrentPane() != nullptr); |
1385 | 1385 |
1386 bool rdf = (source.getExtension().toLower() == "rdf" || | 1386 bool rdf = (source.getExtension().toLower() == "rdf" || |
1387 source.getExtension().toLower() == "n3" || | 1387 source.getExtension().toLower() == "n3" || |
1388 source.getExtension().toLower() == "ttl"); | 1388 source.getExtension().toLower() == "ttl"); |
1389 | 1389 |
1707 // the current pane does not contain the main model, otherwise | 1707 // the current pane does not contain the main model, otherwise |
1708 // we would have reset it to ReplaceMainModel. But we don't | 1708 // we would have reset it to ReplaceMainModel. But we don't |
1709 // know whether the pane contains a waveform model at all. | 1709 // know whether the pane contains a waveform model at all. |
1710 | 1710 |
1711 Pane *pane = m_paneStack->getCurrentPane(); | 1711 Pane *pane = m_paneStack->getCurrentPane(); |
1712 Layer *replace = 0; | 1712 Layer *replace = nullptr; |
1713 | 1713 |
1714 for (int i = 0; i < pane->getLayerCount(); ++i) { | 1714 for (int i = 0; i < pane->getLayerCount(); ++i) { |
1715 Layer *layer = pane->getLayer(i); | 1715 Layer *layer = pane->getLayer(i); |
1716 if (dynamic_cast<WaveformLayer *>(layer)) { | 1716 if (dynamic_cast<WaveformLayer *>(layer)) { |
1717 replace = layer; | 1717 replace = layer; |
2074 } else { | 2074 } else { |
2075 return FileOpenFailed; | 2075 return FileOpenFailed; |
2076 } | 2076 } |
2077 } | 2077 } |
2078 | 2078 |
2079 QXmlInputSource *inputSource = 0; | 2079 QXmlInputSource *inputSource = nullptr; |
2080 BZipFileDevice *bzFile = 0; | 2080 BZipFileDevice *bzFile = nullptr; |
2081 QFile *rawFile = 0; | 2081 QFile *rawFile = nullptr; |
2082 | 2082 |
2083 if (source.getExtension().toLower() == sessionExt) { | 2083 if (source.getExtension().toLower() == sessionExt) { |
2084 bzFile = new BZipFileDevice(source.getLocalFilename()); | 2084 bzFile = new BZipFileDevice(source.getLocalFilename()); |
2085 if (!bzFile->open(QIODevice::ReadOnly)) { | 2085 if (!bzFile->open(QIODevice::ReadOnly)) { |
2086 delete bzFile; | 2086 delete bzFile; |
2200 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation() << ")" << endl; | 2200 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation() << ")" << endl; |
2201 | 2201 |
2202 if (!source.isAvailable()) return FileOpenFailed; | 2202 if (!source.isAvailable()) return FileOpenFailed; |
2203 source.waitForData(); | 2203 source.waitForData(); |
2204 | 2204 |
2205 QXmlInputSource *inputSource = 0; | 2205 QXmlInputSource *inputSource = nullptr; |
2206 QFile *file = 0; | 2206 QFile *file = nullptr; |
2207 | 2207 |
2208 file = new QFile(source.getLocalFilename()); | 2208 file = new QFile(source.getLocalFilename()); |
2209 inputSource = new QXmlInputSource(file); | 2209 inputSource = new QXmlInputSource(file); |
2210 | 2210 |
2211 if (!checkSaveModified()) { | 2211 if (!checkSaveModified()) { |
2344 WaveFileModel *w = dynamic_cast<WaveFileModel *>(m); | 2344 WaveFileModel *w = dynamic_cast<WaveFileModel *>(m); |
2345 | 2345 |
2346 if (w) { | 2346 if (w) { |
2347 | 2347 |
2348 Pane *pane = addPaneToStack(); | 2348 Pane *pane = addPaneToStack(); |
2349 Layer *layer = 0; | 2349 Layer *layer = nullptr; |
2350 | 2350 |
2351 if (m_timeRulerLayer) { | 2351 if (m_timeRulerLayer) { |
2352 m_document->addLayerToView(pane, m_timeRulerLayer); | 2352 m_document->addLayerToView(pane, m_timeRulerLayer); |
2353 } | 2353 } |
2354 | 2354 |
2563 void | 2563 void |
2564 MainWindowBase::deleteAudioIO() | 2564 MainWindowBase::deleteAudioIO() |
2565 { | 2565 { |
2566 // First prevent this trying to call target. | 2566 // First prevent this trying to call target. |
2567 if (m_playSource) { | 2567 if (m_playSource) { |
2568 m_playSource->setSystemPlaybackTarget(0); | 2568 m_playSource->setSystemPlaybackTarget(nullptr); |
2569 m_playSource->setResamplerWrapper(0); | 2569 m_playSource->setResamplerWrapper(nullptr); |
2570 } | 2570 } |
2571 | 2571 |
2572 // Then delete the breakfastquay::System object. | 2572 // Then delete the breakfastquay::System object. |
2573 // Only one of these two exists! | 2573 // Only one of these two exists! |
2574 delete m_audioIO; | 2574 delete m_audioIO; |
2577 // And the breakfastquay resampler wrapper. We need to | 2577 // And the breakfastquay resampler wrapper. We need to |
2578 // delete/recreate this if the channel count changes, which is one | 2578 // delete/recreate this if the channel count changes, which is one |
2579 // of the use cases for recreateAudioIO() calling this | 2579 // of the use cases for recreateAudioIO() calling this |
2580 delete m_resamplerWrapper; | 2580 delete m_resamplerWrapper; |
2581 | 2581 |
2582 m_audioIO = 0; | 2582 m_audioIO = nullptr; |
2583 m_playTarget = 0; | 2583 m_playTarget = nullptr; |
2584 m_resamplerWrapper = 0; | 2584 m_resamplerWrapper = nullptr; |
2585 } | 2585 } |
2586 | 2586 |
2587 void | 2587 void |
2588 MainWindowBase::recreateAudioIO() | 2588 MainWindowBase::recreateAudioIO() |
2589 { | 2589 { |
2606 } | 2606 } |
2607 | 2607 |
2608 WaveFileModel * | 2608 WaveFileModel * |
2609 MainWindowBase::getMainModel() | 2609 MainWindowBase::getMainModel() |
2610 { | 2610 { |
2611 if (!m_document) return 0; | 2611 if (!m_document) return nullptr; |
2612 return m_document->getMainModel(); | 2612 return m_document->getMainModel(); |
2613 } | 2613 } |
2614 | 2614 |
2615 const WaveFileModel * | 2615 const WaveFileModel * |
2616 MainWindowBase::getMainModel() const | 2616 MainWindowBase::getMainModel() const |
2617 { | 2617 { |
2618 if (!m_document) return 0; | 2618 if (!m_document) return nullptr; |
2619 return m_document->getMainModel(); | 2619 return m_document->getMainModel(); |
2620 } | 2620 } |
2621 | 2621 |
2622 void | 2622 void |
2623 MainWindowBase::createDocument() | 2623 MainWindowBase::createDocument() |
2907 } | 2907 } |
2908 } | 2908 } |
2909 if (m_timeRulerLayer) { | 2909 if (m_timeRulerLayer) { |
2910 SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl; | 2910 SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl; |
2911 delete m_timeRulerLayer; | 2911 delete m_timeRulerLayer; |
2912 m_timeRulerLayer = 0; | 2912 m_timeRulerLayer = nullptr; |
2913 } | 2913 } |
2914 } | 2914 } |
2915 | 2915 |
2916 void | 2916 void |
2917 MainWindowBase::toggleTimeRulers() | 2917 MainWindowBase::toggleTimeRulers() |
3432 | 3432 |
3433 Layer * | 3433 Layer * |
3434 MainWindowBase::getSnapLayer() const | 3434 MainWindowBase::getSnapLayer() const |
3435 { | 3435 { |
3436 Pane *pane = m_paneStack->getCurrentPane(); | 3436 Pane *pane = m_paneStack->getCurrentPane(); |
3437 if (!pane) return 0; | 3437 if (!pane) return nullptr; |
3438 | 3438 |
3439 Layer *layer = pane->getSelectedLayer(); | 3439 Layer *layer = pane->getSelectedLayer(); |
3440 | 3440 |
3441 if (!dynamic_cast<TimeInstantLayer *>(layer) && | 3441 if (!dynamic_cast<TimeInstantLayer *>(layer) && |
3442 !dynamic_cast<TimeValueLayer *>(layer) && | 3442 !dynamic_cast<TimeValueLayer *>(layer) && |
3443 !dynamic_cast<RegionLayer *>(layer) && | 3443 !dynamic_cast<RegionLayer *>(layer) && |
3444 !dynamic_cast<TimeRulerLayer *>(layer)) { | 3444 !dynamic_cast<TimeRulerLayer *>(layer)) { |
3445 | 3445 |
3446 layer = 0; | 3446 layer = nullptr; |
3447 | 3447 |
3448 for (int i = pane->getLayerCount(); i > 0; --i) { | 3448 for (int i = pane->getLayerCount(); i > 0; --i) { |
3449 Layer *l = pane->getLayer(i-1); | 3449 Layer *l = pane->getLayer(i-1); |
3450 if (dynamic_cast<TimeRulerLayer *>(l)) { | 3450 if (dynamic_cast<TimeRulerLayer *>(l)) { |
3451 layer = l; | 3451 layer = l; |
3482 } | 3482 } |
3483 } | 3483 } |
3484 | 3484 |
3485 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : | 3485 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : |
3486 m_mw(mw), | 3486 m_mw(mw), |
3487 m_pane(0), | 3487 m_pane(nullptr), |
3488 m_prevCurrentPane(0), | 3488 m_prevCurrentPane(nullptr), |
3489 m_added(false) | 3489 m_added(false) |
3490 { | 3490 { |
3491 } | 3491 } |
3492 | 3492 |
3493 MainWindowBase::AddPaneCommand::~AddPaneCommand() | 3493 MainWindowBase::AddPaneCommand::~AddPaneCommand() |
3529 } | 3529 } |
3530 | 3530 |
3531 MainWindowBase::RemovePaneCommand::RemovePaneCommand(MainWindowBase *mw, Pane *pane) : | 3531 MainWindowBase::RemovePaneCommand::RemovePaneCommand(MainWindowBase *mw, Pane *pane) : |
3532 m_mw(mw), | 3532 m_mw(mw), |
3533 m_pane(pane), | 3533 m_pane(pane), |
3534 m_prevCurrentPane(0), | 3534 m_prevCurrentPane(nullptr), |
3535 m_added(true) | 3535 m_added(true) |
3536 { | 3536 { |
3537 } | 3537 } |
3538 | 3538 |
3539 MainWindowBase::RemovePaneCommand::~RemovePaneCommand() | 3539 MainWindowBase::RemovePaneCommand::~RemovePaneCommand() |
3605 } | 3605 } |
3606 | 3606 |
3607 void | 3607 void |
3608 MainWindowBase::editCurrentLayer() | 3608 MainWindowBase::editCurrentLayer() |
3609 { | 3609 { |
3610 Layer *layer = 0; | 3610 Layer *layer = nullptr; |
3611 Pane *pane = m_paneStack->getCurrentPane(); | 3611 Pane *pane = m_paneStack->getCurrentPane(); |
3612 if (pane) layer = pane->getSelectedLayer(); | 3612 if (pane) layer = pane->getSelectedLayer(); |
3613 if (!layer) return; | 3613 if (!layer) return; |
3614 | 3614 |
3615 Model *model = layer->getModel(); | 3615 Model *model = layer->getModel(); |
3725 } else { | 3725 } else { |
3726 for (int i = 0; i < count; ++i) { | 3726 for (int i = 0; i < count; ++i) { |
3727 if (currentPane->getFixedOrderLayer(i) == currentLayer) { | 3727 if (currentPane->getFixedOrderLayer(i) == currentLayer) { |
3728 if (i == 0) { | 3728 if (i == 0) { |
3729 m_paneStack->setCurrentLayer | 3729 m_paneStack->setCurrentLayer |
3730 (currentPane, 0); // pane | 3730 (currentPane, nullptr); // pane |
3731 } else { | 3731 } else { |
3732 m_paneStack->setCurrentLayer | 3732 m_paneStack->setCurrentLayer |
3733 (currentPane, currentPane->getFixedOrderLayer(i-1)); | 3733 (currentPane, currentPane->getFixedOrderLayer(i-1)); |
3734 } | 3734 } |
3735 break; | 3735 break; |
3760 } else { | 3760 } else { |
3761 for (int i = 0; i < count; ++i) { | 3761 for (int i = 0; i < count; ++i) { |
3762 if (currentPane->getFixedOrderLayer(i) == currentLayer) { | 3762 if (currentPane->getFixedOrderLayer(i) == currentLayer) { |
3763 if (i == currentPane->getLayerCount()-1) { | 3763 if (i == currentPane->getLayerCount()-1) { |
3764 m_paneStack->setCurrentLayer | 3764 m_paneStack->setCurrentLayer |
3765 (currentPane, 0); // pane | 3765 (currentPane, nullptr); // pane |
3766 } else { | 3766 } else { |
3767 m_paneStack->setCurrentLayer | 3767 m_paneStack->setCurrentLayer |
3768 (currentPane, currentPane->getFixedOrderLayer(i+1)); | 3768 (currentPane, currentPane->getFixedOrderLayer(i+1)); |
3769 } | 3769 } |
3770 break; | 3770 break; |
3824 | 3824 |
3825 void | 3825 void |
3826 MainWindowBase::globalCentreFrameChanged(sv_frame_t ) | 3826 MainWindowBase::globalCentreFrameChanged(sv_frame_t ) |
3827 { | 3827 { |
3828 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3828 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3829 Pane *p = 0; | 3829 Pane *p = nullptr; |
3830 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3830 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3831 if (!p->getFollowGlobalPan()) return; | 3831 if (!p->getFollowGlobalPan()) return; |
3832 updateVisibleRangeDisplay(p); | 3832 updateVisibleRangeDisplay(p); |
3833 } | 3833 } |
3834 | 3834 |
3842 i != m_viewDataDialogMap[v].end(); ++i) { | 3842 i != m_viewDataDialogMap[v].end(); ++i) { |
3843 (*i)->userScrolledToFrame(frame); | 3843 (*i)->userScrolledToFrame(frame); |
3844 } | 3844 } |
3845 } | 3845 } |
3846 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3846 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3847 Pane *p = 0; | 3847 Pane *p = nullptr; |
3848 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3848 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3849 if (v == p) updateVisibleRangeDisplay(p); | 3849 if (v == p) updateVisibleRangeDisplay(p); |
3850 } | 3850 } |
3851 | 3851 |
3852 void | 3852 void |
3853 MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool ) | 3853 MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool ) |
3854 { | 3854 { |
3855 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3855 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3856 Pane *p = 0; | 3856 Pane *p = nullptr; |
3857 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3857 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3858 if (v == p) updateVisibleRangeDisplay(p); | 3858 if (v == p) updateVisibleRangeDisplay(p); |
3859 } | 3859 } |
3860 | 3860 |
3861 void | 3861 void |
3879 | 3879 |
3880 removeLayerEditDialog(layer); | 3880 removeLayerEditDialog(layer); |
3881 | 3881 |
3882 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { | 3882 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { |
3883 // cerr << "(this is the time ruler layer)" << endl; | 3883 // cerr << "(this is the time ruler layer)" << endl; |
3884 m_timeRulerLayer = 0; | 3884 m_timeRulerLayer = nullptr; |
3885 } | 3885 } |
3886 } | 3886 } |
3887 | 3887 |
3888 void | 3888 void |
3889 MainWindowBase::layerInAView(Layer *layer, bool inAView) | 3889 MainWindowBase::layerInAView(Layer *layer, bool inAView) |
3962 void | 3962 void |
3963 MainWindowBase::modelAboutToBeDeleted(Model *model) | 3963 MainWindowBase::modelAboutToBeDeleted(Model *model) |
3964 { | 3964 { |
3965 // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; | 3965 // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; |
3966 if (model == m_viewManager->getPlaybackModel()) { | 3966 if (model == m_viewManager->getPlaybackModel()) { |
3967 m_viewManager->setPlaybackModel(0); | 3967 m_viewManager->setPlaybackModel(nullptr); |
3968 } | 3968 } |
3969 m_playSource->removeModel(model); | 3969 m_playSource->removeModel(model); |
3970 } | 3970 } |
3971 | 3971 |
3972 void | 3972 void |
4029 } | 4029 } |
4030 | 4030 |
4031 void | 4031 void |
4032 MainWindowBase::inProgressSelectionChanged() | 4032 MainWindowBase::inProgressSelectionChanged() |
4033 { | 4033 { |
4034 Pane *currentPane = 0; | 4034 Pane *currentPane = nullptr; |
4035 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); | 4035 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); |
4036 if (currentPane) { | 4036 if (currentPane) { |
4037 //cerr << "JTEST: mouse event on selection pane" << endl; | 4037 //cerr << "JTEST: mouse event on selection pane" << endl; |
4038 updateVisibleRangeDisplay(currentPane); | 4038 updateVisibleRangeDisplay(currentPane); |
4039 } | 4039 } |