]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/hyphen-engraver.cc
patch::: 1.3.130.jcn1
[lilypond.git] / lily / hyphen-engraver.cc
index 9fbbb77f5b95bee47d76c4655230a4c36e600a3d..44eb9298053fe18fbb10a5f31fd674740caef1f1 100644 (file)
@@ -4,7 +4,7 @@
   (c) 1999 Glen Prideaux <glenprideaux@iname.com>
 */
 
-#include "proto.hh"
+#include "flower-proto.hh"
 #include "musical-request.hh"
 #include "hyphen-spanner.hh"
 #include "paper-column.hh"
@@ -22,8 +22,8 @@
   then.  */
 class Hyphen_engraver : public Engraver
 {
-  Item *last_lyric_l_;
-  Item *current_lyric_l_;
+  Grob *last_lyric_l_;
+  Grob *current_lyric_l_;
   Hyphen_req* req_l_;
   Spanner* hyphen_p_;
 public:
@@ -31,12 +31,12 @@ public:
   VIRTUAL_COPY_CONS (Translator);
 
 protected:
-  virtual void acknowledge_element (Score_element_info);
-  virtual void do_removal_processing();
-  virtual void do_process_music();
-  virtual bool do_try_music (Music*);
-  virtual void do_pre_move_processing();
-  virtual void do_post_move_processing ();
+  virtual void acknowledge_grob (Grob_info);
+  virtual void finalize();
+  virtual bool try_music (Music*);
+  virtual void stop_translation_timestep();
+  virtual void start_translation_timestep ();
+  virtual void create_grobs ();
 private:
 
 };
@@ -52,25 +52,24 @@ Hyphen_engraver::Hyphen_engraver ()
 }
 
 void
-Hyphen_engraver::acknowledge_element (Score_element_info i)
+Hyphen_engraver::acknowledge_grob (Grob_info i)
 {
-
   // -> text-item
-  if (Item* t = dynamic_cast<Item*> (i.elem_l_))
+  if (i.elem_l_->has_interface (ly_symbol2scm ("lyric-syllable-interface")))
     {
-      current_lyric_l_ = t;
+      current_lyric_l_ = i.elem_l_;
       if (hyphen_p_
          && !hyphen_p_->get_bound (RIGHT)
            )
          {
-           Hyphen_spanner (hyphen_p_).set_textitem (RIGHT, t);
+           Hyphen_spanner (hyphen_p_).set_textitem (RIGHT, i.elem_l_);
          }
     }
 }
 
 
 bool
-Hyphen_engraver::do_try_music (Music* r)
+Hyphen_engraver::try_music (Music* r)
 {
   if (Hyphen_req* p = dynamic_cast <Hyphen_req *> (r))
     {
@@ -84,40 +83,40 @@ Hyphen_engraver::do_try_music (Music* r)
 }
 
 void
-Hyphen_engraver::do_removal_processing ()
+Hyphen_engraver::finalize ()
 {
   if (hyphen_p_)
     {
-      req_l_->warning (_ ("unterminated hyphen"));
-      hyphen_p_->set_bound(RIGHT, get_staff_info ().command_pcol_l ());
+      req_l_->origin ()->warning (_ ("unterminated hyphen"));
+      hyphen_p_->set_bound(RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
     }
 }
 
 void
-Hyphen_engraver::do_process_music ()
+Hyphen_engraver::create_grobs ()
 {
-  if (req_l_)
+  if (req_l_ &&! hyphen_p_)
     {
       if (!last_lyric_l_)
        {
-         req_l_->warning (_ ("Nothing to connect hyphen to on the left.  Ignoring hyphen request."));
+         req_l_->origin ()->warning (_ ("Nothing to connect hyphen to on the left.  Ignoring hyphen request."));
          return;
        }
       
-      hyphen_p_ = new Spanner (get_property ("basicHyphenSpannerProperties"));
-      hyphen_p_->set_extent_callback (Score_element::point_dimension_callback,Y_AXIS);
+      hyphen_p_ = new Spanner (get_property ("LyricHyphen"));
+
       Hyphen_spanner (hyphen_p_).set_textitem  (LEFT, last_lyric_l_);
-      announce_element (Score_element_info (hyphen_p_, req_l_));
+      announce_grob (hyphen_p_, req_l_);
     }
 }
 
 
 void
-Hyphen_engraver::do_pre_move_processing ()
+Hyphen_engraver::stop_translation_timestep ()
 {
   if (hyphen_p_)
     {
-      typeset_element (hyphen_p_);
+      typeset_grob (hyphen_p_);
       hyphen_p_ = 0;
     }
 
@@ -129,7 +128,7 @@ Hyphen_engraver::do_pre_move_processing ()
 }
 
 void
-Hyphen_engraver::do_post_move_processing ()
+Hyphen_engraver::start_translation_timestep ()
 {
   req_l_ = 0;
 }