fix #117061 concert pitch button doesn't do anything

This commit is contained in:
werner 2016-07-04 09:27:43 +02:00
parent ae781b286b
commit 9144b25277
5 changed files with 8 additions and 42 deletions

View file

@ -2314,7 +2314,7 @@ void Score::sortStaves(QList<int>& dst)
void Score::cmdConcertPitchChanged(bool flag, bool /*useDoubleSharpsFlats*/)
{
undo(new ChangeConcertPitch(this, flag)); // change style flag
undo(new ChangeStyleVal(this, StyleIdx::concertPitch, flag)); // change style flag
for (Staff* staff : _staves) {
if (staff->staffType()->group() == StaffGroup::PERCUSSION)
@ -2337,7 +2337,7 @@ void Score::cmdConcertPitchChanged(bool flag, bool /*useDoubleSharpsFlats*/)
if (!flag)
interval.flip();
for (Element* e : segment->annotations()) {
if ((e->type() != Element::Type::HARMONY) || (e->track() < startTrack) || (e->track() >= endTrack))
if (!e->isHarmony() || (e->track() < startTrack) || (e->track() >= endTrack))
continue;
Harmony* h = toHarmony(e);
int rootTpc = transposeTpc(h->rootTpc(), interval, true);

View file

@ -1619,28 +1619,6 @@ const char* RemoveElement::name() const
return buffer;
}
//---------------------------------------------------------
// ChangeConcertPitch
//---------------------------------------------------------
ChangeConcertPitch::ChangeConcertPitch(Score* s, bool v)
{
score = s;
val = v;
}
//---------------------------------------------------------
// flip
//---------------------------------------------------------
void ChangeConcertPitch::flip()
{
int oval = int(score->styleB(StyleIdx::concertPitch));
score->style()->set(StyleIdx::concertPitch, val);
score->setLayoutAll();
val = oval;
}
//---------------------------------------------------------
// InsertPart
//---------------------------------------------------------

View file

@ -546,20 +546,6 @@ class RemoveElement : public UndoCommand {
virtual const char* name() const override;
};
//---------------------------------------------------------
// ChangeConcertPitch
//---------------------------------------------------------
class ChangeConcertPitch : public UndoCommand {
Score* score;
bool val;
void flip();
public:
ChangeConcertPitch(Score* s, bool val);
UNDO_NAME("ChangeConcertPitch")
};
//---------------------------------------------------------
// EditText
//---------------------------------------------------------

View file

@ -4948,7 +4948,7 @@ void ExportMusicXml::write(QIODevice* dev)
bool concertPitch = score()->styleB(StyleIdx::concertPitch);
if (concertPitch) {
score()->startCmd();
score()->undo(new ChangeConcertPitch(score(), false));
score()->undo(new ChangeStyleVal(score(), StyleIdx::concertPitch, false));
score()->doLayout(); // this is only allowed in a cmd context to not corrupt the undo/redo stack
}

View file

@ -741,7 +741,9 @@ MuseScore::MuseScore()
cpitchTools = addToolBar("");
cpitchTools->setObjectName("pitch-tools");
cpitchTools->addWidget(new AccessibleToolButton( cpitchTools, getAction("concert-pitch")));
a = getAction("concert-pitch");
a->setCheckable(true);
cpitchTools->addWidget(new AccessibleToolButton(cpitchTools, a));
//-------------------------------
// Image Capture Tool Bar
@ -1287,9 +1289,9 @@ void MuseScore::retranslate(bool firstStart)
viewModeCombo->setItemText(viewModeCombo->findData(int(LayoutMode::PAGE)), tr("Page View"));
viewModeCombo->setItemText(viewModeCombo->findData(int(LayoutMode::LINE)), tr("Continuous View"));
viewModeCombo->setItemText(viewModeCombo->findData(int(LayoutMode::SYSTEM)), tr("Single Page"));
showMidiImportButton->setText(tr("Show MIDI import panel"));
Shortcut::retranslate();
if (!firstStart && Workspace::currentWorkspace->readOnly()) {
changeWorkspace(Workspace::currentWorkspace);