]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4828/1: Allow override of NoteHead.ledger-positions
authorPaul Morris <paulwmorris@gmail.com>
Tue, 19 Apr 2016 19:46:08 +0000 (15:46 -0400)
committerPaul Morris <paulwmorris@gmail.com>
Sun, 1 May 2016 16:22:22 +0000 (12:22 -0400)
Typical use case is:
\once \override NoteHead.ledger-positions = #'(...)
where the user specifies a list of ledger positions.

lily/include/staff-symbol.hh
lily/ledger-line-spanner.cc
lily/note-head.cc
lily/staff-symbol.cc
scm/define-grob-properties.scm

index 9454ebe7f445a53c72f7284c1e7bfb5a6cd9280e..28b30244c7a87316721b913655aab890b5157cfe 100644 (file)
@@ -34,7 +34,7 @@ public:
   static Real get_ledger_line_thickness (Grob *);
 
   static vector<Real> line_positions (Grob *);
-  static vector<Real> ledger_positions (Grob *me, int pos);
+  static vector<Real> ledger_positions (Grob *me, int pos, Item const *head = 0);
   static int line_count (Grob *);
   static bool on_line (Grob *me, int pos, bool allow_ledger = true);
   static Interval line_span (Grob *);
index 42d32b496af7bb5ec7a15f1b52cdbc4ea84959c8..2fe2d7d9c3896e0b627dccc8f78ab51444007006 100644 (file)
@@ -211,10 +211,9 @@ Ledger_line_spanner::print (SCM smob)
   for (vsize i = heads.size (); i--;)
     {
       Item *h = dynamic_cast<Item *> (heads[i]);
-
       int pos = Staff_symbol_referencer::get_rounded_position (h);
       vector<Real> ledger_positions =
-        Staff_symbol::ledger_positions (staff, pos);
+        Staff_symbol::ledger_positions (staff, pos, h);
 
       // We work with all notes that produce ledgers and any notes that
       // fall outside the staff that do not produce ledgers, such as
index 33bbf339cafd9b431b83d2955522c2c8f91c1379..73a2255d9040a91199e994cf05c2fe0e6f9a74b5 100644 (file)
@@ -211,5 +211,6 @@ ADD_INTERFACE (Note_head,
                "glyph-name "
                "stem-attachment "
                "style "
+               "ledger-positions "
               );
 
index 256a9bdd0d24687ac26a63cc8cbc9a7ca2c7159e..527a5c7baf726b2a0d04d7e4e1c841777ea9fa0f 100644 (file)
@@ -135,8 +135,16 @@ Staff_symbol::line_positions (Grob *me)
 }
 
 vector<Real>
-Staff_symbol::ledger_positions (Grob *me, int pos)
+Staff_symbol::ledger_positions (Grob *me, int pos, Item const *head)
 {
+  // allow the option to override ledger positions via note head grob
+  if (head)
+    {
+      SCM posns = head->get_property ("ledger-positions");
+      if (scm_is_pair (posns))
+        return ly_scm2floatvector (posns);
+    }
+
   SCM ledger_positions = me->get_property ("ledger-positions");
   Real ledger_extra = robust_scm2double (me->get_property ("ledger-extra"), 0);
   vector<Real> line_positions = Staff_symbol::line_positions (me);
index e54bdaf18386363be5afb59c7016051dedf88af2..dcf9705998236a2a78da8ae062fb62d003930731 100644 (file)
@@ -575,8 +575,10 @@ lines for.")
 lines.  It is the sum of 2@tie{}numbers: The first is the factor for
 line thickness, and the second for staff space.  Both contributions
 are added.")
-     (ledger-positions ,list? "Repeating pattern for the vertical positions
-of ledger lines.  Bracketed groups are always shown together.")
+     (ledger-positions ,list? "Vertical positions of ledger lines.
+When set on a @code{StaffSymbol} grob it defines a repeating
+pattern of ledger lines and any parenthesized groups will always be
+shown together.")
      (left-bound-info ,list? "An alist of properties for determining
 attachments of spanners to edges.")
      (left-padding ,ly:dimension? "The amount of space that is put