]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ledger-line-spanner.cc
* scm/page-layout.scm (plain-header): add printpagenumber boolean
[lilypond.git] / lily / ledger-line-spanner.cc
index 6bc1b830c69e7eb4bc30fac66e573ee06040cca0..6506eb0e2aeb1f1a5d90426278050bb0f05d0f6c 100644 (file)
@@ -17,7 +17,6 @@
 #include "spanner.hh" 
 #include "group-interface.hh" 
 #include "paper-column.hh"
-#include "ambitus.hh"
 
 struct Ledger_line_spanner
 {
@@ -107,10 +106,15 @@ Ledger_line_spanner::print (SCM smob)
 {
   Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (smob));
   Link_array<Grob> heads (Pointer_group_interface__extract_grobs (me, (Grob*)0, "note-heads"));
-  Link_array<Grob> ambituses (Pointer_group_interface__extract_grobs (me, (Grob*)0, "ambituses"));
 
-  if (heads.is_empty () && ambituses.is_empty ())
+  if (heads.is_empty ())
     return SCM_EOL;
+  
+  // find size of note heads.
+  Grob * staff = Staff_symbol_referencer::get_staff_symbol (me);
+  if (!staff)
+    return SCM_EOL;
+  
     
   Stencil ledgers;
   Stencil default_ledger;
@@ -121,14 +125,11 @@ Ledger_line_spanner::print (SCM smob)
     {
       Axis a = Axis (i);
       common[a] = common_refpoint_of_array (heads, me, a);
-      common[a] = common_refpoint_of_array (ambituses, common[a], a);
       for (int i = heads.size (); i--; )
        if (Grob * g = unsmob_grob (me->get_property ("accidental-grob")))
          common[a] = common[a]->common_refpoint (g, a);
     }
 
-  // find size of note heads.
-  Grob * staff = Staff_symbol_referencer::get_staff_symbol (me);
   int interspaces = Staff_symbol::line_count (staff)-1;
   Ledger_requests reqs;
   Real length_fraction = 0.25;
@@ -137,11 +138,12 @@ Ledger_line_spanner::print (SCM smob)
       Item *h = dynamic_cast<Item*> (heads[i]);
       
       int pos = Staff_symbol_referencer::get_rounded_position (h);
-      if (abs (pos) > interspaces)
+      if (pos
+         && abs (pos) > interspaces)
        {
          Interval head_extent = h->extent (common[X_AXIS], X_AXIS);
          Interval ledger_extent = head_extent;
-         head_extent.widen (length_fraction * head_extent.length ());
+         ledger_extent.widen (length_fraction * head_extent.length ());
 
          Direction vdir = Direction (sign (pos));
          int rank = Paper_column::get_rank (h->get_column ());
@@ -237,30 +239,7 @@ Ledger_line_spanner::print (SCM smob)
        }
     }
 
-  /* create  ledgers for ambitus.
-
-  TODO: split off separate function
 
-  */      
-  for (int i = ambituses.size (); i--; )
-    {
-      Item *a = dynamic_cast<Item*> (ambituses[i]);
-      Interval x_ext = ambituses[i]->extent (common[X_AXIS], X_AXIS);
-      x_ext.widen (length_fraction * x_ext.length ());
-      
-      Slice ps (Ambitus::get_positions (a));
-      Direction d = DOWN; 
-      do
-       {
-         if (abs (ps[d]) > interspaces + 1)
-           ledgers.add_stencil (brew_ledger_lines (staff, ps[d], interspaces,
-                                                   halfspace,
-                                                   ledgerlinethickness,
-                                                   x_ext, 0.0));
-       }
-      while (flip (&d) != DOWN);
-    }
-      
   ledgers.translate_axis (-me->relative_coordinate (common[X_AXIS], X_AXIS),
                          X_AXIS);
   
@@ -269,5 +248,5 @@ Ledger_line_spanner::print (SCM smob)
 
 ADD_INTERFACE (Ledger_line_spanner,
               "ledger-line-interface",
-              "This spanner draws the ledger lines of a staff on note heads. ",
+              "This spanner draws the ledger lines of a staff, for note heads that stick out. ",
               "note-heads thickness gap length minimum-length")