lilypond-devel
[Top][All Lists]
Advanced

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

Fixes note column skylines by adding stem tremolo to axis group. (issue4


From: mtsolo
Subject: Fixes note column skylines by adding stem tremolo to axis group. (issue4754054)
Date: Mon, 18 Jul 2011 16:11:09 +0000

Reviewers: ,

Message:
This fixes issue 1768.

Description:
Fixes note column skylines by adding stem tremolo to axis group.

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

Affected files:
  A input/regression/stem-tremolo-note-column.ly
  M lily/include/note-column.hh
  M lily/note-column.cc
  M lily/rhythmic-column-engraver.cc
  M scm/define-grob-properties.scm


Index: input/regression/stem-tremolo-note-column.ly
diff --git a/input/regression/stem-tremolo-note-column.ly b/input/regression/stem-tremolo-note-column.ly
new file mode 100644
index 0000000000000000000000000000000000000000..b09bd024fc45dc170746f4d5083464199524c7bc
--- /dev/null
+++ b/input/regression/stem-tremolo-note-column.ly
@@ -0,0 +1,12 @@
+\version "2.15.6"
+\header{
+  texidoc="Stem tremolos count in a note column's horizontal skyline.
+"
+}
+
+
+\relative c'' {
+  \autoBeamOff
+  \override NoteHead #'stencil = #(ly:make-stencil '() '(0 . 0) '(0 . 0))
+  \repeat unfold 8 { b8:32 }
+}
Index: lily/include/note-column.hh
diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh
index d2138e9fcdce2bdecae5808791ee528eec62ebb0..4af4df9070bd00d61b206f435bf06edf8121f91c 100644
--- a/lily/include/note-column.hh
+++ b/lily/include/note-column.hh
@@ -40,6 +40,7 @@ public:
   static Grob *first_head (Grob *me);
   static Grob *get_rest (Grob *me);
   static void set_stem (Grob *me, Grob *);
+  static void set_stem_tremolo (Grob *me, Grob *);
   static void add_head (Grob *me, Grob *);
   static bool has_rests (Grob *me);
   static Grob *dot_column (Grob *me);
Index: lily/note-column.cc
diff --git a/lily/note-column.cc b/lily/note-column.cc
index 2ba81c66c47b0349865a459ff3e12b630c72b1e2..c44db9a94441566848549b9263ecbb92394edc77 100644
--- a/lily/note-column.cc
+++ b/lily/note-column.cc
@@ -106,6 +106,13 @@ Note_column::set_stem (Grob *me, Grob *stem)
   Axis_group_interface::add_element (me, stem);
 }

+void
+Note_column::set_stem_tremolo (Grob *me, Grob *stem_tremolo)
+{
+  me->set_object ("stem-tremolo", stem_tremolo->self_scm ());
+  Axis_group_interface::add_element (me, stem_tremolo);
+}
+
 Grob *
 Note_column::get_rest (Grob *me)
 {
@@ -216,4 +223,5 @@ ADD_INTERFACE (Note_column,
               "rest "
               "rest-collision "
               "stem "
+              "stem-tremolo "
               );
Index: lily/rhythmic-column-engraver.cc
diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 9768cafcabaf9b97c2d7f20023f50732de0adaa4..49c1a47710ad833921ca9a85308c047ba337a7af 100644
--- a/lily/rhythmic-column-engraver.cc
+++ b/lily/rhythmic-column-engraver.cc
@@ -55,6 +55,7 @@ class Rhythmic_column_engraver : public Engraver
 {
   vector<Grob*> rheads_;
   Grob *stem_;
+  Grob *stem_tremolo_;
   Grob *note_column_;
   Grob *dotcol_;
   Grob *arpeggio_;
@@ -63,6 +64,7 @@ class Rhythmic_column_engraver : public Engraver
 protected:

   DECLARE_ACKNOWLEDGER (stem);
+  DECLARE_ACKNOWLEDGER (stem_tremolo);
   DECLARE_ACKNOWLEDGER (rhythmic_head);
   DECLARE_ACKNOWLEDGER (arpeggio);
   void process_acknowledged ();
@@ -99,6 +101,13 @@ Rhythmic_column_engraver::process_acknowledged ()
          && !stem_->get_parent (X_AXIS))
        {
          Note_column::set_stem (note_column_, stem_);
+          if (stem_tremolo_
+             && stem_tremolo_->get_parent (X_AXIS) == stem_)
+         {
+           Note_column::set_stem_tremolo (note_column_, stem_tremolo_);
+           stem_tremolo_ = 0;
+         }
+
          stem_ = 0;
        }

@@ -114,6 +123,12 @@ Rhythmic_column_engraver::acknowledge_stem (Grob_info i)
 }

 void
+Rhythmic_column_engraver::acknowledge_stem_tremolo (Grob_info i)
+{
+  stem_tremolo_ = i.grob ();
+}
+
+void
 Rhythmic_column_engraver::acknowledge_rhythmic_head (Grob_info i)
 {
   rheads_.push_back (i.grob ());
@@ -134,6 +149,7 @@ Rhythmic_column_engraver::stop_translation_timestep ()
 }

 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem);
+ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem_tremolo);
 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head);
 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, arpeggio);

Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 5c2114338e053cb5468c5af6672d689d22d74ddf..9a54b954e3f51873c9bd455cdae8f6acecc75145 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1064,6 +1064,7 @@ with lots of rhythmic diversity. For predictable results, use LEFT and RIGHT.")
      (staff-grouper ,ly:grob? "The staff grouper we belong to.")
      (staff-symbol ,ly:grob? "The staff symbol grob that we are in.")
      (stem ,ly:grob? "A pointer to a @code{Stem} object.")
+     (stem-tremolo ,ly:grob? "A pointer to a @code{StemTremolo} object.")
      (stems ,ly:grob-array? "An array of stem objects.")

      (tie ,ly:grob? "A pointer to a @code{Tie} object.")





reply via email to

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