X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob-closure.cc;h=4f6c0adc81f5219836e20c2bb92754f347a20eab;hb=a713d376200adcb6eda27c8667eceb52116de341;hp=9dddc0616f85a11241992a4e39d1a4967253e910;hpb=0c5bcc9f980e3dc40b53543a957bbf353d7c2308;p=lilypond.git diff --git a/lily/grob-closure.cc b/lily/grob-closure.cc index 9dddc0616f..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,25 +59,35 @@ 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 if (!scm_is_number (data)) - data = scm_from_int (0); - + else + /* + 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)); }