comparison layer/FlexiNoteLayer.cpp @ 918:4fe7a09be0fe osx-retina

Many fixes for the previous stuff
author Chris Cannam
date Tue, 17 Mar 2015 16:56:03 +0000
parents 94e4952a6774
children bb80983c9e61
comparison
equal deleted inserted replaced
917:77a1d42353ce 918:4fe7a09be0fe
1339 { 1339 {
1340 // Better than we used to do, but still not very satisfactory 1340 // Better than we used to do, but still not very satisfactory
1341 1341
1342 cerr << "FlexiNoteLayer::getAssociatedPitchModel()" << endl; 1342 cerr << "FlexiNoteLayer::getAssociatedPitchModel()" << endl;
1343 1343
1344 for (int i = 0; i < v->getLayerCount(); ++i) { 1344 for (int i = 0; i < v->getView()->getLayerCount(); ++i) {
1345 Layer *layer = v->getLayer(i); 1345 Layer *layer = v->getView()->getLayer(i);
1346 if (layer && 1346 if (layer &&
1347 layer->getLayerPresentationName() != "candidate") { 1347 layer->getLayerPresentationName() != "candidate") {
1348 cerr << "FlexiNoteLayer::getAssociatedPitchModel: looks like our layer is " << layer << endl; 1348 cerr << "FlexiNoteLayer::getAssociatedPitchModel: looks like our layer is " << layer << endl;
1349 SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *> 1349 SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *>
1350 (layer->getModel()); 1350 (layer->getModel());
1483 1483
1484 void 1484 void
1485 FlexiNoteLayer::mouseMoveEvent(LayerGeometryProvider *v, QMouseEvent *e) 1485 FlexiNoteLayer::mouseMoveEvent(LayerGeometryProvider *v, QMouseEvent *e)
1486 { 1486 {
1487 // GF: context sensitive cursors 1487 // GF: context sensitive cursors
1488 // v->setCursor(Qt::ArrowCursor); 1488 // v->getView()->setCursor(Qt::ArrowCursor);
1489 FlexiNoteModel::Point note(0); 1489 FlexiNoteModel::Point note(0);
1490 if (!getNoteToEdit(v, e->x(), e->y(), note)) { 1490 if (!getNoteToEdit(v, e->x(), e->y(), note)) {
1491 // v->setCursor(Qt::UpArrowCursor); 1491 // v->getView()->setCursor(Qt::UpArrowCursor);
1492 return; 1492 return;
1493 } 1493 }
1494 1494
1495 bool closeToLeft = false, closeToRight = false, closeToTop = false, closeToBottom = false; 1495 bool closeToLeft = false, closeToRight = false, closeToTop = false, closeToBottom = false;
1496 getRelativeMousePosition(v, note, e->x(), e->y(), closeToLeft, closeToRight, closeToTop, closeToBottom); 1496 getRelativeMousePosition(v, note, e->x(), e->y(), closeToLeft, closeToRight, closeToTop, closeToBottom);
1497 // if (!closeToLeft) return; 1497 // if (!closeToLeft) return;
1498 // if (closeToTop) v->setCursor(Qt::SizeVerCursor); 1498 // if (closeToTop) v->getView()->setCursor(Qt::SizeVerCursor);
1499 1499
1500 if (closeToLeft) { v->setCursor(Qt::SizeHorCursor); m_editMode = LeftBoundary; return; } 1500 if (closeToLeft) { v->getView()->setCursor(Qt::SizeHorCursor); m_editMode = LeftBoundary; return; }
1501 if (closeToRight) { v->setCursor(Qt::SizeHorCursor); m_editMode = RightBoundary; return; } 1501 if (closeToRight) { v->getView()->setCursor(Qt::SizeHorCursor); m_editMode = RightBoundary; return; }
1502 if (closeToTop) { v->setCursor(Qt::CrossCursor); m_editMode = DragNote; return; } 1502 if (closeToTop) { v->getView()->setCursor(Qt::CrossCursor); m_editMode = DragNote; return; }
1503 if (closeToBottom) { v->setCursor(Qt::UpArrowCursor); m_editMode = SplitNote; return; } 1503 if (closeToBottom) { v->getView()->setCursor(Qt::UpArrowCursor); m_editMode = SplitNote; return; }
1504 1504
1505 v->setCursor(Qt::ArrowCursor); 1505 v->getView()->setCursor(Qt::ArrowCursor);
1506 1506
1507 std::cerr << "Mouse moved in edit mode over FlexiNoteLayer" << std::endl; 1507 std::cerr << "Mouse moved in edit mode over FlexiNoteLayer" << std::endl;
1508 // v->setCursor(Qt::SizeHorCursor); 1508 // v->getView()->setCursor(Qt::SizeHorCursor);
1509 1509
1510 } 1510 }
1511 1511
1512 void 1512 void
1513 FlexiNoteLayer::getRelativeMousePosition(LayerGeometryProvider *v, FlexiNoteModel::Point &note, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const 1513 FlexiNoteLayer::getRelativeMousePosition(LayerGeometryProvider *v, FlexiNoteModel::Point &note, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const
1720 bool realign = false; 1720 bool realign = false;
1721 1721
1722 if (clipboardHasDifferentAlignment(v, from)) { 1722 if (clipboardHasDifferentAlignment(v, from)) {
1723 1723
1724 QMessageBox::StandardButton button = 1724 QMessageBox::StandardButton button =
1725 QMessageBox::question(v->getWidget(), tr("Re-align pasted items?"), 1725 QMessageBox::question(v->getView(), tr("Re-align pasted items?"),
1726 tr("The items you are pasting came from a layer with different source material from this one. Do you want to re-align them in time, to match the source material for this layer?"), 1726 tr("The items you are pasting came from a layer with different source material from this one. Do you want to re-align them in time, to match the source material for this layer?"),
1727 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, 1727 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
1728 QMessageBox::Yes); 1728 QMessageBox::Yes);
1729 1729
1730 if (button == QMessageBox::Cancel) { 1730 if (button == QMessageBox::Cancel) {
1873 } 1873 }
1874 1874
1875 std::cerr << "min frequency:" << minf << ", max frequency: " << maxf << std::endl; 1875 std::cerr << "min frequency:" << minf << ", max frequency: " << maxf << std::endl;
1876 1876
1877 if (hasNotes) { 1877 if (hasNotes) {
1878 v->getLayer(1)->setDisplayExtents(minf*0.66,maxf*1.5); 1878 v->getView()->getLayer(1)->setDisplayExtents(minf*0.66,maxf*1.5);
1879 // MM: this is a hack because we rely on 1879 // MM: this is a hack because we rely on
1880 // * this layer being automatically aligned to layer 1 1880 // * this layer being automatically aligned to layer 1
1881 // * layer one is a log frequency layer. 1881 // * layer one is a log frequency layer.
1882 } 1882 }
1883 } 1883 }