Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changing of clef when switching to a different instrument #819

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions mscore/editstaff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ EditStaff::EditStaff(Staff* s, QWidget* parent)
staff->setStaffType(orgStaff->staffType());
staff->setPart(part);

instrumentClefChanged.first = false;

// hide string data controls if instrument has no strings
stringDataFrame->setVisible(instrument.stringData() && instrument.stringData()->strings() > 0);
// set dlg controls
Expand Down Expand Up @@ -228,6 +230,9 @@ void EditStaff::apply()
instrument.setShortName(shortName->toPlainText());
instrument.setLongName(longName->toPlainText());

if(instrumentClefChanged.first)
score->undoChangeClef(orgStaff,score->firstSegment(),instrumentClefChanged.second);

bool s = small->isChecked();
bool inv = invisible->isChecked();
qreal userDist = spinExtraDistance->value();
Expand Down Expand Up @@ -358,6 +363,13 @@ void EditStaff::showInstrumentDialog()
if (si.exec()) {
instrument = Instrument::fromTemplate(si.instrTemplate());
updateInstrument();
bool concertPitch = staff->score()->styleB(StyleIdx::concertPitch);
if (concertPitch)
instrumentClefChanged.second = si.instrTemplate()->clefTypes[0]._concertClef;
else
instrumentClefChanged.second = si.instrTemplate()->clefTypes[0]._transposingClef;

instrumentClefChanged.first = true;
}
}

Expand Down
2 changes: 2 additions & 0 deletions mscore/editstaff.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Ms {

class Staff;
class InstrumentTemplate;
enum class ClefType : signed char;

//---------------------------------------------------------
// EditStaff
Expand All @@ -42,6 +43,7 @@ class EditStaff : public QDialog, private Ui::EditStaffBase {
Staff* staff;
Staff* orgStaff;
Instrument instrument;
std::pair<bool,ClefType> instrumentClefChanged;
int _minPitchA, _maxPitchA, _minPitchP, _maxPitchP;

void apply();
Expand Down