]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
Fix #10.
[lilypond.git] / lily / system.cc
index 4d42bdb171c61ed52a4c58ad041f992eae80c281..5070f9426cd92506b77d97e3a9f108200f55e1ff 100644 (file)
@@ -23,6 +23,7 @@
 #include "staff-symbol-referencer.hh"
 #include "tweak-registration.hh"
 #include "warn.hh"
+#include "lookup.hh"
 
 extern bool debug_skylines;
 
@@ -245,10 +246,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);
@@ -402,8 +400,8 @@ System::get_paper_system ()
                                 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));
+      sys_stencil.add_stencil (Lookup::points_to_line_stencil (0.1, skylines_[UP].to_points ()).in_color (255, 0, 0));
+      sys_stencil.add_stencil (Lookup::points_to_line_stencil (0.1, skylines_[DOWN].to_points ()).in_color (0, 255, 0));
     }
 
   Grob *left_bound = this->get_bound (LEFT);
@@ -448,9 +446,7 @@ System::broken_col_range (Item const *left, Item const *right) const
   
   extract_grob_set (this, "columns", cols);
 
-  vsize i = binary_search (cols, (Grob *) left,
-                          Paper_column::less_than);
-
+  vsize i = Paper_column::get_rank (left);
   int end_rank = Paper_column::get_rank (right);
   if (i < cols.size ())
     i++;
@@ -493,6 +489,13 @@ System::columns () const
   return columns;
 }
 
+Grob*
+System::column (int which) const
+{
+  extract_grob_set (this, "columns", columns);
+  return columns[which];
+}
+
 Paper_score*
 System::paper_score () const
 {
@@ -532,9 +535,10 @@ System::build_skylines ()
        boxes.push_back (Box (xiv, yiv));
     }
 
-  /* todo: make skyline slope configurable? */
-  skylines_[UP] = Skyline (boxes, 2, X_AXIS, UP);
-  skylines_[DOWN] = Skyline (boxes, 2, 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);
 }
 
 
@@ -548,4 +552,5 @@ ADD_INTERFACE (System,
               "pure-Y-extent "
               "spaceable-staves "
               "skyline-distance "
+              "skyline-horizontal-padding "
               )