comparison view/Pane.cpp @ 842:8432d2551fb2 tonioni

Update subrepos and merge from default branch
author Chris Cannam
date Tue, 02 Sep 2014 16:23:48 +0100
parents d843e6275d0f
children c17719e488c9
comparison
equal deleted inserted replaced
826:43256b925e15 842:8432d2551fb2
200 int current = 0; 200 int current = 0;
201 int level = 1; 201 int level = 1;
202 202
203 //!!! pull out into function (presumably in View) 203 //!!! pull out into function (presumably in View)
204 bool haveConstraint = false; 204 bool haveConstraint = false;
205 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); 205 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end();
206 ++i) { 206 ++i) {
207 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { 207 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) {
208 haveConstraint = true; 208 haveConstraint = true;
209 break; 209 break;
210 } 210 }
345 345
346 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) { 346 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) {
347 return false; 347 return false;
348 } 348 }
349 349
350 if (layer == getSelectedLayer() && 350 if (layer == getInteractionLayer() &&
351 !shouldIlluminateLocalSelection(discard, b0, b1)) { 351 !shouldIlluminateLocalSelection(discard, b0, b1)) {
352 352
353 pos = m_identifyPoint; 353 pos = m_identifyPoint;
354 return m_identifyFeatures; 354 return m_identifyFeatures;
355 } 355 }
370 370
371 Selection s(getSelectionAt(m_identifyPoint.x(), 371 Selection s(getSelectionAt(m_identifyPoint.x(),
372 closeToLeft, closeToRight)); 372 closeToLeft, closeToRight));
373 373
374 if (!s.isEmpty()) { 374 if (!s.isEmpty()) {
375 if (getSelectedLayer() && getSelectedLayer()->isLayerEditable()) { 375 if (getInteractionLayer() && getInteractionLayer()->isLayerEditable()) {
376 376
377 pos = m_identifyPoint; 377 pos = m_identifyPoint;
378 return true; 378 return true;
379 } 379 }
380 } 380 }
424 if (m_manager && 424 if (m_manager &&
425 // !m_manager->isPlaying() && 425 // !m_manager->isPlaying() &&
426 m_mouseInWidget && 426 m_mouseInWidget &&
427 toolMode == ViewManager::MeasureMode) { 427 toolMode == ViewManager::MeasureMode) {
428 428
429 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 429 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) {
430 --vi; 430 --vi;
431 431
432 std::vector<QRect> crosshairExtents; 432 std::vector<QRect> crosshairExtents;
433 433
434 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, 434 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint,
445 bool haveSomeTimeXAxis = false; 445 bool haveSomeTimeXAxis = false;
446 446
447 const Model *waveformModel = 0; // just for reporting purposes 447 const Model *waveformModel = 0; // just for reporting purposes
448 const Model *workModel = 0; 448 const Model *workModel = 0;
449 449
450 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 450 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) {
451 --vi; 451 --vi;
452 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) { 452 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) {
453 haveSomeTimeXAxis = true; 453 haveSomeTimeXAxis = true;
454 } 454 }
455 if (dynamic_cast<WaveformLayer *>(*vi)) { 455 if (dynamic_cast<WaveformLayer *>(*vi)) {
584 584
585 if (!hasDisplayExtents) { 585 if (!hasDisplayExtents) {
586 586
587 if (!hasValueExtents) { 587 if (!hasValueExtents) {
588 588
589 for (LayerList::iterator vi = m_layers.end(); 589 for (LayerList::iterator vi = m_layerStack.end();
590 vi != m_layers.begin(); ) { 590 vi != m_layerStack.begin(); ) {
591 591
592 --vi; 592 --vi;
593 593
594 if ((*vi) == topLayer) continue; 594 if ((*vi) == topLayer) continue;
595 595
604 } 604 }
605 } else if (unit != "") { // && hasValueExtents && !hasDisplayExtents 605 } else if (unit != "") { // && hasValueExtents && !hasDisplayExtents
606 606
607 QString requireUnit = unit; 607 QString requireUnit = unit;
608 608
609 for (LayerList::iterator vi = m_layers.end(); 609 for (LayerList::iterator vi = m_layerStack.end();
610 vi != m_layers.begin(); ) { 610 vi != m_layerStack.begin(); ) {
611 611
612 --vi; 612 --vi;
613 613
614 if ((*vi) == topLayer) continue; 614 if ((*vi) == topLayer) continue;
615 615
736 736
737 paint.setPen(QColor(50, 50, 50)); 737 paint.setPen(QColor(50, 50, 50));
738 738
739 int y = height() - fontHeight + fontAscent - 6; 739 int y = height() - fontHeight + fontAscent - 6;
740 740
741 LayerList::iterator vi = m_layers.end(); 741 LayerList::iterator vi = m_layerStack.end();
742 742
743 if (vi != m_layers.begin()) { 743 if (vi != m_layerStack.begin()) {
744 744
745 switch ((*--vi)->getPreferredFrameCountPosition()) { 745 switch ((*--vi)->getPreferredFrameCountPosition()) {
746 746
747 case Layer::PositionTop: 747 case Layer::PositionTop:
748 y = fontAscent + 6; 748 y = fontAscent + 6;
914 int lly = height() - 6; 914 int lly = height() - 6;
915 if (m_manager->getZoomWheelsEnabled()) { 915 if (m_manager->getZoomWheelsEnabled()) {
916 lly -= 20; 916 lly -= 20;
917 } 917 }
918 918
919 if (r.y() + r.height() < lly - int(m_layers.size()) * fontHeight) { 919 if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) {
920 return; 920 return;
921 } 921 }
922 922
923 QStringList texts; 923 QStringList texts;
924 std::vector<QPixmap> pixmaps; 924 std::vector<QPixmap> pixmaps;
925 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { 925 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) {
926 texts.push_back((*i)->getLayerPresentationName()); 926 texts.push_back((*i)->getLayerPresentationName());
927 // cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " 927 // cerr << "Pane " << this << ": Layer presentation name for " << *i << ": "
928 // << texts[texts.size()-1] << endl; 928 // << texts[texts.size()-1] << endl;
929 pixmaps.push_back((*i)->getLayerPresentationPixmap 929 pixmaps.push_back((*i)->getLayerPresentationPixmap
930 (QSize(fontAscent, fontAscent))); 930 (QSize(fontAscent, fontAscent)));
1091 return false; 1091 return false;
1092 } 1092 }
1093 1093
1094 if (m_scaleWidth > 0) { 1094 if (m_scaleWidth > 0) {
1095 1095
1096 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 1096 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) {
1097 --vi; 1097 --vi;
1098 1098
1099 paint.save(); 1099 paint.save();
1100 1100
1101 paint.setPen(getForeground()); 1101 paint.setPen(getForeground());
1125 height(), QImage::Format_RGB32); 1125 height(), QImage::Format_RGB32);
1126 1126
1127 int formerScaleWidth = m_scaleWidth; 1127 int formerScaleWidth = m_scaleWidth;
1128 1128
1129 if (m_manager && m_manager->shouldShowVerticalScale()) { 1129 if (m_manager && m_manager->shouldShowVerticalScale()) {
1130 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 1130 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) {
1131 --vi; 1131 --vi;
1132 QPainter paint(image); 1132 QPainter paint(image);
1133 m_scaleWidth = (*vi)->getVerticalScaleWidth 1133 m_scaleWidth = (*vi)->getVerticalScaleWidth
1134 (this, m_manager->shouldShowVerticalColourScale(), paint); 1134 (this, m_manager->shouldShowVerticalColourScale(), paint);
1135 break; 1135 break;
1162 QImage *image = new QImage(100, 100, QImage::Format_RGB32); 1162 QImage *image = new QImage(100, 100, QImage::Format_RGB32);
1163 QPainter paint(image); 1163 QPainter paint(image);
1164 1164
1165 int sw = 0; 1165 int sw = 0;
1166 if (m_manager && m_manager->shouldShowVerticalScale()) { 1166 if (m_manager && m_manager->shouldShowVerticalScale()) {
1167 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 1167 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) {
1168 --vi; 1168 --vi;
1169 sw = (*vi)->getVerticalScaleWidth 1169 sw = (*vi)->getVerticalScaleWidth
1170 (this, m_manager->shouldShowVerticalColourScale(), paint); 1170 (this, m_manager->shouldShowVerticalColourScale(), paint);
1171 break; 1171 break;
1172 } 1172 }
1275 } 1275 }
1276 1276
1277 Layer * 1277 Layer *
1278 Pane::getTopFlexiNoteLayer() 1278 Pane::getTopFlexiNoteLayer()
1279 { 1279 {
1280 for (int i = int(m_layers.size()) - 1; i >= 0; --i) { 1280 for (int i = int(m_layerStack.size()) - 1; i >= 0; --i) {
1281 if (LayerFactory::getInstance()->getLayerType(m_layers[i]) == 1281 if (LayerFactory::getInstance()->getLayerType(m_layerStack[i]) ==
1282 LayerFactory::FlexiNotes) { 1282 LayerFactory::FlexiNotes) {
1283 return m_layers[i]; 1283 return m_layerStack[i];
1284 } 1284 }
1285 } 1285 }
1286 return 0; 1286 return 0;
1287 } 1287 }
1288 1288
1331 float vmin, vmax, dmin, dmax; 1331 float vmin, vmax, dmin, dmax;
1332 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { 1332 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) {
1333 m_dragStartMinValue = dmin; 1333 m_dragStartMinValue = dmin;
1334 } 1334 }
1335 1335
1336 // Schedule a play-head move to the mouse frame location. This 1336 if (m_followPlay == PlaybackScrollPage) {
1337 // will happen only if nothing else of interest happens 1337 // Schedule a play-head move to the mouse frame
1338 // (double-click, drag) before the timeout. 1338 // location. This will happen only if nothing else of
1339 schedulePlaybackFrameMove(getFrameForX(e->x())); 1339 // interest happens (double-click, drag) before the
1340 // timeout.
1341 schedulePlaybackFrameMove(getFrameForX(e->x()));
1342 }
1340 1343
1341 } else if (mode == ViewManager::SelectMode) { 1344 } else if (mode == ViewManager::SelectMode) {
1342 1345
1343 if (!hasTopLayerTimeXAxis()) return; 1346 if (!hasTopLayerTimeXAxis()) return;
1344 1347
1362 1365
1363 int mouseFrame = getFrameForX(e->x()); 1366 int mouseFrame = getFrameForX(e->x());
1364 int resolution = 1; 1367 int resolution = 1;
1365 int snapFrame = mouseFrame; 1368 int snapFrame = mouseFrame;
1366 1369
1367 Layer *layer = getSelectedLayer(); 1370 Layer *layer = getInteractionLayer();
1368 if (layer && !m_shiftPressed) { 1371 if (layer && !m_shiftPressed) {
1369 layer->snapToFeatureFrame(this, snapFrame, 1372 layer->snapToFeatureFrame(this, snapFrame,
1370 resolution, Layer::SnapLeft); 1373 resolution, Layer::SnapLeft);
1371 } 1374 }
1372 1375
1379 !m_ctrlPressed); 1382 !m_ctrlPressed);
1380 } 1383 }
1381 1384
1382 m_resizing = false; 1385 m_resizing = false;
1383 1386
1384 // Schedule a play-head move to the mouse frame 1387 if (m_followPlay == PlaybackScrollPage) {
1385 // location. This will happen only if nothing else of 1388 // Schedule a play-head move to the mouse frame
1386 // interest happens (double-click, drag) before the 1389 // location. This will happen only if nothing else of
1387 // timeout. 1390 // interest happens (double-click, drag) before the
1388 schedulePlaybackFrameMove(mouseFrame); 1391 // timeout.
1392 schedulePlaybackFrameMove(mouseFrame);
1393 }
1389 } 1394 }
1390 1395
1391 update(); 1396 update();
1392 1397
1393 } else if (mode == ViewManager::DrawMode) { 1398 } else if (mode == ViewManager::DrawMode) {
1394 1399
1395 Layer *layer = getSelectedLayer(); 1400 Layer *layer = getInteractionLayer();
1396 if (layer && layer->isLayerEditable()) { 1401 if (layer && layer->isLayerEditable()) {
1397 layer->drawStart(this, e); 1402 layer->drawStart(this, e);
1398 } 1403 }
1399 1404
1400 } else if (mode == ViewManager::EraseMode) { 1405 } else if (mode == ViewManager::EraseMode) {
1401 1406
1402 Layer *layer = getSelectedLayer(); 1407 Layer *layer = getInteractionLayer();
1403 if (layer && layer->isLayerEditable()) { 1408 if (layer && layer->isLayerEditable()) {
1404 layer->eraseStart(this, e); 1409 layer->eraseStart(this, e);
1405 } 1410 }
1406 1411
1407 // GF: handle mouse press for NoteEditMode 1412 // GF: handle mouse press for NoteEditMode
1515 1520
1516 update(); 1521 update();
1517 1522
1518 } else if (mode == ViewManager::DrawMode) { 1523 } else if (mode == ViewManager::DrawMode) {
1519 1524
1520 Layer *layer = getSelectedLayer(); 1525 Layer *layer = getInteractionLayer();
1521 if (layer && layer->isLayerEditable()) { 1526 if (layer && layer->isLayerEditable()) {
1522 layer->drawEnd(this, e); 1527 layer->drawEnd(this, e);
1523 update(); 1528 update();
1524 } 1529 }
1525 1530
1526 } else if (mode == ViewManager::EraseMode) { 1531 } else if (mode == ViewManager::EraseMode) {
1527 1532
1528 Layer *layer = getSelectedLayer(); 1533 Layer *layer = getInteractionLayer();
1529 if (layer && layer->isLayerEditable()) { 1534 if (layer && layer->isLayerEditable()) {
1530 layer->eraseEnd(this, e); 1535 layer->eraseEnd(this, e);
1531 update(); 1536 update();
1532 } 1537 }
1533 1538
1550 1555
1551 } else if (mode == ViewManager::EditMode) { 1556 } else if (mode == ViewManager::EditMode) {
1552 1557
1553 if (m_editing) { 1558 if (m_editing) {
1554 if (!editSelectionEnd(e)) { 1559 if (!editSelectionEnd(e)) {
1555 Layer *layer = getSelectedLayer(); 1560 Layer *layer = getInteractionLayer();
1556 if (layer && layer->isLayerEditable()) { 1561 if (layer && layer->isLayerEditable()) {
1557 layer->editEnd(this, e); 1562 layer->editEnd(this, e);
1558 update(); 1563 update();
1559 } 1564 }
1560 } 1565 }
1631 1636
1632 if (!m_manager->isPlaying()) { 1637 if (!m_manager->isPlaying()) {
1633 1638
1634 bool updating = false; 1639 bool updating = false;
1635 1640
1636 if (getSelectedLayer() && 1641 if (getInteractionLayer() &&
1637 m_manager->shouldIlluminateLocalFeatures()) { 1642 m_manager->shouldIlluminateLocalFeatures()) {
1638 1643
1639 bool previouslyIdentifying = m_identifyFeatures; 1644 bool previouslyIdentifying = m_identifyFeatures;
1640 m_identifyFeatures = true; 1645 m_identifyFeatures = true;
1641 1646
1678 1683
1679 dragExtendSelection(e); 1684 dragExtendSelection(e);
1680 1685
1681 } else if (mode == ViewManager::DrawMode) { 1686 } else if (mode == ViewManager::DrawMode) {
1682 1687
1683 Layer *layer = getSelectedLayer(); 1688 Layer *layer = getInteractionLayer();
1684 if (layer && layer->isLayerEditable()) { 1689 if (layer && layer->isLayerEditable()) {
1685 layer->drawDrag(this, e); 1690 layer->drawDrag(this, e);
1686 } 1691 }
1687 1692
1688 } else if (mode == ViewManager::EraseMode) { 1693 } else if (mode == ViewManager::EraseMode) {
1689 1694
1690 Layer *layer = getSelectedLayer(); 1695 Layer *layer = getInteractionLayer();
1691 if (layer && layer->isLayerEditable()) { 1696 if (layer && layer->isLayerEditable()) {
1692 layer->eraseDrag(this, e); 1697 layer->eraseDrag(this, e);
1693 } 1698 }
1694 1699
1695 // GF: handling NoteEditMode dragging and boundary actions for mouseMoveEvent 1700 // GF: handling NoteEditMode dragging and boundary actions for mouseMoveEvent
1735 1740
1736 } else { 1741 } else {
1737 1742
1738 if (!editSelectionDrag(e)) { 1743 if (!editSelectionDrag(e)) {
1739 1744
1740 Layer *layer = getSelectedLayer(); 1745 Layer *layer = getInteractionLayer();
1741 1746
1742 if (layer && layer->isLayerEditable()) { 1747 if (layer && layer->isLayerEditable()) {
1743 1748
1744 int x = e->x(); 1749 int x = e->x();
1745 int y = e->y(); 1750 int y = e->y();
1790 Qt::NoButton, 1795 Qt::NoButton,
1791 e->buttons(), 1796 e->buttons(),
1792 e->modifiers()); 1797 e->modifiers());
1793 1798
1794 if (!editSelectionStart(&clickEvent)) { 1799 if (!editSelectionStart(&clickEvent)) {
1795 Layer *layer = getSelectedLayer(); 1800 Layer *layer = getInteractionLayer();
1796 if (layer && layer->isLayerEditable()) { 1801 if (layer && layer->isLayerEditable()) {
1797 layer->editStart(this, &clickEvent); 1802 layer->editStart(this, &clickEvent);
1798 } 1803 }
1799 } 1804 }
1800 } 1805 }
1801 1806
1802 } else { 1807 } else {
1803 1808
1804 if (!editSelectionDrag(e)) { 1809 if (!editSelectionDrag(e)) {
1805 1810
1806 Layer *layer = getSelectedLayer(); 1811 Layer *layer = getInteractionLayer();
1807 1812
1808 if (layer && layer->isLayerEditable()) { 1813 if (layer && layer->isLayerEditable()) {
1809 1814
1810 int x = e->x(); 1815 int x = e->x();
1811 int y = e->y(); 1816 int y = e->y();
1873 1878
1874 QString unit; 1879 QString unit;
1875 float min, max; 1880 float min, max;
1876 bool log; 1881 bool log;
1877 Layer *layer = 0; 1882 Layer *layer = 0;
1878 for (LayerList::const_iterator i = m_layers.begin(); 1883 for (LayerList::const_iterator i = m_layerStack.begin();
1879 i != m_layers.end(); ++i) { 1884 i != m_layerStack.end(); ++i) {
1880 if ((*i)->getValueExtents(min, max, log, unit) && 1885 if ((*i)->getValueExtents(min, max, log, unit) &&
1881 (*i)->getDisplayExtents(min, max)) { 1886 (*i)->getDisplayExtents(min, max)) {
1882 layer = *i; 1887 layer = *i;
1883 break; 1888 break;
1884 } 1889 }
2072 int mouseFrame = getFrameForX(e->x()); 2077 int mouseFrame = getFrameForX(e->x());
2073 int resolution = 1; 2078 int resolution = 1;
2074 int snapFrameLeft = mouseFrame; 2079 int snapFrameLeft = mouseFrame;
2075 int snapFrameRight = mouseFrame; 2080 int snapFrameRight = mouseFrame;
2076 2081
2077 Layer *layer = getSelectedLayer(); 2082 Layer *layer = getInteractionLayer();
2078 if (layer && !m_shiftPressed) { 2083 if (layer && !m_shiftPressed) {
2079 layer->snapToFeatureFrame(this, snapFrameLeft, 2084 layer->snapToFeatureFrame(this, snapFrameLeft,
2080 resolution, Layer::SnapLeft); 2085 resolution, Layer::SnapLeft);
2081 layer->snapToFeatureFrame(this, snapFrameRight, 2086 layer->snapToFeatureFrame(this, snapFrameRight,
2082 resolution, Layer::SnapRight); 2087 resolution, Layer::SnapRight);
2174 } 2179 }
2175 2180
2176 if (mode == ViewManager::NavigateMode || 2181 if (mode == ViewManager::NavigateMode ||
2177 mode == ViewManager::EditMode) { 2182 mode == ViewManager::EditMode) {
2178 2183
2179 Layer *layer = getSelectedLayer(); 2184 Layer *layer = getInteractionLayer();
2180 if (layer && layer->isLayerEditable()) { 2185 if (layer && layer->isLayerEditable()) {
2181 if (layer->editOpen(this, e)) relocate = false; 2186 if (layer->editOpen(this, e)) relocate = false;
2182 } 2187 }
2183 2188
2184 } else if (mode == ViewManager::MeasureMode) { 2189 } else if (mode == ViewManager::MeasureMode) {
2204 } 2209 }
2205 } 2210 }
2206 2211
2207 if (mode == ViewManager::NoteEditMode) { 2212 if (mode == ViewManager::NoteEditMode) {
2208 std::cerr << "double click in note edit mode" << std::endl; 2213 std::cerr << "double click in note edit mode" << std::endl;
2209 Layer *layer = getSelectedLayer(); 2214 Layer *layer = getInteractionLayer();
2210 if (layer && layer->isLayerEditable()) { 2215 if (layer && layer->isLayerEditable()) {
2211 layer->addNote(this, e); 2216 layer->addNote(this, e);
2212 } 2217 }
2213 } 2218 }
2214 2219
2386 int level = 1; 2391 int level = 1;
2387 2392
2388 2393
2389 //!!! pull out into function (presumably in View) 2394 //!!! pull out into function (presumably in View)
2390 bool haveConstraint = false; 2395 bool haveConstraint = false;
2391 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); 2396 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end();
2392 ++i) { 2397 ++i) {
2393 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { 2398 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) {
2394 haveConstraint = true; 2399 haveConstraint = true;
2395 break; 2400 break;
2396 } 2401 }
2576 Pane::editSelectionEnd(QMouseEvent *) 2581 Pane::editSelectionEnd(QMouseEvent *)
2577 { 2582 {
2578 if (m_editingSelection.isEmpty()) return false; 2583 if (m_editingSelection.isEmpty()) return false;
2579 2584
2580 int offset = m_mousePos.x() - m_clickPos.x(); 2585 int offset = m_mousePos.x() - m_clickPos.x();
2581 Layer *layer = getSelectedLayer(); 2586 Layer *layer = getInteractionLayer();
2582 2587
2583 if (offset == 0 || !layer) { 2588 if (offset == 0 || !layer) {
2584 m_editingSelection = Selection(); 2589 m_editingSelection = Selection();
2585 return true; 2590 return true;
2586 } 2591 }
2758 2763
2759 ViewManager::ToolMode mode = ViewManager::NavigateMode; 2764 ViewManager::ToolMode mode = ViewManager::NavigateMode;
2760 if (m_manager) mode = m_manager->getToolModeFor(this); 2765 if (m_manager) mode = m_manager->getToolModeFor(this);
2761 2766
2762 bool editable = false; 2767 bool editable = false;
2763 Layer *layer = getSelectedLayer(); 2768 Layer *layer = getInteractionLayer();
2764 if (layer && layer->isLayerEditable()) { 2769 if (layer && layer->isLayerEditable()) {
2765 editable = true; 2770 editable = true;
2766 } 2771 }
2767 2772
2768 if (mode == ViewManager::NavigateMode) { 2773 if (mode == ViewManager::NavigateMode) {