Added slur filter.
This commit is contained in:
parent
b13ab3bf3c
commit
52b870dce7
8 changed files with 238 additions and 4 deletions
|
@ -945,7 +945,7 @@ void Chord::write(Xml& xml) const
|
|||
e->write(xml);
|
||||
for (auto i : score()->spanner()) { // TODO: dont search whole list
|
||||
Spanner* s = i.second;
|
||||
if (s->generated() || s->type() != Element::Type::SLUR)
|
||||
if (s->generated() || s->type() != Element::Type::SLUR || !xml.canWrite(s))
|
||||
continue;
|
||||
|
||||
if (s->startElement() == this) {
|
||||
|
|
|
@ -285,6 +285,8 @@ bool SelectionFilter::canSelect(const Element* e) const
|
|||
&& !isFiltered(SelectionFilterType::FINGERING)) return false;
|
||||
if (e->type() == Element::Type::HARMONY
|
||||
&& !isFiltered(SelectionFilterType::CHORD_SYMBOL)) return false;
|
||||
if (e->type() == Element::Type::SLUR
|
||||
&& !isFiltered(SelectionFilterType::SLUR)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -419,9 +421,9 @@ void Selection::updateSelectedElements()
|
|||
continue;
|
||||
if (sp->type() == Element::Type::SLUR
|
||||
&& ((sp->tick() >= stick && sp->tick() < etick) || (sp->tick2() >= stick && sp->tick2() < etick)))
|
||||
_el.append(sp); // slur with start or end in range selection
|
||||
appendFiltered(sp); // slur with start or end in range selection
|
||||
else if((sp->tick() >= stick && sp->tick() < etick) && (sp->tick2() >= stick && sp->tick2() < etick))
|
||||
_el.append(sp); // spanner with start and end in range selection
|
||||
appendFiltered(sp); // spanner with start and end in range selection
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ enum class SelectionFilterType {
|
|||
LYRICS = 1 << 6,
|
||||
CHORD_SYMBOL = 1 << 7,
|
||||
ARTICULATION = 1 << 8,
|
||||
SLUR = 1 << 9,
|
||||
ALL = -1
|
||||
};
|
||||
|
||||
|
|
|
@ -1175,6 +1175,7 @@ Slur::~Slur()
|
|||
|
||||
void Slur::write(Xml& xml) const
|
||||
{
|
||||
if (!xml.canWrite(this)) return;
|
||||
xml.stag(QString("Slur id=\"%1\"").arg(xml.spannerId(this)));
|
||||
SlurTie::writeProperties(xml);
|
||||
xml.etag();
|
||||
|
|
|
@ -17,7 +17,8 @@ static const char* labels[] = {
|
|||
QT_TRANSLATE_NOOP("selectionfilter", "Fingering"),
|
||||
QT_TRANSLATE_NOOP("selectionfilter", "Lyrics"),
|
||||
QT_TRANSLATE_NOOP("selectionfilter", "Chord Symbols"),
|
||||
QT_TRANSLATE_NOOP("selectionfilter", "Articulations")
|
||||
QT_TRANSLATE_NOOP("selectionfilter", "Articulations"),
|
||||
QT_TRANSLATE_NOOP("selectionfilter", "Slurs")
|
||||
};
|
||||
|
||||
const int numLabels = sizeof(labels)/sizeof(labels[0]);
|
||||
|
|
42
mtest/libmscore/selectionfilter/selectionfilter6-ref.xml
Normal file
42
mtest/libmscore/selectionfilter/selectionfilter6-ref.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<StaffList version="1.24" tick="0" len="1920" staff="0" staves="1">
|
||||
<Staff id="0">
|
||||
<tick>0</tick>
|
||||
<Chord>
|
||||
<track>0</track>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<track>0</track>
|
||||
<pitch>72</pitch>
|
||||
<tpc>14</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<Chord>
|
||||
<track>0</track>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<track>0</track>
|
||||
<pitch>74</pitch>
|
||||
<tpc>16</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<Chord>
|
||||
<track>0</track>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<track>0</track>
|
||||
<pitch>76</pitch>
|
||||
<tpc>18</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<Chord>
|
||||
<track>0</track>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<track>0</track>
|
||||
<pitch>77</pitch>
|
||||
<tpc>13</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
</Staff>
|
||||
</StaffList>
|
186
mtest/libmscore/selectionfilter/selectionfilter6.mscx
Normal file
186
mtest/libmscore/selectionfilter/selectionfilter6.mscx
Normal file
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<museScore version="1.24">
|
||||
<Score>
|
||||
<LayerTag id="0" tag="default"></LayerTag>
|
||||
<currentLayer>0</currentLayer>
|
||||
<Division>480</Division>
|
||||
<Style>
|
||||
<page-layout>
|
||||
<page-height>1683.78</page-height>
|
||||
<page-width>1190.55</page-width>
|
||||
<page-margins type="even">
|
||||
<left-margin>56.6929</left-margin>
|
||||
<right-margin>56.6929</right-margin>
|
||||
<top-margin>56.6929</top-margin>
|
||||
<bottom-margin>113.386</bottom-margin>
|
||||
</page-margins>
|
||||
<page-margins type="odd">
|
||||
<left-margin>56.6929</left-margin>
|
||||
<right-margin>56.6929</right-margin>
|
||||
<top-margin>56.6929</top-margin>
|
||||
<bottom-margin>113.386</bottom-margin>
|
||||
</page-margins>
|
||||
</page-layout>
|
||||
<Spatium>1.76389</Spatium>
|
||||
</Style>
|
||||
<showInvisible>1</showInvisible>
|
||||
<showUnprintable>1</showUnprintable>
|
||||
<showFrames>1</showFrames>
|
||||
<showMargins>0</showMargins>
|
||||
<metaTag name="arranger"></metaTag>
|
||||
<metaTag name="composer"></metaTag>
|
||||
<metaTag name="copyright"></metaTag>
|
||||
<metaTag name="lyricist"></metaTag>
|
||||
<metaTag name="movementNumber"></metaTag>
|
||||
<metaTag name="movementTitle"></metaTag>
|
||||
<metaTag name="poet"></metaTag>
|
||||
<metaTag name="source"></metaTag>
|
||||
<metaTag name="translator"></metaTag>
|
||||
<metaTag name="workNumber"></metaTag>
|
||||
<metaTag name="workTitle">selection-filter-lyrics</metaTag>
|
||||
<PageList>
|
||||
<Page>
|
||||
<System>
|
||||
</System>
|
||||
<System>
|
||||
</System>
|
||||
</Page>
|
||||
</PageList>
|
||||
<Part>
|
||||
<Staff id="1">
|
||||
<StaffType group="pitched">
|
||||
<name>Standard</name>
|
||||
</StaffType>
|
||||
<bracket type="-1" span="0"/>
|
||||
</Staff>
|
||||
<trackName>Violin</trackName>
|
||||
<Instrument>
|
||||
<longName pos="0">Violin</longName>
|
||||
<shortName pos="0">Vln.</shortName>
|
||||
<trackName>Violin</trackName>
|
||||
<minPitchP>55</minPitchP>
|
||||
<maxPitchP>103</maxPitchP>
|
||||
<minPitchA>55</minPitchA>
|
||||
<maxPitchA>88</maxPitchA>
|
||||
<Articulation>
|
||||
<velocity>100</velocity>
|
||||
<gateTime>100</gateTime>
|
||||
</Articulation>
|
||||
<Articulation name="staccato">
|
||||
<velocity>100</velocity>
|
||||
<gateTime>50</gateTime>
|
||||
</Articulation>
|
||||
<Articulation name="tenuto">
|
||||
<velocity>100</velocity>
|
||||
<gateTime>100</gateTime>
|
||||
</Articulation>
|
||||
<Articulation name="sforzato">
|
||||
<velocity>120</velocity>
|
||||
<gateTime>100</gateTime>
|
||||
</Articulation>
|
||||
<Channel>
|
||||
<program value="40"/>
|
||||
</Channel>
|
||||
<Channel name="pizzicato">
|
||||
<program value="45"/>
|
||||
</Channel>
|
||||
<Channel name="tremolo">
|
||||
<program value="44"/>
|
||||
</Channel>
|
||||
</Instrument>
|
||||
</Part>
|
||||
<Staff id="1">
|
||||
<VBox>
|
||||
<height>10</height>
|
||||
<Text>
|
||||
<style>Title</style>
|
||||
<text>selection-filter-slurs</text>
|
||||
</Text>
|
||||
</VBox>
|
||||
<Measure number="1">
|
||||
<Clef>
|
||||
<concertClefType>G</concertClefType>
|
||||
<transposingClefType>G</transposingClefType>
|
||||
</Clef>
|
||||
<KeySig>
|
||||
<accidental>0</accidental>
|
||||
</KeySig>
|
||||
<TimeSig>
|
||||
<sigN>4</sigN>
|
||||
<sigD>4</sigD>
|
||||
<showCourtesySig>1</showCourtesySig>
|
||||
</TimeSig>
|
||||
<Slur id="2">
|
||||
<track>0</track>
|
||||
</Slur>
|
||||
<Chord>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<pitch>72</pitch>
|
||||
<tpc>14</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<endSpanner id="2"/>
|
||||
<Chord>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<pitch>74</pitch>
|
||||
<tpc>16</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<Slur id="3">
|
||||
<track>0</track>
|
||||
</Slur>
|
||||
<Chord>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<pitch>76</pitch>
|
||||
<tpc>18</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<endSpanner id="3"/>
|
||||
<Chord>
|
||||
<durationType>quarter</durationType>
|
||||
<Note>
|
||||
<pitch>77</pitch>
|
||||
<tpc>13</tpc>
|
||||
</Note>
|
||||
</Chord>
|
||||
<BarLine>
|
||||
<subtype>normal</subtype>
|
||||
<span>1</span>
|
||||
</BarLine>
|
||||
</Measure>
|
||||
<Measure number="2">
|
||||
<Rest>
|
||||
<durationType>measure</durationType>
|
||||
<duration z="4" n="4"/>
|
||||
</Rest>
|
||||
<BarLine>
|
||||
<subtype>normal</subtype>
|
||||
<span>1</span>
|
||||
</BarLine>
|
||||
</Measure>
|
||||
<Measure number="3">
|
||||
<Rest>
|
||||
<durationType>measure</durationType>
|
||||
<duration z="4" n="4"/>
|
||||
</Rest>
|
||||
<BarLine>
|
||||
<subtype>normal</subtype>
|
||||
<span>1</span>
|
||||
</BarLine>
|
||||
</Measure>
|
||||
<Measure number="4">
|
||||
<Rest>
|
||||
<durationType>measure</durationType>
|
||||
<duration z="4" n="4"/>
|
||||
</Rest>
|
||||
<BarLine>
|
||||
<subtype>end</subtype>
|
||||
<span>1</span>
|
||||
</BarLine>
|
||||
</Measure>
|
||||
</Staff>
|
||||
</Score>
|
||||
</museScore>
|
|
@ -36,6 +36,7 @@ class TestSelectionFilter : public QObject, public MTest
|
|||
void filterLyrics() { testFilter(3,SelectionFilterType::LYRICS); }
|
||||
void filterFingering() { testFilter(4,SelectionFilterType::FINGERING); }
|
||||
void filterChordSymbol() { testFilter(5,SelectionFilterType::CHORD_SYMBOL); }
|
||||
void filterSlur() { testFilter(6,SelectionFilterType::SLUR); }
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue