]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.65
authorfred <fred>
Tue, 26 Mar 2002 23:23:53 +0000 (23:23 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:23:53 +0000 (23:23 +0000)
input/test/beamed-slur-endings.ly [new file with mode: 0644]
input/test/ophee-slurs.ly [new file with mode: 0644]
input/test/simple-slur-endings.ly [new file with mode: 0644]
input/test/slur-attachment.ly [new file with mode: 0644]
lily/slur-engraver.cc

diff --git a/input/test/beamed-slur-endings.ly b/input/test/beamed-slur-endings.ly
new file mode 100644 (file)
index 0000000..df91eec
--- /dev/null
@@ -0,0 +1,24 @@
+\score{
+       \notes \relative c''{
+               \property Voice.slurVerticalDirection = #1 c8(()c())c4
+               \property Voice.slurVerticalDirection = #-1 a8(()a)a4
+               \break
+
+               \property Voice.slurVerticalDirection = #-1 a8(()a())a4
+               \property Voice.slurVerticalDirection = #1 c8(()c)c4
+               \break
+
+               \property Voice.slurVerticalDirection = #-1 e8(()e())e4
+               \property Voice.slurVerticalDirection = #1 f,8(()f)f4
+               \break
+
+               \property Voice.slurVerticalDirection = #1 e8(()e())e4
+               \property Voice.slurVerticalDirection = #-1 f'8(()f)f4
+               \break
+
+       }
+       \paper{
+               indent = 0.0;
+               linewidth = 60.0\mm;
+       }
+}
diff --git a/input/test/ophee-slurs.ly b/input/test/ophee-slurs.ly
new file mode 100644 (file)
index 0000000..402aba2
--- /dev/null
@@ -0,0 +1,12 @@
+\score{
+       \notes \relative c''{
+               \property Voice.slurVerticalDirection = #1
+               \property Voice.slurBeginAttachment = #'head
+               \property Voice.slurEndAttachment = #'head
+               g16()g()g()g()d'()d()d()d
+       }
+       \paper{
+               indent = 0.0;
+               linewidth = 60.0\mm;
+       }
+}
diff --git a/input/test/simple-slur-endings.ly b/input/test/simple-slur-endings.ly
new file mode 100644 (file)
index 0000000..03e4826
--- /dev/null
@@ -0,0 +1,13 @@
+\score{
+       \notes \relative c''{
+               \property Voice.slurVerticalDirection = #1 c()a d()g,\break
+               \property Voice.slurVerticalDirection = #-1 c()a d()g,\break
+               \property Voice.slurVerticalDirection = #1 a()c d()g,\break
+               \property Voice.slurVerticalDirection = #-1 a()c d()g,\break
+               \property Voice.slurVerticalDirection = #-1 a()c d()g,\break
+       }
+       \paper{
+               indent = 0.0;
+               linewidth = 60.0\mm;
+       }
+}
diff --git a/input/test/slur-attachment.ly b/input/test/slur-attachment.ly
new file mode 100644 (file)
index 0000000..4f7e8d4
--- /dev/null
@@ -0,0 +1,17 @@
+\score{
+       \notes \relative c''{
+               % URG, make stem length match beam!
+               \property Voice.stemLength = #5
+
+               \property Voice.slurVerticalDirection = #1
+               \property Voice.slurEndAttachment = #'stem
+               a8(a)a4
+               \property Voice.slurEndAttachment = ##f
+               \property Voice.slurBeginAttachment = #'stem
+               a4(a8)a
+       }
+       \paper{
+               indent = 0.0;
+               linewidth = 60.0\mm;
+       }
+}
index ccb3a9a360d8da1cff028dc15833897f604279c9..7987187335586ec8c050ca8b8301939f5808d101 100644 (file)
@@ -22,14 +22,14 @@ class Slur_engraver :public Engraver {
   void set_melisma (bool);
 protected:
   virtual bool do_try_music (Music*);
-  virtual void do_process_music();
+  virtual void do_process_music ();
   virtual void acknowledge_element (Score_element_info);
-  virtual void do_pre_move_processing();
-  virtual void do_post_move_processing();
+  virtual void do_pre_move_processing ();
+  virtual void do_post_move_processing ();
   virtual void do_removal_processing ();
 
 public:
-  VIRTUAL_COPY_CONS(Translator);
+  VIRTUAL_COPY_CONS (Translator);
   
 };
 
@@ -59,9 +59,9 @@ Slur_engraver::acknowledge_element (Score_element_info info)
   if (dynamic_cast<Note_column *> (info.elem_l_))
     {
       Note_column *col_l =dynamic_cast<Note_column *> (info.elem_l_) ;// ugh
-      for (int i = 0; i < slur_l_stack_.size(); i++)
+      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++)
+      for (int i = 0; i < end_slur_l_arr_.size (); i++)
        end_slur_l_arr_[i]->add_column (col_l);
     }
 }
