]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-engraver.cc
patch::: 1.5.41.jcn1
[lilypond.git] / lily / text-engraver.cc
index ed9473e000d3213ad08b762506a7b75b2572f7b9..38716da2af5d008b43a8145f37feccc89cc97cf1 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -24,7 +24,7 @@ class Text_engraver : public Engraver
   Link_array<Text_script_req> reqs_;
   Link_array<Item> texts_;
 public:
-  VIRTUAL_COPY_CONS (Translator);
+  TRANSLATOR_DECLARATIONS(Text_engraver);
 protected:
   virtual bool try_music (Music* m);
   virtual void stop_translation_timestep ();
@@ -48,30 +48,30 @@ Text_engraver::try_music (Music *m)
 void
 Text_engraver::acknowledge_grob (Grob_info inf)
 {
-  if (Rhythmic_head::has_interface (inf.elem_l_))
+  if (Rhythmic_head::has_interface (inf.grob_l_))
     {
       for (int i=0; i < texts_.size (); i++)
        {
          Grob*t = texts_[i];
-         Side_position_interface::add_support (t,inf.elem_l_);
+         Side_position_interface::add_support (t,inf.grob_l_);
 
          /*
            ugh.
           */
          if (Side_position_interface::get_axis (t) == X_AXIS
-             && !t->parent_l (Y_AXIS))
-           t->set_parent (inf.elem_l_, Y_AXIS);
+             && !t->get_parent (Y_AXIS))
+           t->set_parent (inf.grob_l_, Y_AXIS);
          else if (Side_position_interface::get_axis (t) == Y_AXIS
-             && !t->parent_l (X_AXIS))
-           t->set_parent (inf.elem_l_, X_AXIS);
+             && !t->get_parent (X_AXIS))
+           t->set_parent (inf.grob_l_, X_AXIS);
        }
     }
   
-  if (Stem::has_interface (inf.elem_l_))
+  if (Stem::has_interface (inf.grob_l_))
     {
       for (int i=0; i < texts_.size (); i++)
        {
-         Side_position_interface::add_support (texts_[i],inf.elem_l_);
+         Side_position_interface::add_support (texts_[i],inf.grob_l_);
        }
     }
 }
@@ -128,13 +128,18 @@ Text_engraver::create_grobs ()
       text->set_grob_property ("text", r->get_mus_property ("text"));
       
       SCM nonempty = get_property ("textNonEmpty");
-      if (to_boolean (nonempty))
-       /*
-         empty text: signal that no rods should be applied.  
-        */
-       text->set_grob_property ("no-spacing-rods" , SCM_BOOL_F);
-               
-      announce_grob (text, r);
+
+      if (gh_boolean_p (nonempty))
+       if (gh_scm2bool (nonempty))
+         /*
+           empty text: signal that no rods should be applied.
+           Default nowadays.
+         */
+         text->set_grob_property ("no-spacing-rods" , SCM_BOOL_F);
+       else
+         text->set_grob_property ("no-spacing-rods" , SCM_BOOL_T);
+       
+      announce_grob (text, r->self_scm ());
       texts_.push (text);
     }
 }
@@ -145,7 +150,8 @@ Text_engraver::stop_translation_timestep ()
   for (int i=0; i < texts_.size (); i++)
     {
       Item *ti = texts_[i];
-      Side_position_interface::add_staff_support (ti);
+      if (!to_boolean (get_property ("scriptHorizontal")))
+       Side_position_interface::add_staff_support (ti);
       typeset_grob (ti);
     }
   texts_.clear ();
@@ -157,5 +163,12 @@ Text_engraver::start_translation_timestep ()
   reqs_.clear ();
 }
 
-ADD_THIS_TRANSLATOR (Text_engraver);
 
+Text_engraver::Text_engraver(){}
+
+ENTER_DESCRIPTION(Text_engraver,
+/* descr */       "Create text-scripts",
+/* creats*/       "TextScript",
+/* acks  */       "rhythmic-head-interface stem-interface",
+/* reads */       "scriptHorizontal textNonEmpty",
+/* write */       "");