Skip to content

Commit

Permalink
Merge pull request #5502 from Git-Lior/bugfix-select-more
Browse files Browse the repository at this point in the history
fix #297549: Selecting notes by duration matches notes with different duration
  • Loading branch information
dmitrio95 committed Dec 25, 2019
2 parents 9003987 + 75df39e commit 89b2c34
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
4 changes: 3 additions & 1 deletion libmscore/score.cpp
Expand Up @@ -3275,7 +3275,9 @@ void Score::collectNoteMatch(void* data, Element* e)
return;
if (p->notehead != NoteHead::Group::HEAD_INVALID && p->notehead != n->headGroup())
return;
if (p->duration.type() != TDuration::DurationType::V_INVALID && p->duration != n->chord()->actualDurationType())
if (p->durationType.type() != TDuration::DurationType::V_INVALID && p->durationType != n->chord()->actualDurationType())
return;
if (p->durationTicks != Fraction(-1,1) && p->durationTicks != n->chord()->actualTicks())
return;
if ((p->staffStart != -1)
&& ((p->staffStart > e->staffIdx()) || (p->staffEnd <= e->staffIdx())))
Expand Down
3 changes: 2 additions & 1 deletion libmscore/select.h
Expand Up @@ -55,7 +55,8 @@ struct NotePattern {
int string = STRING_NONE;
int tpc = Tpc::TPC_INVALID;;
NoteHead::Group notehead = NoteHead::Group::HEAD_INVALID;
TDuration duration = TDuration();
TDuration durationType = TDuration();
Fraction durationTicks;
NoteType type = NoteType::INVALID;
int staffStart;
int staffEnd; // exclusive
Expand Down
12 changes: 9 additions & 3 deletions mscore/selectnotedialog.cpp
Expand Up @@ -49,7 +49,8 @@ SelectNoteDialog::SelectNoteDialog(const Note* _n, QWidget* parent)
pitch->setText(n->tpcUserName());
string->setText(QString::number(n->string()+1));
type->setText(n->noteTypeUserName());
duration->setText(n->chord()->durationUserName());
durationType->setText(tr("%1 Note").arg(n->chord()->durationType().durationTypeUserName()));
durationTicks->setText(n->chord()->durationUserName());
name->setText(tpc2name(n->tpc(), NoteSpellingType::STANDARD, NoteCaseType::AUTO, false));
inSelection->setEnabled(n->score()->selection().isRange());
MuseScore::restoreGeometry(this);
Expand All @@ -71,8 +72,13 @@ void SelectNoteDialog::setPattern(NotePattern* p)
p->tpc = n->tpc();
if (sameType->isChecked())
p->type = n->noteType();
if (sameDuration->isChecked())
p->duration = n->chord()->actualDurationType();
if (sameDurationType->isChecked())
p->durationType = n->chord()->actualDurationType();

if (sameDurationTicks->isChecked())
p->durationTicks = n->chord()->actualTicks();
else
p->durationTicks = Fraction(-1,1);

if (sameStaff->isChecked()) {
p->staffStart = n->staffIdx();
Expand Down
35 changes: 25 additions & 10 deletions mscore/selectnotedialog.ui
Expand Up @@ -48,42 +48,56 @@
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="sameSystem">
<property name="text">
<string>Same system</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QCheckBox" name="sameVoice">
<property name="text">
<string>Same voice</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="duration">
<widget class="QLabel" name="durationType">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="sameDuration">
<widget class="QCheckBox" name="sameDurationType">
<property name="text">
<string>Same note type:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="durationTicks">
<property name="text">
<string>Same duration:</string>
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="sameDurationTicks">
<property name="text">
<string>Same duration:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="samePitch">
<property name="text">
<string>Same pitch:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="inSelection">
<property name="text">
<string>In selection</string>
Expand All @@ -97,7 +111,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="sameStaff">
<property name="text">
<string>Same staff</string>
Expand All @@ -118,14 +132,14 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="sameName">
<property name="text">
<string>Same note name:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLabel" name="name">
<property name="text">
<string/>
Expand Down Expand Up @@ -217,7 +231,8 @@
<tabstop>samePitch</tabstop>
<tabstop>sameString</tabstop>
<tabstop>sameType</tabstop>
<tabstop>sameDuration</tabstop>
<tabstop>sameDurationType</tabstop>
<tabstop>sameDurationTicks</tabstop>
<tabstop>sameName</tabstop>
<tabstop>sameStaff</tabstop>
<tabstop>inSelection</tabstop>
Expand Down

0 comments on commit 89b2c34

Please sign in to comment.