]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-engraver.cc
* lily/include/translator.icc: new file.
[lilypond.git] / lily / dynamic-engraver.cc
index 5e1cbc9754bf21e32d02a6323a3508712356c4fa..97bafa4c00dd3e9b52926eb81876ebf8ebb1eae6 100644 (file)
@@ -19,6 +19,8 @@
 #include "side-position-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
+#include "self-alignment-interface.hh"
+#include "pointer-group-interface.hh"
 
 /*
   TODO:
@@ -61,8 +63,8 @@ protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Dynamic_engraver::Dynamic_engraver ()
@@ -270,6 +272,7 @@ Dynamic_engraver::stop_translation_timestep ()
       finished_line_spanner_ = line_spanner_;
       line_spanner_ = 0;
     }
+  
   typeset_all ();
 
   if (cresc_ && !cresc_->get_bound (LEFT))
@@ -380,9 +383,15 @@ Dynamic_engraver::acknowledge_grob (Grob_info info)
 
       if (script_ && !script_->get_parent (X_AXIS))
        {
-         SCM head = scm_last_pair (info.grob ()->get_property ("note-heads"));
-         if (scm_is_pair (head))
-           script_->set_parent (unsmob_grob (scm_car (head)), X_AXIS);
+         extract_grob_set (info.grob (), "note-heads", heads);
+         if (heads.size())
+           {
+             Grob *head = heads[0];
+             script_->set_parent (head, X_AXIS);
+             script_->add_offset_callback (Self_alignment_interface::centered_on_parent_proc,
+                                           X_AXIS);
+
+           }
        }
 
       if (cresc_)
@@ -416,6 +425,8 @@ Dynamic_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Dynamic_engraver,
                /* descr */
                "This engraver creates hairpins, dynamic texts, and their vertical\n"