fix #22353: Bass clef appears in drums

This commit is contained in:
Andrey M. Tokarev 2013-08-24 22:32:48 +04:00
parent 95de82de22
commit 3d7121d3da
4 changed files with 8 additions and 4 deletions

View file

@ -492,7 +492,7 @@ void MTrack::convertTrack(const ReducedFraction &lastTick)
const auto swingType = preferences.midiImportOperations.trackOperations(indexOfOperation).swing;
Swing::detectSwing(staff, swingType);
MidiClef::createClefs(staff, indexOfOperation);
MidiClef::createClefs(staff, indexOfOperation, mtrack->drumTrack());
}
Fraction metaTimeSignature(const MidiEvent& e)

View file

@ -212,13 +212,13 @@ Segment* enlargeSegToPrev(Segment *s, int strack, int counterLimit, int lPitch,
return s;
}
void createClefs(Staff *staff, int indexOfOperation)
void createClefs(Staff *staff, int indexOfOperation, bool isDrumTrack)
{
ClefType currentClef = staff->initialClef()._concertClef;
createClef(currentClef, staff, 0);
const auto trackOpers = preferences.midiImportOperations.trackOperations(indexOfOperation);
if (!trackOpers.changeClef)
if (!trackOpers.changeClef || isDrumTrack)
return;
const int highPitch = 65; // all notes equal or upper - in treble clef

View file

@ -10,7 +10,7 @@ class Staff;
namespace MidiClef {
void createClefs(Staff *staff, int indexOfOperation);
void createClefs(Staff *staff, int indexOfOperation, bool isDrumTrack);
int midPitch();
ClefType clefTypeFromAveragePitch(int averagePitch);

View file

@ -31,6 +31,7 @@ struct Controller {
Node *splitDrums = nullptr;
Node *showStaffBracket = nullptr;
Node *pickupMeasure = nullptr;
Node *clef = nullptr;
int trackCount = 0;
bool isDrumTrack = false;
@ -187,6 +188,7 @@ OperationsModel::OperationsModel()
changeClef->oper.value = TrackOperations().changeClef;
changeClef->parent = root.get();
root->children.push_back(std::unique_ptr<Node>(changeClef));
controller->clef = changeClef;
Node *splitDrums = new Node;
@ -621,6 +623,8 @@ bool Controller::updateNodeDependencies(Node *node, bool forceUpdate)
splitDrums->visible = isDrumTrack;
if (multipleVoices)
multipleVoices->visible = !isDrumTrack;
if (clef)
clef->visible = !isDrumTrack;
if (pickupMeasure)
pickupMeasure->visible = allTracksSelected;
result = true;