Skip to content

Commit

Permalink
update inspector for lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 12, 2017
1 parent b92296d commit bfebf95
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 135 deletions.
23 changes: 11 additions & 12 deletions libmscore/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ void Lyrics::add(Element* el)

void Lyrics::remove(Element* el)
{
if (el->type() == ElementType::LYRICSLINE) {
if (el->isLyricsLine()) {
// only if separator still exists and is the right one
if (_separator != nullptr && el == _separator) {
// Lyrics::remove() and LyricsLine::removeUnmanaged() call each other;
// be sure each finds a clean context
LyricsLine* separ = _separator;
_separator = nullptr;
separ->setParent(nullptr);
_separator = 0;
separ->setParent(0);
separ->removeUnmanaged();
delete separ;
}
Expand All @@ -223,9 +223,9 @@ bool Lyrics::isMelisma() const
// if so, it is a melisma only if there is no lyric in same verse on next CR
if (_syllabic == Syllabic::BEGIN || _syllabic == Syllabic::MIDDLE) {
// find next CR on same track and check for existence of lyric in same verse
ChordRest* cr = chordRest();
Segment* s = cr->segment()->next1();
ChordRest* ncr = s ? s->nextChordRest(cr->track()) : nullptr;
ChordRest* cr = chordRest();
Segment* s = cr->segment()->next1();
ChordRest* ncr = s ? s->nextChordRest(cr->track()) : 0;
if (ncr && !ncr->lyrics(_no, placement()))
return true;
}
Expand Down Expand Up @@ -475,12 +475,11 @@ Element* Lyrics::drop(const DropData& data)
Text::drop(data);
return 0;
}
Text* e = static_cast<Text*>(data.element);
// if (!(e->isText() && e->subStyle() == SubStyle::???)) {
if (!e->isText()) {
delete e;
if (!data.element->isText()) {
delete data.element;
return 0;
}
Text* e = toText(data.element);
e->setParent(this);
score()->undoAddElement(e);
return e;
Expand Down Expand Up @@ -606,13 +605,13 @@ LyricsLine::LyricsLine(Score* s)
setDiagonal(false);
setLineWidth(Spatium(Lyrics::LYRICS_DASH_DEFAULT_LINE_THICKNESS));
setAnchor(Spanner::Anchor::SEGMENT);
_nextLyrics = nullptr;
_nextLyrics = 0;
}

LyricsLine::LyricsLine(const LyricsLine& g)
: SLine(g)
{
_nextLyrics = nullptr;
_nextLyrics = 0;
}

//---------------------------------------------------------
Expand Down
6 changes: 1 addition & 5 deletions mscore/inspector/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,17 +893,15 @@ void InspectorTempoText::postInit()
//---------------------------------------------------------

InspectorLyric::InspectorLyric(QWidget* parent)
: InspectorElementBase(parent)
: InspectorTextBase(parent)
{
t.setupUi(addWidget());
l.setupUi(addWidget());

const std::vector<InspectorItem> il = {
{ P_ID::PLACEMENT, 0, 0, l.placement, l.resetPlacement },
{ P_ID::VERSE, 0, 0, l.verse, l.resetVerse }
};
const std::vector<InspectorPanel> ppList = {
{ t.title, t.panel },
{ l.title, l.panel }
};
l.placement->clear();
Expand All @@ -922,10 +920,8 @@ void InspectorLyric::valueChanged(int idx)
if (iList[idx].t == P_ID::VERSE) {
int val = getValue(iList[idx]).toInt();
Lyrics* l = toLyrics(inspector->element());
printf("value changed %d old %d\n", val, l->no());
Lyrics* nl = l->chordRest()->lyrics(val, l->placement());
if (nl) {
printf(" move away %d -> %d\n", nl->no(), l->no());
nl->undoChangeProperty(P_ID::VERSE, l->no());
}
}
Expand Down
3 changes: 1 addition & 2 deletions mscore/inspector/inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,9 @@ class InspectorTempoText : public InspectorTextBase {
// InspectorLyric
//---------------------------------------------------------

class InspectorLyric : public InspectorElementBase {
class InspectorLyric : public InspectorTextBase {
Q_OBJECT

Ui::InspectorText t;
Ui::InspectorLyric l;

private slots:
Expand Down
6 changes: 3 additions & 3 deletions mscore/inspector/inspector_stafftypechange.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>199</width>
<height>323</height>
<width>266</width>
<height>428</height>
</rect>
</property>
<property name="accessibleName">
Expand Down Expand Up @@ -472,7 +472,7 @@
<number>1</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
<double>-20.000000000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
Expand Down
2 changes: 1 addition & 1 deletion mtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ subdirs (
libmscore/rhythmicGrouping
libmscore/selectionfilter
libmscore/selectionrangedelete
# libmscore/spanners
libmscore/spanners
libmscore/split
libmscore/splitstaff
libmscore/timesig
Expand Down
21 changes: 1 addition & 20 deletions mtest/libmscore/spanners/lyricsline02-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Chord>
<durationType>quarter</durationType>
<Lyrics>
<ticks>1440</ticks>
<ticks>480</ticks>
<text>A</text>
</Lyrics>
<Note>
Expand All @@ -102,25 +102,6 @@
</Chord>
</Measure>
<Measure number="2">
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>74</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Rest>
<durationType>half</durationType>
</Rest>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
Expand Down
23 changes: 0 additions & 23 deletions mtest/libmscore/spanners/lyricsline03-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,6 @@
</Rest>
</Measure>
<Measure number="2">
<Rest>
<durationType>half</durationType>
</Rest>
<Chord>
<durationType>quarter</durationType>
<Lyrics>
<ticks>1440</ticks>
<text>A</text>
</Lyrics>
<Note>
<pitch>69</pitch>
<tpc>17</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
</Measure>
<Measure number="3">
<Chord>
<durationType>quarter</durationType>
<Note>
Expand Down
23 changes: 0 additions & 23 deletions mtest/libmscore/spanners/lyricsline04-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,6 @@
</Rest>
</Measure>
<Measure number="2">
<Rest>
<durationType>half</durationType>
</Rest>
<Chord>
<durationType>quarter</durationType>
<Lyrics>
<ticks>480</ticks>
<text>A</text>
</Lyrics>
<Note>
<pitch>69</pitch>
<tpc>17</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
Expand Down
32 changes: 1 addition & 31 deletions mtest/libmscore/spanners/lyricsline05-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<Chord>
<durationType>quarter</durationType>
<Lyrics>
<ticks>2400</ticks>
<ticks>480</ticks>
<text>A</text>
</Lyrics>
<Note>
Expand All @@ -98,36 +98,6 @@
</Chord>
</Measure>
<Measure number="2">
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>74</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
</Measure>
<Measure number="3">
<Chord>
<durationType>quarter</durationType>
<Note>
Expand Down
16 changes: 1 addition & 15 deletions mtest/libmscore/spanners/tst_spanners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void TestSpanners::spanners01()

MasterScore* score = readScore(DIR + "glissando01.mscx");
QVERIFY(score);
score->doLayout();

// SIMPLE CASE: GLISSANDO FROM A NOTE TO THE FOLLOWING
// go to top note of first chord
Expand Down Expand Up @@ -174,7 +173,6 @@ void TestSpanners::spanners02()
{
MasterScore* score = readScore(DIR + "glissando-crossstaff01.mscx");
QVERIFY(score);
score->doLayout();

QVERIFY(saveCompareScore(score, "glissando-crsossstaff01.mscx", DIR + "glissando-crossstaff01-ref.mscx"));
delete score;
Expand All @@ -192,7 +190,6 @@ void TestSpanners::spanners03()

MasterScore* score = readScore(DIR + "glissando-graces01.mscx");
QVERIFY(score);
score->doLayout();

// GLISSANDO FROM MAIN NOTE TO AFTER-GRACE
// go to top note of first chord
Expand Down Expand Up @@ -263,7 +260,6 @@ void TestSpanners::spanners04()
{
MasterScore* score = readScore(DIR + "glissando-cloning01.mscx");
QVERIFY(score);
score->doLayout();

// add a linked staff to the existing staff
// (copied and adapted from void MuseScore::editInstrList() in mscore/instrdialog.cpp)
Expand Down Expand Up @@ -293,7 +289,6 @@ void TestSpanners::spanners05()
{
MasterScore* score = readScore(DIR + "glissando-cloning02.mscx");
QVERIFY(score);
score->doLayout();

// create parts
// (copied and adapted from void TestParts::createParts() in mtest/libmscore/parts/tst_parts.cpp)
Expand Down Expand Up @@ -329,7 +324,6 @@ void TestSpanners::spanners06()

MasterScore* score = readScore(DIR + "glissando-cloning03.mscx");
QVERIFY(score);
score->doLayout();

// DROP A GLISSANDO ON FIRST NOTE
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -362,7 +356,6 @@ void TestSpanners::spanners07()

MasterScore* score = readScore(DIR + "glissando-cloning04.mscx");
QVERIFY(score);
score->doLayout();

// DROP A GLISSANDO ON FIRST NOTE
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -392,7 +385,6 @@ void TestSpanners::spanners08()
{
MasterScore* score = readScore(DIR + "lyricsline01.mscx");
QVERIFY(score);
score->doLayout();

// verify initial LyricsLine setup
System* sys = score->systems().at(0);
Expand Down Expand Up @@ -445,10 +437,9 @@ void TestSpanners::spanners09()
{
MasterScore* score = readScore(DIR + "lyricsline02.mscx");
QVERIFY(score);
score->doLayout();

// DELETE SECOND MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
Measure* msr = score->firstMeasure();
QVERIFY(msr);
msr = msr->nextMeasure();
QVERIFY(msr);
Expand Down Expand Up @@ -478,7 +469,6 @@ void TestSpanners::spanners10()
{
MasterScore* score = readScore(DIR + "lyricsline03.mscx");
QVERIFY(score);
score->doLayout();

// DELETE SECOND MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -511,7 +501,6 @@ void TestSpanners::spanners11()
{
MasterScore* score = readScore(DIR + "lyricsline04.mscx");
QVERIFY(score);
score->doLayout();

// DELETE SECOND MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -544,7 +533,6 @@ void TestSpanners::spanners12()
{
MasterScore* score = readScore(DIR + "lyricsline05.mscx");
QVERIFY(score);
score->doLayout();

// DELETE SECOND MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -577,7 +565,6 @@ void TestSpanners::spanners13()

MasterScore* score = readScore(DIR + "lyricsline06.mscx");
QVERIFY(score);
score->doLayout();

// DROP A BREAK AT FIRST MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
Expand Down Expand Up @@ -611,7 +598,6 @@ void TestSpanners::spanners14()
{
MasterScore* score = readScore(DIR + "glissando-cloning05.mscx");
QVERIFY(score);
score->doLayout();

// create parts
// (copied and adapted from void TestParts::createParts() in mtest/libmscore/parts/tst_parts.cpp)
Expand Down

0 comments on commit bfebf95

Please sign in to comment.