void PowerTabOldImporter::convert(const PowerTabDocument::KeySignature &oldKey, KeySignature &key) { key.setKeyType(static_cast<KeySignature::KeyType>(oldKey.GetKeyType())); key.setNumAccidentals(oldKey.GetKeyAccidentalsIncludingCancel()); key.setSharps(oldKey.UsesSharps()); key.setVisible(oldKey.IsShown()); key.setCancellation(oldKey.IsCancellation()); }
void EditKeySignature::updateFollowingKeySignatures(const KeySignature &oldKey, const KeySignature &newKey) { Score &score = myLocation.getScore(); const int startSystem = myLocation.getSystemIndex(); for (unsigned int i = startSystem; i < score.getSystems().size(); ++i) { for (Barline &bar : score.getSystems()[i].getBarlines()) { if (i == startSystem && bar.getPosition() <= myLocation.getPositionIndex()) { continue; } const KeySignature ¤tKey = bar.getKeySignature(); if (currentKey.getKeyType() == oldKey.getKeyType() && currentKey.getNumAccidentals() == oldKey.getNumAccidentals() && currentKey.usesSharps() == oldKey.usesSharps()) { KeySignature key; key.setVisible(bar.getKeySignature().isVisible()); key.setCancellation(bar.getKeySignature().isCancellation()); key.setSharps(newKey.usesSharps()); key.setKeyType(newKey.getKeyType()); key.setNumAccidentals(newKey.getNumAccidentals()); bar.setKeySignature(key); } else { return; } } } }