]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest.cc
Merge remote branch 'origin/master' into release/unstable
[lilypond.git] / lily / rest.cc
index 7191b3ba93eeca9134b062eaf08d5c8645baca58..4f05764296c4faf61df85f892c9327293ca4d2fb 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2015 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
@@ -72,12 +72,13 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
       return pos;
     }
 
-  pos = 4 * dir;
+  Real vpos = dir * robust_scm2int (me->get_property ("voiced-position"), 0);
+  pos = vpos;
 
   if (duration_log > 1)
     /* Only half notes or longer want alignment with staff lines */
     return pos;
-      
+
   /*
     We need a staff symbol for actually aligning anything
   */
@@ -89,9 +90,9 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
 
   if (linepos.empty ())
     return pos;
-      
+
   std::sort (linepos.begin (), linepos.end ());
-          
+
   if (duration_log == 0)
     {
       /*
@@ -105,7 +106,7 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
         make a semibreve rest hang from the next available line,
         except when there is none.
       */
-      
+
       std::vector<Real>::const_iterator it
         = std::upper_bound (linepos.begin (), linepos.end (), pos);
       if (it != linepos.end ())
@@ -127,16 +128,15 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
     return pos;
 
   /* If we have a voiced position, make sure that it's on the
-     proper side of neutral before using it.  If it isn't, we fall
-     back to a constant offset from neutral position.
+     proper side of neutral before using it.
   */
 
   Real neutral = staff_position_internal (me, duration_log, 0);
 
   if (dir * (pos - neutral) > 0)
     return pos;
-
-  return neutral + 4 * dir;
+  else
+    return neutral + vpos;
 }
 
 /* A rest might lie under a beam, in which case it should be cross-staff if
@@ -199,11 +199,10 @@ Rest::glyph_name (Grob *me, int durlog, const string &style, bool try_ledgers,
         actual_style = "";
     }
 
-  if ((style == "classical") && (durlog != 2))
+  if (((style == "classical") || (style == "z")) && (durlog != 2))
     {
       /*
-        classical style: revert back to default style for any rest other
-        than quarter rest
+        these styles differ from the default in quarter rests only
       */
       actual_style = "";
     }
@@ -318,4 +317,5 @@ ADD_INTERFACE (Rest,
                "direction "
                "minimum-distance "
                "style "
+               "voiced-position "
               );