chained callback.
* lily/rest.cc (y_offset_callback): merge function of 3 callbacks.
* lily/rest.cc (polyphonic_offset_callback): remove.
2005-11-02 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/rest-collision.cc (force_shift_callback_rest): change to
+ chained callback.
+
* lily/rest.cc (y_offset_callback): merge function of 3 callbacks.
* lily/grob.cc (y_parent_positioning): remove axis argument from
static bool has_interface (Grob *);
DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element));
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element));
- DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element));
+ DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM off));
static SCM do_shift (Grob *);
};
#endif // REST_COLLISION_HH
return scm_from_double (0.0);
}
-MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback_rest, 1);
+MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback_rest, 2);
SCM
-Rest_collision::force_shift_callback_rest (SCM rest)
+Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
{
Grob *rest_grob = unsmob_grob (rest);
Grob *parent = rest_grob->get_parent (X_AXIS);
+
+ /*
+ translate REST; we need the result of this translation later on,
+ while the offset probably still is 0/calculation-in-progress.
+ */
+ rest_grob->translate_axis (scm_to_double (offset), Y_AXIS);
+
if (Note_column::has_interface (parent))
- return force_shift_callback (parent->self_scm ());
- else
- return scm_from_double (0.0);
+ force_shift_callback (parent->self_scm ());
+
+ return scm_from_double (0.0);
}
void
Grob *rest = unsmob_grob (p->get_object ("rest"));
if (rest)
{
- rest->set_property ("Y-offset" ,
- Rest_collision::force_shift_callback_rest_proc);
+ chain_offset_callback (rest,
+ Rest_collision::force_shift_callback_rest_proc, Y_AXIS);
}
}
{
Grob *me = unsmob_grob (smob);
int duration_log = scm_to_int (me->get_property ("duration-log"));
- int lc = Staff_symbol_referencer::line_count (me);
+ int line_count = Staff_symbol_referencer::line_count (me);
Real ss = Staff_symbol_referencer::staff_space (me);
Real amount = 0.0;
- if (lc % 2)
+ if (line_count % 2)
{
- if (duration_log == 0 && lc > 1)
+ if (duration_log == 0 && line_count > 1)
amount += ss;
}
else
String
Rest::glyph_name (Grob *me, int balltype, String style, bool try_ledgers)
{
- bool ledgered_b = false;
+ bool is_ledgered = false;
if (try_ledgers && (balltype == 0 || balltype == 1))
{
Real rad = Staff_symbol_referencer::staff_radius (me) * 2.0;
could bemore generic, but hey, we understand this even after
dinner.
*/
- ledgered_b |= (balltype == 0) && (pos >= +rad + 2 || pos < -rad);
- ledgered_b |= (balltype == 1) && (pos <= -rad - 2 || pos > +rad);
+ is_ledgered |= (balltype == 0) && (pos >= +rad + 2 || pos < -rad);
+ is_ledgered |= (balltype == 1) && (pos <= -rad - 2 || pos > +rad);
}
String actual_style (style.to_str0 ());
ledgered rests at all now that we can draw ledger lines with
variable width, length and blotdiameter? -- jr
*/
- ledgered_b = 0;
+ is_ledgered = 0;
/*
There are no 32th/64th/128th mensural/neomensural rests. In
actual_style = "";
}
- return ("rests." + to_string (balltype) + (ledgered_b ? "o" : "")
+ return ("rests." + to_string (balltype) + (is_ledgered ? "o" : "")
+ actual_style);
}