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->internal_set_property (axis_offset_symbol (a),
45 if (ly_is_procedure (data))
46 data = ly_make_simple_closure (scm_list_1 (data));
47 else if (is_simple_closure (data))
48 data = simple_closure_expression (data);
50 SCM plus = ly_lily_module_constant ("+");
52 if (ly_is_procedure (proc))
53 proc = ly_make_simple_closure (scm_list_1 (proc));
55 SCM expr = scm_list_3 (plus, proc, data);
56 g->internal_set_property (axis_offset_symbol (a),
57 ly_make_simple_closure (expr));
68 (PROC GROB (orig-proc GROB))
72 chain_offset_callback (Grob *g, SCM proc, Axis a)
74 SCM data = g->get_property_data (axis_offset_symbol (a));
76 if (ly_is_procedure (data))
77 data = ly_make_simple_closure (scm_list_1 (data));
78 else if (is_simple_closure (data))
79 data = simple_closure_expression (data);
80 else if (!scm_is_number (data))
81 data = scm_from_int (0);
83 SCM expr = scm_list_2 (proc, data);
84 g->internal_set_property (axis_offset_symbol (a),
86 // twice: one as a wrapper for grob property routines,
87 // once for the actual delayed binding.
88 ly_make_simple_closure (ly_make_simple_closure (expr)));