change edit mode implementation
This commit is contained in:
parent
2184910865
commit
2bcc1bdf5a
30 changed files with 584 additions and 548 deletions
|
@ -1,7 +1,6 @@
|
|||
//=============================================================================
|
||||
// MuseScore
|
||||
// Music Composition & Notation
|
||||
// $Id: arpeggio.cpp 5149 2011-12-29 08:38:43Z wschweer $
|
||||
//
|
||||
// Copyright (C) 2002-2011 Werner Schweer
|
||||
//
|
||||
|
|
|
@ -752,6 +752,15 @@ void Element::read(XmlReader& e)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// startEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Element::startEdit(MuseScoreView*, const QPointF&)
|
||||
{
|
||||
undoPushProperty(P_USER_OFF);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// remove
|
||||
//---------------------------------------------------------
|
||||
|
@ -1506,6 +1515,16 @@ void Element::undoChangeProperty(P_ID id, const QVariant& val)
|
|||
score()->undoChangeProperty(this, id, val);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// undoPushProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Element::undoPushProperty(P_ID id)
|
||||
{
|
||||
QVariant val = getProperty(id);
|
||||
score()->undo()->push1(new ChangeProperty(this, id, val));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// isChordRest
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -403,7 +403,7 @@ class Element : public QObject {
|
|||
virtual QLineF dragAnchor() const { return QLineF(); }
|
||||
|
||||
virtual bool isEditable() const { return !_generated; }
|
||||
virtual void startEdit(MuseScoreView*, const QPointF&) {}
|
||||
virtual void startEdit(MuseScoreView*, const QPointF&);
|
||||
virtual bool edit(MuseScoreView*, int grip, int key, Qt::KeyboardModifiers, const QString& s);
|
||||
virtual void editDrag(const EditData&);
|
||||
virtual void endEditDrag() {}
|
||||
|
@ -528,6 +528,7 @@ class Element : public QObject {
|
|||
virtual bool setProperty(P_ID, const QVariant&);
|
||||
virtual QVariant propertyDefault(P_ID) const;
|
||||
void undoChangeProperty(P_ID, const QVariant&);
|
||||
void undoPushProperty(P_ID);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -1016,7 +1016,7 @@ void FiguredBass::layout()
|
|||
QFontMetricsF fm(textStyle().font(spatium()));
|
||||
// box width
|
||||
w = 0;
|
||||
QStringList list = getText().split('\n');
|
||||
QStringList list = text().split('\n');
|
||||
foreach(QString str, list) {
|
||||
w1 = fm.width(str);
|
||||
if(w1 > w)
|
||||
|
@ -1165,7 +1165,7 @@ void FiguredBass::endEdit()
|
|||
int idx;
|
||||
|
||||
Text::endEdit();
|
||||
QString txt = getText();
|
||||
QString txt = text();
|
||||
if(txt.isEmpty()) { // if no text, nothing to do
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ void Harmony::startEdit(MuseScoreView* view, const QPointF& p)
|
|||
bool Harmony::edit(MuseScoreView* view, int grip, int key, Qt::KeyboardModifiers mod, const QString& s)
|
||||
{
|
||||
bool rv = Text::edit(view, grip, key, mod, s);
|
||||
QString str = getText();
|
||||
QString str = text();
|
||||
int root, base;
|
||||
bool badSpell = !str.isEmpty() && !parseHarmony(str, &root, &base);
|
||||
spellCheckUnderline(badSpell);
|
||||
|
@ -387,7 +387,7 @@ bool Harmony::edit(MuseScoreView* view, int grip, int key, Qt::KeyboardModifiers
|
|||
void Harmony::endEdit()
|
||||
{
|
||||
Text::endEdit();
|
||||
setHarmony(getText());
|
||||
setHarmony(text());
|
||||
layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -2177,7 +2177,7 @@ void Measure::read(XmlReader& e, int staffIdx)
|
|||
dyn->setTrack(e.track());
|
||||
dyn->read(e);
|
||||
if (score()->mscVersion() <= 114)
|
||||
dyn->setSubtype(dyn->getText());
|
||||
dyn->setSubtype(dyn->text());
|
||||
segment = getSegment(Segment::SegChordRest, e.tick());
|
||||
segment->add(dyn);
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ enum P_ID {
|
|||
P_LOCK_ASPECT_RATIO,
|
||||
P_SIZE_IS_SPATIUM,
|
||||
P_TEXT_STYLE,
|
||||
P_TEXT,
|
||||
P_USER_MODIFIED,
|
||||
P_BEAM_POS,
|
||||
P_BEAM_MODE,
|
||||
|
|
|
@ -387,7 +387,7 @@ Score::FileError Score::read114(XmlReader& e)
|
|||
else if (tag == "copyright" || tag == "rights") {
|
||||
Text* text = new Text(this);
|
||||
text->read(e);
|
||||
setMetaTag("copyright", text->getText());
|
||||
setMetaTag("copyright", text->text());
|
||||
delete text;
|
||||
}
|
||||
else if (tag == "movement-number")
|
||||
|
|
|
@ -509,6 +509,8 @@ class Score : public QObject {
|
|||
void undoChangeBarLine(Measure* m, BarLineType);
|
||||
void undoSwapCR(ChordRest* cr1, ChordRest* cr2);
|
||||
void undoChangeProperty(Element*, P_ID, const QVariant& v);
|
||||
UndoStack* undo() const;
|
||||
void undo(UndoCommand* cmd) const;
|
||||
|
||||
void setGraceNote(Chord*, int pitch, NoteType type, bool behind, int len);
|
||||
|
||||
|
@ -736,8 +738,6 @@ class Score : public QObject {
|
|||
void adjustBracketsDel(int sidx, int eidx);
|
||||
void adjustBracketsIns(int sidx, int eidx);
|
||||
void renumberMeasures();
|
||||
UndoStack* undo() const;
|
||||
void undo(UndoCommand* cmd) const;
|
||||
|
||||
void endUndoRedo();
|
||||
Measure* searchLabel(const QString& s);
|
||||
|
|
|
@ -876,7 +876,7 @@ bool Score::read(XmlReader& e)
|
|||
else if (tag == "copyright" || tag == "rights") {
|
||||
Text* text = new Text(this);
|
||||
text->read(e);
|
||||
setMetaTag("copyright", text->getText());
|
||||
setMetaTag("copyright", text->text());
|
||||
delete text;
|
||||
}
|
||||
else if (tag == "movement-number")
|
||||
|
|
|
@ -79,7 +79,8 @@ void SegmentList::check()
|
|||
void SegmentList::insert(Segment* e, Segment* el)
|
||||
{
|
||||
if (e->score()->undoRedo())
|
||||
qFatal("SegmentList:insert in undo/redo");
|
||||
qFatal("SegmentList:insert <%s, tick %d> in undo/redo",
|
||||
e->subTypeName(), e->tick());
|
||||
if (el == 0)
|
||||
push_back(e);
|
||||
else if (el == first())
|
||||
|
|
|
@ -256,22 +256,18 @@ void SimpleText::layout()
|
|||
}
|
||||
}
|
||||
else {
|
||||
foreach(QString s, sl)
|
||||
foreach (QString s, sl)
|
||||
_layout.append(TLine(s));
|
||||
}
|
||||
}
|
||||
int n = _layout.size();
|
||||
if (!n) {
|
||||
setPos(QPointF());
|
||||
setbbox(QRectF());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_layout.isEmpty())
|
||||
_layout.append(TLine());
|
||||
QPointF o(_textStyle.offset(spatium()));
|
||||
|
||||
QRectF bb;
|
||||
qreal lh = lineHeight();
|
||||
qreal ly = .0;
|
||||
int n = _layout.size();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
TLine* t = &_layout[i];
|
||||
|
||||
|
@ -353,33 +349,18 @@ qreal SimpleText::baseLine() const
|
|||
return QFontMetricsF(textStyle().font(spatium())).ascent();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setText
|
||||
//---------------------------------------------------------
|
||||
|
||||
void SimpleText::setText(const QString& s)
|
||||
{
|
||||
_text = s;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// getText
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString SimpleText::getText() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// startEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void SimpleText::startEdit(MuseScoreView*, const QPointF& pt)
|
||||
{
|
||||
if (_layout.isEmpty())
|
||||
layout();
|
||||
_cursor.line = 0;
|
||||
_cursor.column = 0;
|
||||
setCursor(pt);
|
||||
undoPushProperty(P_TEXT);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -540,6 +521,7 @@ void SimpleText::insertText(const QString& s)
|
|||
if (!s.isEmpty()) {
|
||||
curLine().insert(_cursor.column, s);
|
||||
_cursor.column += s.size();
|
||||
_cursor.selectColumn = _cursor.column;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,6 +549,8 @@ bool SimpleText::deletePreviousChar()
|
|||
curLine().remove(_cursor.column-1, 1);
|
||||
--_cursor.column;
|
||||
}
|
||||
_cursor.selectLine = _cursor.line;
|
||||
_cursor.selectColumn = _cursor.column;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -581,6 +565,8 @@ bool SimpleText::deleteChar()
|
|||
if (curLine().at(_cursor.column-1).isHighSurrogate())
|
||||
curLine().remove(_cursor.column, 1);
|
||||
curLine().remove(_cursor.column, 1);
|
||||
_cursor.selectLine = _cursor.line;
|
||||
_cursor.selectColumn = _cursor.column;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,9 @@ class SimpleText : public Element {
|
|||
|
||||
bool _layoutToParentWidth;
|
||||
bool _editMode;
|
||||
static TCursor _cursor;
|
||||
|
||||
static TCursor _cursor; // used during editing
|
||||
|
||||
QRectF cursorRect() const;
|
||||
QString& curLine();
|
||||
void drawSelection(QPainter*, const QRectF&) const;
|
||||
|
@ -85,8 +87,8 @@ class SimpleText : public Element {
|
|||
const TextStyle& textStyle() const { return _textStyle; }
|
||||
TextStyle& textStyle() { return _textStyle; }
|
||||
|
||||
void setText(const QString& s);
|
||||
QString getText() const;
|
||||
void setText(const QString& s) { _text = s; }
|
||||
QString text() const { return _text; }
|
||||
|
||||
bool editMode() const { return _editMode; }
|
||||
void setEditMode(bool val) { _editMode = val; }
|
||||
|
|
|
@ -90,7 +90,7 @@ void TempoText::textChanged()
|
|||
{
|
||||
if (!_followText)
|
||||
return;
|
||||
QString s = getText();
|
||||
QString s = text();
|
||||
|
||||
static const TempoPattern tp[] = {
|
||||
TempoPattern("\\xd834\\xdd5f = (\\d+)", 1.0/60.0), // 1/4
|
||||
|
|
|
@ -171,12 +171,12 @@ void Text::setHtml(const QString& s)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// getText
|
||||
// text
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString Text::getText() const
|
||||
QString Text::text() const
|
||||
{
|
||||
return styled() ? SimpleText::getText() : _doc->toPlainText();
|
||||
return styled() ? SimpleText::text() : _doc->toPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -395,7 +395,7 @@ void Text::writeProperties(Xml& xml, bool writeText) const
|
|||
_textStyle.writeProperties(xml);
|
||||
if (writeText) {
|
||||
if (styled())
|
||||
xml.tag("text", getText());
|
||||
xml.tag("text", text());
|
||||
else {
|
||||
xml.stag("html-data");
|
||||
xml.writeHtml(_doc->toHtml("utf-8"));
|
||||
|
@ -1270,7 +1270,7 @@ void Text::styleChanged()
|
|||
if (styled()) {
|
||||
if (_styleIndex != TEXT_STYLE_UNKNOWN)
|
||||
setTextStyle(score()->textStyle(_styleIndex));
|
||||
setText(getText()); // destroy formatting
|
||||
setText(text()); // destroy formatting
|
||||
score()->setLayoutAll(true);
|
||||
}
|
||||
}
|
||||
|
@ -1338,7 +1338,7 @@ void Text::setUnstyled()
|
|||
_styleIndex = TEXT_STYLE_UNSTYLED;
|
||||
createDoc();
|
||||
if (!SimpleText::isEmpty())
|
||||
setUnstyledText(SimpleText::getText());
|
||||
setUnstyledText(SimpleText::text());
|
||||
if (editMode())
|
||||
_cursor = new QTextCursor(_doc);
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ void Text::endCursorEdit()
|
|||
|
||||
bool Text::isEmpty() const
|
||||
{
|
||||
return styled() ? SimpleText::getText().isEmpty() : _doc->isEmpty();
|
||||
return styled() ? SimpleText::text().isEmpty() : _doc->isEmpty();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -1412,11 +1412,20 @@ void Text::setModified(bool v)
|
|||
QTextDocumentFragment Text::getFragment() const
|
||||
{
|
||||
if (styled())
|
||||
return QTextDocumentFragment::fromPlainText(getText());
|
||||
return QTextDocumentFragment::fromPlainText(text());
|
||||
else
|
||||
return QTextDocumentFragment(_doc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// undoSetText
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Text::undoSetText(const QString& s)
|
||||
{
|
||||
score()->undoChangeProperty(this, P_TEXT, s);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// getProperty
|
||||
//---------------------------------------------------------
|
||||
|
@ -1426,6 +1435,9 @@ QVariant Text::getProperty(P_ID propertyId) const
|
|||
switch(propertyId) {
|
||||
case P_TEXT_STYLE:
|
||||
return QVariant(_styleIndex);
|
||||
case P_TEXT:
|
||||
return text();
|
||||
|
||||
default:
|
||||
return Element::getProperty(propertyId);
|
||||
}
|
||||
|
@ -1444,6 +1456,9 @@ bool Text::setProperty(P_ID propertyId, const QVariant& v)
|
|||
_styleIndex = v.toInt();
|
||||
setGenerated(false);
|
||||
break;
|
||||
case P_TEXT:
|
||||
setText(v.toString());
|
||||
break;
|
||||
default:
|
||||
rv = Element::setProperty(propertyId, v);
|
||||
break;
|
||||
|
|
|
@ -30,7 +30,7 @@ struct SymCode;
|
|||
|
||||
class Text : public SimpleText {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ getText WRITE setText)
|
||||
Q_PROPERTY(QString text READ text WRITE undoSetText)
|
||||
|
||||
QTextDocument* _doc;
|
||||
int _styleIndex; // set to TEXT_STYLE_UNSTYLED if not styled
|
||||
|
@ -55,11 +55,12 @@ class Text : public SimpleText {
|
|||
virtual Text* clone() const { return new Text(*this); }
|
||||
virtual ElementType type() const { return TEXT; }
|
||||
|
||||
void setText(const QString& s);
|
||||
void setText(const QString&);
|
||||
void undoSetText(const QString&);
|
||||
void setText(const QTextDocumentFragment&);
|
||||
void setHtml(const QString& s);
|
||||
|
||||
QString getText() const;
|
||||
QString text() const;
|
||||
QString getHtml() const;
|
||||
QTextDocumentFragment getFragment() const;
|
||||
|
||||
|
|
|
@ -239,6 +239,16 @@ void UndoStack::push(UndoCommand* cmd)
|
|||
cmd->redo();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// push1
|
||||
//---------------------------------------------------------
|
||||
|
||||
void UndoStack::push1(UndoCommand* cmd)
|
||||
{
|
||||
if (curCmd)
|
||||
curCmd->appendChild(cmd);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// pop
|
||||
//---------------------------------------------------------
|
||||
|
@ -2129,7 +2139,7 @@ void EditText::redo()
|
|||
void EditText::undoRedo()
|
||||
{
|
||||
if (text->styled()) {
|
||||
QString s = text->getText();
|
||||
QString s = text->text();
|
||||
text->setText(oldText);
|
||||
oldText = s;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,8 @@ class UndoStack {
|
|||
bool active() const { return curCmd != 0; }
|
||||
void beginMacro();
|
||||
void endMacro(bool rollback);
|
||||
void push(UndoCommand*);
|
||||
void push(UndoCommand*); // push & execute
|
||||
void push1(UndoCommand*);
|
||||
void pop();
|
||||
void setClean();
|
||||
bool canUndo() const { return curIdx > 0; }
|
||||
|
|
|
@ -96,7 +96,7 @@ void Volta::setText(const QString& s)
|
|||
|
||||
QString Volta::text() const
|
||||
{
|
||||
return beginText()->getText();
|
||||
return beginText()->text();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -172,9 +172,8 @@ add_executable ( ${ExecutableName}
|
|||
simplebutton.cpp musedata.cpp exportly.cpp
|
||||
editdrumset.cpp editstaff.cpp voltaproperties.cpp
|
||||
timesigproperties.cpp newwizard.cpp transposedialog.cpp
|
||||
chordedit.cpp excerptsdialog.cpp
|
||||
metaedit.cpp magbox.cpp voiceselector.cpp capella.cpp
|
||||
exportaudio.cpp palettebox.cpp
|
||||
chordedit.cpp excerptsdialog.cpp metaedit.cpp magbox.cpp
|
||||
voiceselector.cpp capella.cpp exportaudio.cpp palettebox.cpp
|
||||
textproperties.cpp slurproperties.cpp
|
||||
synthcontrol.cpp drumroll.cpp pianoroll.cpp piano.cpp
|
||||
pianoview.cpp drumview.cpp scoretab.cpp keyedit.cpp harmonyedit.cpp
|
||||
|
@ -195,7 +194,7 @@ add_executable ( ${ExecutableName}
|
|||
inspectorGroupElement.cpp dragdrop.cpp inspectorImage.cpp
|
||||
waveview.cpp helpBrowser.cpp inspectorLasso.cpp
|
||||
editelement.cpp inspectorVolta.cpp inspectorOttava.cpp inspectorTrill.cpp
|
||||
inspectorHairpin.cpp qmlplugin.cpp
|
||||
inspectorHairpin.cpp qmlplugin.cpp editlyrics.cpp
|
||||
musicxmlsupport.cpp exportxml.cpp importxml.cpp importxmlfirstpass.cpp
|
||||
savePositions.cpp pluginManager.cpp inspectorJump.cpp inspectorMarker.cpp
|
||||
${OMR_FILES}
|
||||
|
|
|
@ -1394,7 +1394,7 @@ void TextView::setElement(Element* e)
|
|||
tb.textStyle->addItem(e->score()->textStyle(i).name());
|
||||
|
||||
ShowElementBase::setElement(e);
|
||||
tb.text->setPlainText(te->getText());
|
||||
tb.text->setPlainText(te->text());
|
||||
tb.xoffset->setValue(te->xoff());
|
||||
tb.yoffset->setValue(te->yoff());
|
||||
tb.rxoffset->setValue(te->reloff().x());
|
||||
|
@ -1517,7 +1517,7 @@ void DynamicView::setElement(Element* e)
|
|||
for (int i = 0; i < TEXT_STYLES; ++i)
|
||||
tb.textStyle->addItem(e->score()->textStyle(i).name());
|
||||
|
||||
tb.text->setPlainText(dynamic->getText());
|
||||
tb.text->setPlainText(dynamic->text());
|
||||
tb.xoffset->setValue(dynamic->xoff());
|
||||
tb.yoffset->setValue(dynamic->yoff());
|
||||
tb.rxoffset->setValue(dynamic->reloff().x());
|
||||
|
|
|
@ -37,7 +37,7 @@ void ScoreView::startEdit(Element* e)
|
|||
{
|
||||
if (e->type() == Element::TBOX)
|
||||
e = static_cast<TBox*>(e)->getText();
|
||||
origEditObject = e;
|
||||
editObject = e;
|
||||
sm->postEvent(new CommandEvent("edit"));
|
||||
_score->end();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void ScoreView::startEdit(Element* e)
|
|||
|
||||
void ScoreView::startEdit(Element* element, int startGrip)
|
||||
{
|
||||
origEditObject = element;
|
||||
editObject = element;
|
||||
startEdit();
|
||||
if (startGrip == -1)
|
||||
curGrip = grips-1;
|
||||
|
@ -67,10 +67,9 @@ void ScoreView::startEdit()
|
|||
setFocus();
|
||||
if (!_score->undo()->active())
|
||||
_score->startCmd();
|
||||
_score->deselectAll();
|
||||
|
||||
if (origEditObject->isSegment()) { // if spanner segment
|
||||
SpannerSegment* ss = (SpannerSegment*)origEditObject;
|
||||
if (editObject->isSegment()) { // if spanner segment
|
||||
SpannerSegment* ss = (SpannerSegment*)editObject;
|
||||
Spanner* spanner = ss->spanner();
|
||||
Spanner* clone = static_cast<Spanner*>(spanner->clone());
|
||||
clone->setLinks(spanner->links());
|
||||
|
@ -80,21 +79,10 @@ void ScoreView::startEdit()
|
|||
editObject->startEdit(this, startMove);
|
||||
_score->undoChangeElement(spanner, clone);
|
||||
}
|
||||
else {
|
||||
foreach(Element* e, origEditObject->linkList()) {
|
||||
Element* ce = e->clone();
|
||||
if (e == origEditObject) {
|
||||
editObject = ce;
|
||||
editObject->setSelected(true);
|
||||
}
|
||||
_score->undoChangeElement(e, ce);
|
||||
}
|
||||
editObject->layout();
|
||||
else
|
||||
editObject->startEdit(this, startMove);
|
||||
}
|
||||
curGrip = -1;
|
||||
updateGrips();
|
||||
_score->rebuildBspTree(); // we replaced elements
|
||||
_score->end();
|
||||
}
|
||||
|
||||
|
@ -105,10 +93,8 @@ void ScoreView::startEdit()
|
|||
void ScoreView::endEdit()
|
||||
{
|
||||
setDropTarget(0);
|
||||
if (!editObject) {
|
||||
origEditObject = 0;
|
||||
if (!editObject)
|
||||
return;
|
||||
}
|
||||
|
||||
_score->addRefresh(editObject->canvasBoundingRect());
|
||||
for (int i = 0; i < grips; ++i)
|
||||
|
@ -119,6 +105,7 @@ void ScoreView::endEdit()
|
|||
mscore->getInspector()->setElement(0);
|
||||
|
||||
if (editObject->isSegment()) {
|
||||
#if 0
|
||||
Spanner* spanner = static_cast<SpannerSegment*>(editObject)->spanner();
|
||||
Spanner* original = static_cast<SpannerSegment*>(origEditObject)->spanner();
|
||||
|
||||
|
@ -192,6 +179,7 @@ void ScoreView::endEdit()
|
|||
score()->undo(new ChangeSpannerAnchor(lspanner, lse, lee));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
_score->addRefresh(editObject->canvasBoundingRect());
|
||||
|
||||
|
@ -211,7 +199,6 @@ void ScoreView::endEdit()
|
|||
_score->end();
|
||||
}
|
||||
editObject = 0;
|
||||
origEditObject = 0;
|
||||
grips = 0;
|
||||
}
|
||||
|
||||
|
|
422
mscore/editlyrics.cpp
Normal file
422
mscore/editlyrics.cpp
Normal file
|
@ -0,0 +1,422 @@
|
|||
//=============================================================================
|
||||
// MuseScore
|
||||
// Music Composition & Notation
|
||||
//
|
||||
// Copyright (C) 2002-2011 Werner Schweer
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2
|
||||
// as published by the Free Software Foundation and appearing in
|
||||
// the file LICENCE.GPL
|
||||
//=============================================================================
|
||||
|
||||
#include "musescore.h"
|
||||
#include "scoreview.h"
|
||||
#include "libmscore/score.h"
|
||||
#include "libmscore/segment.h"
|
||||
#include "libmscore/lyrics.h"
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsUpDown
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsUpDown(bool up, bool end)
|
||||
{
|
||||
Lyrics* lyrics = static_cast<Lyrics*>(editObject);
|
||||
int track = lyrics->track();
|
||||
ChordRest* cr = lyrics->chordRest();
|
||||
int verse = lyrics->no();
|
||||
const QList<Lyrics*>* ll = &lyrics->chordRest()->lyricsList();
|
||||
|
||||
if (up) {
|
||||
if (verse == 0)
|
||||
return;
|
||||
--verse;
|
||||
}
|
||||
else {
|
||||
++verse;
|
||||
if (verse >= ll->size())
|
||||
return;
|
||||
}
|
||||
endEdit();
|
||||
_score->startCmd();
|
||||
lyrics = ll->value(verse);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(cr);
|
||||
lyrics->setNo(verse);
|
||||
_score->undoAddElement(lyrics);
|
||||
}
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
if (end)
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
else
|
||||
((Lyrics*)editObject)->moveCursorToStart();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsTab
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsTab(bool back, bool end, bool moveOnly)
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
|
||||
Segment* nextSegment = segment;
|
||||
if (back) {
|
||||
// search prev chord
|
||||
while ((nextSegment = nextSegment->prev1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// search next chord
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextSegment == 0)
|
||||
return;
|
||||
|
||||
endEdit();
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
if (!back) {
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
}
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
if (ll == 0) {
|
||||
qDebug("no next lyrics list: %s", nextSegment->element(track)->name());
|
||||
return;
|
||||
}
|
||||
lyrics = ll->value(verse);
|
||||
|
||||
bool newLyrics = false;
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
ChordRest* cr = static_cast<ChordRest*>(nextSegment->element(track));
|
||||
lyrics->setParent(cr);
|
||||
lyrics->setNo(verse);
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
newLyrics = true;
|
||||
}
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
if (oldLyrics && !moveOnly) {
|
||||
switch(lyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::BEGIN:
|
||||
break;
|
||||
case Lyrics::END:
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
break;
|
||||
case Lyrics::MIDDLE:
|
||||
lyrics->setSyllabic(Lyrics::BEGIN);
|
||||
break;
|
||||
}
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
case Lyrics::BEGIN:
|
||||
oldLyrics->setSyllabic(Lyrics::SINGLE);
|
||||
break;
|
||||
case Lyrics::MIDDLE:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
if (end)
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
else
|
||||
((Lyrics*)editObject)->moveCursorToStart();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsMinus
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsMinus()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
|
||||
endEdit();
|
||||
|
||||
// search next chord
|
||||
Segment* nextSegment = segment;
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
if (nextSegment == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (!nll) {
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
continue;
|
||||
}
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
lyrics = ll->value(verse);
|
||||
bool newLyrics = (lyrics == 0);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(nextSegment->element(track));
|
||||
lyrics->setNo(verse);
|
||||
lyrics->setSyllabic(Lyrics::END);
|
||||
}
|
||||
|
||||
if(lyrics->syllabic()==Lyrics::BEGIN) {
|
||||
lyrics->setSyllabic(Lyrics::MIDDLE);
|
||||
}
|
||||
else if(lyrics->syllabic()==Lyrics::SINGLE) {
|
||||
lyrics->setSyllabic(Lyrics::END);
|
||||
}
|
||||
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::BEGIN:
|
||||
case Lyrics::MIDDLE:
|
||||
break;
|
||||
case Lyrics::SINGLE:
|
||||
oldLyrics->setSyllabic(Lyrics::BEGIN);
|
||||
break;
|
||||
case Lyrics::END:
|
||||
oldLyrics->setSyllabic(Lyrics::MIDDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsUnderscore
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsUnderscore()
|
||||
{
|
||||
Lyrics* lyrics = static_cast<Lyrics*>(editObject);
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
int endTick = segment->tick();
|
||||
|
||||
endEdit();
|
||||
|
||||
// search next chord
|
||||
Segment* nextSegment = segment;
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
if (nextSegment == 0) {
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
default:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
if (oldLyrics->segment()->tick() < endTick)
|
||||
oldLyrics->setTicks(endTick - oldLyrics->segment()->tick());
|
||||
}
|
||||
return;
|
||||
}
|
||||
_score->startCmd();
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
lyrics = ll->value(verse);
|
||||
bool newLyrics = (lyrics == 0);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(nextSegment->element(track));
|
||||
lyrics->setNo(verse);
|
||||
}
|
||||
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
default:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
if (oldLyrics->segment()->tick() < endTick)
|
||||
oldLyrics->setTicks(endTick - oldLyrics->segment()->tick());
|
||||
}
|
||||
if (newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsReturn
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsReturn()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
Segment* segment = lyrics->segment();
|
||||
|
||||
endEdit();
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
Lyrics* oldLyrics = lyrics;
|
||||
|
||||
lyrics = static_cast<Lyrics*>(Element::create(lyrics->type(), _score));
|
||||
lyrics->setTrack(oldLyrics->track());
|
||||
lyrics->setParent(segment->element(oldLyrics->track()));
|
||||
lyrics->setNo(oldLyrics->no() + 1);
|
||||
_score->undoAddElement(lyrics);
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsEndEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsEndEdit()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
int endTick = lyrics->segment()->tick();
|
||||
|
||||
// search previous lyric:
|
||||
int verse = lyrics->no();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
Segment* segment = lyrics->segment();
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
// if (lyrics->isEmpty() && origL->isEmpty())
|
||||
if (lyrics->isEmpty())
|
||||
lyrics->parent()->remove(lyrics);
|
||||
else {
|
||||
if (oldLyrics && oldLyrics->syllabic() == Lyrics::END) {
|
||||
if (oldLyrics->endTick() >= endTick)
|
||||
oldLyrics->setTicks(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -946,11 +946,11 @@ void ExportLy::storeChord(struct InstructionAnchor chordanchor)
|
|||
|
||||
void ExportLy::tempoText(TempoText* text)
|
||||
{
|
||||
QString temptekst = text->getText();
|
||||
QString temptekst = text->text();
|
||||
double met = text->tempo();
|
||||
int metronome;
|
||||
metronome = (int) (met * 60);
|
||||
out << "\\tempo \"" << text->getText() << "\" " << timedenom << " = " << metronome << " ";
|
||||
out << "\\tempo \"" << text->text() << "\" " << timedenom << " = " << metronome << " ";
|
||||
}
|
||||
|
||||
|
||||
|
@ -966,8 +966,8 @@ void ExportLy::words(Text* text)
|
|||
findTextProperties(text,style,size);
|
||||
//todo: find exact mscore-position of text and not only anchorpoint, and position accordingly in lily.
|
||||
//TODO if ((text->subtypeName() != "RehearsalMark"))
|
||||
// if (text->getText() != "")
|
||||
out << "^\\markup {" << style<< " \"" << text->getText() << "\"} ";
|
||||
// if (text->text() != "")
|
||||
out << "^\\markup {" << style<< " \"" << text->text() << "\"} ";
|
||||
// qDebug("tekst %s\n", tekst.toLatin1().data());
|
||||
}
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ void ExportLy::pedal(Pedal* pd, int tick)
|
|||
//---------------------------------------------------------
|
||||
void ExportLy::dynamic(Dynamic* dyn, int nop)
|
||||
{
|
||||
QString t = dyn->getText();
|
||||
QString t = dyn->text();
|
||||
if (t == "p" || t == "pp" || t == "ppp" || t == "pppp" || t == "ppppp" || t == "pppppp"
|
||||
|| t == "f" ||
|
||||
t == "ff" || t == "fff" || t == "ffff" || t == "fffff" || t == "ffffff"
|
||||
|
@ -1171,7 +1171,7 @@ void ExportLy::textLine(Element* instruction, int tick, bool pre)
|
|||
}
|
||||
if (tekstlinje->beginText())
|
||||
{
|
||||
QString linetext = tekstlinje->beginText()->getText();
|
||||
QString linetext = tekstlinje->beginText()->text();
|
||||
Text* tekst = (Text*) tekstlinje->beginText();
|
||||
QString tekststyle = "";
|
||||
findTextProperties(tekst, tekststyle, fontsize);
|
||||
|
@ -1459,7 +1459,7 @@ void ExportLy::handlePreInstruction(Element * el)
|
|||
bool ok = false;
|
||||
// int dec=0;
|
||||
QString c;
|
||||
c=tekst->getText();
|
||||
c=tekst->text();
|
||||
// dec = c.toInt(&ok, 10);
|
||||
if (ok) rehearsalnumbers=true;
|
||||
Element* elm = 0;
|
||||
|
@ -1538,7 +1538,7 @@ void ExportLy::handleElement(Element* el)
|
|||
if (wholemeasurerest)
|
||||
{
|
||||
Text* wmtx = (Text*) instruction;
|
||||
wholemeasuretext = wmtx->getText();
|
||||
wholemeasuretext = wmtx->text();
|
||||
}
|
||||
else
|
||||
words((Text*) instruction);
|
||||
|
@ -2734,12 +2734,12 @@ void ExportLy::findFingerAndStringno(Note* note, int &fingix, int &stringix, QSt
|
|||
if (text->textStyleType() == TEXT_STYLE_FINGERING) {
|
||||
fingix++;
|
||||
Text* f = (Text*)e;
|
||||
fingarray[fingix] = f->getText();
|
||||
fingarray[fingix] = f->text();
|
||||
}
|
||||
else if (text->textStyleType() == TEXT_STYLE_STRING_NUMBER) {
|
||||
stringix++;
|
||||
Text * s = (Text*)e;
|
||||
stringarray[stringix] = s->getText();
|
||||
stringarray[stringix] = s->text();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3562,7 +3562,7 @@ void ExportLy::findLyrics()
|
|||
}
|
||||
}
|
||||
|
||||
QString lyriks = (lix)->getText();
|
||||
QString lyriks = (lix)->text();
|
||||
|
||||
// escape '"' character
|
||||
if (lyriks.contains('"'))
|
||||
|
@ -4644,7 +4644,7 @@ void ExportLy::writeScoreTitles()
|
|||
foreach(const Element* e, *m->el()) {
|
||||
if (e->type() != TEXT)
|
||||
continue;
|
||||
QString s = ((Text*)e)->getText();
|
||||
QString s = ((Text*)e)->text();
|
||||
indentF();
|
||||
switch(e->subtype()) {
|
||||
case TEXT_TITLE:
|
||||
|
|
|
@ -986,7 +986,7 @@ void ExportMusicXml::credits(Xml& xml)
|
|||
text->styled(),
|
||||
text->textStyleType(),
|
||||
qPrintable(text->textStyle().name()),
|
||||
qPrintable(text->getText()),
|
||||
qPrintable(text->text()),
|
||||
text->pagePos().x(),
|
||||
text->pagePos().y()
|
||||
);
|
||||
|
@ -1027,13 +1027,13 @@ void ExportMusicXml::credits(Xml& xml)
|
|||
if (text->styled()) {
|
||||
QString styleName = text->textStyle().name();
|
||||
if (styleName == "Title")
|
||||
creditWords(xml, w / 2, ty, fs, "center", "top", text->getText());
|
||||
creditWords(xml, w / 2, ty, fs, "center", "top", text->text());
|
||||
else if (styleName == "Subtitle")
|
||||
creditWords(xml, w / 2, ty, fs, "center", "top", text->getText());
|
||||
creditWords(xml, w / 2, ty, fs, "center", "top", text->text());
|
||||
else if (styleName == "Composer")
|
||||
creditWords(xml, w - rm, ty, fs, "right", "top", text->getText());
|
||||
creditWords(xml, w - rm, ty, fs, "right", "top", text->text());
|
||||
else if (styleName == "Lyricist")
|
||||
creditWords(xml, lm, ty, fs, "left", "top", text->getText());
|
||||
creditWords(xml, lm, ty, fs, "left", "top", text->text());
|
||||
else
|
||||
qDebug("credits: text style %s not supported", qPrintable(styleName));
|
||||
}
|
||||
|
@ -2258,7 +2258,7 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList<Lyrics*>* ll, bo
|
|||
Text* f = (Text*)e;
|
||||
notations.tag(xml);
|
||||
technical.tag(xml);
|
||||
QString t = f->getText();
|
||||
QString t = f->text();
|
||||
if (f->textStyleType() == TEXT_STYLE_FINGERING) {
|
||||
// p, i, m, a, c represent the plucking finger
|
||||
if (t == "p" || t == "i" || t == "m" || t == "a" || t == "c")
|
||||
|
@ -2690,7 +2690,7 @@ static void wordsMetrome(Xml& xml, Text const* const text)
|
|||
QString metroLeft; // left part of metronome
|
||||
QString metroRight; // right part of metronome
|
||||
QString wordsRight; // words right of metronome
|
||||
if (findMetronome(text->getText(), wordsLeft, hasParen, metroLeft, metroRight, wordsRight)) {
|
||||
if (findMetronome(text->text(), wordsLeft, hasParen, metroLeft, metroRight, wordsRight)) {
|
||||
if (wordsLeft != "") {
|
||||
xml.stag("direction-type");
|
||||
xml.tag("words", wordsLeft);
|
||||
|
@ -2725,7 +2725,7 @@ static void wordsMetrome(Xml& xml, Text const* const text)
|
|||
}
|
||||
else {
|
||||
xml.stag("direction-type");
|
||||
xml.tag("words", text->getText());
|
||||
xml.tag("words", text->text());
|
||||
xml.etag();
|
||||
}
|
||||
}
|
||||
|
@ -2733,7 +2733,7 @@ static void wordsMetrome(Xml& xml, Text const* const text)
|
|||
void ExportMusicXml::tempoText(TempoText const* const text, int staff)
|
||||
{
|
||||
/*
|
||||
qDebug("ExportMusicXml::tempoText(TempoText='%s')", qPrintable(text->getText()));
|
||||
qDebug("ExportMusicXml::tempoText(TempoText='%s')", qPrintable(text->text()));
|
||||
*/
|
||||
attr.doAttr(xml, false);
|
||||
xml.stag(QString("direction placement=\"%1\"").arg((text->parent()->y()-text->y() < 0.0) ? "below" : "above"));
|
||||
|
@ -2758,13 +2758,13 @@ void ExportMusicXml::words(Text const* const text, int staff)
|
|||
/*
|
||||
qDebug("ExportMusicXml::words userOff.x=%f userOff.y=%f xoff=%g yoff=%g text='%s'",
|
||||
text->userOff().x(), text->userOff().y(), text->xoff(), text->yoff(),
|
||||
text->getText().toUtf8().data());
|
||||
text->text().toUtf8().data());
|
||||
*/
|
||||
directionTag(xml, attr, text);
|
||||
if (text->type() == Element::REHEARSAL_MARK) {
|
||||
// TODO: check if dead code (see rehearsal below)
|
||||
xml.stag("direction-type");
|
||||
xml.tag("rehearsal", text->getText());
|
||||
xml.tag("rehearsal", text->text());
|
||||
xml.etag();
|
||||
}
|
||||
else
|
||||
|
@ -2780,7 +2780,7 @@ void ExportMusicXml::rehearsal(RehearsalMark const* const rmk, int staff)
|
|||
{
|
||||
directionTag(xml, attr, rmk);
|
||||
xml.stag("direction-type");
|
||||
xml.tag("rehearsal", rmk->getText());
|
||||
xml.tag("rehearsal", rmk->text());
|
||||
xml.etag();
|
||||
directionETag(xml, staff);
|
||||
}
|
||||
|
@ -2953,7 +2953,7 @@ void ExportMusicXml::textLine(TextLine const* const tl, int staff, int tick)
|
|||
directionTag(xml, attr, tl);
|
||||
if (tl->beginText() && tl->tick() == tick) {
|
||||
xml.stag("direction-type");
|
||||
xml.tag("words", tl->beginText()->getText());
|
||||
xml.tag("words", tl->beginText()->text());
|
||||
xml.etag();
|
||||
}
|
||||
xml.stag("direction-type");
|
||||
|
@ -2979,7 +2979,7 @@ void ExportMusicXml::textLine(TextLine const* const tl, int staff, int tick)
|
|||
|
||||
void ExportMusicXml::dynamic(Dynamic const* const dyn, int staff)
|
||||
{
|
||||
QString t = dyn->getText();
|
||||
QString t = dyn->text();
|
||||
Dynamic::DynamicType st = dyn->subtype();
|
||||
|
||||
directionTag(xml, attr, dyn);
|
||||
|
@ -3080,7 +3080,7 @@ void ExportMusicXml::lyrics(const QList<Lyrics*>* ll, const int trk)
|
|||
qDebug("unknown syllabic %d\n", syl);
|
||||
}
|
||||
xml.tag("syllabic", s);
|
||||
xml.tag("text", (l)->getText());
|
||||
xml.tag("text", (l)->text());
|
||||
/*
|
||||
Temporarily disabled because it doesn't work yet (and thus breaks the regression test).
|
||||
See MusicXml::xmlLyric: "// TODO-WS l->setTick(tick);"
|
||||
|
@ -3106,41 +3106,41 @@ static void directionJump(Xml& xml, const Jump* const jp)
|
|||
QString type = "";
|
||||
QString sound = "";
|
||||
if (jtp == JumpType::DC) {
|
||||
if (jp->getText() == "")
|
||||
if (jp->text() == "")
|
||||
words = "D.C.";
|
||||
else
|
||||
words = jp->getText();
|
||||
words = jp->text();
|
||||
sound = "dacapo=\"yes\"";
|
||||
}
|
||||
else if (jtp == JumpType::DC_AL_FINE) {
|
||||
if (jp->getText() == "")
|
||||
if (jp->text() == "")
|
||||
words = "D.C. al Fine";
|
||||
else
|
||||
words = jp->getText();
|
||||
words = jp->text();
|
||||
sound = "dacapo=\"yes\"";
|
||||
}
|
||||
else if (jtp == JumpType::DC_AL_CODA) {
|
||||
if (jp->getText() == "")
|
||||
if (jp->text() == "")
|
||||
words = "D.C. al Coda";
|
||||
else
|
||||
words = jp->getText();
|
||||
words = jp->text();
|
||||
sound = "dacapo=\"yes\"";
|
||||
}
|
||||
else if (jtp == JumpType::DS_AL_CODA) {
|
||||
if (jp->getText() == "")
|
||||
if (jp->text() == "")
|
||||
words = "D.S. al Coda";
|
||||
else
|
||||
words = jp->getText();
|
||||
words = jp->text();
|
||||
if (jp->jumpTo() == "")
|
||||
sound = "dalsegno=\"1\"";
|
||||
else
|
||||
sound = "dalsegno=\"" + jp->jumpTo() + "\"";
|
||||
}
|
||||
else if (jtp == JumpType::DS_AL_FINE) {
|
||||
if (jp->getText() == "")
|
||||
if (jp->text() == "")
|
||||
words = "D.S. al Fine";
|
||||
else
|
||||
words = jp->getText();
|
||||
words = jp->text();
|
||||
if (jp->jumpTo() == "")
|
||||
sound = "dalsegno=\"1\"";
|
||||
else
|
||||
|
@ -3197,10 +3197,10 @@ static void directionMarker(Xml& xml, const Marker* const m)
|
|||
sound = "fine=\"yes\"";
|
||||
}
|
||||
else if (mtp == MarkerType::TOCODA) {
|
||||
if (m->getText() == "")
|
||||
if (m->text() == "")
|
||||
words = "To Coda";
|
||||
else
|
||||
words = m->getText();
|
||||
words = m->text();
|
||||
if (m->label() == "")
|
||||
sound = "tocoda=\"1\"";
|
||||
else
|
||||
|
@ -4483,7 +4483,7 @@ void ExportMusicXml::harmony(Harmony const* const h, FretDiagram const* const fd
|
|||
//
|
||||
xml.stag("direction");
|
||||
xml.stag("direction-type");
|
||||
xml.tag("words default-y=\"100\"", h->getText());
|
||||
xml.tag("words default-y=\"100\"", h->text());
|
||||
xml.etag();
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ void MuseScore::saveFile()
|
|||
QString fn = cs->fileInfo()->fileName();
|
||||
Text* t = cs->getText(TEXT_STYLE_TITLE);
|
||||
if (t)
|
||||
fn = t->getText();
|
||||
fn = t->text();
|
||||
QString name = createDefaultFileName(fn);
|
||||
QString f1 = tr("Compressed MuseScore File (*.mscz)");
|
||||
QString f2 = tr("MuseScore File (*.mscx)");
|
||||
|
|
|
@ -2287,7 +2287,7 @@ static void metronome(QDomElement e, Text* t)
|
|||
{
|
||||
if (!t) return;
|
||||
bool textAdded = false;
|
||||
QString tempoText = t->getText();
|
||||
QString tempoText = t->text();
|
||||
|
||||
QString parenth = e.attribute("parentheses");
|
||||
if (parenth == "yes")
|
||||
|
@ -3372,13 +3372,13 @@ void MusicXml::xmlLyric(int trk, QDomElement e,
|
|||
qDebug("unknown syllabic %s", qPrintable(e.text()));
|
||||
}
|
||||
else if (e.tagName() == "text")
|
||||
l->setText(l->getText()+e.text());
|
||||
l->setText(l->text()+e.text());
|
||||
else if (e.tagName() == "elision")
|
||||
if (e.text().isEmpty()) {
|
||||
l->setText(l->getText()+" ");
|
||||
l->setText(l->text()+" ");
|
||||
}
|
||||
else {
|
||||
l->setText(l->getText()+e.text());
|
||||
l->setText(l->text()+e.text());
|
||||
}
|
||||
else if (e.tagName() == "extend")
|
||||
;
|
||||
|
|
|
@ -113,8 +113,8 @@ LineProperties::LineProperties(TextLine* l, QWidget* parent)
|
|||
continueSymbolX->setEnabled(bt);
|
||||
continueSymbolY->setEnabled(bt);
|
||||
|
||||
beginText->setText(tl->beginText() ? tl->beginText()->getText() : "");
|
||||
continueText->setText(tl->continueText() ? tl->continueText()->getText() : "");
|
||||
beginText->setText(tl->beginText() ? tl->beginText()->text() : "");
|
||||
continueText->setText(tl->continueText() ? tl->continueText()->text() : "");
|
||||
|
||||
setLineSymbolComboBox(beginSymbol, tl->beginSymbol());
|
||||
setLineSymbolComboBox(continueSymbol, tl->continueSymbol());
|
||||
|
|
|
@ -195,13 +195,13 @@ class EditTransition : public QMouseEventTransition
|
|||
|
||||
protected:
|
||||
virtual bool eventTest(QEvent* event) {
|
||||
if (!QMouseEventTransition::eventTest(event) || canvas->getOrigEditObject())
|
||||
if (!QMouseEventTransition::eventTest(event) || canvas->getEditObject())
|
||||
return false;
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>(static_cast<QStateMachine::WrappedEvent*>(event)->event());
|
||||
QPointF p = canvas->toLogical(me->pos());
|
||||
Element* e = canvas->elementNear(p);
|
||||
if (e)
|
||||
canvas->setOrigEditObject(e);
|
||||
canvas->setEditObject(e);
|
||||
return e && e->isEditable();
|
||||
}
|
||||
public:
|
||||
|
@ -651,7 +651,6 @@ ScoreView::ScoreView(QWidget* parent)
|
|||
_cursor = new TextCursor;
|
||||
shadowNote = 0;
|
||||
grips = 0;
|
||||
origEditObject = 0;
|
||||
editObject = 0;
|
||||
addSelect = false;
|
||||
|
||||
|
@ -3894,12 +3893,12 @@ void ScoreView::cmdAddSlur(Note* firstNote, Note* lastNote)
|
|||
//
|
||||
// start slur in edit mode if lastNote is not given
|
||||
//
|
||||
if (origEditObject && origEditObject->isText()) {
|
||||
if (editObject && editObject->isText()) {
|
||||
_score->endCmd();
|
||||
return;
|
||||
}
|
||||
if ((lastNote == 0) && !el.isEmpty()) {
|
||||
origEditObject = el.front();
|
||||
editObject = el.front();
|
||||
sm->postEvent(new CommandEvent("edit")); // calls startCmd()
|
||||
}
|
||||
else
|
||||
|
@ -4153,417 +4152,13 @@ void ScoreView::changeVoice(int voice)
|
|||
void ScoreView::harmonyEndEdit()
|
||||
{
|
||||
Harmony* harmony = static_cast<Harmony*>(editObject);
|
||||
Harmony* origH = static_cast<Harmony*>(origEditObject);
|
||||
|
||||
if (harmony->isEmpty() && origH->isEmpty()) {
|
||||
if (harmony->isEmpty()) {
|
||||
Measure* measure = (Measure*)(harmony->parent());
|
||||
measure->remove(harmony);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsUpDown
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsUpDown(bool up, bool end)
|
||||
{
|
||||
Lyrics* lyrics = static_cast<Lyrics*>(editObject);
|
||||
int track = lyrics->track();
|
||||
ChordRest* cr = lyrics->chordRest();
|
||||
int verse = lyrics->no();
|
||||
const QList<Lyrics*>* ll = &lyrics->chordRest()->lyricsList();
|
||||
|
||||
if (up) {
|
||||
if (verse == 0)
|
||||
return;
|
||||
--verse;
|
||||
}
|
||||
else {
|
||||
++verse;
|
||||
if (verse >= ll->size())
|
||||
return;
|
||||
}
|
||||
endEdit();
|
||||
_score->startCmd();
|
||||
lyrics = ll->value(verse);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(cr);
|
||||
lyrics->setNo(verse);
|
||||
_score->undoAddElement(lyrics);
|
||||
}
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
if (end)
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
else
|
||||
((Lyrics*)editObject)->moveCursorToStart();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsTab
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsTab(bool back, bool end, bool moveOnly)
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
|
||||
Segment* nextSegment = segment;
|
||||
if (back) {
|
||||
// search prev chord
|
||||
while ((nextSegment = nextSegment->prev1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// search next chord
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextSegment == 0)
|
||||
return;
|
||||
|
||||
endEdit();
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
if (!back) {
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
}
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
if (ll == 0) {
|
||||
qDebug("no next lyrics list: %s", nextSegment->element(track)->name());
|
||||
return;
|
||||
}
|
||||
lyrics = ll->value(verse);
|
||||
|
||||
bool newLyrics = false;
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
ChordRest* cr = static_cast<ChordRest*>(nextSegment->element(track));
|
||||
lyrics->setParent(cr);
|
||||
lyrics->setNo(verse);
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
newLyrics = true;
|
||||
}
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
if (oldLyrics && !moveOnly) {
|
||||
switch(lyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::BEGIN:
|
||||
break;
|
||||
case Lyrics::END:
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
break;
|
||||
case Lyrics::MIDDLE:
|
||||
lyrics->setSyllabic(Lyrics::BEGIN);
|
||||
break;
|
||||
}
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
case Lyrics::BEGIN:
|
||||
oldLyrics->setSyllabic(Lyrics::SINGLE);
|
||||
break;
|
||||
case Lyrics::MIDDLE:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
if (end)
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
else
|
||||
((Lyrics*)editObject)->moveCursorToStart();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsMinus
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsMinus()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
|
||||
endEdit();
|
||||
|
||||
// search next chord
|
||||
Segment* nextSegment = segment;
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
if (nextSegment == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (!nll) {
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
continue;
|
||||
}
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
lyrics = ll->value(verse);
|
||||
bool newLyrics = (lyrics == 0);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(nextSegment->element(track));
|
||||
lyrics->setNo(verse);
|
||||
lyrics->setSyllabic(Lyrics::END);
|
||||
}
|
||||
|
||||
if(lyrics->syllabic()==Lyrics::BEGIN) {
|
||||
lyrics->setSyllabic(Lyrics::MIDDLE);
|
||||
}
|
||||
else if(lyrics->syllabic()==Lyrics::SINGLE) {
|
||||
lyrics->setSyllabic(Lyrics::END);
|
||||
}
|
||||
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::BEGIN:
|
||||
case Lyrics::MIDDLE:
|
||||
break;
|
||||
case Lyrics::SINGLE:
|
||||
oldLyrics->setSyllabic(Lyrics::BEGIN);
|
||||
break;
|
||||
case Lyrics::END:
|
||||
oldLyrics->setSyllabic(Lyrics::MIDDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsUnderscore
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsUnderscore()
|
||||
{
|
||||
Lyrics* lyrics = static_cast<Lyrics*>(editObject);
|
||||
int track = lyrics->track();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
Segment* segment = lyrics->segment();
|
||||
int verse = lyrics->no();
|
||||
int endTick = segment->tick();
|
||||
|
||||
endEdit();
|
||||
|
||||
// search next chord
|
||||
Segment* nextSegment = segment;
|
||||
while ((nextSegment = nextSegment->next1(Segment::SegChordRest | Segment::SegGrace))) {
|
||||
Element* el = nextSegment->element(track);
|
||||
if (el && el->type() == Element::CHORD)
|
||||
break;
|
||||
}
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
if (nextSegment == 0) {
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
default:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
if (oldLyrics->segment()->tick() < endTick)
|
||||
oldLyrics->setTicks(endTick - oldLyrics->segment()->tick());
|
||||
}
|
||||
return;
|
||||
}
|
||||
_score->startCmd();
|
||||
|
||||
const QList<Lyrics*>* ll = nextSegment->lyricsList(staffIdx);
|
||||
lyrics = ll->value(verse);
|
||||
bool newLyrics = (lyrics == 0);
|
||||
if (!lyrics) {
|
||||
lyrics = new Lyrics(_score);
|
||||
lyrics->setTrack(track);
|
||||
lyrics->setParent(nextSegment->element(track));
|
||||
lyrics->setNo(verse);
|
||||
}
|
||||
|
||||
lyrics->setSyllabic(Lyrics::SINGLE);
|
||||
|
||||
if (oldLyrics) {
|
||||
switch(oldLyrics->syllabic()) {
|
||||
case Lyrics::SINGLE:
|
||||
case Lyrics::END:
|
||||
break;
|
||||
default:
|
||||
oldLyrics->setSyllabic(Lyrics::END);
|
||||
break;
|
||||
}
|
||||
if (oldLyrics->segment()->tick() < endTick)
|
||||
oldLyrics->setTicks(endTick - oldLyrics->segment()->tick());
|
||||
}
|
||||
if (newLyrics)
|
||||
_score->undoAddElement(lyrics);
|
||||
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
((Lyrics*)editObject)->moveCursorToEnd();
|
||||
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsReturn
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsReturn()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
Segment* segment = lyrics->segment();
|
||||
|
||||
endEdit();
|
||||
|
||||
_score->startCmd();
|
||||
|
||||
Lyrics* oldLyrics = lyrics;
|
||||
|
||||
lyrics = static_cast<Lyrics*>(Element::create(lyrics->type(), _score));
|
||||
lyrics->setTrack(oldLyrics->track());
|
||||
lyrics->setParent(segment->element(oldLyrics->track()));
|
||||
lyrics->setNo(oldLyrics->no() + 1);
|
||||
_score->undoAddElement(lyrics);
|
||||
_score->select(lyrics, SELECT_SINGLE, 0);
|
||||
startEdit(lyrics, -1);
|
||||
mscore->changeState(mscoreState());
|
||||
|
||||
adjustCanvasPosition(lyrics, false);
|
||||
_score->setLayoutAll(true);
|
||||
_score->end2();
|
||||
_score->end1();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// lyricsEndEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreView::lyricsEndEdit()
|
||||
{
|
||||
Lyrics* lyrics = (Lyrics*)editObject;
|
||||
Lyrics* origL = (Lyrics*)origEditObject;
|
||||
int endTick = lyrics->segment()->tick();
|
||||
|
||||
// search previous lyric:
|
||||
int verse = lyrics->no();
|
||||
int staffIdx = lyrics->staffIdx();
|
||||
|
||||
// search previous lyric
|
||||
Lyrics* oldLyrics = 0;
|
||||
Segment* segment = lyrics->segment();
|
||||
while (segment) {
|
||||
const QList<Lyrics*>* nll = segment->lyricsList(staffIdx);
|
||||
if (nll) {
|
||||
oldLyrics = nll->value(verse);
|
||||
if (oldLyrics)
|
||||
break;
|
||||
}
|
||||
segment = segment->prev1(Segment::SegChordRest | Segment::SegGrace);
|
||||
}
|
||||
|
||||
if (lyrics->isEmpty() && origL->isEmpty())
|
||||
lyrics->parent()->remove(lyrics);
|
||||
else {
|
||||
if (oldLyrics && oldLyrics->syllabic() == Lyrics::END) {
|
||||
if (oldLyrics->endTick() >= endTick)
|
||||
oldLyrics->setTicks(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// modifyElement
|
||||
//---------------------------------------------------------
|
||||
|
@ -5173,10 +4768,9 @@ void ScoreView::layoutChanged()
|
|||
|
||||
void ScoreView::figuredBassEndEdit()
|
||||
{
|
||||
FiguredBass* fb = static_cast<FiguredBass*>(editObject);
|
||||
FiguredBass* origFb = static_cast<FiguredBass*>(origEditObject);
|
||||
FiguredBass* fb = static_cast<FiguredBass*>(editObject);
|
||||
|
||||
if (fb->isEmpty() && origFb->isEmpty())
|
||||
if (fb->isEmpty())
|
||||
fb->parent()->remove(fb);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,8 +175,7 @@ class ScoreView : public QWidget, public MuseScoreView {
|
|||
int curGrip;
|
||||
QRectF grip[MAX_GRIPS]; // edit "grips"
|
||||
int grips; // number of used grips
|
||||
Element* origEditObject;
|
||||
Element* editObject; ///< Valid in edit mode
|
||||
Element* editObject; ///< Valid in edit mode
|
||||
|
||||
//--input state:
|
||||
TextCursor* _cursor;
|
||||
|
@ -338,8 +337,6 @@ class ScoreView : public QWidget, public MuseScoreView {
|
|||
void zoom(int step, const QPoint& pos);
|
||||
void zoom(qreal _mag, const QPointF& pos);
|
||||
void contextPopup(QMouseEvent* ev);
|
||||
void setOrigEditObject(Element* e) { origEditObject = e; }
|
||||
Element* getOrigEditObject() { return origEditObject; }
|
||||
void editKey(QKeyEvent*);
|
||||
bool editKeyLyrics(QKeyEvent*);
|
||||
void dragScoreView(QMouseEvent* ev);
|
||||
|
@ -427,8 +424,9 @@ class ScoreView : public QWidget, public MuseScoreView {
|
|||
|
||||
OmrView* omrView() const { return _omrView; }
|
||||
void setOmrView(OmrView* v) { _omrView = v; }
|
||||
Element* getEditObject() { return editObject; }
|
||||
Lasso* fotoLasso() const { return _foto; }
|
||||
Element* getEditObject() { return editObject; }
|
||||
void setEditObject(Element* e) { editObject = e; }
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue