Fix #22996 - Wrong clef when selecting standard staff type in instrument wizard.
In the instrument wizard, when a staff is changed to standard type (from a previous different type), the standard clef of the istrument is lost. Changes: - Added a member variable to `StaffListItem` storing the default standard clef for the instrument. - Modified `instruments.xml' to remove <clef> tags from tablature instrument definitions: all these instruments are inited from a standard-staff main entry, recording the default standard clef; this clef is used to init the `StaffListItem::_defaultClef` member variable. NOTE: Percussion instruments are not covered (an number of percussion instruments seem to have old-style definitions in `instruments.xml`); conversion from percussion to standard staff may yield unexpected results.
This commit is contained in:
parent
6e452dbe49
commit
b8ecd49905
4 changed files with 31 additions and 19 deletions
|
@ -61,7 +61,7 @@ StaffListItem::StaffListItem(PartListItem* li)
|
|||
setPartIdx(0);
|
||||
staffIdx = 0;
|
||||
setLinked(false);
|
||||
setClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
setDefaultClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
_staffTypeCombo = 0;
|
||||
initStaffTypeCombo();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ StaffListItem::StaffListItem()
|
|||
staff = 0;
|
||||
setPartIdx(0);
|
||||
staffIdx = 0;
|
||||
setClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
setDefaultClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
setLinked(false);
|
||||
_staffTypeCombo = 0;
|
||||
}
|
||||
|
@ -129,6 +129,16 @@ void StaffListItem::setPartIdx(int val)
|
|||
setText(0, InstrumentsDialog::tr("Staff %1").arg(_partIdx + 1));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setDefaultClef
|
||||
//---------------------------------------------------------
|
||||
|
||||
void StaffListItem::setDefaultClef(const ClefTypeList& val)
|
||||
{
|
||||
_defaultClef = val;
|
||||
setClef(val);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setClef
|
||||
//---------------------------------------------------------
|
||||
|
@ -210,10 +220,10 @@ void StaffListItem::staffTypeChanged(int idx)
|
|||
ClefType clefType;
|
||||
switch (stfType->group()) {
|
||||
case STANDARD_STAFF_GROUP:
|
||||
clefType = ClefType::G3;
|
||||
clefType = _defaultClef._transposingClef;
|
||||
break;
|
||||
case TAB_STAFF_GROUP:
|
||||
clefType = ClefType::TAB2;
|
||||
clefType = ClefType::TAB;
|
||||
break;
|
||||
case PERCUSSION_STAFF_GROUP:
|
||||
clefType = ClefType::PERC;
|
||||
|
@ -548,7 +558,7 @@ void InstrumentsDialog::on_addButton_clicked()
|
|||
sli->staff = 0;
|
||||
sli->setPartIdx(i);
|
||||
sli->staffIdx = -1;
|
||||
sli->setClef(it->clefTypes[i]);
|
||||
sli->setDefaultClef(it->clefTypes[i]);
|
||||
sli->setStaffType(it->staffTypePreset);
|
||||
}
|
||||
partiturList->setItemExpanded(pli, true);
|
||||
|
@ -795,7 +805,7 @@ void InstrumentsDialog::on_belowButton_clicked()
|
|||
PartListItem* pli = (PartListItem*)sli->QTreeWidgetItem::parent();
|
||||
StaffListItem* nsli = new StaffListItem();
|
||||
nsli->staff = staff;
|
||||
nsli->setClef(sli->clef());
|
||||
nsli->setDefaultClef(sli->clef());
|
||||
if (staff)
|
||||
nsli->op = ITEM_ADD;
|
||||
pli->insertChild(pli->indexOfChild(sli)+1, nsli);
|
||||
|
@ -823,7 +833,7 @@ void InstrumentsDialog::on_linkedButton_clicked()
|
|||
PartListItem* pli = (PartListItem*)sli->QTreeWidgetItem::parent();
|
||||
StaffListItem* nsli = new StaffListItem();
|
||||
nsli->staff = staff;
|
||||
nsli->setClef(sli->clef());
|
||||
nsli->setDefaultClef(sli->clef());
|
||||
nsli->setLinked(true);
|
||||
if (staff)
|
||||
nsli->op = ITEM_ADD;
|
||||
|
|
|
@ -64,6 +64,7 @@ class PartListItem : public QTreeWidgetItem {
|
|||
class StaffListItem : public QObject, public QTreeWidgetItem {
|
||||
Q_OBJECT
|
||||
ClefTypeList _clef;
|
||||
ClefTypeList _defaultClef; // the clef to use when the staff type does not mandate a specific clef
|
||||
int _partIdx;
|
||||
bool _linked;
|
||||
QComboBox* _staffTypeCombo;
|
||||
|
@ -83,6 +84,7 @@ class StaffListItem : public QObject, public QTreeWidgetItem {
|
|||
|
||||
void setClef(const ClefTypeList& val);
|
||||
const ClefTypeList& clef() const { return _clef; }
|
||||
void setDefaultClef(const ClefTypeList& val);
|
||||
void setLinked(bool val);
|
||||
bool linked() const { return _linked; }
|
||||
void setStaffType(const StaffType*);
|
||||
|
|
|
@ -207,9 +207,9 @@ void InstrumentWizard::on_addButton_clicked()
|
|||
sli->setPartIdx(i);
|
||||
sli->staffIdx = -1;
|
||||
if (i > MAX_STAVES)
|
||||
sli->setClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
sli->setDefaultClef(ClefTypeList(ClefType::G, ClefType::G));
|
||||
else
|
||||
sli->setClef(it->clefTypes[i]);
|
||||
sli->setDefaultClef(it->clefTypes[i]);
|
||||
sli->setStaffType(it->staffTypePreset);
|
||||
}
|
||||
partiturList->setItemExpanded(pli, true);
|
||||
|
@ -388,7 +388,7 @@ void InstrumentWizard::on_linkedButton_clicked()
|
|||
pli->setVisible(true);
|
||||
StaffListItem* nsli = new StaffListItem();
|
||||
nsli->staff = staff;
|
||||
nsli->setClef(sli->clef());
|
||||
nsli->setDefaultClef(sli->clef());
|
||||
nsli->setLinked(true);
|
||||
if (staff)
|
||||
nsli->op = ITEM_ADD;
|
||||
|
@ -417,7 +417,7 @@ void InstrumentWizard::on_belowButton_clicked()
|
|||
PartListItem* pli = (PartListItem*)sli->QTreeWidgetItem::parent();
|
||||
StaffListItem* nsli = new StaffListItem();
|
||||
nsli->staff = staff;
|
||||
nsli->setClef(sli->clef());
|
||||
nsli->setDefaultClef(sli->clef());
|
||||
if (staff)
|
||||
nsli->op = ITEM_ADD;
|
||||
pli->insertChild(pli->indexOfChild(sli)+1, nsli);
|
||||
|
|
|
@ -7935,7 +7935,7 @@
|
|||
<description>Acoustic Nylon Strung Guitar (Tablature)</description>
|
||||
<musicXMLid>pluck.guitar.nylon-string</musicXMLid>
|
||||
<stafftype staffTypePreset="tab6StrCommon">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>common</genre>
|
||||
</Instrument>
|
||||
<Instrument id="guitar-steel">
|
||||
|
@ -7968,7 +7968,7 @@
|
|||
<description>Acoustic Steel Strung Guitar (Tablature)</description>
|
||||
<musicXMLid>pluck.guitar.acoustic</musicXMLid>
|
||||
<stafftype staffTypePreset="tab6StrCommon">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>common</genre>
|
||||
</Instrument>
|
||||
<Instrument id="11-string-alto-guitar">
|
||||
|
@ -8043,7 +8043,7 @@
|
|||
<init>electric-guitar</init>
|
||||
<description>Electric Guitar (Tablature)</description>
|
||||
<stafftype staffTypePreset="tab6StrCommon">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>common</genre>
|
||||
</Instrument>
|
||||
<Instrument id="harp">
|
||||
|
@ -8108,7 +8108,7 @@
|
|||
<description>Lute (Tablature)</description>
|
||||
<musicXMLid>pluck.lute</musicXMLid>
|
||||
<stafftype staffTypePreset="tab6StrFrench">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>earlymusic</genre>
|
||||
</Instrument>
|
||||
<Instrument id="ren.-tenor-lute-5-course">
|
||||
|
@ -8488,7 +8488,7 @@
|
|||
<description>Ukulele (4-str. TAB)</description>
|
||||
<musicXMLid>pluck.ukulele</musicXMLid>
|
||||
<stafftype staffTypePreset="tabUkulele">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
</Instrument>
|
||||
<Instrument id="tenor-ukulele">
|
||||
<longName>Tenor Ukulele</longName>
|
||||
|
@ -8558,7 +8558,7 @@
|
|||
<description>Bass Guitar (Tablature)</description>
|
||||
<musicXMLid>pluck.bass</musicXMLid>
|
||||
<stafftype staffTypePreset="tab4StrCommon">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>common</genre>
|
||||
</Instrument>
|
||||
<Instrument id="acoustic-bass">
|
||||
|
@ -8604,7 +8604,7 @@
|
|||
<description>Electric Bass (Tablature)</description>
|
||||
<musicXMLid>pluck.bass.electric</musicXMLid>
|
||||
<stafftype staffTypePreset="tab4StrCommon">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>common</genre>
|
||||
</Instrument>
|
||||
<Instrument id="fretless-electric-bass">
|
||||
|
@ -8874,7 +8874,7 @@
|
|||
<init>viola-da-gamba</init>
|
||||
<description>Viola da gamba (Tablature)</description>
|
||||
<stafftype staffTypePreset="tab6StrFrench">tablature</stafftype>
|
||||
<clef>TAB</clef>
|
||||
<!-- <clef>TAB</clef> -->
|
||||
<genre>earlymusic</genre>
|
||||
</Instrument>
|
||||
<!-- Viola da Gamba (6 string) removed as a duplication -->
|
||||
|
|
Loading…
Reference in a new issue