X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsystem.cc;h=8fee38257286408c69ed8df8ce4042ece36a7ca2;hb=652f02a53886cde08c691eec6e13a7523b061268;hp=3337a77146d4e193682f38a2ba60f6807d39f131;hpb=fb2c53d8b1c06d8b20e92024ed6f9c34a7e11a33;p=lilypond.git diff --git a/lily/system.cc b/lily/system.cc index 3337a77146..8fee382572 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -24,6 +24,8 @@ #include "tweak-registration.hh" #include "warn.hh" +extern bool debug_skylines; + System::System (System const &src, int count) : Spanner (src, count) { @@ -243,10 +245,7 @@ System::add_column (Paper_column *p) ga = unsmob_grob_array (scm_ga); } - p->rank_ - = ga->size () - ? Paper_column::get_rank (ga->array ().back ()) + 1 - : 0; + p->rank_ = ga->size (); ga->add (p); Axis_group_interface::add_element (this, p); @@ -398,6 +397,11 @@ System::get_paper_system () Stencil sys_stencil (Box (x, y), scm_cons (ly_symbol2scm ("combine-stencil"), exprs)); + if (debug_skylines) + { + sys_stencil.add_stencil (points_to_line_stencil (skylines_[UP].to_points ()).in_color (255, 0, 0)); + sys_stencil.add_stencil (points_to_line_stencil (skylines_[DOWN].to_points ()).in_color (0, 255, 0)); + } Grob *left_bound = this->get_bound (LEFT); SCM prop_init = left_bound->get_property ("line-break-system-details"); @@ -438,17 +442,18 @@ System::broken_col_range (Item const *left, Item const *right) const left = left->get_column (); right = right->get_column (); + extract_grob_set (this, "columns", cols); - vsize i = 0; - while (i < cols.size () - && cols[i] != left) - i++; + vsize i = binary_search (cols, (Grob *) left, + Paper_column::less_than); + + int end_rank = Paper_column::get_rank (right); if (i < cols.size ()) i++; while (i < cols.size () - && cols[i] != right) + && Paper_column::get_rank (cols[i]) < end_rank) { Paper_column *c = dynamic_cast (cols[i]); if (Paper_column::is_breakable (c) && !c->system_) @@ -459,6 +464,7 @@ System::broken_col_range (Item const *left, Item const *right) const return ret; } + /** Return all columns, but filter out any unused columns , since they might disrupt the spacing problem. */ vector @@ -484,6 +490,17 @@ System::columns () const return columns; } +Grob* +System::column (int which) const +{ + extract_grob_set (this, "columns", columns); + for (vsize i = 0; i < columns.size (); i++) + if (dynamic_cast (columns[i])->get_rank () == which) + return columns[i]; + programming_error ("couldn't find the column of the requested index"); + return columns[0]; +} + Paper_score* System::paper_score () const { @@ -523,12 +540,14 @@ System::build_skylines () boxes.push_back (Box (xiv, yiv)); } - skylines_[UP] = Skyline (boxes, X_AXIS, UP); - skylines_[DOWN] = Skyline (boxes, X_AXIS, DOWN); + SCM horizon_padding_scm = get_property ("skyline-horizontal-padding"); + Real horizon_padding = robust_scm2double (horizon_padding_scm, 0); + skylines_[UP] = Skyline (boxes, horizon_padding, X_AXIS, UP); + skylines_[DOWN] = Skyline (boxes, horizon_padding, X_AXIS, DOWN); } -ADD_INTERFACE (System, "system-interface", +ADD_INTERFACE (System, "This is the toplevel object: each object in a score " "ultimately has a System object as its X and Y parent. ", @@ -538,4 +557,5 @@ ADD_INTERFACE (System, "system-interface", "pure-Y-extent " "spaceable-staves " "skyline-distance " + "skyline-horizontal-padding " )