X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob-closure.cc;h=4f6c0adc81f5219836e20c2bb92754f347a20eab;hb=4003749dc15f9f231e2bfd7a6d511519e232996b;hp=5e4035f7e898f343b0b22469ec8d3bd03309ea63;hpb=73d087a6589038ac21efe802fe6d51cafa411749;p=lilypond.git diff --git a/lily/grob-closure.cc b/lily/grob-closure.cc index 5e4035f7e8..4f6c0adc81 100644 --- a/lily/grob-closure.cc +++ b/lily/grob-closure.cc @@ -5,20 +5,18 @@ SCM axis_offset_symbol (Axis a) { return a == X_AXIS - ? ly_symbol2scm ("X-offset") - : ly_symbol2scm ("Y-offset"); + ? ly_symbol2scm ("X-offset") + : ly_symbol2scm ("Y-offset"); } SCM axis_parent_positioning (Axis a) { return (a == X_AXIS) - ? Grob::x_parent_positioning_proc - : Grob::y_parent_positioning_proc; + ? Grob::x_parent_positioning_proc + : Grob::y_parent_positioning_proc; } - - /* Replace @@ -27,7 +25,6 @@ axis_parent_positioning (Axis a) by (+ (PROC GROB) (orig-proc GROB)) - */ void add_offset_callback (Grob *g, SCM proc, Axis a) @@ -38,11 +35,11 @@ add_offset_callback (Grob *g, SCM proc, Axis a) && !is_simple_closure (data)) { g->set_property (axis_offset_symbol (a), proc); - return ; + return; } if (ly_is_procedure (data)) - data = ly_make_simple_closure (scm_list_1 (data)); + data = ly_make_simple_closure (scm_list_1 (data)); else if (is_simple_closure (data)) data = simple_closure_expression (data); @@ -50,12 +47,11 @@ add_offset_callback (Grob *g, SCM proc, Axis a) if (ly_is_procedure (proc)) proc = ly_make_simple_closure (scm_list_1 (proc)); - + SCM expr = scm_list_3 (plus, proc, data); g->set_property (axis_offset_symbol (a), ly_make_simple_closure (expr)); } - /* replace @@ -63,16 +59,15 @@ add_offset_callback (Grob *g, SCM proc, Axis a) by - (PROC GROB (orig-proc GROB)) - + (PROC GROB (orig-proc GROB)) */ void -chain_offset_callback (Grob *g, SCM proc, Axis a) +chain_callback (Grob *g, SCM proc, SCM sym) { - SCM data = g->get_property_data (axis_offset_symbol (a)); + SCM data = g->get_property_data (sym); if (ly_is_procedure (data)) - data = ly_make_simple_closure (scm_list_1 (data)); + data = ly_make_simple_closure (scm_list_1 (data)); else if (is_simple_closure (data)) data = simple_closure_expression (data); else @@ -80,13 +75,19 @@ chain_offset_callback (Grob *g, SCM proc, Axis a) Data may be nonnumber. In that case, it is assumed to be undefined. */ - + data = SCM_UNDEFINED; SCM expr = scm_list_2 (proc, data); - g->set_property (axis_offset_symbol (a), - - // twice: one as a wrapper for grob property routines, - // once for the actual delayed binding. - ly_make_simple_closure (ly_make_simple_closure (expr))); + g->set_property (sym, + + // twice: one as a wrapper for grob property routines, + // once for the actual delayed binding. + ly_make_simple_closure (ly_make_simple_closure (expr))); +} + +void +chain_offset_callback (Grob *g, SCM proc, Axis a) +{ + chain_callback (g, proc, axis_offset_symbol (a)); }