]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-engraver.cc
release: 1.3.0
[lilypond.git] / lily / slur-engraver.cc
index f820bd78b536dcf6218b45b8b4338a7fad9282f5..0ac32e8d347fc1cf2b1af134a732e9a38c19eb54 100644 (file)
@@ -5,25 +5,38 @@
 */
 
 #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_music (Music *req_l)
 {
-  Musical_req *mus_l = dynamic_cast <Musical_req *> (req_l);
-  if (Slur_req *sl = dynamic_cast <Slur_req *> (mus_l))
+  if (Span_req *sl = dynamic_cast <Span_req *> (req_l))
     {
-      new_slur_req_l_arr_.push (dynamic_cast <Slur_req *> (mus_l));
+      if (sl->span_type_str_ != "slur")
+       return false;
+      new_slur_req_l_arr_.push (sl);
+
       return true;
     }
   return false;
 }
 
+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 ? SCM_BOOL_T :SCM_BOOL_F);
+}
+
 void
 Slur_engraver::acknowledge_element (Score_element_info info)
 {
@@ -45,10 +58,13 @@ 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"));
-    }
+  SCM wg = get_property ("weAreGraceContext",0);
+  bool wgb = gh_boolean_p (wg) && gh_scm2bool (wgb);
+  if (!wgb)
+    for (int i=0; i < requests_arr_.size(); i++)
+      {
+       requests_arr_[i]->warning (_ ("unterminated slur"));
+      }
 }
 
 void
@@ -57,36 +73,29 @@ 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_ == STOP)
+      if (slur_req_l->span_dir_ == STOP)
        {
          if (slur_l_stack_.empty())
 
-           slur_req_l->warning (_f ("can't find both ends of %s", _("slur")));
+           slur_req_l->warning (_f ("Can't find both ends of %s", _("slur")));
          else
            {
              end_slur_l_arr_.push (slur_l_stack_.pop());
              requests_arr_.pop();
            }
        }
-      else  if (slur_req_l->spantype_ == 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", 0);
-         if (prop.isnum_b ()) 
-           s_p->dash_i_ = prop;
-
-         prop = get_property ("minVerticalAlign", 0);
-         if (prop.isnum_b ())
-           s_p->vertical_align_drul_[MIN] = prop;
-
-         prop = get_property ("maxVerticalAlign", 0);
-         if (prop.isnum_b ())
-           s_p->vertical_align_drul_[MAX] = prop;
+         SCM prop = get_property ("slurDash", 0);
+         if (SCM_NUMBERP(prop)) 
+           s_p->set_elt_property (dashed_scm_sym, prop);
 
+         
          requests_arr_.push (slur_req_l);
          start_slur_l_arr_.push (s_p);
          announce_element (Score_element_info (s_p, slur_req_l));
@@ -99,14 +108,14 @@ Slur_engraver::do_process_requests()
 void
 Slur_engraver::do_pre_move_processing()
 {
-  Scalar dir (get_property ("slurydirection", 0));
-  Scalar dir2 (get_property ("ydirection", 0));
+  SCM dir (get_property ("slurVerticalDirection", 0));
+  SCM dir2 (get_property ("verticalDirection", 0));
 
   Direction slurdir = CENTER;
-  if (dir.length_i () && dir.isnum_b ())
-    slurdir = (Direction) sign (int(dir));
-  else if (dir2.length_i () && dir2.isnum_b ())
-    slurdir = (Direction) sign (int (dir2));
+  if (SCM_NUMBERP(dir))
+    slurdir = to_dir (dir);
+  else if (gh_number_p (dir2))
+    slurdir = to_dir (dir2);
   
   for (int i = 0; i < end_slur_l_arr_.size(); i++)
     {
@@ -120,6 +129,11 @@ void
 Slur_engraver::do_post_move_processing()
 {
   new_slur_req_l_arr_.clear();
+  SCM m = get_property ("automaticMelismata",0);
+  if (gh_boolean_p (m) && gh_scm2bool (m))
+    {
+      set_melisma (slur_l_stack_.size ());
+    }
 }