@@ -69,7 +69,7 @@ Slur_engraver::acknowledge_element (Score_element_info info)
 void
 Slur_engraver::do_removal_processing ()
 {
-  for (int i = 0; i < slur_l_stack_.size(); i++)
+  for (int i = 0; i < slur_l_stack_.size (); i++)
     {
       typeset_element (slur_l_stack_[i]);
     }
@@ -77,60 +77,70 @@ Slur_engraver::do_removal_processing ()
   SCM wg = get_property ("weAreGraceContext");
   bool wgb = to_boolean (wg);
   if (!wgb)
-    for (int i=0; i < requests_arr_.size(); i++)
+    for (int i=0; i < requests_arr_.size (); i++)
       {
        requests_arr_[i]->warning (_ ("unterminated slur"));
       }
 }
 
 void
-Slur_engraver::do_process_music()
+Slur_engraver::do_process_music ()
 {
   Array<Slur*> start_slur_l_arr_;
-  for (int i=0; i< new_slur_req_l_arr_.size(); i++)
+  for (int i=0; i< new_slur_req_l_arr_.size (); i++)
     {
       Span_req* slur_req_l = new_slur_req_l_arr_[i];
       // end slur: move the slur to other array
       if (slur_req_l->span_dir_ == STOP)
        {
-         if (slur_l_stack_.empty())
+         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();
+             Slur* slur = slur_l_stack_.pop ();
+             SCM s = get_property ("slurEndAttachment");
+             if (gh_symbol_p (s))
+               {
+                 index_set_cell (slur->get_elt_property ("attachment"), STOP, s);
+               }
+             end_slur_l_arr_.push (slur);
+             requests_arr_.pop ();
            }
        }
       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 (get_property ("basicSlurProperties"));
-         
+         // (use temp. array to wait for all slur STOPs)
+         Slur* slur = new Slur (get_property ("basicSlurProperties"));
+         SCM s = get_property ("slurBeginAttachment");
+         if (gh_symbol_p (s))
+           {
+             index_set_cell (slur->get_elt_property ("attachment"), START, s);
+           }
+         start_slur_l_arr_.push (slur);
          requests_arr_.push (slur_req_l);
-         start_slur_l_arr_.push (s_p);
-         announce_element (Score_element_info (s_p, slur_req_l));
+         announce_element (Score_element_info (slur, slur_req_l));
        }
     }
-  for (int i=0; i < start_slur_l_arr_.size(); i++)
+  for (int i=0; i < start_slur_l_arr_.size (); i++)
     slur_l_stack_.push (start_slur_l_arr_[i]);
 }
 
 void
-Slur_engraver::do_pre_move_processing()
+Slur_engraver::do_pre_move_processing ()
 {
-  for (int i = 0; i < end_slur_l_arr_.size(); i++)
+  for (int i = 0; i < end_slur_l_arr_.size (); i++)
     {
       typeset_element (end_slur_l_arr_[i]);
     }
-  end_slur_l_arr_.clear();
+  end_slur_l_arr_.clear ();
 }
 
 void
-Slur_engraver::do_post_move_processing()
+Slur_engraver::do_post_move_processing ()
 {
-  new_slur_req_l_arr_.clear();
+  new_slur_req_l_arr_.clear ();
   SCM m = get_property ("automaticMelismata");
   if (to_boolean (m))
     {
@@ -139,4 +149,4 @@ Slur_engraver::do_post_move_processing()
 }
 
 
-ADD_THIS_TRANSLATOR(Slur_engraver);
+ADD_THIS_TRANSLATOR (Slur_engraver);