Merge pull request #11423 from cbjeukendrup/const_ref_instead_of_ptr

Simplify by using const references instead of pointers
This commit is contained in:
RomanPudashkin 2022-04-27 16:17:52 +02:00 committed by GitHub
commit ad9e02a6be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 232 additions and 250 deletions

View file

@ -505,11 +505,11 @@ static qreal sff2(qreal width, qreal xMin, const SpringMap& springs)
// respace
//---------------------------------------------------------
void LayoutBeams::respace(std::vector<ChordRest*>* elements)
void LayoutBeams::respace(const std::vector<ChordRest*>& elements)
{
ChordRest* cr1 = elements->front();
ChordRest* cr2 = elements->back();
int n = int(elements->size());
ChordRest* cr1 = elements.front();
ChordRest* cr2 = elements.back();
int n = int(elements.size());
qreal x1 = cr1->segment()->pos().x();
qreal x2 = cr2->segment()->pos().x();
@ -525,8 +525,8 @@ void LayoutBeams::respace(std::vector<ChordRest*>* elements)
int minTick = 100000;
for (int i = 0; i < n - 1; ++i) {
ChordRest* cr = (*elements)[i];
ChordRest* ncr = (*elements)[i + 1];
ChordRest* cr = elements[i];
ChordRest* ncr = elements[i + 1];
width[i] = cr->shape().minHorizontalDistance(ncr->shape(), cr->score());
ticksList[i] = cr->ticks().ticks();
minTick = qMin(ticksList[i], minTick);
@ -563,7 +563,7 @@ void LayoutBeams::respace(std::vector<ChordRest*>* elements)
qreal x = x1;
for (int i = 1; i < n - 1; ++i) {
x += width[i - 1];
ChordRest* cr = (*elements)[i];
ChordRest* cr = elements[i];
qreal dx = x - cr->segment()->pos().x();
cr->rxpos() += dx;
}

View file

@ -42,7 +42,7 @@ public:
static void createBeams(Ms::Score* score, LayoutContext& lc, Ms::Measure* measure);
static void restoreBeams(Ms::Measure* m);
static void breakCrossMeasureBeams(const LayoutContext& ctx, Ms::Measure* measure);
static void respace(std::vector<Ms::ChordRest*>* elements);
static void respace(const std::vector<Ms::ChordRest*>& elements);
private:
static void beamGraceNotes(Ms::Score* score, Ms::Chord* mainNote, bool after);

View file

@ -512,7 +512,7 @@ void LayoutPage::distributeStaves(const LayoutContext& ctx, Page* page, qreal fo
int endNormalBracket { -1 };
int endCurlyBracket { -1 };
int staffNr { -1 };
for (SysStaff* sysStaff : *system->staves()) {
for (SysStaff* sysStaff : system->staves()) {
Staff* staff { score->staff(++staffNr) };
IF_ASSERT_FAILED(staff) {
break;

View file

@ -532,10 +532,10 @@ void LayoutSystem::hideEmptyStaves(Score* score, System* system, bool isFirstSys
}
// check if notes moved into this staff
Part* part = staff->part();
size_t n = part->nstaves();
const size_t n = part->nstaves();
if (hideStaff && (n > 1)) {
staff_idx_t idx = part->staves()->front()->idx();
for (staff_idx_t i = 0; i < part->nstaves(); ++i) {
staff_idx_t idx = part->staves().front()->idx();
for (staff_idx_t i = 0; i < n; ++i) {
staff_idx_t st = idx + i;
for (MeasureBase* mb : system->measures()) {
@ -1215,7 +1215,7 @@ void LayoutSystem::processLines(System* system, std::vector<Spanner*> lines, boo
}
if (align && segments.size() > 1) {
const size_t nstaves = system->staves()->size();
const size_t nstaves = system->staves().size();
constexpr qreal minY = -1000000.0;
const qreal defaultY = segments[0]->rypos();
std::vector<qreal> y(nstaves, minY);

View file

@ -478,7 +478,7 @@ bool Arpeggio::edit(EditData& ed)
Staff* s = staff();
Part* part = s->part();
size_t n = part->nstaves();
staff_idx_t ridx = mu::indexOf(*part->staves(), s);
staff_idx_t ridx = mu::indexOf(part->staves(), s);
if (ridx != mu::nidx) {
if (_span + ridx < n) {
++_span;

View file

@ -1087,7 +1087,7 @@ void BarLine::endEditDrag(EditData& ed)
// determine new span value
int staffIdx2;
int numOfStaves = syst->staves()->size();
int numOfStaves = syst->staves().size();
if (staffIdx1 + 1 >= numOfStaves) {
// if initial staff is last staff, ending staff must be the same
staffIdx2 = staffIdx1;

View file

@ -387,10 +387,9 @@ void Beam::layout1()
if (const Chord* chord = findChordWithCustomStemDirection()) {
_up = chord->stemDirection() == DirectionV::UP;
} else {
std::vector<int> notes;
std::set<int> noteSet(_notes.begin(), _notes.end());
notes.assign(noteSet.begin(), noteSet.end());
_up = Chord::computeAutoStemDirection(&notes) > 0;
std::vector<int> notes(noteSet.begin(), noteSet.end());
_up = Chord::computeAutoStemDirection(notes) > 0;
}
}
} else {
@ -648,7 +647,7 @@ int Beam::computeDesiredSlant(int startNote, int endNote, int middleLine, int di
return qMin(maxSlope, maxSlopes[interval]) * (_up ? 1 : -1);
}
int Beam::getBeamCount(std::vector<ChordRest*> chordRests) const
int Beam::getBeamCount(const std::vector<ChordRest*>& chordRests) const
{
int beamCount = 0;
for (ChordRest* chordRest : chordRests) {
@ -836,7 +835,7 @@ void Beam::calcBeamBreaks(const Chord* chord, int level, bool& isBroken32, bool&
isBroken64 = isManuallyBroken64 || isDefaultBroken64;
}
void Beam::createBeamSegments(std::vector<ChordRest*> chordRests)
void Beam::createBeamSegments(const std::vector<ChordRest*>& chordRests)
{
qDeleteAll(_beamSegments);
_beamSegments.clear();
@ -899,7 +898,7 @@ void Beam::createBeamSegments(std::vector<ChordRest*> chordRests)
} while (levelHasBeam);
}
void Beam::offsetBeamToRemoveCollisions(std::vector<ChordRest*> chordRests, int& dictator, int& pointer, qreal startX, qreal endX,
void Beam::offsetBeamToRemoveCollisions(const std::vector<ChordRest*>& chordRests, int& dictator, int& pointer, qreal startX, qreal endX,
bool isFlat, bool isStartDictator) const
{
// tolerance eliminates all possibilities of floating point rounding errors
@ -934,7 +933,7 @@ void Beam::offsetBeamToRemoveCollisions(std::vector<ChordRest*> chordRests, int&
}
}
void Beam::extendStems(std::vector<ChordRest*> chordRests, PointF start, PointF end)
void Beam::extendStems(const std::vector<ChordRest*>& chordRests, PointF start, PointF end)
{
for (ChordRest* chordRest : chordRests) {
if (!chordRest->isChord()) {
@ -1108,7 +1107,7 @@ void Beam::add8thSpaceSlant(PointF& dictatorAnchor, int dictator, int pointer, i
// layout2
//---------------------------------------------------------
void Beam::layout2(std::vector<ChordRest*> chordRests, SpannerSegmentType, int frag)
void Beam::layout2(const std::vector<ChordRest*>& chordRests, SpannerSegmentType, int frag)
{
if (chordRests.empty()) {
return;
@ -1120,7 +1119,7 @@ void Beam::layout2(std::vector<ChordRest*> chordRests, SpannerSegmentType, int f
}
if (_distribute) {
// fix horizontal spacing of stems
LayoutBeams::respace(&chordRests);
LayoutBeams::respace(chordRests);
}
_beamSpacing = score()->styleB(Sid::useWideBeams) ? 4 : 3;

View file

@ -85,8 +85,8 @@ class Beam final : public EngravingItem
int getMiddleStaffLine(ChordRest* startChord, ChordRest* endChord, int staffLines) const;
int computeDesiredSlant(int startNote, int endNote, int middleLine, int dictator, int pointer) const;
int getBeamCount(std::vector<ChordRest*> chordRests) const;
void offsetBeamToRemoveCollisions(std::vector<ChordRest*> chordRests, int& dictator, int& pointer, qreal startX, qreal endX,
int getBeamCount(const std::vector<ChordRest*>& chordRests) const;
void offsetBeamToRemoveCollisions(const std::vector<ChordRest*>& chordRests, int& dictator, int& pointer, qreal startX, qreal endX,
bool isFlat, bool isStartDictator) const;
bool isBeamInsideStaff(int yPos, int staffLines) const;
int getOuterBeamPosOffset(int innerBeam, int beamCount, int staffLines) const;
@ -97,13 +97,13 @@ class Beam final : public EngravingItem
bool isAscending);
void addMiddleLineSlant(int& dictator, int& pointer, int beamCount, int middleLine, int interval);
void add8thSpaceSlant(mu::PointF& dictatorAnchor, int dictator, int pointer, int beamCount, int interval, int middleLine, bool Flat);
void extendStems(std::vector<ChordRest*> chordRests, mu::PointF start, mu::PointF end);
void extendStems(const std::vector<ChordRest*>& chordRests, mu::PointF start, mu::PointF end);
mu::PointF chordBeamAnchor(Chord* chord) const;
bool calcIsBeamletBefore(Chord* chord, int i, int level, bool isAfter32Break, bool isAfter64Break) const;
void createBeamSegment(Chord* startChord, Chord* endChord, int level);
void createBeamletSegment(Chord* chord, bool isBefore, int level);
void createBeamSegments(std::vector<ChordRest*> chordRests);
void layout2(std::vector<ChordRest*>, SpannerSegmentType, int frag);
void createBeamSegments(const std::vector<ChordRest*>& chordRests);
void layout2(const std::vector<ChordRest*>& chordRests, SpannerSegmentType, int frag);
void addChordRest(ChordRest* a);
void removeChordRest(ChordRest* a);

View file

@ -376,7 +376,7 @@ void Bracket::endEditDrag(EditData&)
int staffIdx1 = staffIdx();
int staffIdx2;
int n = static_cast<int>(system()->staves()->size());
int n = static_cast<int>(system()->staves().size());
if (staffIdx1 + 1 >= n) {
staffIdx2 = staffIdx1;
} else {
@ -431,7 +431,7 @@ bool Bracket::isEditAllowed(EditData& ed) const
if (ed.key == Qt::Key_Up && span() > 1) {
return true;
}
if (ed.key == Qt::Key_Down && _lastStaff < system()->staves()->size() - 1) {
if (ed.key == Qt::Key_Down && _lastStaff < system()->staves().size() - 1) {
return true;
}
@ -467,7 +467,7 @@ bool Bracket::edit(EditData& ed)
bracketItem()->undoChangeProperty(Pid::BRACKET_SPAN, static_cast<int>(span()) - 1);
return true;
}
if (ed.key == Qt::Key_Down && _lastStaff < system()->staves()->size() - 1) {
if (ed.key == Qt::Key_Down && _lastStaff < system()->staves().size() - 1) {
bracketItem()->undoChangeProperty(Pid::BRACKET_SPAN, static_cast<int>(span()) + 1);
return true;
}

View file

@ -1028,7 +1028,7 @@ void Chord::computeUp()
}
std::vector<int> distances = noteDistances();
int direction = Chord::computeAutoStemDirection(&distances);
int direction = Chord::computeAutoStemDirection(distances);
_up = direction > 0;
_usesAutoUp = direction == 0;
@ -1038,14 +1038,14 @@ void Chord::computeUp()
}
// return 1 means up, 0 means in the middle, -1 means down
int Chord::computeAutoStemDirection(const std::vector<int>* noteDistances)
int Chord::computeAutoStemDirection(const std::vector<int>& noteDistances)
{
int left = 0;
int right = static_cast<int>(noteDistances->size()) - 1;
int right = static_cast<int>(noteDistances.size()) - 1;
while (left <= right) {
int leftNote = noteDistances->at(left);
int rightNote = noteDistances->at(right);
int leftNote = noteDistances.at(left);
int rightNote = noteDistances.at(right);
int netDirecting = leftNote + rightNote;
if (netDirecting == 0) {
left++;

View file

@ -246,7 +246,7 @@ public:
void setTrack(track_idx_t val) override;
void computeUp() override;
static int computeAutoStemDirection(const std::vector<int>* noteDistances);
static int computeAutoStemDirection(const std::vector<int>& noteDistances);
qreal dotPosX() const;

View file

@ -265,7 +265,7 @@ bool ChordRest::readProperties(XmlReader& e)
setDots(e.readInt());
} else if (tag == "staffMove") {
_staffMove = e.readInt();
if (vStaffIdx() < part()->staves()->front()->idx() || vStaffIdx() > part()->staves()->back()->idx()) {
if (vStaffIdx() < part()->staves().front()->idx() || vStaffIdx() > part()->staves().back()->idx()) {
_staffMove = 0;
}
} else if (tag == "Spanner") {

View file

@ -428,9 +428,6 @@ void Score::update(bool resetCmdState)
setPlayPos(is.segment()->tick());
}
if (playlistDirty()) {
for (Score* s : scoreList()) {
emit s->playlistChanged();
}
masterScore()->setPlaylistClean();
}
if (resetCmdState) {
@ -2099,10 +2096,10 @@ void Score::moveUp(ChordRest* cr)
return;
}
const std::vector<Staff*>* staves = part->staves();
const std::vector<Staff*>& staves = part->staves();
// we know that staffMove+rstaff-1 index exists due to the previous condition.
if (staff->staffType(cr->tick())->group() != StaffGroup::STANDARD
|| staves->at(rstaff + staffMove - 1)->staffType(cr->tick())->group() != StaffGroup::STANDARD) {
|| staves.at(rstaff + staffMove - 1)->staffType(cr->tick())->group() != StaffGroup::STANDARD) {
qDebug("User attempted to move a note from/to a staff which does not use standard notation - ignoring.");
} else {
// move the chord up a staff
@ -2128,10 +2125,10 @@ void Score::moveDown(ChordRest* cr)
return;
}
const std::vector<Staff*>* staves = part->staves();
const std::vector<Staff*>& staves = part->staves();
// we know that staffMove+rstaff+1 index exists due to the previous condition.
if (staff->staffType(cr->tick())->group() != StaffGroup::STANDARD
|| staves->at(staffMove + rstaff + 1)->staffType(cr->tick())->group() != StaffGroup::STANDARD) {
|| staves.at(staffMove + rstaff + 1)->staffType(cr->tick())->group() != StaffGroup::STANDARD) {
qDebug("User attempted to move a note from/to a staff which does not use standard notation - ignoring.");
} else {
// move the chord down a staff

View file

@ -708,7 +708,7 @@ PointF EngravingItem::pagePos() const
p.ry() += measure->staffLines(idx)->y();
}
if (system) {
if (system->staves()->size() <= idx) {
if (system->staves().size() <= idx) {
qDebug("staffIdx out of bounds: %s", typeName());
}
p.ry() += system->staffYpage(idx);

View file

@ -269,7 +269,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
p->setInstrument(*part->instrument());
p->setPartName(part->partName());
for (Staff* staff : *part->staves()) {
for (Staff* staff : part->staves()) {
Staff* s = Factory::createStaff(p);
s->setId(staff->id());
s->init(staff);

View file

@ -458,7 +458,7 @@ Segment* LineSegment::findSegmentForGrip(Grip grip, PointF pos) const
System* sys = oldSeg->system();
const std::vector<System*> foundSystems = score()->searchSystem(pos, sys, spacingFactor);
if (!foundSystems.empty() && !mu::contains(foundSystems, sys) && foundSystems[0]->staves()->size()) {
if (!foundSystems.empty() && !mu::contains(foundSystems, sys) && foundSystems[0]->staves().size()) {
sys = foundSystems[0];
}

View file

@ -164,7 +164,7 @@ public:
std::vector<Excerpt*>& excerpts() { return _excerpts; }
const std::vector<Excerpt*>& excerpts() const { return _excerpts; }
QQueue<MidiInputEvent>* midiInputQueue() override { return &_midiInputQueue; }
std::list<MidiInputEvent>* activeMidiPitches() override { return &_activeMidiPitches; }
std::list<MidiInputEvent>& activeMidiPitches() override { return _activeMidiPitches; }
void setUpdateAll() override;

View file

@ -2070,7 +2070,7 @@ bool Measure::visible(staff_idx_t staffIdx) const
qDebug("Measure::visible: bad staffIdx: %zu", staffIdx);
return false;
}
if (system() && (system()->staves()->empty() || !system()->staff(staffIdx)->show())) {
if (system() && (system()->staves().empty() || !system()->staff(staffIdx)->show())) {
return false;
}
if (score()->staff(staffIdx)->cutaway() && isEmpty(staffIdx)) {
@ -2425,7 +2425,7 @@ bool Measure::isEmpty(staff_idx_t staffIdx) const
return false;
}
// Check for cross-staff chords
bool hasStaves = score()->staff(track / VOICES)->part()->staves()->size() > 1;
bool hasStaves = score()->staff(track / VOICES)->part()->staves().size() > 1;
if (hasStaves) {
if (strack >= VOICES) {
e = s->element(track - VOICES);

View file

@ -232,9 +232,9 @@ size_t Part::nstaves() const
return _staves.size();
}
const std::vector<Staff*>* Part::staves() const
const std::vector<Staff*>& Part::staves() const
{
return &_staves;
return _staves;
}
void Part::appendStaff(Staff* staff)
@ -787,10 +787,7 @@ const Channel* Part::harmonyChannel() const
bool Part::hasPitchedStaff() const
{
if (!staves()) {
return false;
}
for (Staff* s : *staves()) {
for (Staff* s : staves()) {
if (s && s->isPitchedStaff(Fraction(0, 1))) {
return true;
}
@ -804,10 +801,7 @@ bool Part::hasPitchedStaff() const
bool Part::hasTabStaff() const
{
if (!staves()) {
return false;
}
for (Staff* s : *staves()) {
for (Staff* s : staves()) {
if (s && s->isTabStaff(Fraction(0, 1))) {
return true;
}
@ -821,10 +815,7 @@ bool Part::hasTabStaff() const
bool Part::hasDrumStaff() const
{
if (!staves()) {
return false;
}
for (Staff* s : *staves()) {
for (Staff* s : staves()) {
if (s && s->isDrumStaff(Fraction(0, 1))) {
return true;
}

View file

@ -99,7 +99,7 @@ public:
void write(XmlWriter& xml) const;
size_t nstaves() const;
const std::vector<Staff*>* staves() const;
const std::vector<Staff*>& staves() const;
void appendStaff(Staff* staff);
void clearStaves();

View file

@ -117,8 +117,8 @@ void Score::updateSwing()
continue;
}
SwingParameters sp;
sp.swingRatio = st->swingParameters()->swingRatio;
sp.swingUnit = st->swingParameters()->swingUnit;
sp.swingRatio = st->swingParameters().swingRatio;
sp.swingUnit = st->swingParameters().swingUnit;
if (st->systemFlag()) {
for (Staff* sta : qAsConst(_staves)) {
sta->insertIntoSwingList(s->tick(), sp);
@ -182,7 +182,7 @@ void Score::updateChannel()
for (Segment* s = fm->first(SegmentType::ChordRest); s; s = s->next1(SegmentType::ChordRest)) {
for (const EngravingItem* e : s->annotations()) {
if (e->isInstrumentChange()) {
for (Staff* staff : *e->part()->staves()) {
for (Staff* staff : e->part()->staves()) {
for (voice_idx_t voice = 0; voice < VOICES; ++voice) {
staff->insertIntoChannelList(voice, s->tick(), 0);
}
@ -598,7 +598,7 @@ static void collectProgramChanges(EventMap* events, Measure const* m, Staff* sta
Fraction tick = s->tick() + Fraction::fromTicks(tickOffset);
Instrument* instr = e->part()->instrument(tick);
for (const ChannelActions& ca : *st1->channelActions()) {
for (const ChannelActions& ca : st1->channelActions()) {
int channel = instr->channel().at(ca.channel)->channel();
for (const QString& ma : ca.midiActionNames) {
NamedEventList* nel = instr->midiAction(ma, ca.channel);
@ -956,7 +956,7 @@ void Score::updateHairpin(Hairpin* h)
st->velocities().addRamp(tick, tick2, veloChange, method, direction);
break;
case DynamicRange::PART:
for (Staff* s : *st->part()->staves()) {
for (Staff* s : st->part()->staves()) {
s->velocities().addRamp(tick, tick2, veloChange, method, direction);
}
break;

View file

@ -354,13 +354,12 @@ public:
///---------------------------------------------------------
void RepeatList::collectRepeatListElements()
{
RepeatListElementList* sectionRLElements = new RepeatListElementList();
RepeatListElementList sectionRLElements;
// Clear out previous listing
for (RepeatListElementList* srle : _rlElements) {
qDeleteAll(*srle);
for (const RepeatListElementList& srle : _rlElements) {
qDeleteAll(srle);
}
qDeleteAll(_rlElements);
_rlElements.clear();
RepeatListElement* startFromRepeatMeasure = nullptr;
@ -371,7 +370,7 @@ void RepeatList::collectRepeatListElements()
// First measure of a section/score is always used as a reference REPEAT_START point
// even if it doesn't have a start repeat
startFromRepeatMeasure = new RepeatListElement(RepeatListElementType::REPEAT_START, mb, toMeasure(mb));
sectionRLElements->push_back(startFromRepeatMeasure);
sectionRLElements.push_back(startFromRepeatMeasure);
// Also trace down the final actual measure of this section (in case a frame follows)
MeasureBase* sectionEndMeasureBase = nullptr;
// Used to track voltas; overlappings and real endings
@ -461,15 +460,15 @@ void RepeatList::collectRepeatListElements()
if (volta != nullptr) {
//if (volta->endMeasure()->tick() < mb->tick()) {
// The previous volta was supposed to end before us (open volta case) -> insert the end
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(
mb->prevMeasure())));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(
mb->prevMeasure())));
//volta = nullptr; // No need, replaced immediately further down
// }
//else { // Overlapping voltas; this should not happen as preProcessedVoltas should've dealt with this already }
}
// Now insert the start of the current volta
volta = preProcessedVoltas.front();
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_START, volta, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_START, volta, toMeasure(mb)));
// Look for start of next volta
preProcessedVoltas.pop_front();
}
@ -481,19 +480,19 @@ void RepeatList::collectRepeatListElements()
// assume the previous volta was supposed to end before us (open volta case) -> insert the end
// Warning: This might "break" a volta prematurely if its explicit notated end is later than this point
// Consider splitting the volta or ignoring this repeat all together
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta,
toMeasure(mb->prevMeasure())));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta,
toMeasure(mb->prevMeasure())));
volta = nullptr;
}
//else { // Volta and Start Repeat coincide on the same measure, see test::repeat56.mscx }
}
startFromRepeatMeasure = new RepeatListElement(RepeatListElementType::REPEAT_START, mb, toMeasure(mb));
sectionRLElements->push_back(startFromRepeatMeasure);
sectionRLElements.push_back(startFromRepeatMeasure);
}
// Jumps and Markers
for (EngravingItem* e : mb->el()) {
if (e->isJump()) {
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::JUMP, e, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::JUMP, e, toMeasure(mb)));
if (volta != nullptr) {
if ((volta->endMeasure()->tick() < mb->tick())
|| ((volta->endMeasure()->tick() == mb->tick())
@ -502,7 +501,7 @@ void RepeatList::collectRepeatListElements()
) {
// The previous volta was supposed to end before us
// or open volta ends together with us -> insert the end
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
volta = nullptr;
}
//else { // Volta is spanning past this jump instruction }
@ -514,7 +513,7 @@ void RepeatList::collectRepeatListElements()
// text alignment and order them left to right
// At the same time, we should ensure Markers are evaluated before Jumps
Align markerRLEalignmentH = toMarker(e)->align();
auto insertionIt = sectionRLElements->end() - 1;
auto insertionIt = sectionRLElements.end() - 1;
while ((*insertionIt)->measure == markerRLE->measure) {
bool markerShouldGoBefore = false;
if (((*insertionIt)->repeatListElementType == RepeatListElementType::MARKER)
@ -532,7 +531,7 @@ void RepeatList::collectRepeatListElements()
) {
// Decrease position
// This should always be possible as the list always starts with a REPEAT_START element
Q_ASSERT(insertionIt != sectionRLElements->begin());
Q_ASSERT(insertionIt != sectionRLElements.begin());
--insertionIt;
} else {
// Found location after which we should go
@ -540,19 +539,19 @@ void RepeatList::collectRepeatListElements()
}
}
// We should be inserted right after insertionIt
sectionRLElements->insert(insertionIt + 1, markerRLE);
sectionRLElements.insert(insertionIt + 1, markerRLE);
}
}
// End
if (mb->repeatEnd()) {
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::REPEAT_END, mb, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::REPEAT_END, mb, toMeasure(mb)));
if (startFromRepeatMeasure != nullptr) {
startFromRepeatMeasure->addToRepeatCount(toMeasure(mb)->repeatCount() - 1);
}
if (volta != nullptr) {
//if (volta->endMeasure()->tick() < mb->tick()) {
// The previous volta was supposed to end before us (open volta case) -> insert the end
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
volta = nullptr;
//} else {
// // Volta is spanning over this end repeat, consider splitting the volta
@ -565,7 +564,7 @@ void RepeatList::collectRepeatListElements()
&& (volta->endMeasure()->tick() == mb->tick())
&& (volta->getProperty(Pid::END_HOOK_TYPE).value<HookType>() != HookType::NONE)) {
// end of closed volta
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb)));
volta = nullptr;
}
}
@ -575,28 +574,28 @@ void RepeatList::collectRepeatListElements()
if (volta != nullptr) {
//if (volta->endMeasure()->tick() < mb->tick()) {
// The previous volta was supposed to end before us (open volta case) -> insert the end
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta,
toMeasure(sectionEndMeasureBase)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta,
toMeasure(sectionEndMeasureBase)));
volta = nullptr;
//} else {
// // Volta is spanning over this section break, consider splitting the volta
// // and adding it again at the start of the next section
//}
}
sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::SECTION_BREAK, mb,
toMeasure(sectionEndMeasureBase)));
sectionRLElements.push_back(new RepeatListElement(RepeatListElementType::SECTION_BREAK, mb,
toMeasure(sectionEndMeasureBase)));
sectionEndMeasureBase = nullptr; // reset to indicate not having found the end for the next section
// store section
_rlElements.push_back(sectionRLElements);
}
// prepare for new section
if (mb->nextMeasure()) {
sectionRLElements = new RepeatListElementList();
sectionRLElements = RepeatListElementList();
// First measure of a section/score is always used as a reference REPEAT_START point
// even if it doesn't have a start repeat
startFromRepeatMeasure
= new RepeatListElement(RepeatListElementType::REPEAT_START, mb->nextMeasure(), toMeasure(mb->nextMeasure()));
sectionRLElements->push_back(startFromRepeatMeasure);
sectionRLElements.push_back(startFromRepeatMeasure);
// Loop will forward one measureBase, so return one now
// this logic aids in skipping multiple frames between sections
mb = mb->nextMeasure()->prev();
@ -614,29 +613,29 @@ void RepeatList::collectRepeatListElements()
/// "start" will result in start of current section
/// "end" will result in end of current section
///
std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElementList::const_iterator> RepeatList::findMarker(
QString label, std::vector<RepeatListElementList*>::const_iterator referenceSectionIt,
std::pair<std::vector<RepeatListElementList>::const_iterator, RepeatListElementList::const_iterator> RepeatList::findMarker(
QString label, std::vector<RepeatListElementList>::const_iterator referenceSectionIt,
RepeatListElementList::const_iterator referenceRepeatListElementIt) const
{
bool found = false;
std::vector<RepeatListElementList*>::const_iterator foundSectionIt;
std::vector<RepeatListElementList>::const_iterator foundSectionIt;
RepeatListElementList::const_iterator foundRepeatListElementIt;
// Start in the current section
foundSectionIt = referenceSectionIt;
// Handle special label casing first
if (label == "start") {
foundRepeatListElementIt = (*referenceSectionIt)->cbegin();
foundRepeatListElementIt = referenceSectionIt->cbegin();
found = true;
} else if (label == "end") {
foundRepeatListElementIt = (*referenceSectionIt)->cend() - 1;
foundRepeatListElementIt = referenceSectionIt->cend() - 1;
found = true;
} else {
foundRepeatListElementIt = referenceRepeatListElementIt;
}
// Search backwards in this section
while (!found && (foundRepeatListElementIt != (*referenceSectionIt)->cbegin())) {
while (!found && (foundRepeatListElementIt != referenceSectionIt->cbegin())) {
--foundRepeatListElementIt;
if (((*foundRepeatListElementIt)->repeatListElementType == RepeatListElementType::MARKER)
&& ((toMarker((*foundRepeatListElementIt)->element))->label() == label)
@ -648,7 +647,7 @@ std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElement
// Search forwards in this section
if (!found) {
foundRepeatListElementIt = referenceRepeatListElementIt + 1;
while (!found && (foundRepeatListElementIt != (*referenceSectionIt)->cend())) {
while (!found && (foundRepeatListElementIt != referenceSectionIt->cend())) {
if (((*foundRepeatListElementIt)->repeatListElementType == RepeatListElementType::MARKER)
&& ((toMarker((*foundRepeatListElementIt)->element))->label() == label)
) {
@ -663,8 +662,8 @@ std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElement
if (!found) {
while (!found && (foundSectionIt != _rlElements.cbegin())) {
--foundSectionIt;
foundRepeatListElementIt = (*foundSectionIt)->cend();
while (!found && (foundRepeatListElementIt != (*foundSectionIt)->cbegin())) {
foundRepeatListElementIt = foundSectionIt->cend();
while (!found && (foundRepeatListElementIt != foundSectionIt->cbegin())) {
--foundRepeatListElementIt;
if (((*foundRepeatListElementIt)->repeatListElementType == RepeatListElementType::MARKER)
&& ((toMarker((*foundRepeatListElementIt)->element))->label() == label)
@ -679,8 +678,8 @@ std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElement
if (!found) {
foundSectionIt = referenceSectionIt + 1;
while (foundSectionIt != _rlElements.cend()) {
foundRepeatListElementIt = (*foundSectionIt)->cbegin();
while (!found && (foundRepeatListElementIt != (*foundSectionIt)->cend())) {
foundRepeatListElementIt = foundSectionIt->cbegin();
while (!found && (foundRepeatListElementIt != foundSectionIt->cend())) {
if (((*foundRepeatListElementIt)->repeatListElementType == RepeatListElementType::MARKER)
&& ((toMarker((*foundRepeatListElementIt)->element))->label() == label)
) {
@ -708,7 +707,7 @@ std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElement
/// \param activeVolta [out] Contains a reference to the active Volta for jump target
/// \param startRepeatReference [out] Reference point to return to and compare against for jump target
///
void RepeatList::performJump(std::vector<RepeatListElementList*>::const_iterator sectionIt,
void RepeatList::performJump(std::vector<RepeatListElementList>::const_iterator sectionIt,
RepeatListElementList::const_iterator repeatListElementTargetIt,
bool withRepeats, int* const playbackCount,
Volta const** const activeVolta, RepeatListElement const** const startRepeatReference) const
@ -716,8 +715,8 @@ void RepeatList::performJump(std::vector<RepeatListElementList*>::const_iterator
RepeatListElementList::const_iterator repeatListElementIt;
// Fast forward processing up to our desired marker
*activeVolta = nullptr;
*startRepeatReference = *((*sectionIt)->cbegin());
for (repeatListElementIt = (*sectionIt)->cbegin(); repeatListElementIt != repeatListElementTargetIt; ++repeatListElementIt) {
*startRepeatReference = *(sectionIt->cbegin());
for (repeatListElementIt = sectionIt->cbegin(); repeatListElementIt != repeatListElementTargetIt; ++repeatListElementIt) {
switch ((*repeatListElementIt)->repeatListElementType) {
case RepeatListElementType::VOLTA_START: {
*activeVolta = toVolta((*repeatListElementIt)->element);
@ -775,20 +774,20 @@ void RepeatList::unwind()
RepeatSegment* rs = nullptr;
int playbackCount;
Volta const* activeVolta = nullptr;
std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElementList::const_iterator> playUntil = std::make_pair(
_rlElements.cend(), _rlElements[0]->cend());
std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElementList::const_iterator> continueAt = std::make_pair(
_rlElements.cend(), _rlElements[0]->cend());
std::pair<std::vector<RepeatListElementList>::const_iterator, RepeatListElementList::const_iterator> playUntil
= std::make_pair(_rlElements.cend(), _rlElements[0].cend());
std::pair<std::vector<RepeatListElementList>::const_iterator, RepeatListElementList::const_iterator> continueAt
= std::make_pair(_rlElements.cend(), _rlElements[0].cend());
Jump const* activeJump = nullptr;
bool forceFinalRepeat = false; // Used during jump processing
RepeatListElementList::const_iterator repeatListElementIt;
for (std::vector<RepeatListElementList*>::const_iterator sectionIt = _rlElements.cbegin(); sectionIt != _rlElements.cend();
for (std::vector<RepeatListElementList>::const_iterator sectionIt = _rlElements.cbegin(); sectionIt != _rlElements.cend();
++sectionIt) {
// Unwind this section
RepeatListElement const* startRepeatReference;
playbackCount = 1;
repeatListElementIt = (*sectionIt)->cbegin(); // Should always be a REPEAT_START indicator
repeatListElementIt = sectionIt->cbegin(); // Should always be a REPEAT_START indicator
startRepeatReference = *repeatListElementIt;
activeVolta = nullptr;
playUntil.first = _rlElements.cend();
@ -799,7 +798,7 @@ void RepeatList::unwind()
rs->addMeasure((*repeatListElementIt)->measure);
++repeatListElementIt;
while (repeatListElementIt != (*sectionIt)->cend()) {
while (repeatListElementIt != sectionIt->cend()) {
if (rs) {
rs->addMeasures((*repeatListElementIt)->measure);
}
@ -895,7 +894,7 @@ void RepeatList::unwind()
// Processing it now
_jumpsTaken.insert(jumpOccurence);
// Find the jump targets
std::pair<std::vector<RepeatListElementList*>::const_iterator,
std::pair<std::vector<RepeatListElementList>::const_iterator,
RepeatListElementList::const_iterator> jumpTo = findMarker(
jumpOccurence.first->jumpTo(), sectionIt, repeatListElementIt);
playUntil = findMarker(jumpOccurence.first->playUntil(), sectionIt, repeatListElementIt);
@ -915,7 +914,7 @@ void RepeatList::unwind()
// Re-evaluate our repeat count for end repeat measures
if (playUntil.first != _rlElements.cend()) { // Only required if we have an end target
for (auto rleIt = repeatListElementIt + 1; rleIt != (*sectionIt)->cend(); ++rleIt) {
for (auto rleIt = repeatListElementIt + 1; rleIt != sectionIt->cend(); ++rleIt) {
if (((*rleIt)->repeatListElementType == RepeatListElementType::REPEAT_END)
&& ((*rleIt)->getRepeatCount() != 0)
) { // We've been played before - see test::repeat22 for why only then
@ -941,7 +940,7 @@ void RepeatList::unwind()
++findRepeatIt; // Start volta analysis past this start repeat
Volta const* voltaReference = nullptr;
int processedRepeatCount = 1;
while ((findRepeatIt != (*sectionIt)->cend())
while ((findRepeatIt != sectionIt->cend())
&& ((*findRepeatIt)->repeatListElementType != RepeatListElementType::REPEAT_START)
&& (processedRepeatCount < startRepeatReference->getRepeatCount())
) {
@ -1006,7 +1005,7 @@ void RepeatList::unwind()
continueAt.first = _rlElements.cend(); // Clear this reference - processed
} else { // Nowhere to go to, break out of this section loop and onto the next section
repeatListElementIt = (*sectionIt)->cend();
repeatListElementIt = sectionIt->cend();
continue;
}
}
@ -1018,7 +1017,7 @@ void RepeatList::unwind()
// Reached the end of this section
// Inform the last RepeatSegment that the Section Break pause property should be honored now
rs = this->back();
repeatListElementIt = (*sectionIt)->cend() - 1;
repeatListElementIt = sectionIt->cend() - 1;
Q_ASSERT((*repeatListElementIt)->repeatListElementType == RepeatListElementType::SECTION_BREAK);
LayoutBreak const* const layoutBreak = toMeasureBase((*repeatListElementIt)->element)->sectionBreakElement();

View file

@ -81,14 +81,14 @@ class RepeatList : public std::vector<RepeatSegment*>
bool _scoreChanged = true;
std::set<std::pair<Jump const* const, int> > _jumpsTaken; // take the jumps only once, so track them during unwind
std::vector<RepeatListElementList*> _rlElements; // all elements of the score that influence the RepeatList
std::vector<RepeatListElementList> _rlElements; // all elements of the score that influence the RepeatList
void collectRepeatListElements();
std::pair<std::vector<RepeatListElementList*>::const_iterator, RepeatListElementList::const_iterator> findMarker(
QString label, std::vector<RepeatListElementList*>::const_iterator referenceSectionIt,
std::pair<std::vector<RepeatListElementList>::const_iterator, RepeatListElementList::const_iterator> findMarker(
QString label, std::vector<RepeatListElementList>::const_iterator referenceSectionIt,
RepeatListElementList::const_iterator referenceRepeatListElementIt) const;
void performJump(std::vector<RepeatListElementList*>::const_iterator sectionIt,
void performJump(std::vector<RepeatListElementList>::const_iterator sectionIt,
RepeatListElementList::const_iterator repeatListElementTargetIt, bool withRepeats, int* const playbackCount,
Volta const** const activeVolta, RepeatListElement const** const startRepeatReference) const;
void unwind();

View file

@ -1121,15 +1121,15 @@ std::vector<System*> Score::searchSystem(const PointF& pos, const System* prefer
return systems;
}
qreal y = pos.y() - page->pos().y(); // transform to page relative
const std::vector<System*>* sl = &page->systems();
const std::vector<System*>& sl = page->systems();
qreal y2;
size_t n = sl->size();
size_t n = sl.size();
for (size_t i = 0; i < n; ++i) {
System* s = sl->at(i);
System* s = sl.at(i);
System* ns = 0; // next system row
size_t ii = i + 1;
for (; ii < n; ++ii) {
ns = sl->at(ii);
ns = sl.at(ii);
if (ns->y() != s->y()) {
break;
}
@ -1151,10 +1151,10 @@ std::vector<System*> Score::searchSystem(const PointF& pos, const System* prefer
if (y < y2) {
systems.push_back(s);
for (size_t iii = i + 1; ii < n; ++iii) {
if (sl->at(iii)->y() != s->y()) {
if (sl.at(iii)->y() != s->y()) {
break;
}
systems.push_back(sl->at(iii));
systems.push_back(sl.at(iii));
}
return systems;
}
@ -4145,7 +4145,7 @@ void Score::appendPart(const InstrumentTemplate* t)
}
undoInsertStaff(staff, i);
}
part->staves()->front()->setBarLineSpan(part->nstaves());
part->staves().front()->setBarLineSpan(part->nstaves());
undoInsertPart(part, n);
setUpTempoMap();
masterScore()->rebuildMidiMapping();
@ -5562,7 +5562,7 @@ const RepeatList& Score::repeatList2() const { return _masterScore->repeatList2
TempoMap* Score::tempomap() const { return _masterScore->tempomap(); }
TimeSigMap* Score::sigmap() const { return _masterScore->sigmap(); }
QQueue<MidiInputEvent>* Score::midiInputQueue() { return _masterScore->midiInputQueue(); }
std::list<MidiInputEvent>* Score::activeMidiPitches() { return _masterScore->activeMidiPitches(); }
std::list<MidiInputEvent>& Score::activeMidiPitches() { return _masterScore->activeMidiPitches(); }
void Score::setUpdateAll() { _masterScore->setUpdateAll(); }

View file

@ -537,7 +537,6 @@ protected:
signals:
void posChanged(POS, unsigned);
void playlistChanged();
public:
Score(const Score&) = delete;
@ -1231,7 +1230,7 @@ public:
mu::engraving::PropertyValue propertyDefault(Pid) const override;
virtual QQueue<MidiInputEvent>* midiInputQueue();
virtual std::list<MidiInputEvent>* activeMidiPitches();
virtual std::list<MidiInputEvent>& activeMidiPitches();
/// For MasterScores: returns the filename without extension
/// For Scores: returns the excerpt name

View file

@ -406,7 +406,7 @@ void ScoreOrder::setBracketsAndBarlines(Score* score)
int staffIdx { 0 };
bool blockThinBracket { false };
for (Staff* staff : *part->staves()) {
for (Staff* staff : part->staves()) {
for (BracketItem* bi : staff->brackets()) {
score->undo(new RemoveBracket(staff, bi->column(), bi->bracketType(), bi->bracketSpan()));
}

View file

@ -2419,11 +2419,10 @@ ChordRest* Segment::ChordRestWithMinDuration(const Segment* seg, const std::vect
ChordRest* chordRestWithMinDuration{ nullptr };
int minTicks = std::numeric_limits<int>::max();
for (int partIdx : visibleParts) {
auto staves = seg->score()->parts().at(partIdx)->staves();
for (auto stave : *staves) {
staff_idx_t staffIdx = stave->idx();
for (voice_idx_t voice = 0; voice < 4; voice++) {
if (auto element = seg->elist().at(staffIdx * 4 + voice)) {
for (const Staff* staff : seg->score()->parts().at(partIdx)->staves()) {
staff_idx_t staffIdx = staff->idx();
for (voice_idx_t voice = 0; voice < VOICES; ++voice) {
if (auto element = seg->elist().at(staffIdx * VOICES + voice)) {
if (!element->isChordRest()) {
continue;
}

View file

@ -1703,7 +1703,7 @@ void Slur::layout()
segment->setSpannerSegmentType(SpannerSegmentType::MIDDLE);
qreal x1 = system->firstNoteRestSegmentX(true);
qreal x2 = system->bbox().width();
qreal y = staffIdx() > system->staves()->size() ? system->y() : system->staff(staffIdx())->y();
qreal y = staffIdx() > system->staves().size() ? system->y() : system->staff(staffIdx())->y();
segment->layoutSegment(PointF(x1, y), PointF(x2, y));
}
// case 4: end segment

View file

@ -1521,7 +1521,7 @@ Staff* Staff::primaryStaff() const
staff_idx_t Staff::rstaff() const
{
return mu::indexOf(*_part->staves(), (Staff*)this);
return mu::indexOf(_part->staves(), this);
}
//---------------------------------------------------------
@ -1530,11 +1530,11 @@ staff_idx_t Staff::rstaff() const
bool Staff::isTop() const
{
if (_part->staves()->empty()) {
if (_part->staves().empty()) {
return false;
}
return _part->staves()->front() == this;
return _part->staves().front() == this;
}
//---------------------------------------------------------

View file

@ -72,14 +72,14 @@ void StaffTextBase::write(XmlWriter& xml) const
}
if (swing()) {
DurationType swingUnit;
if (swingParameters()->swingUnit == Constant::division / 2) {
if (swingParameters().swingUnit == Constant::division / 2) {
swingUnit = DurationType::V_EIGHTH;
} else if (swingParameters()->swingUnit == Constant::division / 4) {
} else if (swingParameters().swingUnit == Constant::division / 4) {
swingUnit = DurationType::V_16TH;
} else {
swingUnit = DurationType::V_ZERO;
}
int swingRatio = swingParameters()->swingRatio;
int swingRatio = swingParameters().swingRatio;
xml.tagE(QString("swing unit=\"%1\" ratio= \"%2\"").arg(TConv::toXml(swingUnit)).arg(swingRatio));
}
if (capo() != 0) {

View file

@ -67,9 +67,9 @@ public:
_swingParameters.swingRatio = ratio;
}
const std::vector<ChannelActions>* channelActions() const { return &_channelActions; }
std::vector<ChannelActions>* channelActions() { return &_channelActions; }
const SwingParameters* swingParameters() const { return &_swingParameters; }
const std::vector<ChannelActions>& channelActions() const { return _channelActions; }
std::vector<ChannelActions>& channelActions() { return _channelActions; }
const SwingParameters& swingParameters() const { return _swingParameters; }
void clearAeolusStops();
void setAeolusStop(int group, int idx, bool val);
bool getAeolusStop(int group, int idx) const;

View file

@ -172,8 +172,8 @@ public:
void clear(); ///< Clear measure list.
mu::RectF bboxStaff(int staff) const { return _staves[staff]->bbox(); }
std::vector<SysStaff*>* staves() { return &_staves; }
const std::vector<SysStaff*>* staves() const { return &_staves; }
std::vector<SysStaff*>& staves() { return _staves; }
const std::vector<SysStaff*>& staves() const { return _staves; }
qreal staffYpage(int staffIdx) const;
qreal staffCanvasYpage(int staffIdx) const;
SysStaff* staff(size_t staffIdx) const;

View file

@ -971,14 +971,12 @@ void TextBlock::layout(TextBase* t)
// fragmentsWithoutEmpty
//---------------------------------------------------------
std::list<Ms::TextFragment>* TextBlock::fragmentsWithoutEmpty()
std::list<Ms::TextFragment> TextBlock::fragmentsWithoutEmpty()
{
std::list<TextFragment>* list = new std::list<TextFragment>();
std::list<TextFragment> list;
for (const auto& x : qAsConst(_fragments)) {
if (x.text.isEmpty()) {
continue;
} else {
list->push_back(x);
if (!x.text.isEmpty()) {
list.push_back(x);
}
}

View file

@ -243,7 +243,7 @@ public:
void layout(TextBase*);
const std::list<TextFragment>& fragments() const { return _fragments; }
std::list<TextFragment>& fragments() { return _fragments; }
std::list<TextFragment>* fragmentsWithoutEmpty();
std::list<TextFragment> fragmentsWithoutEmpty();
const mu::RectF& boundingRect() const { return _bbox; }
mu::RectF boundingRect(int col1, int col2, const TextBase*) const;
size_t columns() const;

View file

@ -657,11 +657,10 @@ void SplitJoinText::join(EditData* ed)
int eol = t->textBlock(line).eol();
auto fragmentsList = t->textBlock(line).fragmentsWithoutEmpty();
if (fragmentsList->size() > 0) {
if (fragmentsList.size() > 0) {
t->textBlock(line - 1).removeEmptyFragment();
}
mu::join(t->textBlock(line - 1).fragments(), *fragmentsList);
delete fragmentsList;
mu::join(t->textBlock(line - 1).fragments(), fragmentsList);
t->textBlockList().erase(t->textBlockList().begin() + line);

View file

@ -814,7 +814,7 @@ void Score::transpositionChanged(Part* part, Interval oldV, Fraction tickStart,
if (tickEnd != Fraction(-1, 1) && s->tick() >= tickEnd) {
break;
}
for (Staff* st : *part->staves()) {
for (Staff* st : part->staves()) {
if (st->staffType(tickStart)->group() == StaffGroup::PERCUSSION) {
continue;
}

View file

@ -801,8 +801,8 @@ Note* searchTieNote(Note* note)
Chord* chord = note->chord();
Segment* seg = chord->segment();
Part* part = chord->part();
track_idx_t strack = part->staves()->front()->idx() * VOICES;
track_idx_t etrack = strack + part->staves()->size() * VOICES;
track_idx_t strack = part->staves().front()->idx() * VOICES;
track_idx_t etrack = strack + part->staves().size() * VOICES;
if (chord->isGraceBefore()) {
chord = toChord(chord->explicitParent());
@ -909,8 +909,8 @@ Note* searchTieNote114(Note* note)
Chord* chord = note->chord();
Segment* seg = chord->segment();
Part* part = chord->part();
track_idx_t strack = part->staves()->front()->idx() * VOICES;
track_idx_t etrack = strack + part->staves()->size() * VOICES;
track_idx_t strack = part->staves().front()->idx() * VOICES;
track_idx_t etrack = strack + part->staves().size() * VOICES;
while ((seg = seg->next1(SegmentType::ChordRest))) {
for (track_idx_t track = strack; track < etrack; ++track) {

View file

@ -121,7 +121,7 @@ void DebugPaint::paintPageDebug(Painter& painter, const Page* page)
if (options.showSkylines) {
for (const System* system : page->systems()) {
for (SysStaff* ss : *system->staves()) {
for (const SysStaff* ss : system->staves()) {
if (!ss->show()) {
continue;
}

View file

@ -2588,7 +2588,7 @@ static void readPart(Part* part, XmlReader& e, ReadContext& ctx)
}
if (part->instrument()->useDrumset()) {
for (Staff* staff : *part->staves()) {
for (Staff* staff : part->staves()) {
int lines = staff->lines(Fraction(0, 1));
int bf = staff->barLineFrom();
int bt = staff->barLineTo();

View file

@ -78,6 +78,8 @@
#include "libmscore/fingering.h"
#include "libmscore/mmrest.h"
#include "containers.h"
using namespace Ms;
using namespace mu;
@ -490,8 +492,8 @@ class ExportBrailleImpl
int notesInSlur(Slur* slur);
bool isShortSlur(Slur* slur);
bool isLongSlur(Slur* slur);
bool isLongLongSlurConvergence(std::vector<Slur*>* slurs);
bool isShortShortSlurConvergence(std::vector<Slur*>* slurs);
bool isLongLongSlurConvergence(const std::vector<Slur*>& slurs);
bool isShortShortSlurConvergence(const std::vector<Slur*>& slurs);
bool hasTies(ChordRest* chordRest);
bool ascendingChords(ClefType clefType);
BarLine* lastBarline(Measure* measure, track_idx_t track);
@ -506,8 +508,8 @@ class ExportBrailleImpl
QString brailleOctave(int octave);
QString brailleChord(Chord* chord);
QString brailleChordRootNote(Chord* chord, Note* rootNote);
QString brailleNote(QString pitchName, DurationType durationType, int dots);
QString brailleChordInterval(Note* rootNote, QList<Note*>* notes, Note* note);
QString brailleNote(const QString& pitchName, DurationType durationType, int dots);
QString brailleChordInterval(Note* rootNote, const std::vector<Note*>& notes, Note* note);
QString brailleGraceNoteMarking(Chord* chord);
QString brailleAccidentalType(AccidentalType accidental);
QString brailleBarline(BarLine* barline);
@ -528,10 +530,10 @@ class ExportBrailleImpl
QString brailleMeasureRepeat(MeasureRepeat* measureRepeat);
QString brailleVolta(Measure* measure, Volta* volta, int staffCount);
QString brailleSlurBefore(ChordRest* chordRest, std::vector<Slur*>* slur);
QString brailleSlurAfter(ChordRest* chordRest, std::vector<Slur*>* slur);
QString brailleHairpinBefore(ChordRest* chordRest, std::vector<Hairpin*>* hairpin);
QString brailleHairpinAfter(ChordRest* chordRest, std::vector<Hairpin*>* hairpin);
QString brailleSlurBefore(ChordRest* chordRest, const std::vector<Slur*>& slur);
QString brailleSlurAfter(ChordRest* chordRest, const std::vector<Slur*>& slur);
QString brailleHairpinBefore(ChordRest* chordRest, const std::vector<Hairpin*>& hairpin);
QString brailleHairpinAfter(ChordRest* chordRest, const std::vector<Hairpin*>& hairpin);
public:
ExportBrailleImpl(Score* s)
@ -962,11 +964,11 @@ QString ExportBrailleImpl::brailleRest(Rest* rest)
}
}
std::vector<Slur*> restSlurs = slurs(rest);
QString slurBrailleBefore = brailleSlurBefore(rest, &restSlurs);
QString slurBrailleAfter = brailleSlurAfter(rest, &restSlurs);
QString slurBrailleBefore = brailleSlurBefore(rest, restSlurs);
QString slurBrailleAfter = brailleSlurAfter(rest, restSlurs);
std::vector<Hairpin*> restHairpins = hairpins(rest);
QString hairpinBrailleBefore = brailleHairpinBefore(rest, &restHairpins);
QString hairpinBrailleAfter = brailleHairpinAfter(rest, &restHairpins);
QString hairpinBrailleBefore = brailleHairpinBefore(rest, restHairpins);
QString hairpinBrailleAfter = brailleHairpinAfter(rest, restHairpins);
QString tupletBraille = brailleTuplet(rest->tuplet(), rest);
@ -1236,7 +1238,7 @@ QString ExportBrailleImpl::brailleAccidentalType(AccidentalType accidental)
return QString();
}
QString ExportBrailleImpl::brailleNote(QString pitchName, DurationType durationType, int dots)
QString ExportBrailleImpl::brailleNote(const QString& pitchName, DurationType durationType, int dots)
{
QString noteBraille = QString();
static QMap<DurationType, QMap<QString, QString> > noteToBraille;
@ -1436,9 +1438,9 @@ int ExportBrailleImpl::computeInterval(Note* note1, Note* note2, bool ignoreOcta
// note: The note for which we are currently representing the braille interval
// return the braille interval representation in the chord
//-----------------------------------------------------------------------------------
QString ExportBrailleImpl::brailleChordInterval(Note* rootNote, QList<Note*>* notes, Note* note)
QString ExportBrailleImpl::brailleChordInterval(Note* rootNote, const std::vector<Note*>& notes, Note* note)
{
if (!rootNote || !note || notes->size() < 2) {
if (!rootNote || !note || notes.size() < 2) {
return QString();
}
@ -1473,8 +1475,8 @@ QString ExportBrailleImpl::brailleChordInterval(Note* rootNote, QList<Note*>* no
if (interval == 1 && rootNote->octave() == note->octave()) {
noteOctaveBraille = brailleOctave(note->octave());
}
int noteIdx = notes->indexOf(note);
int intervalWithPreviousNoteInChord = computeInterval(notes->at(noteIdx - 1), note, false);
int noteIdx = mu::indexOf(notes, note);
int intervalWithPreviousNoteInChord = computeInterval(notes.at(noteIdx - 1), note, false);
// (b) it is the first or only interval and is more than an octave from the written note,
if (noteIdx == 1 && intervalWithPreviousNoteInChord > 8) {
noteOctaveBraille = brailleOctave(note->octave());
@ -1522,12 +1524,12 @@ QString ExportBrailleImpl::brailleChord(Chord* chord)
QString tupletBraille = brailleTuplet(chord->tuplet(), chord);
std::vector<Hairpin*> chordHairpins = hairpins(chord);
QString hairpinBrailleBefore = brailleHairpinBefore(chord, &chordHairpins);
QString hairpinBrailleBefore = brailleHairpinBefore(chord, chordHairpins);
// 9.2. Direction of Intervals (in Chords). Page 75. Music Braille Code 2015
// In Treble, Soprano, Alto clefs: Write the upper most note, then rest of notes as intervals downward
// In Tenor, Baritone, Bass clefs: Write the lower most note, then rest of notes as intervals upward
QList<Note*> notes;
std::vector<Note*> notes;
if (ascendingChords(currentCleffType[chord->staffIdx()])) {
for (auto it = chord->notes().begin(); it != chord->notes().end(); ++it) {
notes.push_back(*it);
@ -1543,7 +1545,7 @@ QString ExportBrailleImpl::brailleChord(Chord* chord)
QString intervals = QString();
for (auto it = notes.begin() + 1; it != notes.end(); ++it) {
intervals += brailleChordInterval(rootNote, &notes, *it);
intervals += brailleChordInterval(rootNote, notes, *it);
}
QString graceNotesAfter = QString();
@ -1566,10 +1568,10 @@ QString ExportBrailleImpl::brailleChord(Chord* chord)
}
std::vector<Slur*> chordSlurs = slurs(chord);
QString slurBrailleBefore = brailleSlurBefore(chord, &chordSlurs);
QString slurBrailleAfter = brailleSlurAfter(chord, &chordSlurs);
QString slurBrailleBefore = brailleSlurBefore(chord, chordSlurs);
QString slurBrailleAfter = brailleSlurAfter(chord, chordSlurs);
QString hairpinBrailleAfter = brailleHairpinAfter(chord, &chordHairpins);
QString hairpinBrailleAfter = brailleHairpinAfter(chord, chordHairpins);
QString arpeggio = brailleArpeggio(chord->arpeggio());
QString tremolloBraille = brailleTremolo(chord);
@ -2192,9 +2194,9 @@ std::vector<Hairpin*> ExportBrailleImpl::hairpins(ChordRest* chordRest)
return result;
}
QString ExportBrailleImpl::brailleSlurBefore(ChordRest* chordRest, std::vector<Slur*>* slurs)
QString ExportBrailleImpl::brailleSlurBefore(ChordRest* chordRest, const std::vector<Slur*>& slurs)
{
if (!chordRest || !slurs || slurs->empty()) {
if (!chordRest || slurs.empty()) {
return QString();
}
@ -2204,7 +2206,7 @@ QString ExportBrailleImpl::brailleSlurBefore(ChordRest* chordRest, std::vector<S
}
QString longSlur = QString();
for (Slur* slur : *slurs) {
for (Slur* slur : slurs) {
//13.3. Page 94. Braille Music Code 2015.
if (isLongSlur(slur) && chordRest->segment() == slur->startSegment()) {
longSlur += BRAILLE_SLUR_BRACKET_START;
@ -2216,9 +2218,9 @@ QString ExportBrailleImpl::brailleSlurBefore(ChordRest* chordRest, std::vector<S
return longSlur;
}
QString ExportBrailleImpl::brailleSlurAfter(ChordRest* chordRest, std::vector<Slur*>* crSlurs)
QString ExportBrailleImpl::brailleSlurAfter(ChordRest* chordRest, const std::vector<Slur*>& crSlurs)
{
if (!chordRest || !crSlurs || crSlurs->empty()) {
if (!chordRest || crSlurs.empty()) {
return QString();
}
@ -2231,7 +2233,7 @@ QString ExportBrailleImpl::brailleSlurAfter(ChordRest* chordRest, std::vector<Sl
QString longSlurBraille = QString();
QString shortSlurBraille = QString();
for (Slur* slur : *crSlurs) {
for (Slur* slur : crSlurs) {
// 13.2. Page 94. Braille Music Code 2015.
// 13.5. Page 98. Music Braille Code 2015. In Braille, slurs are redundant on notes with ties
if (isShortSlur(slur) && chordRest->segment() != slur->endSegment() && !hasTies(chordRest)) {
@ -2252,7 +2254,7 @@ QString ExportBrailleImpl::brailleSlurAfter(ChordRest* chordRest, std::vector<Sl
}
// 13.4 Page 98. Music Braille Code 2015.
if (isShortShortSlurConvergence(&nextCRSlurs)) {
if (isShortShortSlurConvergence(nextCRSlurs)) {
shortSlurBraille = BRAILLE_SLUR_SHORT_CONVERGENCE;
}
// 13.2. Page 94. Braille Music Code 2015.
@ -2265,10 +2267,10 @@ QString ExportBrailleImpl::brailleSlurAfter(ChordRest* chordRest, std::vector<Sl
return shortSlurBraille + longSlurBraille;
}
bool ExportBrailleImpl::isShortShortSlurConvergence(std::vector<Slur*>* slurs)
bool ExportBrailleImpl::isShortShortSlurConvergence(const std::vector<Slur*>& slurs)
{
for (Slur* slur1 : *slurs) {
for (Slur* slur2 : *slurs) {
for (Slur* slur1 : slurs) {
for (Slur* slur2 : slurs) {
if (slur1 != slur2
&& isShortSlur(slur1)
&& isShortSlur(slur2)
@ -2280,10 +2282,10 @@ bool ExportBrailleImpl::isShortShortSlurConvergence(std::vector<Slur*>* slurs)
return false;
}
bool ExportBrailleImpl::isLongLongSlurConvergence(std::vector<Slur*>* slurs)
bool ExportBrailleImpl::isLongLongSlurConvergence(const std::vector<Slur*>& slurs)
{
for (Slur* slur1 : *slurs) {
for (Slur* slur2 : *slurs) {
for (Slur* slur1 : slurs) {
for (Slur* slur2 : slurs) {
if (slur1 != slur2
&& isLongSlur(slur1)
&& isLongSlur(slur2)
@ -2349,14 +2351,14 @@ bool ExportBrailleImpl::isLongSlur(Slur* slur)
return !isShortSlur(slur);
}
QString ExportBrailleImpl::brailleHairpinBefore(ChordRest* chordRest, std::vector<Hairpin*>* hairpins)
QString ExportBrailleImpl::brailleHairpinBefore(ChordRest* chordRest, const std::vector<Hairpin*>& hairpins)
{
if (!chordRest) {
return QString();
}
//TODO we are supposed to use line continuation 1 and 2 if there are multiple lines overlaping
QString result = QString();
for (Hairpin* hairpin : *hairpins) {
for (Hairpin* hairpin : hairpins) {
if (!hairpin || hairpin->startCR() != chordRest) {
continue;
}
@ -2396,7 +2398,7 @@ QString ExportBrailleImpl::brailleHairpinBefore(ChordRest* chordRest, std::vecto
return result;
}
QString ExportBrailleImpl::brailleHairpinAfter(ChordRest* chordRest, std::vector<Hairpin*>* hairpins)
QString ExportBrailleImpl::brailleHairpinAfter(ChordRest* chordRest, const std::vector<Hairpin*>& hairpins)
{
if (!chordRest) {
return QString();
@ -2407,7 +2409,7 @@ QString ExportBrailleImpl::brailleHairpinAfter(ChordRest* chordRest, std::vector
// but since it is not mandatory, we don't do it for simplicity.
// This needs to be accounted when using examples from MBC2015 for tests
QString result = QString();
for (Hairpin* hairpin : *hairpins) {
for (Hairpin* hairpin : hairpins) {
if (!hairpin || hairpin->endCR() != chordRest) {
continue;
}

View file

@ -157,10 +157,10 @@ void GPConverter::convertGP()
// adding capo
for (size_t i = 0; i < _score->parts().size(); ++i) {
Ms::Part* part = _score->parts()[i];
IF_ASSERT_FAILED(part && !part->staves()->empty()) {
IF_ASSERT_FAILED(part && !part->staves().empty()) {
continue;
}
Ms::Staff* staff = part->staves()->front();
Ms::Staff* staff = part->staves().front();
Fraction fr = { 0, 1 };
int capo = staff->capo(fr);

View file

@ -3088,7 +3088,7 @@ Score::FileError importGTP(MasterScore* score, const QString& name)
#endif
for (auto p : infoParts) {
auto staff = p->staves()->back();
auto staff = p->staves().back();
score->removeStaff(staff);
score->removePart(p);
delete staff;

View file

@ -1301,7 +1301,7 @@ Score::FileError PowerTab::read()
Part* p = new Part(pscore);
p->setInstrument(*part->instrument());
Staff* staff = part->staves()->front();
Staff* staff = part->staves().front();
Staff* s = Factory::createStaff(p);
const StaffType* st = staff->staffType(Fraction(0, 1));
@ -1326,7 +1326,7 @@ Score::FileError PowerTab::read()
Excerpt::cloneStaves(score, pscore, stavesMap, tracks);
if (staff->part()->instrument()->stringData()->strings() > 0
&& part->staves()->front()->staffType(Fraction(0, 1))->group() == StaffGroup::STANDARD) {
&& part->staves().front()->staffType(Fraction(0, 1))->group() == StaffGroup::STANDARD) {
p->setStaves(2);
Staff* s1 = p->staff(1);
@ -1340,7 +1340,7 @@ Score::FileError PowerTab::read()
s1->setLines(Fraction(0, 1), static_cast<int>(lines));
Excerpt::cloneStaff(s, s1);
BracketItem* bi = Factory::createBracketItem(pscore->dummy(), BracketType::NORMAL, 2);
p->staves()->front()->addBracket(bi);
p->staves().front()->addBracket(bi);
}
pscore->appendPart(p);

View file

@ -102,14 +102,14 @@ mu::Ret SvgWriter::write(INotationPtr notation, Device& destinationDevice, const
// 1st pass: StaffLines
for (const Ms::System* system : page->systems()) {
size_t stavesCount = system->staves()->size();
size_t stavesCount = system->staves().size();
for (size_t staffIndex = 0; staffIndex < stavesCount; ++staffIndex) {
if (score->staff(staffIndex)->isLinesInvisible(Ms::Fraction(0, 1)) || !score->staff(staffIndex)->show()) {
continue; // ignore invisible staves
}
if (system->staves()->empty() || !system->staff(staffIndex)->show()) {
if (system->staves().empty() || !system->staff(staffIndex)->show()) {
continue;
}

View file

@ -61,7 +61,7 @@ void MuseData::musicalAttribute(QString s, Part* part)
int key = item.midRef(2).toInt();
KeySigEvent ke;
ke.setKey(Key(key));
for (Staff* staff : *(part->staves())) {
for (Staff* staff : part->staves()) {
staff->setKey(curTick, ke);
}
} else if (item.startsWith("Q:")) {

View file

@ -369,7 +369,7 @@ class ExportMusicXml
int findHairpin(const Hairpin* tl) const;
int findOttava(const Ottava* tl) const;
int findTrill(const Trill* tl) const;
void chord(Chord* chord, int staff, const std::vector<Lyrics*>* ll, bool useDrumset);
void chord(Chord* chord, int staff, const std::vector<Lyrics*>& ll, bool useDrumset);
void rest(Rest* chord, int staff);
void clef(int staff, const ClefType ct, const QString& extraAttributes = "");
void timesig(TimeSig* tsig);
@ -377,7 +377,7 @@ class ExportMusicXml
void barlineLeft(const Measure* const m);
void barlineMiddle(const BarLine* bl);
void barlineRight(const Measure* const m, const track_idx_t strack, const track_idx_t etrack);
void lyrics(const std::vector<Lyrics*>* ll, const track_idx_t trk);
void lyrics(const std::vector<Lyrics*>& ll, const track_idx_t trk);
void work(const MeasureBase* measure);
void calcDivMoveToTick(const Fraction& t);
void calcDivisions();
@ -3612,7 +3612,7 @@ QString ExportMusicXml::notePosition(const ExportMusicXml* const expMxml, const
For a single-staff part, \a staff equals zero, suppressing the <staff> element.
*/
void ExportMusicXml::chord(Chord* chord, int staff, const std::vector<Lyrics*>* ll, bool useDrumset)
void ExportMusicXml::chord(Chord* chord, int staff, const std::vector<Lyrics*>& ll, bool useDrumset)
{
Part* part = chord->score()->staff(chord->track() / VOICES)->part();
int partNr = mu::indexOf(_score->parts(), part);
@ -3792,7 +3792,7 @@ void ExportMusicXml::chord(Chord* chord, int staff, const std::vector<Lyrics*>*
*/
notations.etag(_xml);
// write lyrics (only for first note)
if (!grace && (note == nl.front()) && ll) {
if (!grace && (note == nl.front())) {
lyrics(ll, chord->track());
}
_xml.endObject();
@ -5042,9 +5042,9 @@ void ExportMusicXml::symbol(Symbol const* const sym, int staff)
// lyrics
//---------------------------------------------------------
void ExportMusicXml::lyrics(const std::vector<Lyrics*>* ll, const track_idx_t trk)
void ExportMusicXml::lyrics(const std::vector<Lyrics*>& ll, const track_idx_t trk)
{
for (const Lyrics* l :*ll) {
for (const Lyrics* l : ll) {
if (l && !l->xmlText().isEmpty()) {
if ((l)->track() == trk) {
QString lyricXml = QString("lyric number=\"%1\"").arg((l)->no() + 1);
@ -6576,7 +6576,7 @@ void ExportMusicXml::writeElement(EngravingItem* el, const Measure* m, int sstaf
const auto c = toChord(el);
// ise grace after
if (c) {
const auto ll = &c->lyrics();
const auto ll = c->lyrics();
for (const auto g : c->graceNotesBefore()) {
chord(g, sstaff, ll, useDrumset);
}
@ -6924,7 +6924,7 @@ void ExportMusicXml::writeMeasureTracks(const Measure* const m,
const auto lastStaffNr = track2staff(track);
const auto sys = m->mmRest1()->system();
auto textPos = tbox->text()->canvasPos() - m->mmRest1()->canvasPos();
if (lastStaffNr < sys->staves()->size()) {
if (lastStaffNr < sys->staves().size()) {
// convert to position relative to last staff of system
textPos.setY(textPos.y() - (sys->staffCanvasYpage(lastStaffNr) - sys->staffCanvasYpage(0)));
}

View file

@ -72,7 +72,7 @@ void NotationMidiInput::onNoteReceived(const midi::Event& e)
inputEv.pitch = e.note();
inputEv.velocity = e.velocity();
sc->activeMidiPitches()->remove_if([&inputEv](const Ms::MidiInputEvent& val) {
sc->activeMidiPitches().remove_if([&inputEv](const Ms::MidiInputEvent& val) {
return inputEv.pitch == val.pitch;
});
@ -85,7 +85,7 @@ void NotationMidiInput::onNoteReceived(const midi::Event& e)
return;
}
if (sc->activeMidiPitches()->empty()) {
if (sc->activeMidiPitches().empty()) {
inputEv.chord = false;
} else {
inputEv.chord = true;
@ -106,7 +106,7 @@ void NotationMidiInput::onNoteReceived(const midi::Event& e)
playbackController()->playElement(note);
}
sc->activeMidiPitches()->push_back(inputEv);
sc->activeMidiPitches().push_back(inputEv);
m_undoStack->commitChanges();
m_noteChanged.notify();

View file

@ -92,7 +92,7 @@ NotifyList<const Staff*> NotationParts::staffList(const ID& partId) const
return result;
}
for (const Staff* staff: *part->staves()) {
for (const Staff* staff: part->staves()) {
result.push_back(staff);
}
@ -734,7 +734,7 @@ void NotationParts::doInsertPart(Part* part, int index)
{
TRACEFUNC;
std::vector<Staff*> stavesCopy = *part->staves();
std::vector<Staff*> stavesCopy(part->staves());
part->clearStaves();
Ms::InstrumentList instrumentsCopy = *part->instruments();
@ -1027,7 +1027,7 @@ void NotationParts::sortParts(const PartInstrumentList& parts, const std::vector
for (const PartInstrument& pi: parts) {
Ms::Part* currentPart = pi.isExistingPart ? partModifiable(pi.partId) : score()->parts()[partIndex];
for (Ms::Staff* staff : *currentPart->staves()) {
for (Ms::Staff* staff : currentPart->staves()) {
Ms::staff_idx_t actualStaffIndex = mu::indexOf(score()->staves(), staff);
trackMapping.push_back(mu::indexOf(originalStaves, staff));

View file

@ -417,7 +417,7 @@ RectF NotationPlayback::loopBoundaryRectByTick(LoopBoundaryType boundaryType, in
}
Ms::System* system = measure->system();
if (system == nullptr || system->page() == nullptr || system->staves()->empty()) {
if (system == nullptr || system->page() == nullptr || system->staves().empty()) {
return RectF();
}

View file

@ -188,18 +188,18 @@ StaffTextPropertiesDialog::StaffTextPropertiesDialog(QWidget* parent)
if (m_staffText->swing()) {
setSwingBox->setChecked(true);
if (m_staffText->swingParameters()->swingUnit == Constant::division / 2) {
if (m_staffText->swingParameters().swingUnit == Constant::division / 2) {
swingBox->setEnabled(true);
swingEighth->setChecked(true);
swingBox->setValue(m_staffText->swingParameters()->swingRatio);
} else if (m_staffText->swingParameters()->swingUnit == Constant::division / 4) {
swingBox->setValue(m_staffText->swingParameters().swingRatio);
} else if (m_staffText->swingParameters().swingUnit == Constant::division / 4) {
swingBox->setEnabled(true);
swingSixteenth->setChecked(true);
swingBox->setValue(m_staffText->swingParameters()->swingRatio);
} else if (m_staffText->swingParameters()->swingUnit == 0) {
swingBox->setValue(m_staffText->swingParameters().swingRatio);
} else if (m_staffText->swingParameters().swingUnit == 0) {
swingBox->setEnabled(false);
swingOff->setChecked(true);
swingBox->setValue(m_staffText->swingParameters()->swingRatio);
swingBox->setValue(m_staffText->swingParameters().swingRatio);
}
}
@ -411,12 +411,11 @@ void StaffTextPropertiesDialog::voiceButtonClicked(int val)
void StaffTextPropertiesDialog::saveChannel(int channel)
{
std::vector<ChannelActions>* ca = m_staffText->channelActions();
size_t n = ca->size();
std::vector<ChannelActions>& ca = m_staffText->channelActions();
size_t n = ca.size();
for (size_t i = 0; i < n; ++i) {
ChannelActions* a = &(*ca)[i];
if (a->channel == channel) {
ca->erase(ca->begin() + i);
if (ca.at(i).channel == channel) {
ca.erase(ca.begin() + i);
break;
}
}
@ -430,7 +429,7 @@ void StaffTextPropertiesDialog::saveChannel(int channel)
a.midiActionNames.append(item->text(0));
}
}
ca->push_back(a);
ca.push_back(a);
}
//---------------------------------------------------------
@ -474,7 +473,7 @@ void StaffTextPropertiesDialog::channelItemChanged(QTreeWidgetItem* item, QTreeW
ti->setData(0, Qt::UserRole, name);
ti->setText(1, qApp->translate("InstrumentsXML", e.descr.toUtf8().data()));
}
for (const ChannelActions& ca : *m_staffText->channelActions()) {
for (const ChannelActions& ca : m_staffText->channelActions()) {
if (ca.channel == channelIdx) {
for (QString s : ca.midiActionNames) {
QList<QTreeWidgetItem*> items;

View file

@ -206,7 +206,7 @@ Key TransposeDialog::firstPitchedStaffKey() const
Key key = Key::C;
for (const Part* part : notation()->parts()->partList()) {
for (const Staff* staff : *part->staves()) {
for (const Staff* staff : part->staves()) {
if (staff->idx() < startStaffIdx || staff->idx() > endStaffIdx) {
continue;
}