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 (ly_is_procedure (data))
37 data = ly_make_simple_closure (scm_list_1 (data));
38 else if (is_simple_closure (data))
39 data = simple_closure_expression (data);
40 else if (!scm_is_number (data))
41 g->internal_set_property (axis_offset_symbol (a),
45 SCM plus = ly_lily_module_constant ("+");
46 SCM expr = scm_list_3 (plus,
47 ly_make_simple_closure (scm_list_1 (proc)),
49 g->internal_set_property (axis_offset_symbol (a),
50 ly_make_simple_closure (expr));
62 (PROC GROB (orig-proc GROB))
66 chain_offset_callback (Grob *g, SCM proc, Axis a)
68 SCM data = g->get_property_data (axis_offset_symbol (a));
70 if (ly_is_procedure (data))
71 data = ly_make_simple_closure (scm_list_1 (data));
72 else if (is_simple_closure (data))
73 data = simple_closure_expression (data);
74 else if (!scm_is_number (data))
75 data = scm_from_int (0);
77 SCM expr = scm_list_2 (proc, data);
78 g->internal_set_property (axis_offset_symbol (a),
80 // twice: one as a wrapper for grob property routines,
81 // once for the actual delayed binding.
82 ly_make_simple_closure (ly_make_simple_closure (expr)));