]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-spanner-engraver.cc
(try_music): add moments for
[lilypond.git] / lily / text-spanner-engraver.cc
index 294545aa454a1ca39bf7fcd0b6dd45440a873f78..b7bd32b9e1ffc07d7f6804bc2b4c5767e3c20ed2 100644 (file)
@@ -3,32 +3,23 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "dimensions.hh"
-#include "request.hh"
-#include "paper-column.hh"
 #include "note-column.hh"
 #include "item.hh"
 #include "side-position-interface.hh"
 #include "engraver.hh"
-#include "group-interface.hh"
-#include "directional-element-interface.hh"
-#include "translator-group.hh"
-#include "axis-group-interface.hh"
-
 
 class Text_spanner_engraver : public Engraver
 {
 public:
-  TRANSLATOR_DECLARATIONS(Text_spanner_engraver);  
+  TRANSLATOR_DECLARATIONS (Text_spanner_engraver);  
 protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
   virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
   virtual void process_music ();
 
 private:
@@ -49,31 +40,16 @@ Text_spanner_engraver::Text_spanner_engraver ()
   req_drul_[STOP] = 0;
 }
 
-void
-Text_spanner_engraver::start_translation_timestep ()
-{
-  req_drul_[START] = 0;
-  req_drul_[STOP] = 0;
-}
-
 bool
 Text_spanner_engraver::try_music (Music *m)
 {
   if (m->is_mus_type ("text-span-event"))
     {
 
-      Direction d = to_dir (m->get_mus_property ("span-direction"));
+      Direction d = to_dir (m->get_property ("span-direction"));
       req_drul_[d] = m;
       return true;
     }
-  else if (m->is_mus_type ("abort-event"))
-    {
-      req_drul_[LEFT] = 0;
-      req_drul_[RIGHT] = 0;
-      if (span_)
-       span_->suicide ();
-      span_ = 0;
-    }
 
   return false;
 }
@@ -100,20 +76,15 @@ Text_spanner_engraver::process_music ()
     {
       if (current_req_)
        {
-         req_drul_[START]->origin ()->warning(_ ("already have a text spanner"));
+         req_drul_[START]->origin ()->warning (_ ("already have a text spanner"));
        }
       else
        {
          current_req_ = req_drul_[START];
-         span_  = new Spanner (get_property ("TextSpanner"));
+         span_  = make_spanner ("TextSpanner", req_drul_[START]->self_scm ());
 
-         /* Ugh.  Reset (de)cresc. specific properties */
-         span_->set_grob_property ("outer", SCM_BOOL_T);
-         span_->set_grob_property ("if-text-padding", gh_double2scm (0));
-         span_->set_grob_property ("width-correct", gh_double2scm (0));
-                   
+         
          Side_position_interface::set_axis (span_, Y_AXIS);
-         announce_grob (span_, req_drul_[START]->self_scm());
          req_drul_[START] = 0;
        }
     }
@@ -138,13 +109,11 @@ Text_spanner_engraver::typeset_all ()
 {  
   if (finished_)
     {
-      Side_position_interface::add_staff_support (finished_);
       if (!finished_->get_bound (RIGHT))
        {
          Grob* e = unsmob_grob (get_property ("currentMusicalColumn"));
          finished_->set_bound (RIGHT, e);
        }
-      typeset_grob (finished_);
       finished_ = 0;
     }
 }
@@ -159,6 +128,8 @@ Text_spanner_engraver::stop_translation_timestep ()
     }
 
   typeset_all ();
+  req_drul_[START] = 0;
+  req_drul_[STOP] = 0;
 }
 
 void
@@ -173,7 +144,7 @@ Text_spanner_engraver::finalize ()
     }
 }
 
-ENTER_DESCRIPTION(Text_spanner_engraver,
+ENTER_DESCRIPTION (Text_spanner_engraver,
 /* descr */       "Create text spanner from a Music.",
 /* creats*/       "TextSpanner",
 /* accepts */     "text-span-event",