]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-engraver.cc
2003 -> 2004
[lilypond.git] / lily / script-engraver.cc
index 3324488400d04e6fe97b76d8fde591d3472018c9..03826157bf269bc69a171e4aff67924f4e1038fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
   script-engraver.cc -- implement Script_engraver
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "script.hh"
@@ -12,6 +12,7 @@
 #include "engraver.hh"
 #include "note-column.hh"
 #include "translator-group.hh"
+#include "warn.hh"
 
 struct Script_tuple
 {
@@ -43,9 +44,20 @@ Script_engraver::try_music (Music *r)
 {
   if (r->is_mus_type ("articulation-event"))
     {
+      /*
+       Discard double articulations.
+       This is necessary for part-combining.
+       */
+      for (int j = 0; j < scripts_.size (); j++)
+       if (gh_equal_p (scripts_[j]. event_->get_mus_property ("articulation-type"),
+                       r->get_mus_property ("articulation-type")
+                       ))
+         return true;
+         
       Script_tuple t;
       t.event_ =r;
       scripts_.push (t);
+      
       return true;
     }
   return false;
@@ -71,29 +83,25 @@ copy_property (Grob * g , SCM sym, SCM alist)
   ScriptStaccato , ScriptMarcato, etc. )
  */
 void make_script_from_event (Grob *p,
-                            SCM * descr, Translator_group*tg, Music * event,
+                            SCM * descr, Translator_group*tg,
+                            SCM art_type, 
                             int index)
 {
   SCM alist = tg->get_property ("scriptDefinitions");
-  SCM art_type= event->get_mus_property ("articulation-type");
   SCM art = scm_assoc (art_type, alist);
 
   if (art == SCM_BOOL_F)
     {
-      event->origin ()->warning (_("Don't know how to interpret articulation:"));
-      event->origin ()->warning (_("Scheme encoding: "));
+      warning (_("Don't know how to interpret articulation:"));
+      warning (_("Scheme encoding: "));
       scm_write (art_type, scm_current_error_port ());
       return  ;
     }
 
   art = gh_cdr (art);
-    
   
   *descr = art;  
 
-  SCM force_dir = event->get_mus_property ("direction");
-  if (is_direction (force_dir) && to_dir (force_dir))
-    p->set_grob_property ("direction", force_dir);
 
   copy_property (p, ly_symbol2scm ("script-molecule"), art);
   copy_property (p, ly_symbol2scm ("direction"), art);
@@ -125,9 +133,17 @@ Script_engraver::process_music ()
 
       Grob * p = make_item ("Script");
 
-      make_script_from_event (p, &scripts_[i].description_, daddy_trans_, l, i);
+      make_script_from_event (p, &scripts_[i].description_, daddy_trans_,
+                             l->get_mus_property ("articulation-type"),
+                             i);
 
       scripts_[i].script_ = p;
+
+      
+      SCM force_dir = l->get_mus_property ("direction");
+      if (is_direction (force_dir) && to_dir (force_dir))
+       p->set_grob_property ("direction", force_dir);
+      
       if (p)
        announce_grob (p, l->self_scm());
     }