X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpaper-score.cc;h=9b5e8aa7dfb26c936c88ae212938829414bc134c;hb=d000ba690e920b568ec8272d12de46f92aa20f68;hp=cab6834a094225664a5f5e7d318f0e497d9ab9a2;hpb=b7a0cffbf9d1069860368f289a5b50e9d1d90ba8;p=lilypond.git diff --git a/lily/paper-score.cc b/lily/paper-score.cc index cab6834a09..9b5e8aa7df 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1996--2009 Han-Wen Nienhuys + Copyright (C) 1996--2011 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,26 +69,24 @@ Paper_score::typeset_system (System *system) system->unprotect (); } - -vector +void Paper_score::find_break_indices () const { - vector all = root_system ()->used_columns (); - vector retval; + cols_ = root_system ()->used_columns (); + break_indices_.clear (); + break_ranks_.clear (); - for (vsize i = 0; i < all.size (); i++) + for (vsize i = 0; i < cols_.size (); i++) { - Item *it = dynamic_cast (all[i]); - if (Paper_column::is_breakable (all[i]) + Item *it = dynamic_cast (cols_[i]); + if (Paper_column::is_breakable (cols_[i]) && (i == 0 || it->find_prebroken_piece (LEFT)) - && (i == all.size () - 1 || it->find_prebroken_piece (RIGHT))) - retval.push_back (i); + && (i == cols_.size () - 1 || it->find_prebroken_piece (RIGHT))) + { + break_indices_.push_back (i); + break_ranks_.push_back (it->get_column ()->get_rank ()); + } } - - cols_ = all; - break_indices_ = retval; - - return retval; } vector @@ -107,6 +105,14 @@ Paper_score::get_columns () const return cols_; } +vector +Paper_score::get_break_ranks () const +{ + if (break_ranks_.empty ()) + find_break_indices (); + return break_ranks_; +} + vector Paper_score::calc_breaking () {