]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/chord-tremolo-engraver.cc
* lily/note-column.cc (dir): idem.
[lilypond.git] / lily / chord-tremolo-engraver.cc
index 5e983fdc9413cb97f562a47933044622afc329b5..7bb5d93a2b17bf7b729d346566b53b80b639690d 100644 (file)
@@ -13,7 +13,6 @@
 #include "engraver-group-engraver.hh"
 #include "warn.hh"
 #include "misc.hh"
-#include "note-head.hh"
 #include "spanner.hh"
 #include "item.hh"
 #include "chord-tremolo-iterator.hh"
@@ -58,9 +57,9 @@ protected:
   virtual void finalize ();
   virtual bool try_music (Music *);
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Chord_tremolo_engraver::Chord_tremolo_engraver ()
@@ -100,7 +99,7 @@ Chord_tremolo_engraver::try_music (Music *m)
       Rational total_dur = l.main_part_;
       Rational note_dur = total_dur / Rational (elt_count * Repeated_music::repeat_count (repeat_));
 
-      total_duration_flags_ = 0 >? (intlog2 (total_dur.den ()) - 2);
+      total_duration_flags_ = max (0, (intlog2 (total_dur.den ()) - 2));
 
       flags_ = intlog2 (note_dur.den ()) -2;
 
@@ -142,9 +141,9 @@ Chord_tremolo_engraver::typeset_beam ()
 void
 Chord_tremolo_engraver::acknowledge_grob (Grob_info info)
 {
-  if (beam_ && Stem::has_interface (info.grob_))
+  if (beam_ && Stem::has_interface (info.grob ()))
     {
-      Grob *s = info.grob_;
+      Grob *s = info.grob ();
 
       if (start_mom_ == now_mom ())
        Stem::set_beaming (s, flags_, RIGHT);
@@ -170,14 +169,16 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info)
        }
     }
   else if (repeat_
-          && flags_ && !body_is_sequential_ && Stem::has_interface (info.grob_))
+          && flags_
+          && !body_is_sequential_
+          && Stem::has_interface (info.grob ()))
     {
       stem_tremolo_ = make_item ("StemTremolo", repeat_->self_scm ());
       stem_tremolo_->set_property ("flag-count",
                                   scm_int2num (flags_));
-      stem_tremolo_->set_property ("stem",
-                                  info.grob_->self_scm ());
-      stem_tremolo_->set_parent (info.grob_, X_AXIS);
+      stem_tremolo_->set_object ("stem",
+                                  info.grob ()->self_scm ());
+      stem_tremolo_->set_parent (info.grob (), X_AXIS);
     }
 }
 
@@ -206,10 +207,12 @@ Chord_tremolo_engraver::stop_translation_timestep ()
   typeset_beam ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Chord_tremolo_engraver,
                /* descr */ "Generates beams for  tremolo repeats.",
                /* creats*/ "Beam",
                /* accepts */ "repeated-music",
-               /* acks  */ "stem-interface note-head-interface",
+               /* acks  */ "stem-interface",
                /* reads */ "",
                /* write */ "");