comparison view/View.cpp @ 1417:2487521e857b

Merge
author Chris Cannam
date Wed, 23 Jan 2019 14:44:16 +0000
parents d794630429a7 c8a6fd3f9dff
children 31499c3520ee
comparison
equal deleted inserted replaced
1416:d794630429a7 1417:2487521e857b
60 m_followZoom(true), 60 m_followZoom(true),
61 m_followPlay(PlaybackScrollPageWithCentre), 61 m_followPlay(PlaybackScrollPageWithCentre),
62 m_followPlayIsDetached(false), 62 m_followPlayIsDetached(false),
63 m_playPointerFrame(0), 63 m_playPointerFrame(0),
64 m_showProgress(showProgress), 64 m_showProgress(showProgress),
65 m_cache(0), 65 m_cache(nullptr),
66 m_buffer(0), 66 m_buffer(nullptr),
67 m_cacheValid(false), 67 m_cacheValid(false),
68 m_cacheCentreFrame(0), 68 m_cacheCentreFrame(0),
69 m_cacheZoomLevel(ZoomLevel::FramesPerPixel, 1024), 69 m_cacheZoomLevel(ZoomLevel::FramesPerPixel, 1024),
70 m_selectionCached(false), 70 m_selectionCached(false),
71 m_deleting(false), 71 m_deleting(false),
72 m_haveSelectedLayer(false), 72 m_haveSelectedLayer(false),
73 m_manager(0), 73 m_manager(nullptr),
74 m_propertyContainer(new ViewPropertyContainer(this)) 74 m_propertyContainer(new ViewPropertyContainer(this))
75 { 75 {
76 // cerr << "View::View(" << this << ")" << endl; 76 // cerr << "View::View(" << this << ")" << endl;
77 } 77 }
78 78
262 return; 262 return;
263 } 263 }
264 264
265 m_cacheValid = false; 265 m_cacheValid = false;
266 266
267 Layer *selectedLayer = 0; 267 Layer *selectedLayer = nullptr;
268 268
269 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { 269 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) {
270 if (*i == pc) { 270 if (*i == pc) {
271 selectedLayer = *i; 271 selectedLayer = *i;
272 m_layerStack.erase(i); 272 m_layerStack.erase(i);
791 if (!(layer->isLayerDormant(this))) { 791 if (!(layer->isLayerDormant(this))) {
792 return layer; 792 return layer;
793 } 793 }
794 } 794 }
795 } 795 }
796 return 0; 796 return nullptr;
797 } 797 }
798 798
799 const Layer * 799 const Layer *
800 View::getInteractionLayer() const 800 View::getInteractionLayer() const
801 { 801 {
806 View::getSelectedLayer() 806 View::getSelectedLayer()
807 { 807 {
808 if (m_haveSelectedLayer && !m_layerStack.empty()) { 808 if (m_haveSelectedLayer && !m_layerStack.empty()) {
809 return getLayer(getLayerCount() - 1); 809 return getLayer(getLayerCount() - 1);
810 } else { 810 } else {
811 return 0; 811 return nullptr;
812 } 812 }
813 } 813 }
814 814
815 const Layer * 815 const Layer *
816 View::getSelectedLayer() const 816 View::getSelectedLayer() const
1350 View::getAligningModel() const 1350 View::getAligningModel() const
1351 { 1351 {
1352 if (!m_manager || 1352 if (!m_manager ||
1353 !m_manager->getAlignMode() || 1353 !m_manager->getAlignMode() ||
1354 !m_manager->getPlaybackModel()) { 1354 !m_manager->getPlaybackModel()) {
1355 return 0; 1355 return nullptr;
1356 } 1356 }
1357 1357
1358 Model *anyModel = 0; 1358 Model *anyModel = nullptr;
1359 Model *alignedModel = 0; 1359 Model *alignedModel = nullptr;
1360 Model *goodModel = 0; 1360 Model *goodModel = nullptr;
1361 1361
1362 for (LayerList::const_iterator i = m_layerStack.begin(); 1362 for (LayerList::const_iterator i = m_layerStack.begin();
1363 i != m_layerStack.end(); ++i) { 1363 i != m_layerStack.end(); ++i) {
1364 1364
1365 Layer *layer = *i; 1365 Layer *layer = *i;
2023 int dx = dpratio * (getXForFrame(m_cacheCentreFrame) - 2023 int dx = dpratio * (getXForFrame(m_cacheCentreFrame) -
2024 getXForFrame(m_centreFrame)); 2024 getXForFrame(m_centreFrame));
2025 2025
2026 if (dx > -m_cache->width() && dx < m_cache->width()) { 2026 if (dx > -m_cache->width() && dx < m_cache->width()) {
2027 2027
2028 m_cache->scroll(dx, 0, m_cache->rect(), 0); 2028 m_cache->scroll(dx, 0, m_cache->rect(), nullptr);
2029 2029
2030 if (dx < 0) { 2030 if (dx < 0) {
2031 cacheAreaToRepaint = 2031 cacheAreaToRepaint =
2032 QRect(m_cache->width() + dx, 0, -dx, m_cache->height()); 2032 QRect(m_cache->width() + dx, 0, -dx, m_cache->height());
2033 } else { 2033 } else {
2724 2724
2725 QPainter *paint = new QPainter(image); 2725 QPainter *paint = new QPainter(image);
2726 if (!render(*paint, 0, f0, f1)) { 2726 if (!render(*paint, 0, f0, f1)) {
2727 delete paint; 2727 delete paint;
2728 delete image; 2728 delete image;
2729 return 0; 2729 return nullptr;
2730 } else { 2730 } else {
2731 delete paint; 2731 delete paint;
2732 return image; 2732 return image;
2733 } 2733 }
2734 } 2734 }