Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 636:e2715204feaa fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:34:06 +0000 |
parents | 29bef008588e |
children | 8c5379570f36 |
comparison
equal
deleted
inserted
replaced
635:26a0cb8335e3 | 636:e2715204feaa |
---|---|
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)), |
326 delete m_recordTarget; | 326 delete m_recordTarget; |
327 | 327 |
328 delete m_viewManager; | 328 delete m_viewManager; |
329 delete m_midiInput; | 329 delete m_midiInput; |
330 | 330 |
331 disconnect(m_oscQueueStarter, 0, 0, 0); | 331 disconnect(m_oscQueueStarter, nullptr, nullptr, nullptr); |
332 m_oscQueueStarter->wait(1000); | 332 m_oscQueueStarter->wait(1000); |
333 if (m_oscQueueStarter->isRunning()) { | 333 if (m_oscQueueStarter->isRunning()) { |
334 m_oscQueueStarter->terminate(); | 334 m_oscQueueStarter->terminate(); |
335 m_oscQueueStarter->wait(1000); | 335 m_oscQueueStarter->wait(1000); |
336 } | 336 } |
351 MainWindowBase::finaliseMenus() | 351 MainWindowBase::finaliseMenus() |
352 { | 352 { |
353 SVDEBUG << "MainWindowBase::finaliseMenus called" << endl; | 353 SVDEBUG << "MainWindowBase::finaliseMenus called" << endl; |
354 | 354 |
355 delete m_menuShortcutMapper; | 355 delete m_menuShortcutMapper; |
356 m_menuShortcutMapper = 0; | 356 m_menuShortcutMapper = nullptr; |
357 | 357 |
358 foreach (QShortcut *sc, m_appShortcuts) { | 358 foreach (QShortcut *sc, m_appShortcuts) { |
359 delete sc; | 359 delete sc; |
360 } | 360 } |
361 m_appShortcuts.clear(); | 361 m_appShortcuts.clear(); |
522 MainWindowBase::getOpenFileName(FileFinder::FileType type) | 522 MainWindowBase::getOpenFileName(FileFinder::FileType type) |
523 { | 523 { |
524 FileFinder *ff = FileFinder::getInstance(); | 524 FileFinder *ff = FileFinder::getInstance(); |
525 | 525 |
526 if (type == FileFinder::AnyFile) { | 526 if (type == FileFinder::AnyFile) { |
527 if (getMainModel() != 0 && | 527 if (getMainModel() != nullptr && |
528 m_paneStack != 0 && | 528 m_paneStack != nullptr && |
529 m_paneStack->getCurrentPane() != 0) { // can import a layer | 529 m_paneStack->getCurrentPane() != nullptr) { // can import a layer |
530 return ff->getOpenFileName(FileFinder::AnyFile, m_sessionFile); | 530 return ff->getOpenFileName(FileFinder::AnyFile, m_sessionFile); |
531 } else { | 531 } else { |
532 return ff->getOpenFileName(FileFinder::SessionOrAudioFile, | 532 return ff->getOpenFileName(FileFinder::SessionOrAudioFile, |
533 m_sessionFile); | 533 m_sessionFile); |
534 } | 534 } |
582 } | 582 } |
583 | 583 |
584 void | 584 void |
585 MainWindowBase::updateMenuStates() | 585 MainWindowBase::updateMenuStates() |
586 { | 586 { |
587 Pane *currentPane = 0; | 587 Pane *currentPane = nullptr; |
588 Layer *currentLayer = 0; | 588 Layer *currentLayer = nullptr; |
589 | 589 |
590 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); | 590 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); |
591 if (currentPane) currentLayer = currentPane->getSelectedLayer(); | 591 if (currentPane) currentLayer = currentPane->getSelectedLayer(); |
592 | 592 |
593 bool havePrevPane = false, haveNextPane = false; | 593 bool havePrevPane = false, haveNextPane = false; |
610 haveNextLayer = true; | 610 haveNextLayer = true; |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 bool haveCurrentPane = | 614 bool haveCurrentPane = |
615 (currentPane != 0); | 615 (currentPane != nullptr); |
616 bool haveCurrentLayer = | 616 bool haveCurrentLayer = |
617 (haveCurrentPane && | 617 (haveCurrentPane && |
618 (currentLayer != 0)); | 618 (currentLayer != nullptr)); |
619 bool haveMainModel = | 619 bool haveMainModel = |
620 (getMainModel() != 0); | 620 (getMainModel() != nullptr); |
621 bool havePlayTarget = | 621 bool havePlayTarget = |
622 (m_playTarget != 0 || m_audioIO != 0); | 622 (m_playTarget != nullptr || m_audioIO != nullptr); |
623 bool haveSelection = | 623 bool haveSelection = |
624 (m_viewManager && | 624 (m_viewManager && |
625 !m_viewManager->getSelections().empty()); | 625 !m_viewManager->getSelections().empty()); |
626 bool haveCurrentEditableLayer = | 626 bool haveCurrentEditableLayer = |
627 (haveCurrentLayer && | 627 (haveCurrentLayer && |
762 } | 762 } |
763 | 763 |
764 if (m_viewManager->getPlaySoloMode()) { | 764 if (m_viewManager->getPlaySoloMode()) { |
765 currentPaneChanged(m_paneStack->getCurrentPane()); | 765 currentPaneChanged(m_paneStack->getCurrentPane()); |
766 } else { | 766 } else { |
767 m_viewManager->setPlaybackModel(0); | 767 m_viewManager->setPlaybackModel(nullptr); |
768 if (m_playSource) { | 768 if (m_playSource) { |
769 m_playSource->clearSoloModelSet(); | 769 m_playSource->clearSoloModelSet(); |
770 } | 770 } |
771 } | 771 } |
772 } | 772 } |
780 if (!p) return; | 780 if (!p) return; |
781 | 781 |
782 if (!(m_viewManager && | 782 if (!(m_viewManager && |
783 m_playSource && | 783 m_playSource && |
784 m_viewManager->getPlaySoloMode())) { | 784 m_viewManager->getPlaySoloMode())) { |
785 if (m_viewManager) m_viewManager->setPlaybackModel(0); | 785 if (m_viewManager) m_viewManager->setPlaybackModel(nullptr); |
786 return; | 786 return; |
787 } | 787 } |
788 | 788 |
789 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); | 789 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); |
790 | 790 |
1164 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { | 1164 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { |
1165 command->deletePoint(prevPoint); | 1165 command->deletePoint(prevPoint); |
1166 } | 1166 } |
1167 | 1167 |
1168 m_labeller->label<SparseOneDimensionalModel::Point> | 1168 m_labeller->label<SparseOneDimensionalModel::Point> |
1169 (point, havePrevPoint ? &prevPoint : 0); | 1169 (point, havePrevPoint ? &prevPoint : nullptr); |
1170 | 1170 |
1171 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { | 1171 if (m_labeller->actingOnPrevPoint() && havePrevPoint) { |
1172 command->addPoint(prevPoint); | 1172 command->addPoint(prevPoint); |
1173 } | 1173 } |
1174 } | 1174 } |
1214 sv_frame_t alignedStart = pane->alignFromReference(frame); | 1214 sv_frame_t alignedStart = pane->alignFromReference(frame); |
1215 sv_frame_t alignedEnd = pane->alignFromReference(frame + duration); | 1215 sv_frame_t alignedEnd = pane->alignFromReference(frame + duration); |
1216 if (alignedStart >= alignedEnd) return; | 1216 if (alignedStart >= alignedEnd) return; |
1217 sv_frame_t alignedDuration = alignedEnd - alignedStart; | 1217 sv_frame_t alignedDuration = alignedEnd - alignedStart; |
1218 | 1218 |
1219 Command *c = 0; | 1219 Command *c = nullptr; |
1220 | 1220 |
1221 QString name = tr("Add Item at %1 s") | 1221 QString name = tr("Add Item at %1 s") |
1222 .arg(RealTime::frame2RealTime | 1222 .arg(RealTime::frame2RealTime |
1223 (alignedStart, | 1223 (alignedStart, |
1224 getMainModel()->getSampleRate()) | 1224 getMainModel()->getSampleRate()) |
1375 FileOpenStatus status; | 1375 FileOpenStatus status; |
1376 | 1376 |
1377 if (!source.isAvailable()) return FileOpenFailed; | 1377 if (!source.isAvailable()) return FileOpenFailed; |
1378 source.waitForData(); | 1378 source.waitForData(); |
1379 | 1379 |
1380 bool canImportLayer = (getMainModel() != 0 && | 1380 bool canImportLayer = (getMainModel() != nullptr && |
1381 m_paneStack != 0 && | 1381 m_paneStack != nullptr && |
1382 m_paneStack->getCurrentPane() != 0); | 1382 m_paneStack->getCurrentPane() != nullptr); |
1383 | 1383 |
1384 bool rdf = (source.getExtension().toLower() == "rdf" || | 1384 bool rdf = (source.getExtension().toLower() == "rdf" || |
1385 source.getExtension().toLower() == "n3" || | 1385 source.getExtension().toLower() == "n3" || |
1386 source.getExtension().toLower() == "ttl"); | 1386 source.getExtension().toLower() == "ttl"); |
1387 | 1387 |
1705 // the current pane does not contain the main model, otherwise | 1705 // the current pane does not contain the main model, otherwise |
1706 // we would have reset it to ReplaceMainModel. But we don't | 1706 // we would have reset it to ReplaceMainModel. But we don't |
1707 // know whether the pane contains a waveform model at all. | 1707 // know whether the pane contains a waveform model at all. |
1708 | 1708 |
1709 Pane *pane = m_paneStack->getCurrentPane(); | 1709 Pane *pane = m_paneStack->getCurrentPane(); |
1710 Layer *replace = 0; | 1710 Layer *replace = nullptr; |
1711 | 1711 |
1712 for (int i = 0; i < pane->getLayerCount(); ++i) { | 1712 for (int i = 0; i < pane->getLayerCount(); ++i) { |
1713 Layer *layer = pane->getLayer(i); | 1713 Layer *layer = pane->getLayer(i); |
1714 if (dynamic_cast<WaveformLayer *>(layer)) { | 1714 if (dynamic_cast<WaveformLayer *>(layer)) { |
1715 replace = layer; | 1715 replace = layer; |
2070 } else { | 2070 } else { |
2071 return FileOpenFailed; | 2071 return FileOpenFailed; |
2072 } | 2072 } |
2073 } | 2073 } |
2074 | 2074 |
2075 QXmlInputSource *inputSource = 0; | 2075 QXmlInputSource *inputSource = nullptr; |
2076 BZipFileDevice *bzFile = 0; | 2076 BZipFileDevice *bzFile = nullptr; |
2077 QFile *rawFile = 0; | 2077 QFile *rawFile = nullptr; |
2078 | 2078 |
2079 if (source.getExtension().toLower() == sessionExt) { | 2079 if (source.getExtension().toLower() == sessionExt) { |
2080 bzFile = new BZipFileDevice(source.getLocalFilename()); | 2080 bzFile = new BZipFileDevice(source.getLocalFilename()); |
2081 if (!bzFile->open(QIODevice::ReadOnly)) { | 2081 if (!bzFile->open(QIODevice::ReadOnly)) { |
2082 delete bzFile; | 2082 delete bzFile; |
2196 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation() << ")" << endl; | 2196 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation() << ")" << endl; |
2197 | 2197 |
2198 if (!source.isAvailable()) return FileOpenFailed; | 2198 if (!source.isAvailable()) return FileOpenFailed; |
2199 source.waitForData(); | 2199 source.waitForData(); |
2200 | 2200 |
2201 QXmlInputSource *inputSource = 0; | 2201 QXmlInputSource *inputSource = nullptr; |
2202 QFile *file = 0; | 2202 QFile *file = nullptr; |
2203 | 2203 |
2204 file = new QFile(source.getLocalFilename()); | 2204 file = new QFile(source.getLocalFilename()); |
2205 inputSource = new QXmlInputSource(file); | 2205 inputSource = new QXmlInputSource(file); |
2206 | 2206 |
2207 if (!checkSaveModified()) { | 2207 if (!checkSaveModified()) { |
2340 WaveFileModel *w = dynamic_cast<WaveFileModel *>(m); | 2340 WaveFileModel *w = dynamic_cast<WaveFileModel *>(m); |
2341 | 2341 |
2342 if (w) { | 2342 if (w) { |
2343 | 2343 |
2344 Pane *pane = addPaneToStack(); | 2344 Pane *pane = addPaneToStack(); |
2345 Layer *layer = 0; | 2345 Layer *layer = nullptr; |
2346 | 2346 |
2347 if (m_timeRulerLayer) { | 2347 if (m_timeRulerLayer) { |
2348 m_document->addLayerToView(pane, m_timeRulerLayer); | 2348 m_document->addLayerToView(pane, m_timeRulerLayer); |
2349 } | 2349 } |
2350 | 2350 |
2559 void | 2559 void |
2560 MainWindowBase::deleteAudioIO() | 2560 MainWindowBase::deleteAudioIO() |
2561 { | 2561 { |
2562 // First prevent this trying to call target. | 2562 // First prevent this trying to call target. |
2563 if (m_playSource) { | 2563 if (m_playSource) { |
2564 m_playSource->setSystemPlaybackTarget(0); | 2564 m_playSource->setSystemPlaybackTarget(nullptr); |
2565 m_playSource->setResamplerWrapper(0); | 2565 m_playSource->setResamplerWrapper(nullptr); |
2566 } | 2566 } |
2567 | 2567 |
2568 // Then delete the breakfastquay::System object. | 2568 // Then delete the breakfastquay::System object. |
2569 // Only one of these two exists! | 2569 // Only one of these two exists! |
2570 delete m_audioIO; | 2570 delete m_audioIO; |
2573 // And the breakfastquay resampler wrapper. We need to | 2573 // And the breakfastquay resampler wrapper. We need to |
2574 // delete/recreate this if the channel count changes, which is one | 2574 // delete/recreate this if the channel count changes, which is one |
2575 // of the use cases for recreateAudioIO() calling this | 2575 // of the use cases for recreateAudioIO() calling this |
2576 delete m_resamplerWrapper; | 2576 delete m_resamplerWrapper; |
2577 | 2577 |
2578 m_audioIO = 0; | 2578 m_audioIO = nullptr; |
2579 m_playTarget = 0; | 2579 m_playTarget = nullptr; |
2580 m_resamplerWrapper = 0; | 2580 m_resamplerWrapper = nullptr; |
2581 } | 2581 } |
2582 | 2582 |
2583 void | 2583 void |
2584 MainWindowBase::recreateAudioIO() | 2584 MainWindowBase::recreateAudioIO() |
2585 { | 2585 { |
2602 } | 2602 } |
2603 | 2603 |
2604 WaveFileModel * | 2604 WaveFileModel * |
2605 MainWindowBase::getMainModel() | 2605 MainWindowBase::getMainModel() |
2606 { | 2606 { |
2607 if (!m_document) return 0; | 2607 if (!m_document) return nullptr; |
2608 return m_document->getMainModel(); | 2608 return m_document->getMainModel(); |
2609 } | 2609 } |
2610 | 2610 |
2611 const WaveFileModel * | 2611 const WaveFileModel * |
2612 MainWindowBase::getMainModel() const | 2612 MainWindowBase::getMainModel() const |
2613 { | 2613 { |
2614 if (!m_document) return 0; | 2614 if (!m_document) return nullptr; |
2615 return m_document->getMainModel(); | 2615 return m_document->getMainModel(); |
2616 } | 2616 } |
2617 | 2617 |
2618 void | 2618 void |
2619 MainWindowBase::createDocument() | 2619 MainWindowBase::createDocument() |
2903 } | 2903 } |
2904 } | 2904 } |
2905 if (m_timeRulerLayer) { | 2905 if (m_timeRulerLayer) { |
2906 SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl; | 2906 SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl; |
2907 delete m_timeRulerLayer; | 2907 delete m_timeRulerLayer; |
2908 m_timeRulerLayer = 0; | 2908 m_timeRulerLayer = nullptr; |
2909 } | 2909 } |
2910 } | 2910 } |
2911 | 2911 |
2912 void | 2912 void |
2913 MainWindowBase::toggleTimeRulers() | 2913 MainWindowBase::toggleTimeRulers() |
3428 | 3428 |
3429 Layer * | 3429 Layer * |
3430 MainWindowBase::getSnapLayer() const | 3430 MainWindowBase::getSnapLayer() const |
3431 { | 3431 { |
3432 Pane *pane = m_paneStack->getCurrentPane(); | 3432 Pane *pane = m_paneStack->getCurrentPane(); |
3433 if (!pane) return 0; | 3433 if (!pane) return nullptr; |
3434 | 3434 |
3435 Layer *layer = pane->getSelectedLayer(); | 3435 Layer *layer = pane->getSelectedLayer(); |
3436 | 3436 |
3437 if (!dynamic_cast<TimeInstantLayer *>(layer) && | 3437 if (!dynamic_cast<TimeInstantLayer *>(layer) && |
3438 !dynamic_cast<TimeValueLayer *>(layer) && | 3438 !dynamic_cast<TimeValueLayer *>(layer) && |
3439 !dynamic_cast<RegionLayer *>(layer) && | 3439 !dynamic_cast<RegionLayer *>(layer) && |
3440 !dynamic_cast<TimeRulerLayer *>(layer)) { | 3440 !dynamic_cast<TimeRulerLayer *>(layer)) { |
3441 | 3441 |
3442 layer = 0; | 3442 layer = nullptr; |
3443 | 3443 |
3444 for (int i = pane->getLayerCount(); i > 0; --i) { | 3444 for (int i = pane->getLayerCount(); i > 0; --i) { |
3445 Layer *l = pane->getLayer(i-1); | 3445 Layer *l = pane->getLayer(i-1); |
3446 if (dynamic_cast<TimeRulerLayer *>(l)) { | 3446 if (dynamic_cast<TimeRulerLayer *>(l)) { |
3447 layer = l; | 3447 layer = l; |
3478 } | 3478 } |
3479 } | 3479 } |
3480 | 3480 |
3481 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : | 3481 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : |
3482 m_mw(mw), | 3482 m_mw(mw), |
3483 m_pane(0), | 3483 m_pane(nullptr), |
3484 m_prevCurrentPane(0), | 3484 m_prevCurrentPane(nullptr), |
3485 m_added(false) | 3485 m_added(false) |
3486 { | 3486 { |
3487 } | 3487 } |
3488 | 3488 |
3489 MainWindowBase::AddPaneCommand::~AddPaneCommand() | 3489 MainWindowBase::AddPaneCommand::~AddPaneCommand() |
3525 } | 3525 } |
3526 | 3526 |
3527 MainWindowBase::RemovePaneCommand::RemovePaneCommand(MainWindowBase *mw, Pane *pane) : | 3527 MainWindowBase::RemovePaneCommand::RemovePaneCommand(MainWindowBase *mw, Pane *pane) : |
3528 m_mw(mw), | 3528 m_mw(mw), |
3529 m_pane(pane), | 3529 m_pane(pane), |
3530 m_prevCurrentPane(0), | 3530 m_prevCurrentPane(nullptr), |
3531 m_added(true) | 3531 m_added(true) |
3532 { | 3532 { |
3533 } | 3533 } |
3534 | 3534 |
3535 MainWindowBase::RemovePaneCommand::~RemovePaneCommand() | 3535 MainWindowBase::RemovePaneCommand::~RemovePaneCommand() |
3601 } | 3601 } |
3602 | 3602 |
3603 void | 3603 void |
3604 MainWindowBase::editCurrentLayer() | 3604 MainWindowBase::editCurrentLayer() |
3605 { | 3605 { |
3606 Layer *layer = 0; | 3606 Layer *layer = nullptr; |
3607 Pane *pane = m_paneStack->getCurrentPane(); | 3607 Pane *pane = m_paneStack->getCurrentPane(); |
3608 if (pane) layer = pane->getSelectedLayer(); | 3608 if (pane) layer = pane->getSelectedLayer(); |
3609 if (!layer) return; | 3609 if (!layer) return; |
3610 | 3610 |
3611 Model *model = layer->getModel(); | 3611 Model *model = layer->getModel(); |
3721 } else { | 3721 } else { |
3722 for (int i = 0; i < count; ++i) { | 3722 for (int i = 0; i < count; ++i) { |
3723 if (currentPane->getFixedOrderLayer(i) == currentLayer) { | 3723 if (currentPane->getFixedOrderLayer(i) == currentLayer) { |
3724 if (i == 0) { | 3724 if (i == 0) { |
3725 m_paneStack->setCurrentLayer | 3725 m_paneStack->setCurrentLayer |
3726 (currentPane, 0); // pane | 3726 (currentPane, nullptr); // pane |
3727 } else { | 3727 } else { |
3728 m_paneStack->setCurrentLayer | 3728 m_paneStack->setCurrentLayer |
3729 (currentPane, currentPane->getFixedOrderLayer(i-1)); | 3729 (currentPane, currentPane->getFixedOrderLayer(i-1)); |
3730 } | 3730 } |
3731 break; | 3731 break; |
3756 } else { | 3756 } else { |
3757 for (int i = 0; i < count; ++i) { | 3757 for (int i = 0; i < count; ++i) { |
3758 if (currentPane->getFixedOrderLayer(i) == currentLayer) { | 3758 if (currentPane->getFixedOrderLayer(i) == currentLayer) { |
3759 if (i == currentPane->getLayerCount()-1) { | 3759 if (i == currentPane->getLayerCount()-1) { |
3760 m_paneStack->setCurrentLayer | 3760 m_paneStack->setCurrentLayer |
3761 (currentPane, 0); // pane | 3761 (currentPane, nullptr); // pane |
3762 } else { | 3762 } else { |
3763 m_paneStack->setCurrentLayer | 3763 m_paneStack->setCurrentLayer |
3764 (currentPane, currentPane->getFixedOrderLayer(i+1)); | 3764 (currentPane, currentPane->getFixedOrderLayer(i+1)); |
3765 } | 3765 } |
3766 break; | 3766 break; |
3820 | 3820 |
3821 void | 3821 void |
3822 MainWindowBase::globalCentreFrameChanged(sv_frame_t ) | 3822 MainWindowBase::globalCentreFrameChanged(sv_frame_t ) |
3823 { | 3823 { |
3824 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3824 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3825 Pane *p = 0; | 3825 Pane *p = nullptr; |
3826 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3826 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3827 if (!p->getFollowGlobalPan()) return; | 3827 if (!p->getFollowGlobalPan()) return; |
3828 updateVisibleRangeDisplay(p); | 3828 updateVisibleRangeDisplay(p); |
3829 } | 3829 } |
3830 | 3830 |
3838 i != m_viewDataDialogMap[v].end(); ++i) { | 3838 i != m_viewDataDialogMap[v].end(); ++i) { |
3839 (*i)->userScrolledToFrame(frame); | 3839 (*i)->userScrolledToFrame(frame); |
3840 } | 3840 } |
3841 } | 3841 } |
3842 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3842 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3843 Pane *p = 0; | 3843 Pane *p = nullptr; |
3844 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3844 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3845 if (v == p) updateVisibleRangeDisplay(p); | 3845 if (v == p) updateVisibleRangeDisplay(p); |
3846 } | 3846 } |
3847 | 3847 |
3848 void | 3848 void |
3849 MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool ) | 3849 MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool ) |
3850 { | 3850 { |
3851 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 3851 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
3852 Pane *p = 0; | 3852 Pane *p = nullptr; |
3853 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 3853 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
3854 if (v == p) updateVisibleRangeDisplay(p); | 3854 if (v == p) updateVisibleRangeDisplay(p); |
3855 } | 3855 } |
3856 | 3856 |
3857 void | 3857 void |
3875 | 3875 |
3876 removeLayerEditDialog(layer); | 3876 removeLayerEditDialog(layer); |
3877 | 3877 |
3878 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { | 3878 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { |
3879 // cerr << "(this is the time ruler layer)" << endl; | 3879 // cerr << "(this is the time ruler layer)" << endl; |
3880 m_timeRulerLayer = 0; | 3880 m_timeRulerLayer = nullptr; |
3881 } | 3881 } |
3882 } | 3882 } |
3883 | 3883 |
3884 void | 3884 void |
3885 MainWindowBase::layerInAView(Layer *layer, bool inAView) | 3885 MainWindowBase::layerInAView(Layer *layer, bool inAView) |
3958 void | 3958 void |
3959 MainWindowBase::modelAboutToBeDeleted(Model *model) | 3959 MainWindowBase::modelAboutToBeDeleted(Model *model) |
3960 { | 3960 { |
3961 // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; | 3961 // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; |
3962 if (model == m_viewManager->getPlaybackModel()) { | 3962 if (model == m_viewManager->getPlaybackModel()) { |
3963 m_viewManager->setPlaybackModel(0); | 3963 m_viewManager->setPlaybackModel(nullptr); |
3964 } | 3964 } |
3965 m_playSource->removeModel(model); | 3965 m_playSource->removeModel(model); |
3966 } | 3966 } |
3967 | 3967 |
3968 void | 3968 void |
4025 } | 4025 } |
4026 | 4026 |
4027 void | 4027 void |
4028 MainWindowBase::inProgressSelectionChanged() | 4028 MainWindowBase::inProgressSelectionChanged() |
4029 { | 4029 { |
4030 Pane *currentPane = 0; | 4030 Pane *currentPane = nullptr; |
4031 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); | 4031 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); |
4032 if (currentPane) { | 4032 if (currentPane) { |
4033 //cerr << "JTEST: mouse event on selection pane" << endl; | 4033 //cerr << "JTEST: mouse event on selection pane" << endl; |
4034 updateVisibleRangeDisplay(currentPane); | 4034 updateVisibleRangeDisplay(currentPane); |
4035 } | 4035 } |