Mercurial > hg > svgui
comparison view/View.cpp @ 842:8432d2551fb2 tonioni
Update subrepos and merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 16:23:48 +0100 |
parents | 532302d04571 |
children | ee36642b9b59 |
comparison
equal
deleted
inserted
replaced
826:43256b925e15 | 842:8432d2551fb2 |
---|---|
42 #include <cassert> | 42 #include <cassert> |
43 #include <cmath> | 43 #include <cmath> |
44 | 44 |
45 #include <unistd.h> | 45 #include <unistd.h> |
46 | 46 |
47 //#define DEBUG_VIEW 1 | |
47 //#define DEBUG_VIEW_WIDGET_PAINT 1 | 48 //#define DEBUG_VIEW_WIDGET_PAINT 1 |
48 | |
49 | |
50 | 49 |
51 | 50 |
52 View::View(QWidget *w, bool showProgress) : | 51 View::View(QWidget *w, bool showProgress) : |
53 QFrame(w), | 52 QFrame(w), |
54 m_centreFrame(0), | 53 m_centreFrame(0), |
163 } | 162 } |
164 | 163 |
165 int | 164 int |
166 View::getPropertyContainerCount() const | 165 View::getPropertyContainerCount() const |
167 { | 166 { |
168 return m_layers.size() + 1; // the 1 is for me | 167 return m_fixedOrderLayers.size() + 1; // the 1 is for me |
169 } | 168 } |
170 | 169 |
171 const PropertyContainer * | 170 const PropertyContainer * |
172 View::getPropertyContainer(int i) const | 171 View::getPropertyContainer(int i) const |
173 { | 172 { |
177 | 176 |
178 PropertyContainer * | 177 PropertyContainer * |
179 View::getPropertyContainer(int i) | 178 View::getPropertyContainer(int i) |
180 { | 179 { |
181 if (i == 0) return m_propertyContainer; | 180 if (i == 0) return m_propertyContainer; |
182 return m_layers[i-1]; | 181 return m_fixedOrderLayers[i-1]; |
183 } | 182 } |
184 | 183 |
185 bool | 184 bool |
186 View::getValueExtents(QString unit, float &min, float &max, bool &log) const | 185 View::getValueExtents(QString unit, float &min, float &max, bool &log) const |
187 { | 186 { |
188 bool have = false; | 187 bool have = false; |
189 | 188 |
190 for (LayerList::const_iterator i = m_layers.begin(); | 189 for (LayerList::const_iterator i = m_layerStack.begin(); |
191 i != m_layers.end(); ++i) { | 190 i != m_layerStack.end(); ++i) { |
192 | 191 |
193 QString layerUnit; | 192 QString layerUnit; |
194 float layerMin = 0.0, layerMax = 0.0; | 193 float layerMin = 0.0, layerMax = 0.0; |
195 float displayMin = 0.0, displayMax = 0.0; | 194 float displayMin = 0.0, displayMax = 0.0; |
196 bool layerLog = false; | 195 bool layerLog = false; |
222 int | 221 int |
223 View::getTextLabelHeight(const Layer *layer, QPainter &paint) const | 222 View::getTextLabelHeight(const Layer *layer, QPainter &paint) const |
224 { | 223 { |
225 std::map<int, Layer *> sortedLayers; | 224 std::map<int, Layer *> sortedLayers; |
226 | 225 |
227 for (LayerList::const_iterator i = m_layers.begin(); | 226 for (LayerList::const_iterator i = m_layerStack.begin(); |
228 i != m_layers.end(); ++i) { | 227 i != m_layerStack.end(); ++i) { |
229 if ((*i)->needsTextLabelHeight()) { | 228 if ((*i)->needsTextLabelHeight()) { |
230 sortedLayers[getObjectExportId(*i)] = *i; | 229 sortedLayers[getObjectExportId(*i)] = *i; |
231 } | 230 } |
232 } | 231 } |
233 | 232 |
258 delete m_cache; | 257 delete m_cache; |
259 m_cache = 0; | 258 m_cache = 0; |
260 | 259 |
261 Layer *selectedLayer = 0; | 260 Layer *selectedLayer = 0; |
262 | 261 |
263 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 262 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
264 if (*i == pc) { | 263 if (*i == pc) { |
265 selectedLayer = *i; | 264 selectedLayer = *i; |
266 m_layers.erase(i); | 265 m_layerStack.erase(i); |
267 break; | 266 break; |
268 } | 267 } |
269 } | 268 } |
270 | 269 |
271 if (selectedLayer) { | 270 if (selectedLayer) { |
272 m_haveSelectedLayer = true; | 271 m_haveSelectedLayer = true; |
273 m_layers.push_back(selectedLayer); | 272 m_layerStack.push_back(selectedLayer); |
274 update(); | 273 update(); |
275 } else { | 274 } else { |
276 m_haveSelectedLayer = false; | 275 m_haveSelectedLayer = false; |
277 } | 276 } |
278 | 277 |
340 changeVisible = true; | 339 changeVisible = true; |
341 } | 340 } |
342 | 341 |
343 if (e) { | 342 if (e) { |
344 int rf = alignToReference(f); | 343 int rf = alignToReference(f); |
345 #ifdef DEBUG_VIEW_WIDGET_PAINT | 344 #ifdef DEBUG_VIEW |
346 cerr << "View[" << this << "]::setCentreFrame(" << f | 345 cerr << "View[" << this << "]::setCentreFrame(" << f |
347 << "): emitting centreFrameChanged(" | 346 << "): emitting centreFrameChanged(" |
348 << rf << ")" << endl; | 347 << rf << ")" << endl; |
349 #endif | 348 #endif |
350 emit centreFrameChanged(rf, m_followPan, m_followPlay); | 349 emit centreFrameChanged(rf, m_followPan, m_followPlay); |
467 if (m_manager) darkPalette = m_manager->getGlobalDarkBackground(); | 466 if (m_manager) darkPalette = m_manager->getGlobalDarkBackground(); |
468 | 467 |
469 Layer::ColourSignificance maxSignificance = Layer::ColourAbsent; | 468 Layer::ColourSignificance maxSignificance = Layer::ColourAbsent; |
470 bool mostSignificantHasDarkBackground = false; | 469 bool mostSignificantHasDarkBackground = false; |
471 | 470 |
472 for (LayerList::const_iterator i = m_layers.begin(); | 471 for (LayerList::const_iterator i = m_layerStack.begin(); |
473 i != m_layers.end(); ++i) { | 472 i != m_layerStack.end(); ++i) { |
474 | 473 |
475 Layer::ColourSignificance s = (*i)->getLayerColourSignificance(); | 474 Layer::ColourSignificance s = (*i)->getLayerColourSignificance(); |
476 bool light = (*i)->hasLightBackground(); | 475 bool light = (*i)->hasLightBackground(); |
477 | 476 |
478 if (int(s) > int(maxSignificance)) { | 477 if (int(s) > int(maxSignificance)) { |
531 m_cache = 0; | 530 m_cache = 0; |
532 | 531 |
533 SingleColourLayer *scl = dynamic_cast<SingleColourLayer *>(layer); | 532 SingleColourLayer *scl = dynamic_cast<SingleColourLayer *>(layer); |
534 if (scl) scl->setDefaultColourFor(this); | 533 if (scl) scl->setDefaultColourFor(this); |
535 | 534 |
536 m_layers.push_back(layer); | 535 m_fixedOrderLayers.push_back(layer); |
536 m_layerStack.push_back(layer); | |
537 | 537 |
538 QProgressBar *pb = new QProgressBar(this); | 538 QProgressBar *pb = new QProgressBar(this); |
539 pb->setMinimum(0); | 539 pb->setMinimum(0); |
540 pb->setMaximum(0); | 540 pb->setMaximum(0); |
541 pb->setFixedWidth(80); | 541 pb->setFixedWidth(80); |
598 } | 598 } |
599 | 599 |
600 delete m_cache; | 600 delete m_cache; |
601 m_cache = 0; | 601 m_cache = 0; |
602 | 602 |
603 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 603 for (LayerList::iterator i = m_fixedOrderLayers.begin(); |
604 i != m_fixedOrderLayers.end(); | |
605 ++i) { | |
604 if (*i == layer) { | 606 if (*i == layer) { |
605 m_layers.erase(i); | 607 m_fixedOrderLayers.erase(i); |
608 break; | |
609 } | |
610 } | |
611 | |
612 for (LayerList::iterator i = m_layerStack.begin(); | |
613 i != m_layerStack.end(); | |
614 ++i) { | |
615 if (*i == layer) { | |
616 m_layerStack.erase(i); | |
606 if (m_progressBars.find(layer) != m_progressBars.end()) { | 617 if (m_progressBars.find(layer) != m_progressBars.end()) { |
607 delete m_progressBars[layer].bar; | 618 delete m_progressBars[layer].bar; |
608 delete m_progressBars[layer].cancel; | 619 delete m_progressBars[layer].cancel; |
609 delete m_progressBars[layer].checkTimer; | 620 delete m_progressBars[layer].checkTimer; |
610 m_progressBars.erase(layer); | 621 m_progressBars.erase(layer); |
634 | 645 |
635 emit propertyContainerRemoved(layer); | 646 emit propertyContainerRemoved(layer); |
636 } | 647 } |
637 | 648 |
638 Layer * | 649 Layer * |
639 View::getSelectedLayer() | 650 View::getInteractionLayer() |
640 { | 651 { |
641 if (m_haveSelectedLayer && !m_layers.empty()) { | 652 Layer *sl = getSelectedLayer(); |
653 if (sl && !(sl->isLayerDormant(this))) { | |
654 return sl; | |
655 } | |
656 if (!m_layerStack.empty()) { | |
642 int n = getLayerCount(); | 657 int n = getLayerCount(); |
643 while (n > 0) { | 658 while (n > 0) { |
644 --n; | 659 --n; |
645 Layer *layer = getLayer(n); | 660 Layer *layer = getLayer(n); |
646 if (!(layer->isLayerDormant(this))) { | 661 if (!(layer->isLayerDormant(this))) { |
647 return layer; | 662 return layer; |
648 } | 663 } |
649 } | 664 } |
650 return 0; | 665 } |
666 return 0; | |
667 } | |
668 | |
669 const Layer * | |
670 View::getInteractionLayer() const | |
671 { | |
672 return const_cast<const Layer *>(const_cast<View *>(this)->getInteractionLayer()); | |
673 } | |
674 | |
675 Layer * | |
676 View::getSelectedLayer() | |
677 { | |
678 if (m_haveSelectedLayer && !m_layerStack.empty()) { | |
679 return getLayer(getLayerCount() - 1); | |
651 } else { | 680 } else { |
652 return 0; | 681 return 0; |
653 } | 682 } |
654 } | 683 } |
655 | 684 |
968 void | 997 void |
969 View::globalCentreFrameChanged(int rf) | 998 View::globalCentreFrameChanged(int rf) |
970 { | 999 { |
971 if (m_followPan) { | 1000 if (m_followPan) { |
972 int f = alignFromReference(rf); | 1001 int f = alignFromReference(rf); |
973 #ifdef DEBUG_VIEW_WIDGET_PAINT | 1002 #ifdef DEBUG_VIEW |
974 cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf | 1003 cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf |
975 << "): setting centre frame to " << f << endl; | 1004 << "): setting centre frame to " << f << endl; |
976 #endif | 1005 #endif |
977 setCentreFrame(f, false); | 1006 setCentreFrame(f, false); |
978 } | 1007 } |
989 { | 1018 { |
990 if (m_manager) { | 1019 if (m_manager) { |
991 if (sender() != m_manager) return; | 1020 if (sender() != m_manager) return; |
992 } | 1021 } |
993 | 1022 |
1023 #ifdef DEBUG_VIEW | |
1024 cerr << "View::viewManagerPlaybackFrameChanged(" << f << ")" << endl; | |
1025 #endif | |
1026 | |
994 f = getAlignedPlaybackFrame(); | 1027 f = getAlignedPlaybackFrame(); |
995 | 1028 |
1029 #ifdef DEBUG_VIEW | |
1030 cerr << " -> aligned frame = " << af << endl; | |
1031 #endif | |
1032 | |
996 movePlayPointer(f); | 1033 movePlayPointer(f); |
997 } | 1034 } |
998 | 1035 |
999 void | 1036 void |
1000 View::movePlayPointer(int newFrame) | 1037 View::movePlayPointer(int newFrame) |
1001 { | 1038 { |
1039 #ifdef DEBUG_VIEW | |
1040 cerr << "View(" << this << ")::movePlayPointer(" << newFrame << ")" << endl; | |
1041 #endif | |
1042 | |
1002 if (m_playPointerFrame == newFrame) return; | 1043 if (m_playPointerFrame == newFrame) return; |
1003 bool visibleChange = | 1044 bool visibleChange = |
1004 (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame)); | 1045 (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame)); |
1005 int oldPlayPointerFrame = m_playPointerFrame; | 1046 int oldPlayPointerFrame = m_playPointerFrame; |
1006 m_playPointerFrame = newFrame; | 1047 m_playPointerFrame = newFrame; |
1149 View::getModelsStartFrame() const | 1190 View::getModelsStartFrame() const |
1150 { | 1191 { |
1151 bool first = true; | 1192 bool first = true; |
1152 int startFrame = 0; | 1193 int startFrame = 0; |
1153 | 1194 |
1154 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1195 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1155 | 1196 |
1156 if ((*i)->getModel() && (*i)->getModel()->isOK()) { | 1197 if ((*i)->getModel() && (*i)->getModel()->isOK()) { |
1157 | 1198 |
1158 int thisStartFrame = (*i)->getModel()->getStartFrame(); | 1199 int thisStartFrame = (*i)->getModel()->getStartFrame(); |
1159 | 1200 |
1170 View::getModelsEndFrame() const | 1211 View::getModelsEndFrame() const |
1171 { | 1212 { |
1172 bool first = true; | 1213 bool first = true; |
1173 int endFrame = 0; | 1214 int endFrame = 0; |
1174 | 1215 |
1175 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1216 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1176 | 1217 |
1177 if ((*i)->getModel() && (*i)->getModel()->isOK()) { | 1218 if ((*i)->getModel() && (*i)->getModel()->isOK()) { |
1178 | 1219 |
1179 int thisEndFrame = (*i)->getModel()->getEndFrame(); | 1220 int thisEndFrame = (*i)->getModel()->getEndFrame(); |
1180 | 1221 |
1196 // multiple samplerates, we'd probably want to do frame/time | 1237 // multiple samplerates, we'd probably want to do frame/time |
1197 // conversion in the model | 1238 // conversion in the model |
1198 | 1239 |
1199 //!!! nah, this wants to always return the sr of the main model! | 1240 //!!! nah, this wants to always return the sr of the main model! |
1200 | 1241 |
1201 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1242 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1202 if ((*i)->getModel() && (*i)->getModel()->isOK()) { | 1243 if ((*i)->getModel() && (*i)->getModel()->isOK()) { |
1203 return (*i)->getModel()->getSampleRate(); | 1244 return (*i)->getModel()->getSampleRate(); |
1204 } | 1245 } |
1205 } | 1246 } |
1206 return 0; | 1247 return 0; |
1239 | 1280 |
1240 Model *anyModel = 0; | 1281 Model *anyModel = 0; |
1241 Model *alignedModel = 0; | 1282 Model *alignedModel = 0; |
1242 Model *goodModel = 0; | 1283 Model *goodModel = 0; |
1243 | 1284 |
1244 for (LayerList::const_iterator i = m_layers.begin(); | 1285 for (LayerList::const_iterator i = m_layerStack.begin(); |
1245 i != m_layers.end(); ++i) { | 1286 i != m_layerStack.end(); ++i) { |
1246 | 1287 |
1247 Layer *layer = *i; | 1288 Layer *layer = *i; |
1248 | 1289 |
1249 if (!layer) continue; | 1290 if (!layer) continue; |
1250 if (dynamic_cast<TimeRulerLayer *>(layer)) continue; | 1291 if (dynamic_cast<TimeRulerLayer *>(layer)) continue; |
1292 int pf = m_manager->getPlaybackFrame(); | 1333 int pf = m_manager->getPlaybackFrame(); |
1293 if (!m_manager->getAlignMode()) return pf; | 1334 if (!m_manager->getAlignMode()) return pf; |
1294 | 1335 |
1295 Model *aligningModel = getAligningModel(); | 1336 Model *aligningModel = getAligningModel(); |
1296 if (!aligningModel) return pf; | 1337 if (!aligningModel) return pf; |
1297 /* | 1338 |
1298 Model *pm = m_manager->getPlaybackModel(); | |
1299 | |
1300 // cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf; | |
1301 | |
1302 if (pm) { | |
1303 pf = pm->alignToReference(pf); | |
1304 // cerr << " -> " << pf; | |
1305 } | |
1306 */ | |
1307 int af = aligningModel->alignFromReference(pf); | 1339 int af = aligningModel->alignFromReference(pf); |
1308 | 1340 |
1309 // cerr << ", aligned = " << af << endl; | |
1310 return af; | 1341 return af; |
1311 } | 1342 } |
1312 | 1343 |
1313 bool | 1344 bool |
1314 View::areLayersScrollable() const | 1345 View::areLayersScrollable() const |
1315 { | 1346 { |
1316 // True iff all views are scrollable | 1347 // True iff all views are scrollable |
1317 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1348 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1318 if (!(*i)->isLayerScrollable(this)) return false; | 1349 if (!(*i)->isLayerScrollable(this)) return false; |
1319 } | 1350 } |
1320 return true; | 1351 return true; |
1321 } | 1352 } |
1322 | 1353 |
1329 // backmost non-scrollable layer. | 1360 // backmost non-scrollable layer. |
1330 | 1361 |
1331 LayerList scrollables; | 1362 LayerList scrollables; |
1332 bool metUnscrollable = false; | 1363 bool metUnscrollable = false; |
1333 | 1364 |
1334 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1365 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1335 // SVDEBUG << "View::getScrollableBackLayers: calling isLayerDormant on layer " << *i << endl; | 1366 // SVDEBUG << "View::getScrollableBackLayers: calling isLayerDormant on layer " << *i << endl; |
1336 // cerr << "(name is " << (*i)->objectName() << ")" | 1367 // cerr << "(name is " << (*i)->objectName() << ")" |
1337 // << endl; | 1368 // << endl; |
1338 // SVDEBUG << "View::getScrollableBackLayers: I am " << this << endl; | 1369 // SVDEBUG << "View::getScrollableBackLayers: I am " << this << endl; |
1339 if ((*i)->isLayerDormant(this)) continue; | 1370 if ((*i)->isLayerDormant(this)) continue; |
1365 // Everything in front of the first non-scrollable from the back | 1396 // Everything in front of the first non-scrollable from the back |
1366 // should also be considered non-scrollable | 1397 // should also be considered non-scrollable |
1367 | 1398 |
1368 bool started = false; | 1399 bool started = false; |
1369 | 1400 |
1370 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1401 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1371 if ((*i)->isLayerDormant(this)) continue; | 1402 if ((*i)->isLayerDormant(this)) continue; |
1372 if (!started && (*i)->isLayerScrollable(this)) { | 1403 if (!started && (*i)->isLayerScrollable(this)) { |
1373 continue; | 1404 continue; |
1374 } | 1405 } |
1375 started = true; | 1406 started = true; |
1396 int candidate = blockSize; | 1427 int candidate = blockSize; |
1397 bool haveCandidate = false; | 1428 bool haveCandidate = false; |
1398 | 1429 |
1399 PowerOfSqrtTwoZoomConstraint defaultZoomConstraint; | 1430 PowerOfSqrtTwoZoomConstraint defaultZoomConstraint; |
1400 | 1431 |
1401 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1432 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1402 | 1433 |
1403 const ZoomConstraint *zoomConstraint = (*i)->getZoomConstraint(); | 1434 const ZoomConstraint *zoomConstraint = (*i)->getZoomConstraint(); |
1404 if (!zoomConstraint) zoomConstraint = &defaultZoomConstraint; | 1435 if (!zoomConstraint) zoomConstraint = &defaultZoomConstraint; |
1405 | 1436 |
1406 int thisBlockSize = | 1437 int thisBlockSize = |
1420 } | 1451 } |
1421 | 1452 |
1422 bool | 1453 bool |
1423 View::areLayerColoursSignificant() const | 1454 View::areLayerColoursSignificant() const |
1424 { | 1455 { |
1425 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 1456 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
1426 if ((*i)->getLayerColourSignificance() == | 1457 if ((*i)->getLayerColourSignificance() == |
1427 Layer::ColourHasMeaningfulValue) return true; | 1458 Layer::ColourHasMeaningfulValue) return true; |
1428 if ((*i)->isLayerOpaque()) break; | 1459 if ((*i)->isLayerOpaque()) break; |
1429 } | 1460 } |
1430 return false; | 1461 return false; |
1431 } | 1462 } |
1432 | 1463 |
1433 bool | 1464 bool |
1434 View::hasTopLayerTimeXAxis() const | 1465 View::hasTopLayerTimeXAxis() const |
1435 { | 1466 { |
1436 LayerList::const_iterator i = m_layers.end(); | 1467 LayerList::const_iterator i = m_layerStack.end(); |
1437 if (i == m_layers.begin()) return false; | 1468 if (i == m_layerStack.begin()) return false; |
1438 --i; | 1469 --i; |
1439 return (*i)->hasTimeXAxis(); | 1470 return (*i)->hasTimeXAxis(); |
1440 } | 1471 } |
1441 | 1472 |
1442 void | 1473 void |
1630 View::paintEvent(QPaintEvent *e) | 1661 View::paintEvent(QPaintEvent *e) |
1631 { | 1662 { |
1632 // Profiler prof("View::paintEvent", false); | 1663 // Profiler prof("View::paintEvent", false); |
1633 // cerr << "View::paintEvent: centre frame is " << m_centreFrame << endl; | 1664 // cerr << "View::paintEvent: centre frame is " << m_centreFrame << endl; |
1634 | 1665 |
1635 if (m_layers.empty()) { | 1666 if (m_layerStack.empty()) { |
1636 QFrame::paintEvent(e); | 1667 QFrame::paintEvent(e); |
1637 return; | 1668 return; |
1638 } | 1669 } |
1639 | 1670 |
1640 // ensure our constraints are met | 1671 // ensure our constraints are met |
2310 | 2341 |
2311 int origCentreFrame = m_centreFrame; | 2342 int origCentreFrame = m_centreFrame; |
2312 | 2343 |
2313 bool someLayersIncomplete = false; | 2344 bool someLayersIncomplete = false; |
2314 | 2345 |
2315 for (LayerList::iterator i = m_layers.begin(); | 2346 for (LayerList::iterator i = m_layerStack.begin(); |
2316 i != m_layers.end(); ++i) { | 2347 i != m_layerStack.end(); ++i) { |
2317 | 2348 |
2318 int c = (*i)->getCompletion(this); | 2349 int c = (*i)->getCompletion(this); |
2319 if (c < 100) { | 2350 if (c < 100) { |
2320 someLayersIncomplete = true; | 2351 someLayersIncomplete = true; |
2321 break; | 2352 break; |
2329 | 2360 |
2330 int layerCompletion = 0; | 2361 int layerCompletion = 0; |
2331 | 2362 |
2332 while (layerCompletion < 100) { | 2363 while (layerCompletion < 100) { |
2333 | 2364 |
2334 for (LayerList::iterator i = m_layers.begin(); | 2365 for (LayerList::iterator i = m_layerStack.begin(); |
2335 i != m_layers.end(); ++i) { | 2366 i != m_layerStack.end(); ++i) { |
2336 | 2367 |
2337 int c = (*i)->getCompletion(this); | 2368 int c = (*i)->getCompletion(this); |
2338 if (i == m_layers.begin() || c < layerCompletion) { | 2369 if (i == m_layerStack.begin() || c < layerCompletion) { |
2339 layerCompletion = c; | 2370 layerCompletion = c; |
2340 } | 2371 } |
2341 } | 2372 } |
2342 | 2373 |
2343 if (layerCompletion >= 100) break; | 2374 if (layerCompletion >= 100) break; |
2376 paint.drawRect(QRect(xorigin + x, 0, width(), height())); | 2407 paint.drawRect(QRect(xorigin + x, 0, width(), height())); |
2377 | 2408 |
2378 paint.setPen(getForeground()); | 2409 paint.setPen(getForeground()); |
2379 paint.setBrush(Qt::NoBrush); | 2410 paint.setBrush(Qt::NoBrush); |
2380 | 2411 |
2381 for (LayerList::iterator i = m_layers.begin(); | 2412 for (LayerList::iterator i = m_layerStack.begin(); |
2382 i != m_layers.end(); ++i) { | 2413 i != m_layerStack.end(); ++i) { |
2383 if(!((*i)->isLayerDormant(this))){ | 2414 if(!((*i)->isLayerDormant(this))){ |
2384 | 2415 |
2385 paint.setRenderHint(QPainter::Antialiasing, false); | 2416 paint.setRenderHint(QPainter::Antialiasing, false); |
2386 | 2417 |
2387 paint.save(); | 2418 paint.save(); |
2472 m_followPlay == PlaybackScrollPageWithCentre ? "page" : | 2503 m_followPlay == PlaybackScrollPageWithCentre ? "page" : |
2473 m_followPlay == PlaybackScrollPage ? "daw" : | 2504 m_followPlay == PlaybackScrollPage ? "daw" : |
2474 "ignore") | 2505 "ignore") |
2475 .arg(extraAttributes); | 2506 .arg(extraAttributes); |
2476 | 2507 |
2477 for (int i = 0; i < (int)m_layers.size(); ++i) { | 2508 for (int i = 0; i < (int)m_fixedOrderLayers.size(); ++i) { |
2478 bool visible = !m_layers[i]->isLayerDormant(this); | 2509 bool visible = !m_fixedOrderLayers[i]->isLayerDormant(this); |
2479 m_layers[i]->toBriefXml(stream, indent + " ", | 2510 m_fixedOrderLayers[i]->toBriefXml(stream, indent + " ", |
2480 QString("visible=\"%1\"") | 2511 QString("visible=\"%1\"") |
2481 .arg(visible ? "true" : "false")); | 2512 .arg(visible ? "true" : "false")); |
2482 } | 2513 } |
2483 | 2514 |
2484 stream << indent + "</view>\n"; | 2515 stream << indent + "</view>\n"; |
2485 } | 2516 } |
2486 | 2517 |