]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-engraver.cc
*** empty log message ***
[lilypond.git] / lily / text-engraver.cc
index a448d15ef820b7972cd97a1efae7e250183746fd..46e029e79b6775349ff65bd7c9abc36e8ff56ce8 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "engraver.hh"
 #include "side-position-interface.hh"
 #include "item.hh"
-#include "musical-request.hh"
+#include "event.hh"
 #include "stem.hh"
 #include "rhythmic-head.hh"
+#include "text-item.hh"
 
 
 /**
@@ -21,7 +22,7 @@
  */
 class Text_engraver : public Engraver
 {
-  Link_array<Text_script_req> reqs_;
+  Link_array<Music> reqs_;
   Link_array<Item> texts_;
 public:
   TRANSLATOR_DECLARATIONS(Text_engraver);
@@ -36,11 +37,9 @@ protected:
 bool
 Text_engraver::try_music (Music *m)
 {
-  if (dynamic_cast<Text_script_req*> (m)
-      && m->get_mus_property ("text-type") != ly_symbol2scm ("finger")
-      && m->get_mus_property ("text-type") != ly_symbol2scm ("dynamic"))
+  if (m->is_mus_type ("text-script-event"))
     {
-      reqs_.push (dynamic_cast<Text_script_req*> (m));
+      reqs_.push (m);
       return true;
     }
   return false;
@@ -84,7 +83,7 @@ Text_engraver::process_acknowledged_grobs ()
     return;
   for (int i=0; i < reqs_.size (); i++)
     {
-      Text_script_req * r = reqs_[i];
+      Music * r = reqs_[i];
       
       // URG: Text vs TextScript
       String basic = "TextScript";
@@ -105,15 +104,22 @@ Text_engraver::process_acknowledged_grobs ()
       if (gh_number_p (s))
        priority = gh_scm2int (s);
       
-      /* Make sure they're in order of user input by adding index i. */
-      priority += i * (r->get_direction () ? r->get_direction () : 1);
+      /* see script-engraver.cc */
+      priority += i;
       
       text->set_grob_property ("script-priority", gh_int2scm (priority));
 
-      if (r->get_direction ())
-       Side_position_interface::set_direction (text, r->get_direction ());
+      Direction dir = to_dir (r->get_mus_property ("direction"));
+      if (dir)
+       Side_position_interface::set_direction (text, dir);
+
+
+      SCM mark = r->get_mus_property ("text");
+
+      if (new_markup_p (mark))
+       text->set_grob_property ("molecule-callback", new_markup_brewer());
       
-      text->set_grob_property ("text", r->get_mus_property ("text"));
+      text->set_grob_property ("text", mark);
       announce_grob (text, r->self_scm ());
       texts_.push (text);
     }
@@ -144,6 +150,7 @@ Text_engraver::Text_engraver(){}
 ENTER_DESCRIPTION(Text_engraver,
 /* descr */       "Create text-scripts",
 /* creats*/       "TextScript",
-/* acks  */       "rhythmic-head-interface stem-interface",
+/* accepts */     "text-script-event",
+/* acks  */      "rhythmic-head-interface stem-interface",
 /* reads */       "scriptHorizontal",
 /* write */       "");