]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-engraver.cc
release: 1.1.69
[lilypond.git] / lily / slur-engraver.cc
index e7447b74320e71ba59d6c1c93d3ea2d0316eb746..6f025e1a2b759d91d82738820b55dbc46eace4c4 100644 (file)
@@ -1,34 +1,48 @@
 /*
   slur-grav.cc -- implement Slur_engraver
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "proto.hh"
-#include "plist.hh"
 #include "musical-request.hh"
 #include "slur-engraver.hh"
 #include "slur.hh"
 #include "debug.hh"
 #include "note-column.hh"
+#include "translator-group.hh"
 
 bool
-Slur_engraver::do_try_request (Request *req_l)
+Slur_engraver::do_try_music (Music *req_l)
 {
-  Musical_req *mus_l = dynamic_cast <Musical_req *> (req_l);
-  if (!mus_l || !dynamic_cast <Slur_req *> (mus_l))
-    return false;
+  if (Span_req *sl = dynamic_cast <Span_req *> (req_l))
+    {
+      if (sl->span_type_str_ != "slur")
+       return false;
+      new_slur_req_l_arr_.push (sl);
+
+      return true;
+    }
+  return false;
+}
 
-  new_slur_req_l_arr_.push (dynamic_cast <Slur_req *> (mus_l));
-  return true;
+void
+Slur_engraver::set_melisma (bool m)
+{
+  Translator_group *where = daddy_trans_l_;
+  get_property ("slurMelismaBusy", &where);
+  if (!where)
+    where = daddy_trans_l_;
+    
+  daddy_trans_l_->set_property ("slurMelismaBusy", m ? "1" :"0");
 }
 
 void
 Slur_engraver::acknowledge_element (Score_element_info info)
 {
-  if (info.elem_l_->is_type_b (Note_column::static_name ()))
+  if (dynamic_cast<Note_column *> (info.elem_l_))
     {
-      Note_column *col_l =(Note_column*) dynamic_cast <Item *> (info.elem_l_) ;// ugh
+      Note_column *col_l =dynamic_cast<Note_column *> (info.elem_l_) ;// ugh
       for (int i = 0; i < slur_l_stack_.size(); i++)
        slur_l_stack_[i]->add_column (col_l);
       for (int i = 0; i < end_slur_l_arr_.size(); i++)
@@ -44,10 +58,11 @@ Slur_engraver::do_removal_processing ()
       typeset_element (slur_l_stack_[i]);
     }
   slur_l_stack_.clear ();
-  for (int i=0; i < requests_arr_.size(); i++)
-    {
-      requests_arr_[i]->warning (_ ("unterminated slur"));
-    }
+  if (!get_property ("weAreGraceContext",0).to_bool ())
+    for (int i=0; i < requests_arr_.size(); i++)
+      {
+       requests_arr_[i]->warning (_ ("unterminated slur"));
+      }
 }
 
 void
@@ -56,9 +71,9 @@ Slur_engraver::do_process_requests()
   Array<Slur*> start_slur_l_arr_;
   for (int i=0; i< new_slur_req_l_arr_.size(); i++)
     {
-      Slur_req* slur_req_l = new_slur_req_l_arr_[i];
+      Span_req* slur_req_l = new_slur_req_l_arr_[i];
       // end slur: move the slur to other array
-      if (slur_req_l->spantype == Span_req::STOP)
+      if (slur_req_l->span_dir_ == STOP)
        {
          if (slur_l_stack_.empty())
 
@@ -69,14 +84,15 @@ Slur_engraver::do_process_requests()
              requests_arr_.pop();
            }
        }
-      else  if (slur_req_l->spantype == Span_req::START)
+      else  if (slur_req_l->span_dir_ == START)
        {
          // push a new slur onto stack.
          //(use temp. array to wait for all slur STOPs)
          Slur * s_p =new Slur;
-         Scalar prop = get_property ("slurdash");
+         Scalar prop = get_property ("slurDash", 0);
          if (prop.isnum_b ()) 
-           s_p->dash_i_ = prop;
+           s_p->set_elt_property (dashed_scm_sym, gh_int2scm(prop));
+
          requests_arr_.push (slur_req_l);
          start_slur_l_arr_.push (s_p);
          announce_element (Score_element_info (s_p, slur_req_l));
@@ -89,8 +105,8 @@ Slur_engraver::do_process_requests()
 void
 Slur_engraver::do_pre_move_processing()
 {
-  Scalar dir (get_property ("slurydirection"));
-  Scalar dir2 (get_property ("ydirection"));
+  Scalar dir (get_property ("slurVerticalDirection", 0));
+  Scalar dir2 (get_property ("verticalDirection", 0));
 
   Direction slurdir = CENTER;
   if (dir.length_i () && dir.isnum_b ())
@@ -110,7 +126,11 @@ void
 Slur_engraver::do_post_move_processing()
 {
   new_slur_req_l_arr_.clear();
+  if (get_property ("automaticMelismata",0).to_bool ())
+    {
+      set_melisma (slur_l_stack_.size ());
+    }
 }
 
-IMPLEMENT_IS_TYPE_B1(Slur_engraver,Engraver);
+
 ADD_THIS_TRANSLATOR(Slur_engraver);