]> git.donarmstrong.com Git - lilypond.git/commitdiff
scripts on 2nds
authorhanwen <hanwen>
Tue, 21 May 2002 21:58:59 +0000 (21:58 +0000)
committerhanwen <hanwen>
Tue, 21 May 2002 21:58:59 +0000 (21:58 +0000)
ChangeLog
input/bugs/bizarre-beam.ly
input/regression/script-collision.ly [new file with mode: 0644]
lily/script-column.cc
lily/script-engraver.cc
lily/script.cc

index fc50fac890ada49618c810577a86b867a745637c..b4746929db5c62c12a4d00f410850c15f4129276 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-05-22  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/script.cc (before_line_breaking): postpone setting the
+       X-parent of vertical scripts. This fixes the case of scripts on
+       chords with seconds 
+
 2002-05-21  Han-Wen  <hanwen@cs.uu.nl>
 
        * scm/grob-description.scm:  fix alignment of barnumber: make sure
index 2a8ecf7465426119731926412c8f3afd6c75c7fb..166376e7b8a9302ee49ee68637226eeaa164ac18 100644 (file)
@@ -1,3 +1,10 @@
 
 
-\score{ \notes {[g'' <e'''8 g> g''] }}
+\score{ \notes {g''4 [<e'''8 g> g'']
+\notes\relative c'{
+   \times 2/3{[d16 fis' d,]} \times 2/3{[cis g'' cis,,]}
+  a'16 cis a, g''' % Used to give a nice beam directed upwards.
+  <{\stemUp a,,4:32} \context Voice=lower{\stemDown d,:32}>
+
+}
+           }}
diff --git a/input/regression/script-collision.ly b/input/regression/script-collision.ly
new file mode 100644 (file)
index 0000000..78645f9
--- /dev/null
@@ -0,0 +1,16 @@
+
+\header {
+
+    texidoc = "Scripts are put on the utmost head, so they are
+      positioned correctly when there are collisions."
+}
+
+\score  {
+\notes \relative c'' {
+  c4
+  <c d c'-\marcato>
+  < \context Voice = VA { \voiceOne c4^^ }
+    \context Voice = VB { \voiceTwo d4_^} >
+    }
+\paper { linewidth = -1. }
+    }
index 59e28471c7a6f20088c1755d446bb414be4e9c41..33aacb3e5e0c51db3d05936cde40e5d78a146ee6 100644 (file)
@@ -43,7 +43,6 @@ Script_column::before_line_breaking (SCM smob)
   Link_array<Grob> staff_sided 
     = Pointer_group_interface__extract_grobs (me, (Grob*)0, "scripts");
                                     
-                                    
   for (int i=0; i < staff_sided.size (); i++)
     {
       Direction d = Side_position_interface::get_direction (staff_sided[i]);
index 0466630e3a8fa702598373ed25b5330a5b871f06..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
 {
@@ -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
@@ -180,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 */       "");
index 50946ff65d7b1d07da4753dbf4d1af1a4a9852ea..7483b07a79318cdf30cac54eb54d4cdc9a52c0ff 100644 (file)
@@ -15,6 +15,8 @@
 #include "item.hh"
 #include "molecule.hh"
 #include "lookup.hh"
+#include "stem.hh"
+#include "note-column.hh"
 
 Molecule
 Script_interface::get_molecule (Grob * me, Direction d)
@@ -48,15 +50,24 @@ Script_interface::before_line_breaking (SCM smob)
 
   if (!d)
     {
-  /*
-    we should not have `arbitrary' directions. 
-   */
+      /*
+       we should not have `arbitrary' directions. 
+      */
       programming_error ("Script direction not yet known!");
       d = DOWN;
     }
   
   Side_position_interface::set_direction (me,d);
 
+  if (Grob * par = me->get_parent (X_AXIS))
+    {
+      Grob * stem = Note_column::stem_l (par);
+      if (stem && Stem::first_head (stem))
+       {
+         me->set_parent (Stem::first_head (stem), X_AXIS);
+       }
+    }
+  
   return SCM_UNSPECIFIED;
 }