+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
-\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}>
+
+}
+ }}
--- /dev/null
+
+\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. }
+ }
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]);
#include "stem.hh"
#include "rhythmic-head.hh"
#include "engraver.hh"
+#include "note-column.hh"
class Script_engraver : public Engraver
{
{
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))
{
}
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
/* 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 */ "");
#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)
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;
}