Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 1422:6f51297a0250
Keep the point being edited highlighted while the edit dialog is open
author | Chris Cannam |
---|---|
date | Tue, 05 Mar 2019 10:02:48 +0000 |
parents | c8a6fd3f9dff |
children | 62e908518c71 |
comparison
equal
deleted
inserted
replaced
1421:70e93f996da6 | 1422:6f51297a0250 |
---|---|
55 m_dragStartX(0), | 55 m_dragStartX(0), |
56 m_dragStartY(0), | 56 m_dragStartY(0), |
57 m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), | 57 m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), |
58 m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), | 58 m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), |
59 m_editingCommand(nullptr), | 59 m_editingCommand(nullptr), |
60 m_editIsOpen(false), | |
60 m_verticalScale(AutoAlignScale), | 61 m_verticalScale(AutoAlignScale), |
61 m_scaleMinimum(0), | 62 m_scaleMinimum(0), |
62 m_scaleMaximum(0) | 63 m_scaleMaximum(0) |
63 { | 64 { |
64 SVDEBUG << "constructed NoteLayer" << endl; | 65 SVDEBUG << "constructed NoteLayer" << endl; |
775 bool shouldIlluminate = false; | 776 bool shouldIlluminate = false; |
776 | 777 |
777 if (v->shouldIlluminateLocalFeatures(this, localPos)) { | 778 if (v->shouldIlluminateLocalFeatures(this, localPos)) { |
778 shouldIlluminate = getPointToDrag(v, localPos.x(), localPos.y(), | 779 shouldIlluminate = getPointToDrag(v, localPos.x(), localPos.y(), |
779 illuminatePoint); | 780 illuminatePoint); |
781 } else if (m_editIsOpen) { | |
782 shouldIlluminate = true; | |
783 illuminatePoint = m_editingPoint; | |
780 } | 784 } |
781 | 785 |
782 paint.save(); | 786 paint.save(); |
783 paint.setRenderHint(QPainter::Antialiasing, false); | 787 paint.setRenderHint(QPainter::Antialiasing, false); |
784 | 788 |
1090 dialog->setFrameTime(note.frame); | 1094 dialog->setFrameTime(note.frame); |
1091 dialog->setValue(note.value); | 1095 dialog->setValue(note.value); |
1092 dialog->setFrameDuration(note.duration); | 1096 dialog->setFrameDuration(note.duration); |
1093 dialog->setText(note.label); | 1097 dialog->setText(note.label); |
1094 | 1098 |
1099 m_editingPoint = note; | |
1100 m_editIsOpen = true; | |
1101 | |
1095 if (dialog->exec() == QDialog::Accepted) { | 1102 if (dialog->exec() == QDialog::Accepted) { |
1096 | 1103 |
1097 NoteModel::Point newNote = note; | 1104 NoteModel::Point newNote = note; |
1098 newNote.frame = dialog->getFrameTime(); | 1105 newNote.frame = dialog->getFrameTime(); |
1099 newNote.value = dialog->getValue(); | 1106 newNote.value = dialog->getValue(); |
1105 command->deletePoint(note); | 1112 command->deletePoint(note); |
1106 command->addPoint(newNote); | 1113 command->addPoint(newNote); |
1107 finish(command); | 1114 finish(command); |
1108 } | 1115 } |
1109 | 1116 |
1117 m_editingPoint = 0; | |
1118 m_editIsOpen = false; | |
1119 | |
1110 delete dialog; | 1120 delete dialog; |
1111 return true; | 1121 return true; |
1112 } | 1122 } |
1113 | 1123 |
1114 void | 1124 void |