lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Allows LilyPond to ignore certain note-heads in a stem. (issue4547058)


From: mtsolo
Subject: Allows LilyPond to ignore certain note-heads in a stem. (issue4547058)
Date: Sun, 22 May 2011 07:38:17 +0000

Reviewers: ,

Message:
I put this together to do some work with harmonics.  It seems to do the
trick OK.

I've been running this test file to see if it breaks anything:


\relative c' {
  <a d \tweak #'stem-ignore ##t a''> <a d>
  \stemDown
  <a d \tweak #'stem-ignore ##t a''> <a d>
  \stemUp
  \repeat unfold 8 <a d \tweak #'stem-ignore ##t a''>8
  \stemDown
  \repeat unfold 8 <a d \tweak #'stem-ignore ##t a''>8
  <a d \harmonic \parenthesize \tweak #'stem-ignore ##t \tweak
#'duration-log #2 a''>1
  <a d \harmonic>
}


Description:
Allows LilyPond to ignore certain note-heads in a stem.

Please review this at http://codereview.appspot.com/4547058/

Affected files:
  M lily/note-head.cc
  M lily/stem.cc
  M scm/define-grob-properties.scm


Index: lily/note-head.cc
diff --git a/lily/note-head.cc b/lily/note-head.cc
index aeb7b4a19bd395bb730178820fcf5c8d150127df..1252c3413bee1b3a4951e63677cd21fbede72399 100644
--- a/lily/note-head.cc
+++ b/lily/note-head.cc
@@ -190,6 +190,7 @@ ADD_INTERFACE (Note_head,
               "accidental-grob "
               "glyph-name "
               "stem-attachment "
+              "stem-ignore "
               "style "
               );

Index: lily/stem.cc
diff --git a/lily/stem.cc b/lily/stem.cc
index 04bc4105922e0ecfbca2ea41da058b007ff25fe7..cf2ce0b8d684d4f7e0b5cc92a224b85e0f4a66e7 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -123,10 +123,6 @@ Stem::set_stemend (Grob *me, Real se)
 Grob *
 Stem::support_head (Grob *me)
 {
-  extract_grob_set (me, "note-heads", heads);
-  if (heads.size () == 1)
-    return heads[0];
-
   return first_head (me);
 }

@@ -176,6 +172,8 @@ Stem::extremal_heads (Grob *me)
   for (vsize i = heads.size (); i--;)
     {
       Grob *n = heads[i];
+      if (to_boolean (n->get_property ("stem-ignore")))
+        continue;
       int p = Staff_symbol_referencer::get_rounded_position (n);

       Direction d = LEFT;
@@ -202,6 +200,8 @@ Stem::note_head_positions (Grob *me)
   for (vsize i = heads.size (); i--;)
     {
       Grob *n = heads[i];
+      if (to_boolean (n->get_property ("stem-ignore")))
+        continue;
       int p = Staff_symbol_referencer::get_rounded_position (n);

       ps.push_back (p);
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 7fd0b138190bf35f20d9fcec62934c92af86839b..1d2ba756e1aa8212b6399b38d87f14e62c22ae6c 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -836,6 +836,8 @@ structure.")
 pair where the stem attaches to the notehead.")
      (stem-end-position ,number? "Where does the stem end (the end is
 opposite to the support-head)?")
+     (stem-ignore ,boolean? "Should a note-head be ignored by (meaning
+not connected to) its stem?")
      ;;[TODO: doco]
      (stem-spacing-correction ,number? "Optical correction amount for
 stems that are placed in tight configurations.  For opposite





reply via email to

[Prev in Thread] Current Thread [Next in Thread]