--- /dev/null
+\version "2.15.27"
+
+\header {
+ texidoc = "Dot columns should not trigger vertical spacing before
+line breaking. If the regtest issues a programming_error saying that
+vertical spacing has been called before line breaking, it has failed.
+"
+}
+
+\context Staff <<
+ \new Voice { \voiceOne f''8.[ e''16] }
+ \new Voice { \voiceThree r8. a'16}
+>>
}
}
- vector_sort (dots, position_less);
+ /*
+ The use of pure_position_less and pure_get_rounded_position below
+ are due to the fact that this callback is called before line breaking
+ occurs. Because dots' actual Y posiitons may be linked to that of
+ beams (dots are attached to rests, which are shifted to avoid beams),
+ we instead must use their pure Y positions.
+ */
+ vector_sort (dots, pure_position_less);
for (vsize i = dots.size (); i--;)
{
if (!dots[i]->is_live ())
dp.x_extent_ = note->extent (commonx, X_AXIS);
}
- int p = Staff_symbol_referencer::get_rounded_position (dp.dot_);
+ int p = Staff_symbol_referencer::pure_get_rounded_position (dp.dot_);
/* icky, since this should go via a Staff_symbol_referencer
offset callback but adding a dot overwrites Y-offset. */
/*
Junkme?
*/
- Staff_symbol_referencer::set_position (i->second.dot_, i->first);
+ Staff_symbol_referencer::pure_set_position (i->second.dot_, i->first);
}
me->translate_axis (cfg.x_offset () - me->relative_coordinate (commonx, X_AXIS),
DECLARE_GROB_INTERFACE ();
static bool ugly_hack (Grob *);
static void set_position (Grob *, Real);
+ static void pure_set_position (Grob *, Real);
DECLARE_SCHEME_CALLBACK (callback, (SCM element));
/**
static bool on_staff_line (Grob *, int);
static int line_count (Grob *);
static Real get_position (Grob *);
+ static Real pure_get_position (Grob *);
static Real staff_radius (Grob *);
static int get_rounded_position (Grob *);
+ static int pure_get_rounded_position (Grob *);
static Interval extent_in_staff (Grob *);
+
+private:
+ static void internal_set_position (Grob *, Real, bool);
+ static Real internal_get_position (Grob *, bool);
};
int compare_position (Grob *const &, Grob *const &);
bool position_less (Grob *const &, Grob *const &);
+bool pure_position_less (Grob *const &, Grob *const &);
#endif /* STAFF_SYMBOL_REFERENCER_HH */
Real
Staff_symbol_referencer::get_position (Grob *me)
+{
+ return internal_get_position (me, false);
+}
+
+Real
+Staff_symbol_referencer::pure_get_position (Grob *me)
+{
+ return internal_get_position (me, true);
+}
+
+Real
+Staff_symbol_referencer::internal_get_position (Grob *me, bool pure)
{
Real p = 0.0;
Grob *st = get_staff_symbol (me);
Grob *c = st ? me->common_refpoint (st, Y_AXIS) : 0;
if (st && c)
{
- Real y = me->relative_coordinate (c, Y_AXIS)
+ Real y = (pure
+ ? me->pure_relative_y_coordinate (c, 0, INT_MAX)
+ : me->relative_coordinate (c, Y_AXIS))
- st->relative_coordinate (c, Y_AXIS);
Real space = Staff_symbol::staff_space (st);
p = (space == 0) ? 0 : 2.0 * y / space;
return int (rint (get_position (me)));
}
+int
+Staff_symbol_referencer::pure_get_rounded_position (Grob *me)
+{
+ return int (rint (pure_get_position (me)));
+}
+
MAKE_SCHEME_CALLBACK (Staff_symbol_referencer, callback, 1);
SCM
Staff_symbol_referencer::callback (SCM smob)
void
Staff_symbol_referencer::set_position (Grob *me, Real p)
+{
+ internal_set_position (me, p, false);
+}
+
+void
+Staff_symbol_referencer::pure_set_position (Grob *me, Real p)
+{
+ internal_set_position (me, p, true);
+}
+
+void
+Staff_symbol_referencer::internal_set_position (Grob *me, Real p, bool pure)
{
Grob *st = get_staff_symbol (me);
Real oldpos = 0.0;
if (st && me->common_refpoint (st, Y_AXIS))
{
- oldpos = get_position (me);
+ oldpos = pure ? pure_get_position (me) : get_position (me);
}
Real ss = Staff_symbol_referencer::staff_space (me);
< Staff_symbol_referencer::get_position (b);
}
+bool
+pure_position_less (Grob *const &a, Grob *const &b)
+{
+ return Staff_symbol_referencer::pure_get_position (a)
+ < Staff_symbol_referencer::pure_get_position (b);
+}
+
ADD_INTERFACE (Staff_symbol_referencer,
"An object whose Y@tie{}position is meant relative to a staff"
" symbol. These usually"