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

Transpose tool will only transpose initial key signature … #18530

Merged
merged 3 commits into from
Oct 30, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/engraving/dom/transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ bool Score::transpose(TransposeMode mode, TransposeDirection direction, Key trKe
} else if (e->isKeySig() && trKeys && mode != TransposeMode::DIATONICALLY) {
KeySig* ks = toKeySig(e);
Fraction tick = segment->tick();
bool startKey = tick == s1->tick();
bool startKey = tick == s1->tick() && !isFirstSystemKeySig(ks);
bool addKey = ks->isChange();
if ((startKey || addKey) && !ks->isAtonal()) {
Staff* staff = ks->staff();
Expand Down
13 changes: 13 additions & 0 deletions src/engraving/dom/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "chord.h"
#include "chordrest.h"
#include "clef.h"
#include "keysig.h"
#include "measure.h"
#include "note.h"
#include "page.h"
Expand Down Expand Up @@ -1334,4 +1335,16 @@ String formatUniqueExcerptName(const String& baseName, const StringList& allExce

return result;
}

bool isFirstSystemKeySig(const KeySig* ks)
{
if (!ks) {
return false;
}
const System* sys = ks->measure()->system();
if (!sys) {
return false;
}
return ks->tick() == sys->firstMeasure()->tick();
cbjeukendrup marked this conversation as resolved.
Show resolved Hide resolved
}
}
5 changes: 4 additions & 1 deletion src/engraving/dom/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@

namespace mu::engraving {
class Chord;
class EngravingItem;
class KeySig;
class Note;
class Rest;
class Segment;
class System;
class Tuplet;
class EngravingItem;

enum class Key;

Expand Down Expand Up @@ -92,5 +93,7 @@ extern void collectChordsOverlappingRests(Segment* segment, staff_idx_t staffIdx
extern Interval ornamentIntervalToGeneralInterval(OrnamentInterval interval);

extern String formatUniqueExcerptName(const String& baseName, const StringList& allExcerptLowerNames);

extern bool isFirstSystemKeySig(const KeySig* ks);
} // namespace mu::engraving
#endif