|
From: Tapio V. <aa...@us...> - 2011-02-04 09:09:04
|
Module: editor
Branch: master
Commit: 3f068492f313a4bf9eb3902ccedb5598813c504b
Author: Tapio Vierros <tap...@gm...>
Date: Fri Feb 4 11:08:25 2011 +0200
Line break handling in the new style "NEW" Operation.
---
notegraphwidget.cc | 4 ++--
notelabelmanager.cc | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 08d6242..ee87d7a 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -15,7 +15,7 @@
namespace {
static Operation opFromNote(const Note& note, int id, bool floating) {
Operation op("NEW");
- op << id << note.syllable << note.begin << note.end << note.note << floating;
+ op << id << note.syllable << note.begin << note.end << note.note << floating << note.lineBreak;
return op;
}
}
@@ -66,8 +66,8 @@ void NoteGraphWidget::setLyrics(QString lyrics)
ts2 >> word;
if (!word.isEmpty()) {
Note note(word); note.note = 24;
+ if (sentenceStart) note.lineBreak = true;
doOperation(opFromNote(note, m_notes.size(), !firstNote));
- if (sentenceStart) setLineBreak(m_notes.back(), true);
firstNote = false;
sentenceStart = false;
}
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 98514b4..aa67cf7 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -81,8 +81,8 @@ void NoteLabelManager::split(NoteLabel *note, float ratio)
// Create operations for adding the new labels and deleting the old one
int id = getNoteLabelId(note);
Operation new1("NEW"), new2("NEW");
- new1 << id << firstst << n.begin << n.begin + n.length() * ratio << n.note << note->isFloating();
- new2 << id+1 << secondst << n.begin + n.length() * ratio << n.end << n.note << note->isFloating();
+ new1 << id << firstst << n.begin << n.begin + n.length() * ratio << n.note << note->isFloating() << n.lineBreak;
+ new2 << id+1 << secondst << n.begin + n.length() * ratio << n.end << n.note << note->isFloating() << false;
doOperation(new1, Operation::NO_UPDATE);
doOperation(new2, Operation::NO_UPDATE);
doOperation(Operation("DEL", id+2), Operation::NO_UPDATE);
@@ -180,8 +180,10 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
if (action == "BLOCK" || action == "COMBINER") {
; // No op
} else if (action == "NEW") {
+ Note newnote(op.s(2)); // lyric
+ newnote.lineBreak = op.b(7); // lineBreak
NoteLabel *newLabel = new NoteLabel(
- Note(op.s(2)), // Note(lyric)
+ newnote, // Note(lyric)
this, // parent
QPoint(s2px(op.d(3)), n2px(op.i(5)) - m_noteHalfHeight), // x,y
QSize(s2px(op.d(4) - op.d(3)), 2 * m_noteHalfHeight), // w,h
|