From a5af030457fb3f033e288c3801c9c02e5c4c5988 Mon Sep 17 00:00:00 2001 From: hanwen Date: Sun, 16 Oct 2005 01:06:19 +0000 Subject: [PATCH] * scm/define-context-properties.scm (all-user-translation-properties): remove verticalAlignmentChildCallback * lily/tuplet-bracket.cc: use positions property iso. left,right-position. (calc_direction): use callback (calc_positions): use callback. * lily/tie.cc (calc_direction): use callback. Only call parent positioning for more than one tie. * lily/tie-column.cc (calc_positioning_done): use callback * lily/slur-scoring.cc (calc_control_points): use callback * lily/slur.cc (calc_direction): use callback. * lily/note-collision.cc (force_shift_callback): remove. * lily/dot-column.cc (force_shift_callback): remove. Use other_axis_parent_positioning. * lily/grob.cc (other_axis_parent_positioning): new function. (same_axis_parent_positioning): new function * lily/align-interface.cc (alignment_callback): remove function. * lily/note-collision.cc (calc_positioning_done): use callback. * lily/laissez-vibrer-tie.cc (calc_control_points): use callback. (calc_direction): idem. remove print function. * lily/laissez-vibrer-tie-column.cc (calc_positioning_done): use callback. * lily/dot-column.cc (calc_positioning_done): use callback. * lily/break-align-interface.cc (calc_positioning_done): use callback. * lily/beam.cc (calc_direction): use pseudo-property for beam direction callback. (calc_positions): use callback * lily/align-interface.cc (calc_positioning_done): use callback. Fold fixed distance and normal alignment in one function. * lily/stem.cc (calc_stem_end_position): use callback. (calc_positioning_done): idem. (calc_direction): idem. (calc_stem_end_position): idem (calc_stem_info): idem. * lily/grob-property.cc (get_property_data): new function: (try_callback): new function. * scm/define-grob-properties.scm (all-user-grob-properties): doc callbacks property. * lily/break-align-interface.cc: remove Break_align_interface::alignment_callback. --- ChangeLog | 69 +++++++++++- lily/accidental-placement.cc | 47 ++++---- lily/align-interface.cc | 39 +++---- lily/bar-line.cc | 20 +++- lily/beam.cc | 123 ++++++++++----------- lily/break-align-interface.cc | 34 ++---- lily/directional-element-interface.cc | 6 + lily/dot-column.cc | 39 +++---- lily/dots.cc | 5 +- lily/drum-note-engraver.cc | 4 - lily/grob-property.cc | 106 ++++++++++++++++-- lily/grob-smob.cc | 1 + lily/grob.cc | 82 +++++++++++--- lily/hara-kiri-group-spanner.cc | 7 +- lily/include/accidental-placement.hh | 2 +- lily/include/align-interface.hh | 3 +- lily/include/beam.hh | 5 +- lily/include/break-align-interface.hh | 3 +- lily/include/dot-column.hh | 2 +- lily/include/grob.hh | 15 ++- lily/include/laissez-vibrer-tie-column.hh | 4 +- lily/include/laissez-vibrer-tie.hh | 4 +- lily/include/note-collision.hh | 2 +- lily/include/note-head.hh | 1 + lily/include/rest-collision.hh | 1 + lily/include/slur.hh | 3 +- lily/include/stem.hh | 9 +- lily/include/tie-column.hh | 2 +- lily/include/tie.hh | 3 +- lily/include/tuplet-bracket.hh | 4 +- lily/laissez-vibrer-tie-column.cc | 17 ++- lily/laissez-vibrer-tie.cc | 50 ++++----- lily/new-figured-bass-engraver.cc | 3 +- lily/note-collision.cc | 39 +++---- lily/note-column.cc | 1 - lily/note-head.cc | 17 +++ lily/rest-collision.cc | 18 +-- lily/script-column.cc | 8 +- lily/script-engraver.cc | 3 - lily/script-interface.cc | 2 + lily/separating-group-spanner.cc | 6 +- lily/slur-scoring.cc | 13 ++- lily/slur.cc | 60 +++++----- lily/span-bar.cc | 2 - lily/stem.cc | 127 ++++++++++++++-------- lily/tie-column.cc | 38 ++----- lily/tie.cc | 92 +++++++++------- lily/tuplet-bracket.cc | 106 +++++------------- lily/vertical-align-engraver.cc | 3 +- lily/volta-bracket.cc | 2 - ly/engraver-init.ly | 3 - scm/define-context-properties.scm | 3 - scm/define-grob-properties.scm | 8 +- scm/define-grobs.scm | 66 ++++++++--- scm/lily.scm | 1 - scm/music-functions.scm | 2 +- scm/safe-lily.scm | 26 ----- 57 files changed, 774 insertions(+), 587 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ae1106751..f4eb09e2fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,71 @@ +2005-10-16 Han-Wen Nienhuys + + * scm/define-context-properties.scm + (all-user-translation-properties): remove verticalAlignmentChildCallback + + * lily/tuplet-bracket.cc: use positions property iso. left,right-position. + (calc_direction): use callback + (calc_positions): use callback. + + * lily/tie.cc (calc_direction): use callback. Only call parent + positioning for more than one tie. + + * lily/tie-column.cc (calc_positioning_done): use callback + + * lily/slur-scoring.cc (calc_control_points): use callback + + * lily/slur.cc (calc_direction): use callback. + + * lily/note-collision.cc (force_shift_callback): remove. + + * lily/dot-column.cc (force_shift_callback): remove. Use + other_axis_parent_positioning. + + * lily/grob.cc (other_axis_parent_positioning): new function. + (same_axis_parent_positioning): new function + + * lily/align-interface.cc (alignment_callback): remove function. + + * lily/note-collision.cc (calc_positioning_done): use callback. + + * lily/laissez-vibrer-tie.cc (calc_control_points): use callback. + (calc_direction): idem. + remove print function. + + * lily/laissez-vibrer-tie-column.cc (calc_positioning_done): use callback. + + * lily/dot-column.cc (calc_positioning_done): use callback. + + * lily/break-align-interface.cc (calc_positioning_done): use callback. + + * lily/beam.cc (calc_direction): use pseudo-property for beam + direction callback. + (calc_positions): use callback + + * lily/align-interface.cc (calc_positioning_done): use + callback. Fold fixed distance and normal alignment in one function. + + * lily/stem.cc (calc_stem_end_position): use callback. + (calc_positioning_done): idem. + (calc_direction): idem. + (calc_stem_end_position): idem + (calc_stem_info): idem. + + * lily/grob-property.cc (get_property_data): new function: + (try_callback): new function. + + * scm/define-grob-properties.scm (all-user-grob-properties): doc + callbacks property. + + * lily/break-align-interface.cc: remove Break_align_interface::alignment_callback. + 2005-10-15 Han-Wen Nienhuys - * lily/include/*.hh (Module): lots of compile fixes. + * lily/tie.cc (get_position): robustness fix. Don't crash if a + tie + has no heads. + + * lily/include/*.hh (Module): compile fixes. 2005-10-14 Heikki Junes @@ -34,7 +99,7 @@ 2005-10-11 Han-Wen Nienhuys * ly/titling-init.ly (evenHeaderMarkup): use space in header on - even header too.6 + even header too. * scm/define-markup-commands.scm (wordwrap-string): bugfix for MacOS 9 users. diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index 3f63cb1c5b..4457289235 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -18,27 +18,12 @@ #include "note-collision.hh" #include "accidental-interface.hh" -MAKE_SCHEME_CALLBACK (Accidental_placement, alignment_callback, 2); -SCM -Accidental_placement::alignment_callback (SCM s, SCM) -{ - Grob *me = unsmob_grob (s); - - Grob *par = me->get_parent (X_AXIS); - if (!to_boolean (par->get_property ("positioning-done"))) - { - par->set_property ("positioning-done", SCM_BOOL_T); - position_accidentals (par); - } - - return scm_from_int (0); -} void Accidental_placement::add_accidental (Grob *me, Grob *a) { a->set_parent (me, X_AXIS); - a->add_offset_callback (alignment_callback_proc, X_AXIS); + a->add_offset_callback (Grob::same_axis_parent_positioning_proc, X_AXIS); SCM cause = a->get_parent (Y_AXIS)->get_property ("cause"); Music *mcause = unsmob_music (cause); @@ -221,20 +206,26 @@ stagger_apes (Link_array *apes) Natural + downstem - |_ - | | X - |_| | - | | + * + * |_ + * | | X + * |_| | + * | | + * + */ + +MAKE_SCHEME_CALLBACK(Accidental_placement, calc_positioning_done, 1); SCM -Accidental_placement::position_accidentals (Grob *me) +Accidental_placement::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); if (!me->is_live ()) - return SCM_UNSPECIFIED; + return SCM_BOOL_T; SCM accs = me->get_object ("accidental-grobs"); if (!scm_is_pair (accs)) - return SCM_UNSPECIFIED; + return SCM_BOOL_T; /* TODO: there is a bug in this code. If two accs are on the same @@ -403,10 +394,16 @@ Accidental_placement::position_accidentals (Grob *me) for (int i = apes.size (); i--;) delete apes[i]; - return SCM_UNSPECIFIED; + return SCM_BOOL_T; } ADD_INTERFACE (Accidental_placement, "accidental-placement-interface", "Resolve accidental collisions.", - "left-padding padding right-padding accidental-grobs positioning-done") + + /* properties */ + "accidental-grobs " + "left-padding " + "padding " + "positioning-done " + "right-padding ") diff --git a/lily/align-interface.cc b/lily/align-interface.cc index bedae50c80..ada7e4e3a2 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -21,28 +21,21 @@ distance. */ -MAKE_SCHEME_CALLBACK (Align_interface, alignment_callback, 2); +MAKE_SCHEME_CALLBACK (Align_interface, calc_positioning_done, 1); SCM -Align_interface::alignment_callback (SCM element_smob, SCM axis) +Align_interface::calc_positioning_done (SCM smob) { - Grob *me = unsmob_grob (element_smob); + Grob *me = unsmob_grob (smob); + SCM axis = scm_car (me->get_property ("axes")); Axis ax = (Axis)scm_to_int (axis); - Grob *par = me->get_parent (ax); - if (par && !to_boolean (par->get_property ("positioning-done"))) - Align_interface::align_elements_to_extents (par, ax); - return scm_from_double (0.0); -} -MAKE_SCHEME_CALLBACK (Align_interface, fixed_distance_alignment_callback, 2); -SCM -Align_interface::fixed_distance_alignment_callback (SCM element_smob, SCM axis) -{ - Grob *me = unsmob_grob (element_smob); - Axis ax = (Axis)scm_to_int (axis); - Grob *par = me->get_parent (ax); - if (par && !to_boolean (par->get_property ("positioning-done"))) - Align_interface::align_to_fixed_distance (par, ax); - return scm_from_double (0.0); + SCM force = me->get_property ("forced-distance"); + if (scm_is_number (force)) + Align_interface::align_to_fixed_distance (me, ax); + else + Align_interface::align_elements_to_extents (me, ax); + + return SCM_BOOL_T; } /* @@ -88,8 +81,6 @@ Align_interface::stretch_after_break (SCM grob) void Align_interface::align_to_fixed_distance (Grob *me, Axis a) { - me->set_property ("positioning-done", SCM_BOOL_T); - Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), DOWN); @@ -151,6 +142,7 @@ Align_interface::align_to_fixed_distance (Grob *me, Axis a) The original function has been taken over by align_to_fixed_distance (). */ + void Align_interface::align_elements_to_extents (Grob *me, Axis a) { @@ -177,8 +169,6 @@ Align_interface::align_elements_to_extents (Grob *me, Axis a) extra_space); } - me->set_property ("positioning-done", SCM_BOOL_T); - Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), DOWN); @@ -271,9 +261,10 @@ Align_interface::axis (Grob *me) } void -Align_interface::add_element (Grob *me, Grob *element, SCM call_back) +Align_interface::add_element (Grob *me, Grob *element) { - element->add_offset_callback (call_back, Align_interface::axis (me)); + element->add_offset_callback (Grob::same_axis_parent_positioning_proc, + Align_interface::axis (me)); Axis_group_interface::add_element (me, element); } diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 555a5c2566..ab18eb0fcb 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -16,7 +16,6 @@ #include "staff-symbol-referencer.hh" MAKE_SCHEME_CALLBACK (Bar_line, print, 1); - SCM Bar_line::print (SCM smob) { @@ -151,7 +150,6 @@ Bar_line::simple_barline (Grob *me, } MAKE_SCHEME_CALLBACK (Bar_line, before_line_breaking, 1); - SCM Bar_line::before_line_breaking (SCM smob) { @@ -174,7 +172,7 @@ Bar_line::before_line_breaking (SCM smob) // leave y_extent for spanbar? } - if (! ly_is_equal (g, orig)) + if (!ly_is_equal (g, orig)) me->set_property ("glyph", g); return SCM_UNSPECIFIED; @@ -203,7 +201,9 @@ Bar_line::get_staff_bar_size (SCM smob) return scm_from_int (0); } -ADD_INTERFACE (Bar_line, "bar-line-interface", +ADD_INTERFACE (Bar_line, + "bar-line-interface", + "Bar line.\n" "\n" "Print a special bar symbol. It replaces the \n" @@ -218,4 +218,14 @@ ADD_INTERFACE (Bar_line, "bar-line-interface", "repeat, a double bar, a start bar, an end bar, and a thick double bar.\n" "If @var{bartype} is set to @code{empty} then nothing is printed,\n" "but a line break is allowed at that spot.\n", - "bar-size-procedure kern thin-kern hair-thickness thick-thickness glyph bar-size break-glyph-function"); + + + /* properties */ + "bar-size-procedure " + "kern " + "thin-kern " + "hair-thickness " + "thick-thickness " + "glyph " + "bar-size " + "break-glyph-function"); diff --git a/lily/beam.cc b/lily/beam.cc index 4c7d8b85ef..f4d29ed728 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -47,13 +47,14 @@ void Beam::add_stem (Grob *me, Grob *s) { - Pointer_group_interface::add_grob (me, ly_symbol2scm ("stems"), s); - - s->add_dependency (me); + if (Stem::get_beam (s)) + { + programming_error ("Stem already has beam"); + return ; + } - assert (!Stem::get_beam (s)); + Pointer_group_interface::add_grob (me, ly_symbol2scm ("stems"), s); s->set_object ("beam", me->self_scm ()); - add_bound_item (dynamic_cast (me), dynamic_cast (s)); } @@ -120,9 +121,9 @@ Beam::space_function (SCM smob, SCM beam_count) Currenly, this means that beam has set all stem's directions. [Alternatively, stems could set its own directions, according to their beam, during 'final-pre-processing'.] */ -MAKE_SCHEME_CALLBACK (Beam, before_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Beam, calc_direction, 1); SCM -Beam::before_line_breaking (SCM smob) +Beam::calc_direction (SCM smob) { Grob *me = unsmob_grob (smob); @@ -153,10 +154,12 @@ Beam::before_line_breaking (SCM smob) return SCM_UNSPECIFIED; } } + + Direction d = CENTER; + if (count >= 1) { - Direction d = get_default_dir (me); - + d = get_default_dir (me); consider_auto_knees (me); set_stem_directions (me, d); @@ -165,7 +168,7 @@ Beam::before_line_breaking (SCM smob) set_stem_shorten (me); } - return SCM_EOL; + return scm_from_int (d); } /* We want a maximal number of shared beams, but if there is choice, we @@ -284,7 +287,6 @@ SCM Beam::print (SCM grob) { Spanner *me = unsmob_spanner (grob); - position_beam (me); extract_grob_set (me, "stems", stems); Grob *xcommon = common_refpoint_of_array (stems, me, X_AXIS); @@ -522,26 +524,25 @@ Beam::get_default_dir (Grob *me) total[UP] = total[DOWN] = 0; Drul_array count; count[UP] = count[DOWN] = 0; - Direction d = DOWN; extract_grob_set (me, "stems", stems); for (int i = 0; i < stems.size (); i++) - do - { - Grob *s = stems[i]; - Direction sd = get_grob_direction (s); - - int center_distance = max (int (- d * Stem::head_positions (s) [-d]), 0); - int current = sd ? (1 + d * sd) / 2 : center_distance; - - if (current) - { - total[d] += current; - count[d]++; - } - } - while (flip (&d) != DOWN); + { + Grob *s = stems[i]; + Direction stem_dir = CENTER; + SCM stem_dir_scm = s->get_property_data (ly_symbol2scm ("direction")); + if (is_direction (stem_dir_scm)) + stem_dir = to_dir (stem_dir_scm); + else + stem_dir = Stem::get_default_dir (s); + + if (stem_dir) + { + count[stem_dir] ++; + total[stem_dir] += max (int (- stem_dir * Stem::head_positions (s) [-stem_dir]), 0); + } + } SCM func = me->get_property ("dir-function"); SCM s = scm_call_2 (func, @@ -569,7 +570,7 @@ Beam::set_stem_directions (Grob *me, Direction d) { Grob *s = stems[i]; - SCM forcedir = s->get_property ("direction"); + SCM forcedir = s->get_property_data (ly_symbol2scm ("direction")); if (!to_dir (forcedir)) set_grob_direction (s, d); } @@ -624,7 +625,7 @@ Beam::consider_auto_knees (Grob *me) */ head_extents += stem->relative_coordinate (common, Y_AXIS); - if (to_dir (stem->get_property ("direction"))) + if (to_dir (stem->get_property_data (ly_symbol2scm ("direction")))) { Direction stemdir = to_dir (stem->get_property ("direction")); head_extents[-stemdir] = -stemdir * infinity_f; @@ -724,44 +725,31 @@ Beam::set_stem_shorten (Grob *me) me->set_property ("shorten", scm_from_double (shorten_f)); } -/* Call list of y-dy-callbacks, that handle setting of - grob-properties -*/ -MAKE_SCHEME_CALLBACK (Beam, after_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Beam, calc_positions, 1); SCM -Beam::after_line_breaking (SCM smob) +Beam::calc_positions (SCM smob) { Grob *me = unsmob_grob (smob); - - position_beam (me); - return SCM_UNSPECIFIED; -} - -void -Beam::position_beam (Grob *me) -{ if (!me->is_live ()) - return; - if (to_boolean (me->get_property ("positioning-done"))) - return; - - me->set_property ("positioning-done", SCM_BOOL_T); + return SCM_EOL; - /* Copy to mutable list. */ - SCM s = ly_deep_copy (me->get_property ("positions")); - me->set_property ("positions", s); + (void) me->get_property ("direction"); + + SCM posns = scm_cons (SCM_BOOL_F, SCM_BOOL_F); + me->set_property ("positions", posns); - if (scm_car (s) == SCM_BOOL_F) - { - // one wonders if such genericity is necessary --hwn. - SCM callbacks = me->get_property ("position-callbacks"); - for (SCM i = callbacks; scm_is_pair (i); i = scm_cdr (i)) - scm_call_1 (scm_car (i), me->self_scm ()); - } + SCM callbacks = me->get_property ("position-callbacks"); + for (SCM i = callbacks; scm_is_pair (i); i = scm_cdr (i)) + scm_call_1 (scm_car (i), me->self_scm ()); + /* + TODO: move this in separate calc function. + */ set_stem_lengths (me); + return SCM_UNSPECIFIED; } + void set_minimum_dy (Grob *me, Real *dy) { @@ -1291,13 +1279,7 @@ Beam::rest_collision_callback (SCM element_smob, SCM axis) if (scm_is_pair (s) && scm_is_number (scm_car (s))) pos = ly_scm2interval (s); else - { - /* - UGH. TODO: fix dependency tracking. - */ - position_beam (beam); - pos = ly_scm2interval (beam->get_property ("positions")); - } + programming_error ("positions property should always be pair of numbers."); Real staff_space = Staff_symbol_referencer::staff_space (rest); @@ -1395,10 +1377,17 @@ Beam::get_direction_beam_count (Grob *me, Direction d) return bc; } -ADD_INTERFACE (Beam, "beam-interface", +ADD_INTERFACE (Beam, + "beam-interface", + "A beam. \n\n" "The @code{thickness} property is the weight of beams, " - "measured in staffspace", + "measured in staffspace. The @code{direction} property is not user-serviceable. Use " + "the @code{direction} property of @code{Stem} instead. " + + , + + /* properties */ "auto-knee-gap " "beamed-stem-shorten " "break-overshoot " @@ -1406,6 +1395,7 @@ ADD_INTERFACE (Beam, "beam-interface", "concaveness " "damping " "details " + "direction " "dir-function " "flag-width-function " "gap " @@ -1415,7 +1405,6 @@ ADD_INTERFACE (Beam, "beam-interface", "least-squares-dy " "neutral-direction " "position-callbacks " - "positioning-done " "positions " "quant-score " "shorten " diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index 970be7cbe8..1d82c0622a 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -19,23 +19,6 @@ #include "paper-column.hh" #include "align-interface.hh" -MAKE_SCHEME_CALLBACK (Break_align_interface, alignment_callback, 2); -SCM -Break_align_interface::alignment_callback (SCM element_smob, SCM axis) -{ - Grob *me = unsmob_grob (element_smob); - Axis a = (Axis) scm_to_int (axis); - - assert (a == X_AXIS); - Grob *par = me->get_parent (a); - if (par && !to_boolean (par->get_property ("positioning-done"))) - { - par->set_property ("positioning-done", SCM_BOOL_T); - Break_align_interface::do_alignment (par); - } - - return scm_from_double (0); -} MAKE_SCHEME_CALLBACK (Break_align_interface, self_align_callback, 2); SCM @@ -103,12 +86,14 @@ Break_align_interface::ordered_elements (Grob *grob) void Break_align_interface::add_element (Grob *me, Grob *toadd) { - Axis_group_interface::add_element (me, toadd); + Align_interface::add_element (me, toadd); } -void -Break_align_interface::do_alignment (Grob *grob) +MAKE_SCHEME_CALLBACK(Break_align_interface, calc_positioning_done, 1) +SCM +Break_align_interface::calc_positioning_done (SCM smob) { + Grob *grob = unsmob_grob (smob); Item *me = dynamic_cast (grob); Link_array elems = ordered_elements (me); @@ -251,7 +236,7 @@ Break_align_interface::do_alignment (Grob *grob) } if (total_extent.is_empty ()) - return; + return SCM_BOOL_T; if (me->break_status_dir () == LEFT) alignment_off = -total_extent[RIGHT] - extra_right_space; @@ -264,6 +249,8 @@ Break_align_interface::do_alignment (Grob *grob) here += offsets[i]; elems[i]->translate_axis (here, X_AXIS); } + + return SCM_BOOL_T; } ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface", @@ -293,5 +280,8 @@ ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface", ADD_INTERFACE (Break_align_interface, "break-alignment-interface", "The object that performs break aligment. See @ref{break-aligned-interface}.", - "positioning-done break-align-orders"); + + /* properties */ + "positioning-done " + "break-align-orders"); diff --git a/lily/directional-element-interface.cc b/lily/directional-element-interface.cc index 3d7514cad6..872f3ad23f 100644 --- a/lily/directional-element-interface.cc +++ b/lily/directional-element-interface.cc @@ -7,11 +7,17 @@ */ #include "directional-element-interface.hh" +#include "warn.hh" Direction get_grob_direction (Grob *me) { SCM d = me->get_property ("direction"); + if (d == ly_symbol2scm ("calculation-in-progress")) + { + programming_error ("Grob direction requested while calculation in progress. "); + return UP; + } if (!is_direction (d)) return CENTER; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index a8d3e73570..6a1cc7ef02 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -26,24 +26,6 @@ using namespace std; TODO: let Dot_column communicate with stem via Note_column. */ -MAKE_SCHEME_CALLBACK (Dot_column, force_shift_callback, 2); -SCM -Dot_column::force_shift_callback (SCM element_smob, SCM axis) -{ - Grob *me = unsmob_grob (element_smob); - (void) axis; - assert (scm_to_int (axis) == Y_AXIS); - me = me->get_parent (X_AXIS); - - if (!to_boolean (me->get_property ("positioning-done"))) - { - me->set_property ("positioning-done", SCM_BOOL_T); - - do_shifts (me); - } - return scm_from_double (0.0); -} - MAKE_SCHEME_CALLBACK (Dot_column, side_position, 2); SCM Dot_column::side_position (SCM element_smob, SCM axis) @@ -63,8 +45,9 @@ Dot_column::side_position (SCM element_smob, SCM axis) This will add the stem to the support if a flag collision happens. */ - Stem::stem_end_position (stem); + stem->get_property ("stem-end-position"); } + return Side_position_interface::aligned_side (element_smob, axis); } @@ -219,9 +202,11 @@ remove_collision (Dot_configuration &cfg, int p) } } +MAKE_SCHEME_CALLBACK(Dot_column, calc_positioning_done, 1); SCM -Dot_column::do_shifts (Grob *me) +Dot_column::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); Link_array dots = extract_grob_array (me, "dots"); @@ -280,7 +265,7 @@ Dot_column::do_shifts (Grob *me) i != cfg.end (); i++) Staff_symbol_referencer::set_position (i->second.dot_, i->first); - return SCM_UNSPECIFIED; + return SCM_BOOL_T; } void @@ -292,13 +277,19 @@ Dot_column::add_head (Grob *me, Grob *rh) Side_position_interface::add_support (me, rh); Pointer_group_interface::add_grob (me, ly_symbol2scm ("dots"), d); - d->add_offset_callback (Dot_column::force_shift_callback_proc, Y_AXIS); + d->add_offset_callback (Grob::other_axis_parent_positioning_proc, Y_AXIS); Axis_group_interface::add_element (me, d); } } -ADD_INTERFACE (Dot_column, "dot-column-interface", +ADD_INTERFACE (Dot_column, + "dot-column-interface", + "Groups dot objects so they form a column, and position dots so they do not " "clash with staff lines ", - "positioning-done direction stem"); + + /* properties */ + "positioning-done " + "direction " + "stem"); diff --git a/lily/dots.cc b/lily/dots.cc index a6f2e64a5c..c823783d82 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -52,5 +52,8 @@ ADD_INTERFACE (Dots, "dots-interface", "The dots to go with a notehead or rest." "@code{direction} sets the preferred direction to move in case of staff " "line collisions.", - "direction dot-count"); + + /* properties */ + "direction " + "dot-count"); diff --git a/lily/drum-note-engraver.cc b/lily/drum-note-engraver.cc index 13204180a6..059c72190d 100644 --- a/lily/drum-note-engraver.cc +++ b/lily/drum-note-engraver.cc @@ -131,10 +131,6 @@ Drum_notes_engraver::acknowledge_stem (Grob_info inf) if (to_dir (e->get_property ("side-relative-direction"))) e->set_object ("direction-source", inf.grob ()->self_scm ()); - /* - add dep ? - */ - e->add_dependency (inf.grob ()); Side_position_interface::add_support (e, inf.grob ()); } } diff --git a/lily/grob-property.cc b/lily/grob-property.cc index e6b6ec961e..34f1652c90 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -92,31 +92,121 @@ Grob::internal_set_property (SCM sym, SCM v) //#define PROFILE_PROPERTY_ACCESSES +/* + Ugh C&P Coding. + Retrieve property without triggering callback. + */ SCM -Grob::internal_get_property (SCM sym) const +Grob::get_property_data (SCM sym) const { #ifndef NDEBUG if (profile_property_accesses) note_property_access (&grob_property_lookup_table, sym); #endif + + SCM handle = scm_sloppy_assq (sym, mutable_property_alist_); + if (handle != SCM_BOOL_F) + return scm_cdr (handle); - SCM s = scm_sloppy_assq (sym, mutable_property_alist_); - if (s != SCM_BOOL_F) - return scm_cdr (s); + handle = scm_sloppy_assq (sym, immutable_property_alist_); + + if (do_internal_type_checking_global && scm_is_pair (handle)) + { + if (!type_check_assignment (sym, scm_cdr (handle), + ly_symbol2scm ("backend-type?"))) + abort (); - s = scm_sloppy_assq (sym, immutable_property_alist_); + check_interfaces_for_property (this, sym); + } + + return (handle == SCM_BOOL_F) ? SCM_EOL : scm_cdr (handle); +} + +SCM +Grob::internal_get_property (SCM sym) const +{ +#ifndef NDEBUG + if (profile_property_accesses) + note_property_access (&grob_property_lookup_table, sym); +#endif + + SCM handle = scm_sloppy_assq (sym, mutable_property_alist_); + if (handle != SCM_BOOL_F) + return scm_cdr (handle); - if (do_internal_type_checking_global && scm_is_pair (s)) + handle = scm_sloppy_assq (sym, immutable_property_alist_); + + if (do_internal_type_checking_global && scm_is_pair (handle)) { - if (!type_check_assignment (sym, scm_cdr (s), + if (!type_check_assignment (sym, scm_cdr (handle), ly_symbol2scm ("backend-type?"))) abort (); check_interfaces_for_property (this, sym); } - return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s); + + if (handle == SCM_BOOL_F) + { + SCM value = ((Grob*) this)->try_callback (sym); + if (value != SCM_UNSPECIFIED) + return value; + } + + return (handle == SCM_BOOL_F) ? SCM_EOL : scm_cdr (handle); +} + +#ifndef NDEBUG +#include "protected-scm.hh" +Protected_scm grob_property_callback_stack = SCM_EOL; +bool debug_property_callbacks; +#endif + +SCM +Grob::try_callback (SCM sym) +{ + SCM handle = scm_sloppy_assq (sym, property_callbacks_); + if (scm_is_pair (handle)) + { + SCM proc = scm_cdr (handle); + if (ly_is_procedure (proc)) + { + SCM marker = ly_symbol2scm ("calculation-in-progress"); + /* + need to put a value in SYM to ensure that we don't get a + cyclic call chain. + */ + mutable_property_alist_ + = scm_assq_set_x (mutable_property_alist_, sym, marker); + +#ifndef NDEBUG + if (debug_property_callbacks) + grob_property_callback_stack = scm_acons (sym, proc, grob_property_callback_stack); +#endif + SCM value = scm_call_1 (proc, self_scm ()); +#ifndef NDEBUG + if (debug_property_callbacks) + grob_property_callback_stack = scm_cdr (grob_property_callback_stack); +#endif + + /* + If the function returns SCM_UNSPECIFIED, we assume the + property has been set with an explicit set_property() + call. + */ + if (value == SCM_UNSPECIFIED) + value = internal_get_property (sym); + else + internal_set_property (sym, value); + + return value; + } + else + programming_error ("Callback should be procedure type"); + } + + return SCM_UNSPECIFIED; } void diff --git a/lily/grob-smob.cc b/lily/grob-smob.cc index e2e673e194..06e757d1c2 100644 --- a/lily/grob-smob.cc +++ b/lily/grob-smob.cc @@ -21,6 +21,7 @@ Grob::mark_smob (SCM ses) { Grob *s = (Grob *) SCM_CELL_WORD_1 (ses); scm_gc_mark (s->immutable_property_alist_); + scm_gc_mark (s->property_callbacks_); if (s->key_) scm_gc_mark (s->key_->self_scm ()); diff --git a/lily/grob.cc b/lily/grob.cc index cf3b52d935..4933934c0c 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -28,6 +28,36 @@ #include "ly-smobs.icc" #include "output-def.hh" +MAKE_SCHEME_CALLBACK(Grob, same_axis_parent_positioning, 2); +SCM +Grob::same_axis_parent_positioning (SCM element_smob, SCM axis) +{ + Grob *me = unsmob_grob (element_smob); + Axis ax = other_axis ((Axis)scm_to_int (axis)); + + Grob *par = me->get_parent (ax); + if (par) + par->get_property ("positioning-done"); + + return scm_from_double (0.0); +} + +MAKE_SCHEME_CALLBACK(Grob,other_axis_parent_positioning, 2); +SCM +Grob::other_axis_parent_positioning (SCM element_smob, SCM axis) +{ + Grob *me = unsmob_grob (element_smob); + Axis ax = other_axis ((Axis) scm_to_int (axis)); + + Grob *par = me->get_parent (ax); + if (par) + par->get_property ("positioning-done"); + + return scm_from_double (0.0); +} + + + Grob * Grob::clone (int count) const { @@ -55,7 +85,8 @@ Grob::Grob (SCM basicprops, immutable_property_alist_ = basicprops; mutable_property_alist_ = SCM_EOL; object_alist_ = SCM_EOL; - + property_callbacks_ = SCM_EOL; + /* We do smobify_self () as the first step. Since the object lives on the heap, none of its SCM variables are protected from GC. After smobify_self (), they are. */ @@ -78,6 +109,8 @@ Grob::Grob (SCM basicprops, creation. Convenient eg. when using \override with StaffSymbol. */ + property_callbacks_ = get_property ("callbacks"); + SCM off_callbacks[] = { get_property ("X-offset-callbacks"), get_property ("Y-offset-callbacks") @@ -116,6 +149,7 @@ Grob::Grob (SCM basicprops, && ly_is_procedure (get_property ("print-function"))) dim_cache_[a].dimension_callback_ = stencil_extent_proc; } + } Grob::Grob (Grob const &s, int copy_index) @@ -128,6 +162,7 @@ Grob::Grob (Grob const &s, int copy_index) immutable_property_alist_ = s.immutable_property_alist_; mutable_property_alist_ = ly_deep_copy (s.mutable_property_alist_); interfaces_ = s.interfaces_; + property_callbacks_ = s.property_callbacks_; object_alist_ = SCM_EOL; /* No properties are copied. That is the job of @@ -276,14 +311,6 @@ Grob::get_system () const return 0; } -void -Grob::add_dependency (Grob *e) -{ - if (e) - Pointer_group_interface::add_grob (this, ly_symbol2scm ("dependencies"), e); - else - programming_error ("null dependency added"); -} void Grob::handle_broken_dependencies () @@ -331,6 +358,7 @@ Grob::suicide () mutable_property_alist_ = SCM_EOL; object_alist_ = SCM_EOL; + property_callbacks_ = SCM_EOL; immutable_property_alist_ = SCM_EOL; interfaces_ = SCM_EOL; @@ -718,13 +746,35 @@ ADD_INTERFACE (Grob, "grob-interface", "lists of other objects, or results from computations are stored in" "mutable properties: every call to set-grob-property (or its C++ equivalent) " "sets a mutable property. ", - "X-offset-callbacks Y-offset-callbacks X-extent-callback stencil cause " - "Y-extent-callback print-function extra-offset spacing-procedure " - "context staff-symbol interfaces dependencies X-extent Y-extent extra-X-extent " - "meta layer before-line-breaking-callback " - "color " + + /* properties */ + "X-extent " + "X-extent-callback " + "X-offset-callbacks " + "Y-extent " + "Y-extent-callback " + "Y-offset-callbacks " + "after-line-breaking-callback " "axis-group-parent-X " "axis-group-parent-Y " - "after-line-breaking-callback extra-Y-extent minimum-X-extent " - "minimum-Y-extent transparent"); + "before-line-breaking-callback " + "callbacks " + "cause " + "color " + "context " + "extra-X-extent " + "extra-Y-extent " + "extra-offset " + "interfaces " + "layer " + "meta " + "minimum-X-extent " + "minimum-Y-extent " + "print-function " + "spacing-procedure " + "staff-symbol " + "stencil " + "transparent" + ); + diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index f824a2a8cb..01bfa853df 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -92,7 +92,6 @@ Hara_kiri_group_spanner::add_element (Grob *me, Grob *e) void Hara_kiri_group_spanner::add_interesting_item (Grob *me, Grob *n) { - me->add_dependency (n); Pointer_group_interface::add_grob (me, ly_symbol2scm ("items-worth-living"), n); } @@ -100,5 +99,9 @@ ADD_INTERFACE (Hara_kiri_group_spanner, "hara-kiri-group-interface", "A group spanner that keeps track of interesting items. If it " "doesn't contain any after linebreaking, then it " "will remove itself and all its children.", - "items-worth-living remove-first"); + + + /* properties */ + "items-worth-living " + "remove-first"); diff --git a/lily/include/accidental-placement.hh b/lily/include/accidental-placement.hh index 3e75259af4..2343e01e12 100644 --- a/lily/include/accidental-placement.hh +++ b/lily/include/accidental-placement.hh @@ -24,7 +24,7 @@ public: Link_array *break_reminder, Link_array *real_acc); - static SCM position_accidentals (Grob *); + DECLARE_SCHEME_CALLBACK(calc_positioning_done, (SCM)); static bool has_interface (Grob *); }; #endif /* ACCIDENTAL_PLACEMENT_HH */ diff --git a/lily/include/align-interface.hh b/lily/include/align-interface.hh index ec8099d252..73f036eb15 100644 --- a/lily/include/align-interface.hh +++ b/lily/include/align-interface.hh @@ -14,6 +14,7 @@ struct Align_interface { + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM)); DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element, SCM axis)); DECLARE_SCHEME_CALLBACK (fixed_distance_alignment_callback, (SCM element, SCM axis)); DECLARE_SCHEME_CALLBACK (stretch_after_break, (SCM element)); @@ -21,7 +22,7 @@ struct Align_interface static void align_elements_to_extents (Grob *, Axis a); static void set_axis (Grob *, Axis); static Axis axis (Grob *); - static void add_element (Grob *, Grob *, SCM callback); + static void add_element (Grob *, Grob *); static int get_count (Grob *, Grob *); static bool has_interface (Grob *); diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 3d9aa314bf..da210d56b9 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -51,7 +51,6 @@ public: static void set_beaming (Grob *, Beaming_info_list const *); static void set_stemlens (Grob *); static int get_beam_count (Grob *me); - static void position_beam (Grob *me); static Real get_beam_translation (Grob *me); static Real get_thickness (Grob *me); static void connect_beams (Grob *me); @@ -59,8 +58,8 @@ public: DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM axis)); DECLARE_SCHEME_CALLBACK (space_function, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_positions, (SCM)); /* position callbacks */ DECLARE_SCHEME_CALLBACK (least_squares, (SCM)); diff --git a/lily/include/break-align-interface.hh b/lily/include/break-align-interface.hh index 8ab57760f6..cfa651bb9d 100644 --- a/lily/include/break-align-interface.hh +++ b/lily/include/break-align-interface.hh @@ -14,11 +14,10 @@ class Break_align_interface { public: - static void do_alignment (Grob *); static Link_array ordered_elements (Grob *me); static bool has_interface (Grob *); static void add_element (Grob *me, Grob *add); - DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element, SCM axis)); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element)); DECLARE_SCHEME_CALLBACK (self_align_callback, (SCM element, SCM axis)); }; struct Break_aligned_interface diff --git a/lily/include/dot-column.hh b/lily/include/dot-column.hh index ac9bbc488c..3a56cd9cc2 100644 --- a/lily/include/dot-column.hh +++ b/lily/include/dot-column.hh @@ -25,6 +25,6 @@ public: static bool has_interface (Grob *); DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (side_position, (SCM, SCM)); - static SCM do_shifts (Grob *); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM)); }; #endif // DOT_COLUMN_HH diff --git a/lily/include/grob.hh b/lily/include/grob.hh index 40446590a2..c0dd655b47 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -30,12 +30,16 @@ class Grob private: DECLARE_SMOBS (Grob, foo); void init (); + + + protected: Object_key const *key_; SCM immutable_property_alist_; SCM mutable_property_alist_; SCM object_alist_; - + SCM property_callbacks_; + /* If this is a property, it accounts for 25% of the property lookups. @@ -52,6 +56,9 @@ protected: DECLARE_CLASSNAME(Grob); public: + DECLARE_SCHEME_CALLBACK(same_axis_parent_positioning, (SCM, SCM)); + DECLARE_SCHEME_CALLBACK(other_axis_parent_positioning, (SCM, SCM)); + Object_key const *get_key () const; Grob *original_; @@ -71,12 +78,14 @@ public: /* Properties */ - SCM internal_get_property (SCM) const; - SCM internal_get_object (SCM) const; + SCM internal_get_property (SCM symbol) const; + SCM get_property_data (SCM symbol) const; + SCM internal_get_object (SCM symbol) const; void internal_set_property (SCM sym, SCM val); void internal_set_object (SCM sym, SCM val); + SCM try_callback (SCM); /* JUNKME. */ diff --git a/lily/include/laissez-vibrer-tie-column.hh b/lily/include/laissez-vibrer-tie-column.hh index ea7b63c5cd..8b2d16357a 100644 --- a/lily/include/laissez-vibrer-tie-column.hh +++ b/lily/include/laissez-vibrer-tie-column.hh @@ -12,11 +12,13 @@ #include "grob-interface.hh" #include "lily-proto.hh" +#include "lily-guile.hh" struct Laissez_vibrer_tie_column { static bool has_interface (Grob *); - static void set_directions (Grob *me); + + DECLARE_SCHEME_CALLBACK(calc_positioning_done, (SCM)); }; diff --git a/lily/include/laissez-vibrer-tie.hh b/lily/include/laissez-vibrer-tie.hh index d500f08f0c..3dacf88e6f 100644 --- a/lily/include/laissez-vibrer-tie.hh +++ b/lily/include/laissez-vibrer-tie.hh @@ -18,8 +18,8 @@ struct Laissez_vibrer_tie { static bool has_interface (Grob *); - DECLARE_SCHEME_CALLBACK (print, (SCM)); - static void set_direction (Grob *); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM)); static int compare (Grob *const &s1, Grob *const &s2); static int get_position (Grob *); diff --git a/lily/include/note-collision.hh b/lily/include/note-collision.hh index 8a0a5ec79e..ed65a0cac1 100644 --- a/lily/include/note-collision.hh +++ b/lily/include/note-collision.hh @@ -31,7 +31,7 @@ public: static Drul_array > get_clash_groups (Grob *me); DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis)); - static void do_shifts (Grob *); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM smob)); static void add_column (Grob *me, Grob *ncol); static bool has_interface (Grob *); }; diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 1c7e12dd84..6575b568eb 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -22,6 +22,7 @@ public: DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (brew_ez_stencil, (SCM)); DECLARE_SCHEME_CALLBACK (extent, (SCM, SCM)); + DECLARE_SCHEME_CALLBACK (stem_x_shift, (SCM, SCM)); static bool has_interface (Grob *); static Real stem_attachment_coordinate (Grob *, Axis a); static int get_balltype (Grob *); diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index f37fc1e97f..a9a80eb20b 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -19,6 +19,7 @@ public: static bool has_interface (Grob *); DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis)); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element)); DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM axis)); static SCM do_shift (Grob *); }; diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 6fe85ccd0d..9084184120 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -18,7 +18,8 @@ public: static void add_column (Grob *me, Grob *col); static void add_extra_encompass (Grob *me, Grob *col); DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); DECLARE_SCHEME_CALLBACK (height, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (outside_slur_callback, (SCM, SCM)); static bool has_interface (Grob *); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index fa9f65bccc..a42daf856d 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -35,7 +35,6 @@ public: static bool is_invisible (Grob *); static Interval head_positions (Grob *); static Real get_default_stem_end_position (Grob *me); - static void position_noteheads (Grob *); static Real stem_end_position (Grob *); static Stencil flag (Grob *); static Stencil get_translated_flag (Grob*); @@ -44,11 +43,11 @@ public: DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element, SCM axis)); - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_stem_end_position, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_stem_info, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM)); DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis)); DECLARE_SCHEME_CALLBACK (height, (SCM, SCM)); - -private: - static void calc_stem_info (Grob *); }; #endif diff --git a/lily/include/tie-column.hh b/lily/include/tie-column.hh index 37b5725c64..b516569587 100644 --- a/lily/include/tie-column.hh +++ b/lily/include/tie-column.hh @@ -17,7 +17,7 @@ class Tie_column public: static bool has_interface (Grob *); static void add_tie (Grob *me, Grob *); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM)); DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); static void set_directions (Grob *me); static void new_directions (Grob *me); diff --git a/lily/include/tie.hh b/lily/include/tie.hh index 6ea8f653b2..6b4802ef58 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -58,7 +58,6 @@ class Tie public: static void set_head (Grob *, Direction, Grob *head); static bool has_interface (Grob *); - static void set_direction (Grob *); static Grob *head (Grob *, Direction); static int get_column_rank (Grob *, Direction); static int get_position (Grob *); @@ -73,6 +72,8 @@ public: static void set_default_control_points (Grob *); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM)); static int compare (Grob *const &s1, Grob *const &s2); diff --git a/lily/include/tuplet-bracket.hh b/lily/include/tuplet-bracket.hh index 073311500c..add0f47e6f 100644 --- a/lily/include/tuplet-bracket.hh +++ b/lily/include/tuplet-bracket.hh @@ -13,8 +13,8 @@ class Tuplet_bracket { public: - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); - DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_positions, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); static bool has_interface (Grob *); diff --git a/lily/laissez-vibrer-tie-column.cc b/lily/laissez-vibrer-tie-column.cc index d8b1b5e6e7..83b14cc3f4 100644 --- a/lily/laissez-vibrer-tie-column.cc +++ b/lily/laissez-vibrer-tie-column.cc @@ -33,15 +33,12 @@ ADD_INTERFACE(Laissez_vibrer_tie_column, /* Cut & paste from tie-column.cc */ -void -Laissez_vibrer_tie_column::set_directions (Grob *me) +MAKE_SCHEME_CALLBACK(Laissez_vibrer_tie_column, calc_positioning_done, 1); +SCM +Laissez_vibrer_tie_column::calc_positioning_done (SCM smob) { - if (!to_boolean (me->get_property ("positioning-done"))) - me->set_property ("positioning-done", SCM_BOOL_T); - else - return; - - + Grob *me = unsmob_grob (smob); + extract_grob_set (me, "ties", lv_ro_ties); Link_array lv_ties (lv_ro_ties); @@ -52,7 +49,7 @@ Laissez_vibrer_tie_column::set_directions (Grob *me) for (int i = 0; i < lv_ties.size (); i++) { Tie_configuration conf; - conf.dir_ = get_grob_direction (lv_ties[i]); + conf.dir_ = CENTER; Item *head = unsmob_item (lv_ties[i]->get_object ("note-head")); heads.push (head); @@ -122,6 +119,8 @@ Laissez_vibrer_tie_column::set_directions (Grob *me) details ); set_grob_direction (lv_ties[i], tie_configs[i].dir_); } + + return SCM_BOOL_T; } diff --git a/lily/laissez-vibrer-tie.cc b/lily/laissez-vibrer-tie.cc index 7dcce69986..1c361d443a 100644 --- a/lily/laissez-vibrer-tie.cc +++ b/lily/laissez-vibrer-tie.cc @@ -28,40 +28,38 @@ ADD_INTERFACE(Laissez_vibrer_tie, "x-gap " ); -MAKE_SCHEME_CALLBACK (Laissez_vibrer_tie, print, 1); +MAKE_SCHEME_CALLBACK(Laissez_vibrer_tie, calc_control_points, 1) SCM -Laissez_vibrer_tie::print (SCM smob) +Laissez_vibrer_tie::calc_control_points (SCM smob) { Grob *me = unsmob_grob (smob); - if (CENTER == get_grob_direction (me)) - set_direction (me); - - if (!get_grob_direction (me)) - me->programming_error ("lv. tie direction not set."); - - SCM cp = me->get_property ("control-points"); - if (!scm_is_pair (cp)) - if (Laissez_vibrer_tie_column::has_interface (me->get_parent (Y_AXIS))) - { - Laissez_vibrer_tie_column::set_directions (me->get_parent (Y_AXIS)); - } - - return Tie::print (smob); + if (Laissez_vibrer_tie_column::has_interface (me->get_parent (Y_AXIS))) + { + me->get_parent (Y_AXIS)->get_property ("positioning-done"); + } + else + { + programming_error ("lv tie without Laissez_vibrer_tie_column. Killing lv tie."); + me->suicide (); + } + + return SCM_UNSPECIFIED; } -void -Laissez_vibrer_tie::set_direction (Grob *me) +MAKE_SCHEME_CALLBACK(Laissez_vibrer_tie, calc_direction, 1) +SCM +Laissez_vibrer_tie::calc_direction (SCM smob) { - if (!get_grob_direction (me)) + Grob *me = unsmob_grob (smob); + if (Laissez_vibrer_tie_column::has_interface (me->get_parent (Y_AXIS))) + me->get_parent (Y_AXIS)->get_property("positioning-done"); + else { - if (Laissez_vibrer_tie_column::has_interface (me->get_parent (Y_AXIS))) - Laissez_vibrer_tie_column::set_directions (me->get_parent (Y_AXIS)); - else - { - programming_error ("lv tie without Laissez_vibrer_tie_column"); - set_grob_direction (me, UP); - } + programming_error ("lv tie without Laissez_vibrer_tie_column"); + set_grob_direction (me, UP); } + + return SCM_UNSPECIFIED; } int diff --git a/lily/new-figured-bass-engraver.cc b/lily/new-figured-bass-engraver.cc index a68a9c18a5..04dae1da50 100644 --- a/lily/new-figured-bass-engraver.cc +++ b/lily/new-figured-bass-engraver.cc @@ -400,8 +400,7 @@ New_figured_bass_engraver::create_grobs () group.group_ = make_spanner ("BassFigureLine", SCM_EOL); group.group_->set_bound (LEFT, muscol); Align_interface::add_element (alignment_, - group.group_, - Align_interface::alignment_callback_proc); + group.group_); } if (scm_memq (fig, get_property ("implicitBassFigures")) != SCM_BOOL_F) diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 8a96ab5efe..132dccdcae 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -20,25 +20,7 @@ #include "dot-column.hh" #include "pointer-group-interface.hh" -MAKE_SCHEME_CALLBACK (Note_collision_interface, force_shift_callback, 2); -SCM -Note_collision_interface::force_shift_callback (SCM element_smob, SCM axis) -{ - Grob *me = unsmob_grob (element_smob); - Axis a = (Axis) scm_to_int (axis); - assert (a == X_AXIS); - - me = me->get_parent (a); - - if (! to_boolean (me->get_property ("positioning-done"))) - { - me->set_property ("positioning-done", SCM_BOOL_T); - do_shifts (me); - } - - return scm_from_double (0.0); -} void check_meshing_chords (Grob *me, @@ -285,9 +267,12 @@ check_meshing_chords (Grob *me, while ((flip (&d)) != UP); } -void -Note_collision_interface::do_shifts (Grob *me) + +MAKE_SCHEME_CALLBACK(Note_collision_interface, calc_positioning_done, 1) +SCM +Note_collision_interface::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); Drul_array > cg = get_clash_groups (me); SCM autos (automatic_shift (me, cg)); @@ -335,10 +320,12 @@ Note_collision_interface::do_shifts (Grob *me) for (int i = 0; i < amounts.size (); i++) done[i]->translate_axis (amounts[i] - left_most, X_AXIS); + + return SCM_BOOL_T; } -Drul_array < Link_array -> Note_collision_interface::get_clash_groups (Grob *me) +Drul_array < Link_array > +Note_collision_interface::get_clash_groups (Grob *me) { Drul_array > clash_groups; @@ -482,9 +469,8 @@ Note_collision_interface::forced_shift (Grob *me) void Note_collision_interface::add_column (Grob *me, Grob *ncol) { - ncol->add_offset_callback (Note_collision_interface::force_shift_callback_proc, X_AXIS); + ncol->add_offset_callback (Grob::same_axis_parent_positioning_proc, X_AXIS); Axis_group_interface::add_element (me, ncol); - me->add_dependency (ncol); } ADD_INTERFACE (Note_collision_interface, "note-collision-interface", @@ -493,4 +479,7 @@ ADD_INTERFACE (Note_collision_interface, "note-collision-interface", "are to be set in @ref{note-column-interface}: these are " "@code{force-hshift} and @code{horizontal-shift}.", - "merge-differently-dotted merge-differently-headed positioning-done"); + /* properties */ + "merge-differently-dotted " + "merge-differently-headed " + "positioning-done"); diff --git a/lily/note-column.cc b/lily/note-column.cc index 974f220b79..f49b65b986 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -89,7 +89,6 @@ void Note_column::set_stem (Grob *me, Grob *stem) { me->set_object ("stem", stem->self_scm ()); - me->add_dependency (stem); Axis_group_interface::add_element (me, stem); } diff --git a/lily/note-head.cc b/lily/note-head.cc index 1a51dd69b9..2b31367ef0 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -72,6 +72,23 @@ internal_print (Grob *me, String *font_char) return out; } +/* + TODO: make stem X-parent of notehead. + */ +MAKE_SCHEME_CALLBACK (Note_head, stem_x_shift, 2); +SCM +Note_head::stem_x_shift (SCM smob, SCM axis) +{ + (void) axis; + + Grob *me = unsmob_grob (smob); + Grob *stem = unsmob_grob (me->get_object ("stem")); + if (stem) + (void) stem->get_property ("positioning-done"); + + return scm_from_int (0); +} + MAKE_SCHEME_CALLBACK (Note_head, print, 1); SCM Note_head::print (SCM smob) diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 21ec8c9166..ecac2bc08f 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -32,12 +32,11 @@ Rest_collision::force_shift_callback (SCM element_smob, SCM axis) if (Note_column::has_rests (them)) { - Grob *rc = unsmob_grob (them->get_object ("rest-collision")); + Grob *collision = unsmob_grob (them->get_object ("rest-collision")); - if (rc && !to_boolean (rc->get_property ("positioning-done"))) + if (collision) { - rc->set_property ("positioning-done", SCM_BOOL_T); - do_shift (rc); + (void) collision->get_property ("positioning-done"); } } return scm_from_double (0.0); @@ -60,7 +59,6 @@ Rest_collision::force_shift_callback_rest (SCM rest, SCM axis) void Rest_collision::add_column (Grob *me, Grob *p) { - me->add_dependency (p); Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), p); /* @@ -84,9 +82,11 @@ Rest_collision::add_column (Grob *me, Grob *p) TODO: look at horizontal-shift to determine ordering between rests for more than two voices. */ +MAKE_SCHEME_CALLBACK(Rest_collision, calc_positioning_done, 1); SCM -Rest_collision::do_shift (Grob *me) +Rest_collision::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); extract_grob_set (me, "elements", elts); Link_array rests; @@ -254,5 +254,9 @@ Rest_collision::do_shift (Grob *me) ADD_INTERFACE (Rest_collision, "rest-collision-interface", "Move around ordinary rests (not multi-measure-rests) to avoid " "conflicts.", - "minimum-distance positioning-done elements"); + + /* properties */ + "minimum-distance " + "positioning-done " + "elements"); diff --git a/lily/script-column.cc b/lily/script-column.cc index e2e7411b53..2fc7f2f158 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -13,15 +13,13 @@ #include "pointer-group-interface.hh" void -Script_column::add_staff_sided (Grob *me, Item *i) +Script_column::add_staff_sided (Grob *me, Item *item) { - SCM p = i->get_property ("script-priority"); + SCM p = item->get_property ("script-priority"); if (!scm_is_number (p)) return; - Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), i); - - me->add_dependency (i); + Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), item); } LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less", diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index ff0ebcc914..09eef7460c 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -180,8 +180,6 @@ Script_engraver::acknowledge_stem (Grob_info info) if (to_dir (e->get_property ("side-relative-direction"))) e->set_object ("direction-source", info.grob ()->self_scm ()); - /* FIXME: add dependency */ - e->add_dependency (info.grob ()); Side_position_interface::add_support (e, info.grob ()); } } @@ -199,7 +197,6 @@ Script_engraver::acknowledge_rhythmic_head (Grob_info info) && !e->get_parent (Y_AXIS)) { e->set_parent (info.grob (), Y_AXIS); - e->add_dependency (info.grob ()); } Side_position_interface::add_support (e, info.grob ()); } diff --git a/lily/script-interface.cc b/lily/script-interface.cc index 38b801b1b4..7c01a673e5 100644 --- a/lily/script-interface.cc +++ b/lily/script-interface.cc @@ -89,6 +89,8 @@ struct Text_script ADD_INTERFACE (Text_script, "text-script-interface", "An object that is put above or below a note", + + /* properties */ "add-stem-support " "avoid-slur " "script-priority " diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index baf2ea14ae..5939bb4fc7 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -108,10 +108,12 @@ void Separating_group_spanner::add_spacing_unit (Grob *me, Item *i) { Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), i); - me->add_dependency (i); } ADD_INTERFACE (Separating_group_spanner, "separation-spanner-interface", "A spanner that calculates spacing constraints (\"rods\") " "using the @code{separation-item-interface} grobs in @code{elements}.", - "elements padding"); + + /* properties */ + "elements " + "padding"); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index dc6ae85294..b2968cb38a 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -359,14 +359,18 @@ Slur_score_state::fill (Grob *me) musical_dy_ = 0.0; } -void -set_slur_control_points (Grob *me) + +MAKE_SCHEME_CALLBACK(Slur, calc_control_points, 1) +SCM +Slur::calc_control_points (SCM smob) { + Spanner *me = unsmob_spanner (smob); + Slur_score_state state; state.fill (me); if (!state.valid_) - return; + return SCM_EOL; state.generate_curves (); @@ -386,7 +390,8 @@ set_slur_control_points (Grob *me) me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS)); controls = scm_cons (ly_offset2scm (o), controls); } - me->set_property ("control-points", controls); + + return controls; } Bezier diff --git a/lily/slur.cc b/lily/slur.cc index 6db1fabfb0..72dbe3dd08 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -27,11 +27,23 @@ #include "warn.hh" #include "slur-scoring.hh" -static Direction -get_default_dir (Grob *me) +#include "script-interface.hh" + + + +MAKE_SCHEME_CALLBACK(Slur, calc_direction, 1) +SCM +Slur::calc_direction (SCM smob) { + Grob *me = unsmob_grob (smob); extract_grob_set (me, "note-columns", encompasses); + if (encompasses.is_empty ()) + { + me->suicide (); + return SCM_BOOL_F; + } + Direction d = DOWN; for (int i = 0; i < encompasses.size (); i++) { @@ -41,7 +53,7 @@ get_default_dir (Grob *me) break; } } - return d; + return scm_from_int (d); } MAKE_SCHEME_CALLBACK (Slur, height, 2); @@ -136,10 +148,9 @@ void Slur::add_extra_encompass (Grob *me, Grob *n) { Pointer_group_interface::add_grob (me, ly_symbol2scm ("encompass-objects"), n); - me->add_dependency (n); } -#include "script-interface.hh" + MAKE_SCHEME_CALLBACK (Slur, outside_slur_callback, 2); SCM Slur::outside_slur_callback (SCM grob, SCM axis) @@ -158,10 +169,6 @@ Slur::outside_slur_callback (SCM grob, SCM axis) if (dir == CENTER) return scm_from_int (0); - /* FIXME: this dependency should be automatic. */ - if (scm_ilength (slur->get_property ("control-points")) < 4) - Slur::after_line_breaking (slur->self_scm ()); - Grob *cx = script->common_refpoint (slur, X_AXIS); Grob *cy = script->common_refpoint (slur, Y_AXIS); @@ -219,28 +226,23 @@ Slur::outside_slur_callback (SCM grob, SCM axis) return scm_from_double (offset); } -MAKE_SCHEME_CALLBACK (Slur, after_line_breaking, 1); -SCM -Slur::after_line_breaking (SCM smob) -{ - Spanner *me = dynamic_cast (unsmob_grob (smob)); - extract_grob_set (me, "note-columns", encompasses); - if (encompasses.is_empty ()) - { - me->suicide (); - return SCM_UNSPECIFIED; - } - - if (!get_grob_direction (me)) - set_grob_direction (me, get_default_dir (me)); - - if (scm_ilength (me->get_property ("control-points")) < 4) - set_slur_control_points (me); - return SCM_UNSPECIFIED; -} ADD_INTERFACE (Slur, "slur-interface", + "A slur", - "positions quant-score eccentricity encompass-objects control-points dash-period dash-fraction slur-details direction height-limit note-columns ratio thickness"); + + "control-points " + "dash-fraction " + "dash-period " + "direction " + "eccentricity " + "encompass-objects " + "height-limit " + "note-columns " + "positions " + "quant-score " + "ratio " + "slur-details " + "thickness "); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 9a3312daa0..0b018dbce6 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -22,8 +22,6 @@ void Span_bar::add_bar (Grob *me, Grob *b) { Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), b); - - me->add_dependency (b); } MAKE_SCHEME_CALLBACK (Span_bar, print, 1); diff --git a/lily/stem.cc b/lily/stem.cc index 06940e387f..25f8e051c3 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -230,7 +230,6 @@ void Stem::add_head (Grob *me, Grob *n) { n->set_object ("stem", me->self_scm ()); - n->add_dependency (me); if (Note_head::has_interface (n)) Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), n); @@ -266,6 +265,7 @@ Stem::get_default_dir (Grob *me) return to_dir (me->get_property ("neutral-direction")); } + Real Stem::get_default_stem_end_position (Grob *me) { @@ -289,11 +289,6 @@ Stem::get_default_stem_end_position (Grob *me) /* URGURGURG 'set-default-stemlen' sets direction too. */ Direction dir = get_direction (me); - if (!dir) - { - dir = get_default_dir (me); - set_grob_direction (me, dir); - } /* Stems in unnatural (forced) direction should be shortened, according to [Roush & Gourlay] */ @@ -389,11 +384,13 @@ Stem::duration_log (Grob *me) return (scm_is_number (s)) ? scm_to_int (s) : 2; } -void -Stem::position_noteheads (Grob *me) +MAKE_SCHEME_CALLBACK(Stem, calc_positioning_done, 1); +SCM +Stem::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); if (!head_count (me)) - return; + return SCM_BOOL_T; extract_grob_set (me, "note-heads", ro_heads); Link_array heads (ro_heads); @@ -467,11 +464,33 @@ Stem::position_noteheads (Grob *me) lastpos = int (p); } + + return SCM_BOOL_T; +} + + + +MAKE_SCHEME_CALLBACK(Stem, calc_direction, 1); +SCM +Stem::calc_direction (SCM smob) +{ + Grob *me = unsmob_grob (smob); + Direction dir = CENTER; + if (Grob *beam = unsmob_grob (me->get_object ("beam"))) + { + SCM ignore_me = beam->get_property ("direction"); + (void) ignore_me; + dir = get_grob_direction (me); + } + else + dir = get_default_dir (me); + + return scm_from_int (dir); } -MAKE_SCHEME_CALLBACK (Stem, before_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Stem, calc_stem_end_position, 1); SCM -Stem::before_line_breaking (SCM smob) +Stem::calc_stem_end_position (SCM smob) { Grob *me = unsmob_grob (smob); @@ -479,13 +498,13 @@ Stem::before_line_breaking (SCM smob) Do the calculations for visible stems, but also for invisible stems with note heads (i.e. half notes.) */ + Real pos = 0.0; if (head_count (me)) { - stem_end_position (me); // ugh. Trigger direction calc. - position_noteheads (me); + pos = stem_end_position (me); // ugh. Trigger direction calc. } - return SCM_UNSPECIFIED; + return scm_from_double (pos); } /* @@ -501,26 +520,31 @@ Stem::height (SCM smob, SCM ax) Grob *me = unsmob_grob (smob); assert (a == Y_AXIS); - /* - ugh. - this dependency should be automatic. + Direction dir = get_grob_direction (me); + + /* Trigger callback. + + UGH. Should be automatic */ Grob *beam = get_beam (me); if (beam) - Beam::after_line_breaking (beam->self_scm ()); - + { + beam->get_property ("positions"); + } + SCM mol = me->get_uncached_stencil (); Interval iv; if (mol != SCM_EOL) iv = unsmob_stencil (mol)->extent (a); - if (Grob *b = get_beam (me)) + + if (beam) { - Direction d = get_direction (me); - if (d == CENTER) + if (dir == CENTER) { programming_error ("no stem direction"); - d = UP; + dir = UP; } - iv[d] += d * Beam::get_thickness (b) * 0.5; + iv[dir] += dir * Beam::get_thickness (beam) * 0.5; } return ly_interval2scm (iv); @@ -779,25 +803,21 @@ Stem::get_beam (Grob *me) Stem_info Stem::get_stem_info (Grob *me) { - /* Return cached info if available */ - SCM scm_info = me->get_property ("stem-info"); - if (!scm_is_pair (scm_info)) - { - calc_stem_info (me); - scm_info = me->get_property ("stem-info"); - } - Stem_info si; si.dir_ = get_grob_direction (me); + + SCM scm_info = me->get_property ("stem-info"); si.ideal_y_ = scm_to_double (scm_car (scm_info)); si.shortest_y_ = scm_to_double (scm_cadr (scm_info)); return si; } /* TODO: add extra space for tremolos! */ -void -Stem::calc_stem_info (Grob *me) +MAKE_SCHEME_CALLBACK(Stem, calc_stem_info, 1); +SCM +Stem::calc_stem_info (SCM smob) { + Grob *me = unsmob_grob (smob); Direction my_dir = get_grob_direction (me); if (!my_dir) @@ -904,9 +924,8 @@ Stem::calc_stem_info (Grob *me) Real minimum_y = note_start + minimum_length; Real shortest_y = minimum_y * my_dir; - me->set_property ("stem-info", - scm_list_2 (scm_from_double (ideal_y), - scm_from_double (shortest_y))); + return scm_list_2 (scm_from_double (ideal_y), + scm_from_double (shortest_y)); } Slice @@ -925,14 +944,34 @@ ADD_INTERFACE (Stem, "stem-interface", "In addition, it internally connects note heads, beams and" "tremolos. " "Rests and whole notes have invisible stems.", - "tremolo-flag french-beaming " - "avoid-note-head thickness " - "stemlet-length rests " - "stem-info beamed-lengths beamed-minimum-free-lengths " - "beamed-extreme-minimum-free-lengths lengths beam stem-shorten " - "duration-log beaming neutral-direction stem-end-position " - "note-heads direction length flag-style " - "no-stem-extend stroke-style"); + + /* properties */ + + "avoid-note-head " + "beam " + "beamed-extreme-minimum-free-lengths " + "beamed-lengths " + "beamed-minimum-free-lengths " + "beaming " + "direction " + "duration-log " + "flag-style " + "french-beaming " + "length " + "lengths " + "neutral-direction " + "no-stem-extend " + "note-heads " + "positioning-done " + "rests " + "stem-end-position " + "stem-info " + "stem-shorten " + "stemlet-length " + "stroke-style " + "thickness " + "tremolo-flag " + ); /****************************************************************/ diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 76d45004cb..54318451b3 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -36,27 +36,6 @@ Tie_column::add_tie (Grob *me, Grob *tie) tie->set_parent (me, Y_AXIS); Pointer_group_interface::add_grob (me, ly_symbol2scm ("ties"), tie); - tie->add_dependency (me); -} - -void -Tie_column::set_directions (Grob *me) -{ - if (!to_boolean (me->get_property ("positioning-done"))) - { - me->set_property ("positioning-done", SCM_BOOL_T); - new_directions (me); - } -} - - - -MAKE_SCHEME_CALLBACK (Tie_column, after_line_breaking, 1); -SCM -Tie_column::after_line_breaking (SCM smob) -{ - set_directions (unsmob_grob (smob)); - return SCM_UNSPECIFIED; } /* @@ -79,22 +58,26 @@ Tie_column::before_line_breaking (SCM smob) } while (flip (&dir) != LEFT); } + return SCM_UNSPECIFIED; } - -void -Tie_column::new_directions (Grob *me) +MAKE_SCHEME_CALLBACK(Tie_column, calc_positioning_done, 1) +SCM +Tie_column::calc_positioning_done (SCM smob) { + Grob *me = unsmob_grob (smob); extract_grob_set (me, "ties", ro_ties); Link_array ties (ro_ties); if (!ties.size ()) - return; + return SCM_BOOL_T; if (ties.size() == 1) { - Tie::set_default_control_points (ties[0]); - return; + /* + Already handled by standard mechanisms. + */ + return SCM_BOOL_T; } ties.sort (&Tie::compare); @@ -176,6 +159,7 @@ Tie_column::new_directions (Grob *me) ); set_grob_direction (ties[i], tie_configs[i].dir_); } + return SCM_BOOL_T; } diff --git a/lily/tie.cc b/lily/tie.cc index 78501ef7f7..017dba751e 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -7,8 +7,6 @@ */ #include "tie.hh" - - #include "spanner.hh" #include "lookup.hh" #include "output-def.hh" @@ -22,6 +20,7 @@ #include "stem.hh" #include "note-head.hh" #include "tie-column.hh" +#include "grob-array.hh" int Tie::compare (Grob *const &s1, @@ -34,7 +33,6 @@ void Tie::set_head (Grob *me, Direction d, Grob *h) { dynamic_cast (me)->set_bound (d, h); - me->add_dependency (h); } Grob * @@ -62,8 +60,24 @@ Tie::get_column_rank (Grob *me, Direction d) int Tie::get_position (Grob *me) { - Direction d = head (me, LEFT) ? LEFT : RIGHT; - return (int) Staff_symbol_referencer::get_position (head (me, d)); + Direction d = LEFT; + do + { + Grob *h = head (me, d); + if (h) + return (int) Staff_symbol_referencer::get_position (h); + } + while (flip (&d) != LEFT); + + /* + + TODO: this is theoretically possible for ties across more than 2 + systems.. We should look at the first broken copy. + + */ + programming_error ("Tie without heads. Suicide"); + me->suicide (); + return 0; } /* @@ -96,16 +110,24 @@ Tie::get_default_dir (Grob *me) return UP; } -void -Tie::set_direction (Grob *me) + +MAKE_SCHEME_CALLBACK(Tie, calc_direction, 1); +SCM +Tie::calc_direction (SCM smob) { - if (!get_grob_direction (me)) + Grob *me = unsmob_grob (smob); + Grob *yparent = me->get_parent (Y_AXIS); + if (Tie_column::has_interface (yparent) + && unsmob_grob_array (yparent->get_object ("ties")) + && unsmob_grob_array (yparent->get_object ("ties"))->size () > 1) { - if (Tie_column::has_interface (me->get_parent (Y_AXIS))) - Tie_column::set_directions (me->get_parent (Y_AXIS)); - else - set_grob_direction (me, Tie::get_default_dir (me)); + /* trigger positioning. */ + (void) yparent->get_property ("positioning-done"); } + else + set_grob_direction (me, Tie::get_default_dir (me)); + + return SCM_UNSPECIFIED; } Interval @@ -395,9 +417,6 @@ Tie::set_default_control_points (Grob *me_grob) common = me->get_bound (RIGHT)->common_refpoint (common, X_AXIS); Tie_configuration conf; - if (!get_grob_direction (me)) - set_grob_direction (me, get_default_dir (me)); - int tie_position = (int) Tie::get_position (me); conf.position_ = tie_position; @@ -432,42 +451,31 @@ Tie::set_control_points (Grob *me, me->set_property ("control-points", controls); } - - -MAKE_SCHEME_CALLBACK (Tie, print, 1); +MAKE_SCHEME_CALLBACK(Tie, calc_control_points, 1); SCM -Tie::print (SCM smob) +Tie::calc_control_points (SCM smob) { Grob *me = unsmob_grob (smob); - if (CENTER == get_grob_direction (me)) - set_direction (me); + // trigger Tie-column + (void) get_grob_direction (me); - if (!get_grob_direction (me)) - me->programming_error ("Tie direction not set."); - - SCM cp = me->get_property ("control-points"); - if (!scm_is_pair (cp)) - { - /* - UGH. dependency tracking! - */ - if (Tie_column::has_interface (me->get_parent (Y_AXIS))) - { - Tie_column::set_directions (me->get_parent (Y_AXIS)); - } - - cp = me->get_property ("control-points"); - } - - if (!scm_is_pair (cp)) + if (!scm_is_pair (me->get_property ("control-points"))) { set_default_control_points (me); - cp = me->get_property ("control-points"); } - if (!scm_is_pair (cp)) - return Stencil ().smobbed_copy (); + return SCM_UNSPECIFIED; +} + + +MAKE_SCHEME_CALLBACK (Tie, print, 1); +SCM +Tie::print (SCM smob) +{ + Grob *me = unsmob_grob (smob); + + SCM cp = me->get_property ("control-points"); Real staff_thick = Staff_symbol_referencer::line_thickness (me); Real base_thick = robust_scm2double (me->get_property ("thickness"), 1); diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 209545797f..48d0427535 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -110,26 +110,8 @@ Tuplet_bracket::print (SCM smob) Stencil mol; extract_grob_set (me, "note-columns", columns); - { - SCM lp = me->get_property ("left-position"); - SCM rp = me->get_property ("right-position"); - - if (!scm_is_number (rp) || !scm_is_number (lp)) - { - /* - UGH. dependency tracking! - */ - extract_grob_set (me, "tuplets", tuplets); - for (int i = 0; i < tuplets.size (); i++) - Tuplet_bracket::print (tuplets[i]->self_scm ()); - - after_line_breaking (smob); - } - } - - Real ly = robust_scm2double (me->get_property ("left-position"), 0); - Real ry = robust_scm2double (me->get_property ("right-position"), 0); - + Drul_array positions = ly_scm2realdrul (me->get_property ("positions")); + Real dy = positions[RIGHT] - positions[LEFT]; bool equally_long = false; Grob *par_beam = parallel_beam (me, columns, &equally_long); Spanner *sp = dynamic_cast (me); @@ -173,17 +155,14 @@ Tuplet_bracket::print (SCM smob) int neighbor_idx = me->get_break_index () - break_dir; - /* - UGH. dependency handling. - */ if (break_dir && d == RIGHT && neighbor_idx < orig_spanner->broken_intos_.size ()) { Grob *neighbor = orig_spanner->broken_intos_[neighbor_idx]; - // ugh, should inspect callback? - Tuplet_bracket::after_line_breaking (neighbor->self_scm ()); + /* trigger possible suicide*/ + (void) neighbor->get_property ("positions"); } connect_to_other[d] @@ -237,7 +216,7 @@ Tuplet_bracket::print (SCM smob) num.translate_axis (w / 2, X_AXIS); num.align_to (Y_AXIS, CENTER); - num.translate_axis ((ry - ly) / 2, Y_AXIS); + num.translate_axis (dy / 2, Y_AXIS); mol.add_stencil (num); } @@ -299,7 +278,7 @@ Tuplet_bracket::print (SCM smob) while (flip (&d) != LEFT); Stencil brack = make_bracket (me, Y_AXIS, - Offset (w, ry - ly), + Offset (w, positions[RIGHT]), height, /* 0.1 = more space at right due to italics @@ -318,7 +297,7 @@ Tuplet_bracket::print (SCM smob) mol.add_stencil (brack); } - mol.translate_axis (ly, Y_AXIS); + mol.translate_axis (positions[LEFT], Y_AXIS); mol.translate_axis (x_span[LEFT] - sp->get_bound (LEFT)->relative_coordinate (commonx, X_AXIS), X_AXIS); return mol.smobbed_copy (); @@ -499,9 +478,10 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) Interval tuplet_y (tuplets[i]->extent (commony, Y_AXIS)); Direction d = LEFT; - Real lp = scm_to_double (tuplets[i]->get_property ("left-position")); - Real rp = scm_to_double (tuplets[i]->get_property ("right-position")); - Real other_dy = rp - lp; + Drul_array positions = ly_scm2realdrul (tuplets[i]->get_property ("positions")); + + + Real other_dy = positions[RIGHT] - positions[LEFT]; do { @@ -560,29 +540,19 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) } } -/* - We depend on the beams if there are any. -*/ -MAKE_SCHEME_CALLBACK (Tuplet_bracket, before_line_breaking, 1); + +MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_direction, 1); SCM -Tuplet_bracket::before_line_breaking (SCM smob) +Tuplet_bracket::calc_direction (SCM smob) { Grob *me = unsmob_grob (smob); - extract_grob_set (me, "note-columns", columns); - - for (int i = columns.size (); i--;) - { - Grob *s = Note_column::get_stem (columns[i]); - Grob *b = s ? Stem::get_beam (s) : 0; - if (b) - me->add_dependency (b); - } - return SCM_UNSPECIFIED; + Direction dir = Tuplet_bracket::get_default_dir (me); + return scm_from_int (dir); } -MAKE_SCHEME_CALLBACK (Tuplet_bracket, after_line_breaking, 1); +MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_positions, 1); SCM -Tuplet_bracket::after_line_breaking (SCM smob) +Tuplet_bracket::calc_positions (SCM smob) { Grob *me = unsmob_grob (smob); extract_grob_set (me, "note-columns", columns); @@ -590,16 +560,11 @@ Tuplet_bracket::after_line_breaking (SCM smob) if (columns.is_empty()) { me->suicide (); - return SCM_UNSPECIFIED; + return scm_cons (scm_from_double (0), + scm_from_double (0)); } Direction dir = get_grob_direction (me); - if (!dir) - { - dir = Tuplet_bracket::get_default_dir (me); - set_grob_direction (me, dir); - } - bool equally_long = false; Grob *par_beam = parallel_beam (me, columns, &equally_long); @@ -625,23 +590,11 @@ Tuplet_bracket::after_line_breaking (SCM smob) dy = rp - lp; } - SCM lp = me->get_property ("left-position"); - SCM rp = me->get_property ("right-position"); - - if (scm_is_number (lp) && !scm_is_number (rp)) - rp = scm_from_double (scm_to_double (lp) + dy); - else if (scm_is_number (rp) && !scm_is_number (lp)) - lp = scm_from_double (scm_to_double (rp) - dy); - else if (!scm_is_number (rp) && !scm_is_number (lp)) - { - lp = scm_from_double (offset); - rp = scm_from_double (offset + dy); - } - - me->set_property ("left-position", lp); - me->set_property ("right-position", rp); - - return SCM_UNSPECIFIED; + + SCM x = scm_cons (scm_from_double (offset), + scm_from_double (offset + dy)); + + return x; } /* @@ -667,8 +620,6 @@ void Tuplet_bracket::add_column (Grob *me, Item *n) { Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-columns"), n); - me->add_dependency (n); - add_bound_item (dynamic_cast (me), n); } @@ -676,7 +627,6 @@ void Tuplet_bracket::add_tuplet_bracket (Grob *me, Grob *bracket) { Pointer_group_interface::add_grob (me, ly_symbol2scm ("tuplets"), bracket); - me->add_dependency (bracket); } ADD_INTERFACE (Tuplet_bracket, @@ -688,18 +638,18 @@ ADD_INTERFACE (Tuplet_bracket, "At a line break, the markups in the @code{edge-text} are printed " "at the edges. ", - + + /* properties */ "bracket-flare " "bracket-visibility " "break-overshoot " "direction " "edge-height " "edge-text " - "left-position " + "positions " "note-columns " "number-visibility " "padding " - "right-position " "shorten-pair " "staff-padding " "thickness " diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index d711396a6f..7e05369f8b 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -111,8 +111,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i) Grob *before_grob = unsmob_grob (before); Grob *after_grob = unsmob_grob (after); - Align_interface::add_element (valign_, i.grob (), - get_property ("verticalAlignmentChildCallback")); + Align_interface::add_element (valign_, i.grob ()); if (before_grob || after_grob) { diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc index c8e590b0f3..7d7100e468 100644 --- a/lily/volta-bracket.cc +++ b/lily/volta-bracket.cc @@ -50,8 +50,6 @@ Volta_bracket_interface::print (SCM smob) Spanner *orig_span = dynamic_cast (me->original_); bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me); - - Output_def *layout = me->get_layout (); Real half_space = 0.5; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 5282fc5104..f6a04fa110 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -278,7 +278,6 @@ contained staves are not connected vertically." "Just like @code{GrandStaff} but with a forced distance between the staves, so cross staff beaming and slurring can be used." - verticalAlignmentChildCallback = #Align_interface::fixed_distance_alignment_callback \override VerticalAlignment #'forced-distance = #12 \override VerticalAlignment #'self-alignment-Y = #0 \override VerticalAlignment #'after-line-breaking-callback @@ -489,8 +488,6 @@ AncientRemoveEmptyStaffContext = \context { autoBeamCheck = #default-auto-beam-check scriptDefinitions = #default-script-alist - verticalAlignmentChildCallback = #Align_interface::alignment_callback - pedalSustainStrings = #'("Ped." "*Ped." "*") pedalSustainStyle = #'text pedalUnaCordaStrings = #'("una corda" "" "tre corde") diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 73c6b0d630..95255d7895 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -422,9 +422,6 @@ context Voice \\times 2/3 @{ (useBassFigureExtenders ,boolean? "Whether to use extender lines for repeated bass figures") - (verticalAlignmentChildCallback ,procedure? "What callback to add -to children of a vertical alignment. It determines what -procedure is used on the alignment itself.") (verticalExtent ,number-pair? "Hard coded vertical extent. The format is a pair of dimensions, for example, this sets the sizes of a staff to 10 (5+5) staffspaces high. diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index fe7c4f39ce..9a0ade0fd8 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -131,6 +131,10 @@ middle C.") (cautionary-style ,symbol? "How to print cautionary accidentals. Choices are @code{smaller} or @code{parentheses}.") + (callbacks ,list? "An alist of (@var{symbol} . @var{procedure}) +pairs. When the grob property @var{symbol} is requested, +@var{procedure} is invoked. The return value, if it is unequal to +@code{#} is recorded as the value of the property.") (cautionary ,boolean? "Is this a cautionary accidental?") (concaveness ,number? "A beam is concave when its inner stems are closer to the beam than the two outside stems. This number is a @@ -298,7 +302,6 @@ objects in higher layers.") "The thickness of ledger lines: it is the sum of 2 numbers. The first is the factor for line thickness, and the second for staff space. Both contributions are added.") - (left-position ,number? "Vertical position of left part of spanner.") (left-padding ,ly:dimension? "The amount of space that is put left to a group of accidentals.") (length ,ly:dimension? "User override for the stem length of @@ -382,7 +385,6 @@ quicker the slur attains it @code{height-limit}.") (remove-first ,boolean? "Remove the first staff of a orchestral score?") (right-padding ,ly:dimension? "Space to insert between note and accidentals.") - (right-position ,number? "Vertical position of right part of spanner.") (script-priority ,number? "A sorting key that determines in what order a script is within a stack of scripts.") @@ -552,8 +554,6 @@ bounds are spaced.") (columns ,ly:grob-array? "list of grobs, typically containing paper-columns or note-column objects.") (conditional-elements ,ly:grob-array? "Internal use only") - (dependencies ,ly:grob-array? "list of score-grob pointers that indicate -who to compute first for certain global passes.") (encompass-objects ,ly:grob-array? "Objects that a slur should avoid in addition to notes and stems.") (elements ,ly:grob-array? "list of grobs, type depending on the Grob diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 6f2a5337eb..2ed04b5668 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -49,7 +49,8 @@ (AccidentalPlacement . ((X-extent-callback . ,Axis_group_interface::group_extent_callback) (left-padding . 0.2) - + (callbacks . ((positioning-done . ,Accidental_placement::calc_positioning_done) + )) ;; this is quite small, but it is very ugly to have ;; accs closer to the previous note than to the next one. (right-padding . 0.15) @@ -238,6 +239,8 @@ . ( (axes . (,Y)) (threshold . (2 . 1000)) + (callbacks . ((positioning-done . ,Align_interface::calc_positioning_done) + )) (Y-extent-callback . ,Axis_group_interface::group_extent_callback) (stacking-dir . -1) (meta . ((class . Spanner) @@ -250,17 +253,19 @@ ;; rather long. (print-function . ,Beam::print) (gap . 0.8) - (positions . (#f . #f)) (position-callbacks . (,Beam::least_squares ,Beam::check_concave ,Beam::slope_damping ,Beam::shift_region_to_valid ,Beam::quanting)) + (callbacks . ((positions . ,Beam::calc_positions) + (direction . ,Beam::calc_direction) + )) ;; TODO: should be in SLT. (thickness . 0.48) ; in staff-space - (before-line-breaking-callback . ,Beam::before_line_breaking) - (after-line-breaking-callback . ,Beam::after_line_breaking) +; (before-line-breaking-callback . ,Beam::before_line_breaking) +; (after-line-breaking-callback . ,Beam::after_line_breaking) (neutral-direction . -1) (dir-function . ,beam-dir-majority-median) @@ -296,6 +301,8 @@ . ( (breakable . #t) (stacking-dir . 1) + (callbacks . ((positioning-done . ,Break_align_interface::calc_positioning_done) + )) (break-align-orders . ;; end of line #((instrument-name left-edge @@ -340,7 +347,6 @@ (BreakAlignGroup . ( (axes . (0)) - (X-offset-callbacks . (,Break_align_interface::alignment_callback)) (X-extent-callback . ,Axis_group_interface::group_extent_callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -464,6 +470,8 @@ . ( (axes . (0)) (direction . ,RIGHT) + (callbacks . ((positioning-done . ,Dot_column::calc_positioning_done) + )) (X-extent-callback . ,Axis_group_interface::group_extent_callback) (X-offset-callbacks . (,Dot_column::side_position)) (meta . ((class . Item) @@ -719,7 +727,10 @@ break-aligned-interface)))))) (LaissezVibrerTie . ( - (print-function . ,Laissez_vibrer_tie::print) + (print-function . ,Tie::print) + (callbacks . ((control-points . ,Laissez_vibrer_tie::calc_control_points) + (direction . ,Laissez_vibrer_tie::calc_direction) + )) (details . ((ratio . 0.333) (height-limit . 1.0))) (thickness . 1.0) @@ -732,6 +743,8 @@ . ( (X-extent-callback . #f) (Y-extent-callback . #f) + (callbacks . ((positioning-done . ,Laissez_vibrer_tie_column::calc_positioning_done) + )) (meta . ((class . Item) (interfaces . (laissez-vibrer-tie-column-interface)) )) @@ -774,14 +787,18 @@ (LigatureBracket . ( (ligature-primitive-callback . ,Note_head::print) + + ;; ugh. A ligature bracket is totally different from + ;; a tuplet bracket. + (callbacks . ((direction . ,Tuplet_bracket::calc_direction) + (positions . ,Tuplet_bracket::calc_positions) + )) (direction . 1) (gap . 0.0) (padding . 2.0) (thickness . 1.6) (edge-height . (0.7 . 0.7)) (shorten-pair . (-0.2 . -0.2)) - (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking) - (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking) (print-function . ,Tuplet_bracket::print) (meta . ((class . Spanner) (interfaces . (tuplet-bracket-interface @@ -917,6 +934,8 @@ (axes . (0 1)) (X-extent-callback . ,Axis_group_interface::group_extent_callback) (Y-extent-callback . ,Axis_group_interface::group_extent_callback) + (callbacks . ((positioning-done . ,Note_collision_interface::calc_positioning_done) + )) (meta . ((class . Item) (interfaces . (note-collision-interface axis-group-interface)))))) @@ -936,6 +955,7 @@ (ligature-primitive-callback . ,Note_head::print) (glyph-name-procedure . ,find-notehead-symbol) (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (X-offset-callbacks . (,Note_head::stem_x_shift)) (stem-attachment-function . ,note-head-style->attachment-coordinates) (meta . ((class . Item) (interfaces . (rhythmic-grob-interface @@ -1021,11 +1041,13 @@ (PhrasingSlur . ((slur-details . ,default-slur-details) + (callbacks . ((control-points . ,Slur::calc_control_points) + (direction . ,Slur::calc_direction) + )) (print-function . ,Slur::print) (thickness . 1.1) (spacing-procedure . ,Spanner::set_spacing_rods) (minimum-length . 1.5) - (after-line-breaking-callback . ,Slur::after_line_breaking) (Y-extent-callback . ,Slur::height) (height-limit . 2.0) (ratio . 0.333) @@ -1149,6 +1171,8 @@ (RestCollision . ( (minimum-distance . 0.75) + (callbacks . ((positioning-done . ,Rest_collision::calc_positioning_done) + )) (meta . ((class . Item) (interfaces . (rest-collision-interface)))))) @@ -1194,11 +1218,13 @@ (Slur . ((slur-details . ,default-slur-details) + (callbacks . ((control-points . ,Slur::calc_control_points) + (direction . ,Slur::calc_direction) + )) (print-function . ,Slur::print) (thickness . 1.0) (spacing-procedure . ,Spanner::set_spacing_rods) (minimum-length . 1.5) - (after-line-breaking-callback . ,Slur::after_line_breaking) (Y-extent-callback . ,Slur::height) ; Slur::height) (height-limit . 2.0) @@ -1321,7 +1347,11 @@ (Stem . ( ;; this list is rather long. Trim --hwn - (before-line-breaking-callback . ,Stem::before_line_breaking) + (callbacks . ((direction . ,Stem::calc_direction) + (stem-end-position . ,Stem::calc_stem_end_position) + (stem-info . ,Stem::calc_stem_info) + (positioning-done . ,Stem::calc_positioning_done) + )) (print-function . ,Stem::print) (thickness . 1.3) @@ -1499,6 +1529,9 @@ (Tie . ((print-function . ,Tie::print) + (callbacks . ((control-points . ,Tie::calc_control_points) + (direction . ,Tie::calc_direction) + )) (details . ((ratio . 0.333) (height-limit . 1.0) (between-length-limit . 1.0))) @@ -1509,10 +1542,12 @@ (TieColumn . ( - (after-line-breaking-callback . ,Tie_column::after_line_breaking) + (callbacks . ((positioning-done . ,Tie_column::calc_positioning_done) + )) (before-line-breaking-callback . ,Tie_column::before_line_breaking) (X-extent-callback . #f) (Y-extent-callback . #f) + (meta . ((class . Spanner) (interfaces . (tie-column-interface)))))) @@ -1593,8 +1628,9 @@ (thickness . 1.6) (edge-height . (0.7 . 0.7)) (shorten-pair . (-0.2 . -0.2)) - (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking) - (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking) + (callbacks . ((direction . ,Tuplet_bracket::calc_direction) + (positions . ,Tuplet_bracket::calc_positions) + )) (print-function . ,Tuplet_bracket::print) (font-shape . italic) @@ -1646,6 +1682,8 @@ (VerticalAlignment . ( (axes . (1)) + (callbacks . ((positioning-done . ,Align_interface::calc_positioning_done) + )) (Y-extent-callback . ,Axis_group_interface::group_extent_callback) (X-extent-callback . ,Axis_group_interface::group_extent_callback) (stacking-dir . -1) diff --git a/scm/lily.scm b/scm/lily.scm index cf1e1082cf..9b93992e24 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -71,7 +71,6 @@ similar to chord syntax") (debug-enable 'backtrace) (read-enable 'positions))) - (define-public tex-backend? (member (ly:output-backend) '("texstr" "tex"))) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index d30c668bf3..ea58c353fb 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -280,7 +280,7 @@ i.e. this is not an override" (define-public (make-grob-property-revert grob gprop) "Revert the grob property GPROP for GROB." - (make-music 'OverrideProperty + (make-music 'RevertProperty 'symbol grob 'grob-property gprop)) diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index fc483d2f57..3ab99b4988 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -144,29 +144,15 @@ ;;$defaultmidi ;;$defaultlayout - Accidental_interface::after_line_breaking Accidental_interface::print Ambitus::print Arpeggio::print Arpeggio::brew_chord_bracket Arpeggio::width_callback Axis_group_interface::group_extent_callback - Bar_line::before_line_breaking Bar_line::get_staff_bar_size Bar_line::print - Beam::after_line_breaking - Beam::before_line_breaking - Beam::check_concave - Beam::least_squares - Beam::print - Beam::quanting - Beam::shift_region_to_valid - Beam::slope_damping - Beam::space_function - Break_align_interface::alignment_callback Breathing_sign::offset_callback - Chord_name::after_line_breaking - Clef::before_line_breaking Clef::print Cluster::print Cluster_beacon::height @@ -180,7 +166,6 @@ Hyphen_spanner::print Hyphen_spanner::set_spacing_rods Key_signature_interface::print - Line_spanner::after_line_breaking Line_spanner::print Lyric_extender::print Measure_grouping::print @@ -192,17 +177,13 @@ Note_head::print Note_head::brew_ez_stencil Ottava_bracket::print - Paper_column::before_line_breaking Paper_column::print Percent_repeat_item_interface::beat_slash Percent_repeat_item_interface::double_percent Piano_pedal_bracket::print - Rest::after_line_breaking Rest::extent_callback Rest::polyphonic_offset_callback Rest::print - Script_column::before_line_breaking - Script_interface::before_line_breaking Script_interface::print Self_alignment_interface::aligned_on_parent Self_alignment_interface::aligned_on_self @@ -211,18 +192,15 @@ Separating_group_spanner::set_spacing_rods Side_position_interface::aligned_on_support_refpoints Side_position_interface::aligned_side - Slur::after_line_breaking Slur::height Slur::print Spacing_spanner::set_springs - Span_bar::before_line_breaking Span_bar::get_bar_size Span_bar::print Span_bar::width_callback Spanner::set_spacing_rods Staff_symbol::print Staff_symbol_referencer::callback - Stem::before_line_breaking Stem::width_callback Stem::height Stem::offset_callback @@ -230,15 +208,11 @@ Stem_tremolo::height Stem_tremolo::print Sustain_pedal::print - System_start_delimiter::after_line_breaking System_start_delimiter::print Text_interface::print Text_spanner::print Tie::print - Tie_column::after_line_breaking Time_signature::print - Tuplet_bracket::after_line_breaking - Tuplet_bracket::before_line_breaking Tuplet_bracket::print Vaticana_ligature::brew_ligature_primitive Vaticana_ligature::print -- 2.39.5