Remove unused prototype in score.hh.
[lilypond/mpolesky.git] / lily / grob-closure.cc
blob124d1437932c034f7fa5e2ba1dd5195585dac6ad
1 #include "grob.hh"
2 #include "simple-closure.hh"
4 SCM
5 axis_offset_symbol (Axis a)
7 return a == X_AXIS
8 ? ly_symbol2scm ("X-offset")
9 : ly_symbol2scm ("Y-offset");
12 SCM
13 axis_parent_positioning (Axis a)
15 return (a == X_AXIS)
16 ? Grob::x_parent_positioning_proc
17 : Grob::y_parent_positioning_proc;
23 Replace
25 (orig-proc GROB)
29 (+ (PROC GROB) (orig-proc GROB))
32 void
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);
41 return ;
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));
60 replace
62 (orig-proc GROB)
66 (PROC GROB (orig-proc GROB))
69 void
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);
78 else
80 Data may be nonnumber. In that case, it is assumed to be
81 undefined.
84 data = SCM_UNDEFINED;
86 SCM expr = scm_list_2 (proc, data);
87 g->set_property (sym,
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)));
94 void
95 chain_offset_callback (Grob *g, SCM proc, Axis a)
97 chain_callback (g, proc, axis_offset_symbol (a));