]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lyric-engraver.cc
release: 1.3.0
[lilypond.git] / lily / lyric-engraver.cc
index 515bc7abe5a10afe673cc5f9c6d2206dde3a6bc3..080546f2f5fe6524e18e880304043fb607b9f1b1 100644 (file)
@@ -3,7 +3,8 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "lyric-engraver.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
 
+ADD_THIS_TRANSLATOR (Lyric_engraver);
+
+
 Lyric_engraver::Lyric_engraver()
 {
+  text_p_ =0;
+  req_l_ =0;
 }
 
 bool
-Lyric_engraver::do_try_request(Request*r)
+Lyric_engraver::do_try_music (Music*r)
 {
-    Musical_req * m =r->musical();
-    if (!m || ! m->lreq_l()) 
+  if (Lyric_req* l = dynamic_cast <Lyric_req *> (r))
+    {
+      if (req_l_)
        return false;
-    lreq_arr_.push(m->lreq_l());
-
-    return true;
+      req_l_ =l;
+      return true;
+    }
+  return false;
 }
 
 void
 Lyric_engraver::do_process_requests()
 {
-    Text_item * last_item_l =0;
-    for (int i=0; i < lreq_arr_.size(); i++) {
-       Text_item *lp = new Text_item(lreq_arr_[i]->tdef_p_ );
-       lp->dir_i_ = -1;
-       lp->fat_b_ = true;
-       if (last_item_l)
-           lp->add_support(last_item_l);
-       last_item_l = lp;
-       typeset_element(lp);
+  if (req_l_)
+    {
+      text_p_=  new Text_item;
+      text_p_->text_str_ = req_l_->text_str_;
+      text_p_->text_str_ += " ";       // ugh.
+
+      SCM style = get_property ("textStyle", 0);
+      if (gh_string_p(style))
+       text_p_->style_str_ = ly_scm2string (style);
+
+      text_p_->set_elt_property (non_rhythmic_scm_sym, SCM_BOOL_T);
+      
+      announce_element (Score_element_info (text_p_, req_l_));
     }
 }
 
 void
-Lyric_engraver::do_post_move_processing()
+Lyric_engraver::do_pre_move_processing()
 {
-    lreq_arr_.set_size(0);
+  if (text_p_)
+    {
+      typeset_element (text_p_);
+      text_p_ =0;
+    }
 }
 
+void
+Lyric_engraver::do_post_move_processing ()
+{
+  req_l_ =0;
+}
 
-IMPLEMENT_STATIC_NAME(Lyric_engraver);
-IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Request_engraver);
-ADD_THIS_ENGRAVER(Lyric_engraver);