2 #include "simple-closure.hh"
5 axis_offset_symbol (Axis a
)
8 ? ly_symbol2scm ("X-offset")
9 : ly_symbol2scm ("Y-offset");
13 axis_parent_positioning (Axis a
)
16 ? Grob::x_parent_positioning_proc
17 : Grob::y_parent_positioning_proc
;
29 (+ (PROC GROB) (orig-proc GROB))
33 add_offset_callback (Grob
*g
, SCM proc
, Axis a
)
35 SCM data
= g
->get_property_data (axis_offset_symbol (a
));
36 if (!scm_is_number (data
)
37 && !ly_is_procedure (data
)
38 && !is_simple_closure (data
))
40 g
->set_property (axis_offset_symbol (a
), proc
);
44 if (ly_is_procedure (data
))
45 data
= ly_make_simple_closure (scm_list_1 (data
));
46 else if (is_simple_closure (data
))
47 data
= simple_closure_expression (data
);
49 SCM plus
= ly_lily_module_constant ("+");
51 if (ly_is_procedure (proc
))
52 proc
= ly_make_simple_closure (scm_list_1 (proc
));
54 SCM expr
= scm_list_3 (plus
, proc
, data
);
55 g
->set_property (axis_offset_symbol (a
), ly_make_simple_closure (expr
));
66 (PROC GROB (orig-proc GROB))
70 chain_callback (Grob
*g
, SCM proc
, SCM sym
)
72 SCM data
= g
->get_property_data (sym
);
74 if (ly_is_procedure (data
))
75 data
= ly_make_simple_closure (scm_list_1 (data
));
76 else if (is_simple_closure (data
))
77 data
= simple_closure_expression (data
);
80 Data may be nonnumber. In that case, it is assumed to be
86 SCM expr
= scm_list_2 (proc
, data
);
89 // twice: one as a wrapper for grob property routines,
90 // once for the actual delayed binding.
91 ly_make_simple_closure (ly_make_simple_closure (expr
)));
95 chain_offset_callback (Grob
*g
, SCM proc
, Axis a
)
97 chain_callback (g
, proc
, axis_offset_symbol (a
));