]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-engraver.cc
($(outdir)/%.pdf): add DVIPS_FLAGS. This will
[lilypond.git] / lily / script-engraver.cc
index bfce6c5a1faeaecf8ef48318fc4f1c62802f6505..e313e0a0e02e901b7bca1b499f831217ee75bd41 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;
@@ -70,31 +82,28 @@ copy_property (Grob * g , SCM sym, SCM alist)
   little space by tacking the props onto the Script grob (i.e. make
   ScriptStaccato , ScriptMarcato, etc. )
  */
-Grob *make_script_from_event (SCM * descr, Translator_group*tg, Music * event,
-                             int index)
+void make_script_from_event (Grob *p,
+                            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 0 ;
+      return  ;
     }
 
   art = gh_cdr (art);
-    
-  Grob *p =new Item (tg->get_property ("Script"));
+  
   *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 ("script-stencil"), art);
   copy_property (p, ly_symbol2scm ("direction"), art);
   copy_property (p, ly_symbol2scm ("side-relative-direction"), art);
 
@@ -113,7 +122,6 @@ Grob *make_script_from_event (SCM * descr, Translator_group*tg, Music * event,
 
   Side_position_interface::set_axis (p, Y_AXIS);
   p->set_grob_property ("script-priority", gh_int2scm (prio));
-  return p;
 }
 
 void
@@ -123,9 +131,19 @@ Script_engraver::process_music ()
     {
       Music* l=scripts_[i].event_;
 
-      Grob * p = make_script_from_event (&scripts_[i].description_, daddy_trans_, l, i);
+      Grob * p = make_item ("Script");
+
+      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());
     }
@@ -201,9 +219,10 @@ Script_engraver::stop_translation_timestep ()
 
       SCM follow = scm_assoc (ly_symbol2scm ("follow-into-staff"), scripts_[i].description_);
       if (gh_pair_p (follow) && to_boolean (gh_cdr (follow)))
-       sc->add_offset_callback (Side_position_interface::quantised_position_proc, Y_AXIS);
-      else
-       Side_position_interface::add_staff_support (sc);
+       {
+         sc->add_offset_callback (Side_position_interface::quantised_position_proc, Y_AXIS);
+         sc->set_grob_property ("staff-padding", SCM_EOL);
+       }
       typeset_grob (sc);
     }
   scripts_.clear ();