From: Joe Neeman Date: Sat, 30 Sep 2006 20:59:53 +0000 (+0000) Subject: * lily/page-spacing.cc (compress_lines, uncompress_solution): X-Git-Tag: cvs/HEAD~43 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0aa4202d3d301a4bfc59412be4665255e393d77f;p=lilypond.git * lily/page-spacing.cc (compress_lines, uncompress_solution): handle correctly the case where there are multiple \noPageBreaks in a row. --- diff --git a/ChangeLog b/ChangeLog index 6b7d18f509..1c4c1e9aed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-10-01 Joe Neeman + + * lily/page-spacing.cc (compress_lines, uncompress_solution): + handle correctly the case where there are multiple \noPageBreaks + in a row. + 2006-09-30 Laura Conrad * abc2ly.py adds segno (S) and Coda (O) to articulations. diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index dd468e7ea9..945a52b60a 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -91,26 +91,26 @@ compress_lines (const vector &orig) for (vsize i = 0; i < orig.size (); i++) { - if (i < orig.size () - 1 && orig[i].page_permission_ == SCM_EOL) + if (ret.size () && ret.back ().page_permission_ == SCM_EOL) { - Line_details compressed = orig[i+1]; - compressed.extent_[DOWN] = orig[i].extent_[DOWN]; - compressed.extent_[UP] = orig[i].extent_[UP] + orig[i+1].extent_.length () + orig[i].padding_; - compressed.space_ += orig[i].space_; - compressed.inverse_hooke_ += orig[i].inverse_hooke_; + Line_details const &old = ret.back (); + Line_details compressed = orig[i]; + compressed.extent_[DOWN] = old.extent_[DOWN]; + compressed.extent_[UP] = old.extent_[UP] + orig[i].extent_.length () + old.padding_; + compressed.space_ += old.space_; + compressed.inverse_hooke_ += old.inverse_hooke_; /* we don't need the force_ field for the vertical spacing, - so we use force_ = -1 to signal that the line was compressed - (and force_ = +1 otherwise). + so we use force_ = n to signal that the line was compressed, + reducing the number of lines by n (and force_ = 0 otherwise). This makes uncompression much easier. */ - compressed.force_ = -1; - ret.push_back (compressed); - i++; + compressed.force_ = old.force_ + 1; + ret.back () = compressed; } else { ret.push_back (orig[i]); - ret.back ().force_ = 1; + ret.back ().force_ = 0; } } return ret; @@ -130,8 +130,7 @@ uncompress_solution (vector const &systems_per_page, { int compressed_count = 0; for (vsize j = start_sys; j < start_sys + systems_per_page[i]; j++) - if (compressed[j].force_ < 0) - compressed_count++; + compressed_count += (int)compressed[j].force_; ret.push_back (systems_per_page[i] + compressed_count); start_sys += systems_per_page[i];