]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-engraver.cc
* GNUmakefile.in (short-examples):
[lilypond.git] / lily / script-engraver.cc
index 1d0977a487429032020d573aee96f4b6faaff8a3..10cbfe9d93e4209c1cb1c66cae62e60ebef3fdbe 100644 (file)
@@ -10,6 +10,7 @@
 #include "stem.hh"
 #include "rhythmic-head.hh"
 #include "engraver.hh"
+#include "note-column.hh"
 
 class Script_engraver : public Engraver
 {
@@ -69,7 +70,7 @@ Script_engraver::process_music ()
       // todo -> use result of articulation-to-scriptdef directly as basic prop list.
       Grob *p =new Item (get_property ("Script"));
       art = ly_cdr (art);
-      p->set_grob_property ("molecule", ly_car (art));
+      p->set_grob_property ("script-molecule", ly_car (art));
 
       art = ly_cdr (art);
       bool follow_staff = gh_scm2bool (ly_car (art));
@@ -78,13 +79,13 @@ Script_engraver::process_music ()
       art = ly_cdr (art);
 
       SCM force_dir = l->get_mus_property ("direction");
-      if (isdir_b (force_dir) && !to_dir (force_dir))
+      if (ly_dir_p (force_dir) && !to_dir (force_dir))
        force_dir = ly_car (art);
       
       art = ly_cdr (art);
       SCM priority = ly_car (art);
 
-      if (isdir_b (force_dir) && to_dir (force_dir))
+      if (ly_dir_p (force_dir) && to_dir (force_dir))
        p->set_grob_property ("direction", force_dir);
       else if (to_dir (relative_stem_dir))
        p->set_grob_property ("side-relative-direction", relative_stem_dir);
@@ -96,7 +97,7 @@ Script_engraver::process_music ()
       SCM axisprop = get_property ("scriptHorizontal");
       bool xaxis = to_boolean (axisprop);
       Side_position_interface::set_axis (p, xaxis ? X_AXIS : Y_AXIS);
-      
+
       if (!follow_staff && ! xaxis)
        p->set_grob_property ("staff-support", SCM_BOOL_T);
 
@@ -108,7 +109,7 @@ Script_engraver::process_music ()
   
       script_p_arr_.push (p);
       
-      announce_grob (p, l);
+      announce_grob (p, l->self_scm());
     }
 }
 
@@ -132,10 +133,6 @@ Script_engraver::acknowledge_grob (Grob_info inf)
        {
          Grob *e = script_p_arr_[i];
          
-         if (!e->get_parent (X_AXIS))
-           {
-             e->set_parent (inf.grob_l_, X_AXIS);
-           }
          if (Side_position_interface::get_axis (e) == X_AXIS
              && !e->get_parent (Y_AXIS))
            {
@@ -144,7 +141,29 @@ Script_engraver::acknowledge_grob (Grob_info inf)
            }
          Side_position_interface::add_support (e,inf.grob_l_);
        }
-    }  
+    }
+  else if (Note_column::has_interface (inf.grob_l_))
+    {
+
+      /*
+       We make note column the parent of the script. That's not
+       correct, but due to seconds in a chord, noteheads may be
+       swapped around horizontally. We don't know which note head to
+       put it on, so we postpone this decision to
+       Script_interface::before_line_breaking ().
+       */
+      for (int i=0; i < script_p_arr_.size (); i++)
+       {
+         Grob *e = script_p_arr_[i];
+         
+         if (!e->get_parent (X_AXIS) &&
+             Side_position_interface::get_axis (e) == Y_AXIS)
+           {
+             e->set_parent (inf.grob_l_, X_AXIS);
+           }
+       }
+    }
 }
 
 void
@@ -152,6 +171,10 @@ Script_engraver::stop_translation_timestep ()
 {
   for (int i=0; i < script_p_arr_.size (); i++) 
     {
+
+      /*
+       TODO: junk staff-support.
+       */
       Grob * sc = script_p_arr_[i];
       if (to_boolean (sc->get_grob_property ("staff-support")))
        {
@@ -176,6 +199,6 @@ ENTER_DESCRIPTION(Script_engraver,
 /* descr */       "    Handles note ornaments generated by @code{\\script}.  
 ",
 /* creats*/       "Script",
-/* acks  */       "stem-interface rhythmic-head-interface",
+/* acks  */       "stem-interface rhythmic-head-interface note-column-interface",
 /* reads */       "scriptDefinitions scriptHorizontal",
 /* write */       "");