]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/volta-engraver.cc
* lily/context.cc (where_defined): also assign value in
[lilypond.git] / lily / volta-engraver.cc
index 03e940650d32e43ac20ee09c4758b4a255b9e60b..089045005f0129a924bfe5553396e4f83d0b87df 100644 (file)
@@ -15,6 +15,8 @@
 #include "warn.hh"
 #include "staff-symbol.hh"
 
+#include "translator.icc"
+
 /*
   Create Volta spanners, by reading repeatCommands  property, usually
   set by Unfolded_repeat_iterator.
@@ -25,10 +27,14 @@ public:
   TRANSLATOR_DECLARATIONS (Volta_engraver);
 protected:
 
-  virtual void acknowledge_grob (Grob_info);
+  DECLARE_ACKNOWLEDGER(staff_symbol);
+  DECLARE_ACKNOWLEDGER(note_column);
+  DECLARE_ACKNOWLEDGER(bar_line);
+  
   virtual void finalize ();
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
   Moment started_mom_;
   Spanner *volta_span_;
@@ -159,34 +165,32 @@ Volta_engraver::process_music ()
 }
 
 void
-Volta_engraver::acknowledge_grob (Grob_info i)
+Volta_engraver::acknowledge_note_column (Grob_info i)
 {
-  if (Item *item = dynamic_cast<Item *> (i.grob ()))
-    {
-      if (Note_column::has_interface (item))
-       {
-         if (volta_span_)
-           Volta_bracket_interface::add_column (volta_span_, item);
-       }
-      if (Bar_line::has_interface (item))
-       {
-         if (volta_span_)
-           Volta_bracket_interface::add_bar (volta_span_, item);
-         if (end_volta_span_)
-           Volta_bracket_interface::add_bar (end_volta_span_, item);
-       }
-    }
-  else if (Staff_symbol::has_interface (i.grob ()))
-    {
-      /*
-       We only want to know about a single staff: then we add to the
-       support.  */
-      if (staff_ != SCM_EOL)
-       staff_ = SCM_UNDEFINED;
+  if (volta_span_)
+    Volta_bracket_interface::add_column (volta_span_, i.grob());
+}
 
-      if (staff_ != SCM_UNDEFINED)
-       staff_ = i.grob ()->self_scm ();
-    }
+void
+Volta_engraver::acknowledge_bar_line (Grob_info i)
+{
+  if (volta_span_)
+    Volta_bracket_interface::add_bar (volta_span_, i.item ());
+  if (end_volta_span_)
+    Volta_bracket_interface::add_bar (end_volta_span_, i.item ());
+}
+void
+Volta_engraver::acknowledge_staff_symbol (Grob_info i)
+{
+  /*
+    We only want to know about a single staff: then we add to the
+    support.  */
+  if (staff_ != SCM_EOL)
+    staff_ = SCM_UNDEFINED;
+
+  if (staff_ != SCM_UNDEFINED)
+    staff_ = i.grob ()->self_scm ();
 }
 
 void
@@ -230,11 +234,12 @@ Volta_engraver::stop_translation_timestep ()
 /*
   TODO: should attach volta to paper-column if no bar is found.
 */
-
+ADD_ACKNOWLEDGER(Volta_engraver, staff_symbol);
+ADD_ACKNOWLEDGER(Volta_engraver, note_column);
+ADD_ACKNOWLEDGER(Volta_engraver, bar_line);
 ADD_TRANSLATOR (Volta_engraver,
                /* descr */ "Make volta brackets.",
                /* creats*/ "VoltaBracket",
                /* accepts */ "",
-               /* acks  */ "bar-line-interface staff-symbol-interface note-column-interface",
                /* reads */ "repeatCommands voltaSpannerDuration stavesFound",
                /* write */ "");