From 13a0db06c9f03b344d35ebd11ccc5eac16d5345d Mon Sep 17 00:00:00 2001 From: Maurizio Gavioli Date: Sun, 11 Nov 2012 01:50:57 +0100 Subject: [PATCH] Comments improved and cleaned up. --- libmscore/barline.cpp | 27 ++++----------------------- libmscore/layout.cpp | 5 +---- libmscore/undo.cpp | 1 + 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/libmscore/barline.cpp b/libmscore/barline.cpp index ef3dbecc0c..8971e0151a 100644 --- a/libmscore/barline.cpp +++ b/libmscore/barline.cpp @@ -435,7 +435,7 @@ Element* BarLine::drop(const DropData& data) delete e; return 0; } - // system left-hand bar line + // system left-side bar line if (parent()->type() == SYSTEM) { BarLine* b = static_cast(parent())->barLine(); score()->undoChangeProperty(b, P_SUBTYPE, int(bl->subtype())); @@ -454,7 +454,7 @@ Element* BarLine::drop(const DropData& data) // if drop refers to span, update this bar line span if(bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) { // if dropped spanFrom or spanTo are below the middle of standard staff (5 lines) - // adjust to the number of lines of this bar line staff + // adjust to the number of syaff lines int bottomSpan = (staff()->lines()-1) * 2; int spanFrom = bl->spanFrom() > 4 ? bottomSpan - (8 - bl->spanFrom()) : bl->spanFrom(); int spanTo = bl->spanTo() > 4 ? bottomSpan - (8 - bl->spanTo()) : bl->spanTo(); @@ -531,11 +531,11 @@ void BarLine::endEdit() _span = _origSpan; // restore original span values _spanFrom = _origSpanFrom; _spanTo = _origSpanTo; - // undoable change score()->undoChangeSingleBarLineSpan(this, newSpan, newSpanFrom, newSpanTo); return; } + // if same as staff settings, do nothing if (staff()->barLineSpan() == _span && staff()->barLineFrom() == _spanFrom && staff()->barLineTo() == _spanTo) return; @@ -553,7 +553,7 @@ void BarLine::endEdit() else { int idx1 = staffIdx() + _span; int idx2 = staffIdx() + staff()->barLineSpan(); - // set standard span for each un-spanned staff + // set standard span for each no-longer-spanned staff for (int idx = idx1; idx < idx2; ++idx) score()->undoChangeBarLineSpan(score()->staff(idx), 1, 0, (score()->staff(idx)->lines()-1)*2); } @@ -561,8 +561,6 @@ void BarLine::endEdit() // update span for the staff the edited bar line belongs to score()->undoChangeBarLineSpan(staff(), _span, _spanFrom, _spanTo); - // added "_score->setLayoutAll(true);" to ChangeBarLineSpan::flip() - // otherwise no measure bar line update occurs } //--------------------------------------------------------- @@ -612,7 +610,6 @@ void BarLine::endEditDrag() qreal y1, y2; getY(&y1, &y2); qreal ay0 = pagePos().y(); -// qreal ay1 = ay0 + y1; qreal ay2 = ay0 + y2; // absolute (page-relative) bar line bottom coord int staffIdx1 = staffIdx(); @@ -681,25 +678,9 @@ void BarLine::endEditDrag() // if any value changed, update if(newSpan != _span || newSpanFrom != _spanFrom || newSpanTo != _spanTo) { -/* ONLY TAKE NOTE OF NEW SPAN VALUES: LET BarLine::endEdit() DO THE JOB! - if (newSpan > _span) { - int diff = newSpan - _span; - staffIdx1 += _span; - staffIdx2 = staffIdx1 + diff; - Segment* s = score()->firstMeasure()->first(SegEndBarLine); - for (; s; s = s->next1(SegEndBarLine)) { - for (int staffIdx = staffIdx1; staffIdx < staffIdx2; ++staffIdx) { - Element* e = s->element(staffIdx * VOICES); - if (e) { - score()->undoRemoveElement(e); - } - } - } - } */ _span = newSpan; _spanFrom = newSpanFrom; _spanTo = newSpanTo; -// score()->undoChangeBarLineSpan(staff(), _span, _spanFrom, _spanTo); } yoff1 = yoff2 = 0.0; diff --git a/libmscore/layout.cpp b/libmscore/layout.cpp index 2fe2bd94da..9a841f5675 100644 --- a/libmscore/layout.cpp +++ b/libmscore/layout.cpp @@ -2752,9 +2752,6 @@ qreal Score::computeMinWidth(Segment* fs) const //--------------------------------------------------------- // updateBarLineSpans /// updates bar line span(s) when the number of lines of a staff changes -// -// if idxIsStaffIdx == true, change is for staff(idx) -// if idxIsStaffIdx ==false, change for all staves with StaffType idx //--------------------------------------------------------- void Score::updateBarLineSpans(int idx, int linesOld, int linesNew) @@ -2766,7 +2763,7 @@ void Score::updateBarLineSpans(int idx, int linesOld, int linesNew) // barLineSpan is not changed; barLineFrom and barLineTo are changed if they occur in the bottom half of a staff // in practice, a barLineFrom/To from/to the top half of the staff is linked to the staff top line, // a barLineFrom/To from/to the bottom half of the staff is linked to staff bottom line; - // this ensures plainchant and mensurstrich special bar lines keep their relationships to the staff. + // this ensures plainchant and mensurstrich special bar lines keep their relationships to the staff lines. for(int sIdx = 0; sIdx < nStaves; sIdx++) { _staff = staff(sIdx); // if this is the modified staff diff --git a/libmscore/undo.cpp b/libmscore/undo.cpp index 32c88b57e3..b2121293cd 100644 --- a/libmscore/undo.cpp +++ b/libmscore/undo.cpp @@ -2237,6 +2237,7 @@ void ChangeStaff::flip() MStaff* mstaff = m->mstaff(staffIdx); mstaff->lines->setVisible(!staff->invisible()); } + // if staff type changed, the whole staff across the entire score needs re-laying out if(typeChanged) score->setLayoutAll(true); }