]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol.cc
Not quite issue 2149. Create index? predicate for non-negative integers
[lilypond.git] / lily / staff-symbol.cc
index 80be13b993a42d9dccdbb71debc81e3e0708b9d0..e2ea43a570a37bc5452fec3232bf262233a0ab80 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
 #include "lookup.hh"
 #include "dimensions.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "warn.hh"
 #include "item.hh"
 #include "staff-symbol-referencer.hh"
@@ -66,10 +67,10 @@ Staff_symbol::print (SCM smob)
         {
           Item *x = sp->get_bound (d);
 
-          span_points[d] = x->relative_coordinate (common, X_AXIS);
-          if (!x->break_status_dir ()
-              && !x->extent (x, X_AXIS).is_empty ())
-            span_points[d] += x->extent (x, X_AXIS)[d];
+          span_points[d] = ((!x->break_status_dir ()
+                             && !x->extent (x, X_AXIS).is_empty ())
+                            ? Paper_column::break_align_width (x, ly_symbol2scm ("break-alignment"))[d]
+                            : x->relative_coordinate (common, X_AXIS));
         }
 
       span_points[d] -= d * t / 2;
@@ -156,6 +157,7 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
   Direction dir = (Direction)sign (pos - nearest_line);
 
   if (scm_is_pair (ledger_positions))
+    // custom ledger line positions
     {
       Real min_pos = HUGE_VAL;
       Real max_pos = -HUGE_VAL;
@@ -184,6 +186,8 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
       int n = (int) floor ((ledger_fill[DOWN] - min_pos) / cycle);
       Real current;
       SCM s = scm_cdr (ledger_positions);
+      if (!scm_is_pair (s) || cycle < 0.1)
+        return values;
       do
         {
           s2 = scm_car (s);
@@ -225,6 +229,7 @@ Staff_symbol::ledger_positions (Grob *me, int pos)
       while (current <= ledger_fill[UP]);
     }
   else
+    // normal ledger lines
     {
       int ledger_count = (int) floor ((abs (nearest_line - pos) + ledger_extra) / 2);
       values.resize (ledger_count);