|
From: Tapio V. <aa...@us...> - 2011-02-24 20:57:26
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 22:56:15 2011 +0200
Fixed note moving producing incorrect pitch into undo op.
---
notegraphwidget.cc | 11 +++++------
notelabelmanager.cc | 6 ++----
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index c9619b2..bde5149 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -415,15 +415,14 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
if (selectedNote()) {
int movecount = 0;
for (int i = 0; i < m_selectedNotes.size(); ++i) {
- NoteLabel *n = m_selectedNotes[i];
- n->startResizing(0);
- n->startDragging(QPoint());
+ NoteLabel *nl = m_selectedNotes[i];
+ nl->startResizing(0);
+ nl->startDragging(QPoint());
+ const Note& n = nl->note();
if (m_actionHappened) {
// Operation for undo stack & saving
Operation op("MOVE");
- op << getNoteLabelId(n)
- << px2s(n->x()) << px2s(n->x() + n->width())
- << int(round(px2n(n->y() + m_noteHalfHeight)));
+ op << getNoteLabelId(nl) << n.begin << n.end << n.note;
doOperation(op, Operation::NO_EXEC);
++movecount;
}
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 8562c49..7bc695c 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -240,11 +240,9 @@ void NoteLabelManager::move(NoteLabel *note, int value)
int i = 0; // We need this after the loop
for (; i < m_selectedNotes.size(); ++i) {
- NoteLabel *n = m_selectedNotes[i];
+ const Note &n = m_selectedNotes[i]->note();
Operation op("MOVE");
- op << getNoteLabelId(n)
- << px2s(n->x()) << px2s(n->x() + n->width())
- << int(round(px2n(n->y() + m_noteHalfHeight))) + value;
+ op << getNoteLabelId(m_selectedNotes[i]) << n.begin << n.end << n.note + value;
doOperation(op, Operation::NO_UPDATE);
}
|