]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/a2-engraver.cc
patch::: 1.3.132.jcn1
[lilypond.git] / lily / a2-engraver.cc
index 34039b43ea8289db0c0b2d754d206a026e0d3658..f767e7004d3826723466128686b666b7f285a952 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
   
-  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "engraver.hh"
 #include "side-position-interface.hh"
 #include "directional-element-interface.hh"
 
+
 class A2_engraver : public Engraver
 {
 public:
   A2_engraver ();
   VIRTUAL_COPY_CONS (Translator);
-  
 protected:
-  virtual void do_process_music ();
-  virtual void acknowledge_element (Score_element_info);
-
-  virtual void do_pre_move_processing ();
-
+  virtual void acknowledge_grob (Grob_info);
+  virtual void create_grobs ();
+  virtual void stop_translation_timestep ();
 private:
   Item* text_p_;
   enum State { SOLO, SPLIT_INTERVAL, UNIRHYTHM, UNISILENCE, UNISON } state_;
@@ -41,7 +39,7 @@ A2_engraver::A2_engraver ()
 }
 
 void
-A2_engraver::do_process_music ()
+A2_engraver::create_grobs ()
 {
   if (!to_boolean (get_property ("combineParts")))
     return ;
@@ -54,18 +52,18 @@ A2_engraver::do_process_music ()
       if (solo_adue == SCM_BOOL_T
          && ((solo == SCM_BOOL_T && state_ != SOLO)
              || (unison == SCM_BOOL_T && state_ != UNISON
-                 && daddy_trans_l_->id_str_ == "one")))
+                 && daddy_trans_l_->id_str_.left_str (3) == "one")))
        {
-         text_p_ = new Item (get_property ("basicTextScriptProperties"));
+         text_p_ = new Item (get_property ("TextScript"));
          Side_position::set_axis (text_p_, Y_AXIS);
-         announce_element (text_p_, 0);
+         announce_grob (text_p_, 0);
       
          Direction dir = UP;
          SCM text;
          if (solo == SCM_BOOL_T)
            {
              state_ = SOLO;
-             if (daddy_trans_l_->id_str_ == "one")
+             if (daddy_trans_l_->id_str_.left_str (3) == "one")
                {
                  text = get_property ("soloText");
                }
@@ -78,18 +76,18 @@ A2_engraver::do_process_music ()
          else if (unison == SCM_BOOL_T)
            {
              state_ = UNISON;
-             if (daddy_trans_l_->id_str_ == "one")
+             if (daddy_trans_l_->id_str_.left_str (3) == "one")
                text = get_property ("aDueText");
            }
          
          Side_position::set_direction (text_p_, dir);
-         text_p_->set_elt_property ("text", text);
+         text_p_->set_grob_property ("text", text);
        }
     }
 }
 
 void
-A2_engraver::acknowledge_element (Score_element_info i)
+A2_engraver::acknowledge_grob (Grob_info i)
 {
   if (!to_boolean (get_property ("combineParts")))
     return ;
@@ -98,7 +96,7 @@ A2_engraver::acknowledge_element (Score_element_info i)
     {
       if (Note_head::has_interface (i.elem_l_))
        {
-         Score_element*t = text_p_;
+         Grob*t = text_p_;
          Side_position::add_support (t, i.elem_l_);
          if (Side_position::get_axis (t) == X_AXIS
              && !t->parent_l (Y_AXIS))
@@ -131,12 +129,24 @@ A2_engraver::acknowledge_element (Score_element_info i)
     state_ = SPLIT_INTERVAL;
   else if (unirhythm)
     state_ = UNIRHYTHM;
-         
-  if (Stem::has_interface (i.elem_l_)
-      || Slur::has_interface (i.elem_l_)
-      // || Text_item::has_interface (i.elem_l_)
-      //|| Crescendo::has_interface (i.elem_l_)
-      )
+
+  /* Must only set direction for VoiceCombines, not for StaffCombines:
+     we can't detect that here, so, ugh, yet another property */
+  if (!to_boolean (get_property ("noDirection"))
+      && (Stem::has_interface (i.elem_l_)
+         || Slur::has_interface (i.elem_l_)
+         // || Tie::has_interface (i.elem_l_)
+         || i.elem_l_->has_interface (ly_symbol2scm ("tie-interface"))
+         /*
+           Usually, dynamics are removed by *_devnull_engravers for the
+           second voice.  On the one hand, we don't want all dynamics for
+           the first voice to be placed above the staff.  On the other
+           hand, colliding of scripts may be worse */
+#if 0
+         || i.elem_l_->has_interface (ly_symbol2scm ("dynamic-interface"))
+         || i.elem_l_->has_interface (ly_symbol2scm ("text-interface"))
+#endif
+         ))
     {
       /*
        Hmm.  We must set dir when solo, in order to get
@@ -147,25 +157,25 @@ A2_engraver::acknowledge_element (Score_element_info i)
          || (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T
              && (unison != SCM_BOOL_T || solo_adue != SCM_BOOL_T)))
        {
-         if (daddy_trans_l_->id_str_ == "one")
+         if (daddy_trans_l_->id_str_.left_str (3) == "one")
            {
-             i.elem_l_->set_elt_property ("direction", gh_int2scm (1));
+             i.elem_l_->set_grob_property ("direction", gh_int2scm (1));
            }
-         else if (daddy_trans_l_->id_str_ == "two")
+         else if (daddy_trans_l_->id_str_.left_str (3) == "two")
            {
-             i.elem_l_->set_elt_property ("direction", gh_int2scm (-1));
+             i.elem_l_->set_grob_property ("direction", gh_int2scm (-1));
            }
        }
     }
 }
 
 void 
-A2_engraver::do_pre_move_processing ()
+A2_engraver::stop_translation_timestep ()
 {
   if (text_p_)
     {
       Side_position::add_staff_support (text_p_);
-      typeset_element (text_p_);
+      typeset_grob (text_p_);
       text_p_ = 0;
     }
 }