]> git.donarmstrong.com Git - lilypond.git/blob - lily/grob-closure.cc
Doc-es: various updates.
[lilypond.git] / lily / grob-closure.cc
1 #include "grob.hh"
2 #include "unpure-pure-container.hh"
3 #include "lily-imports.hh"
4
5 SCM
6 axis_offset_symbol (Axis a)
7 {
8   return a == X_AXIS
9          ? ly_symbol2scm ("X-offset")
10          : ly_symbol2scm ("Y-offset");
11 }
12
13 SCM
14 axis_parent_positioning (Axis a)
15 {
16   return (a == X_AXIS)
17          ? Grob::x_parent_positioning_proc
18          : Grob::y_parent_positioning_proc;
19 }
20
21 /*
22   Replace
23
24   (orig-proc GROB)
25
26   by
27
28   (+ (PROC GROB) (orig-proc GROB))
29 */
30 void
31 add_offset_callback (Grob *g, SCM proc, Axis a)
32 {
33   SCM sym = axis_offset_symbol (a);
34   SCM data = g->get_property_data (sym);
35   g->set_property (sym, Lily::grob_offset_function (proc, data));
36 }
37
38 /*
39   replace
40
41   (orig-proc GROB)
42
43   by
44
45   (PROC GROB (orig-proc GROB))
46 */
47 void
48 chain_callback (Grob *g, SCM proc, SCM sym)
49 {
50   SCM data = g->get_property_data (sym);
51   g->set_property (sym, Lily::grob_compose_function (proc, data));
52 }
53
54 void
55 chain_offset_callback (Grob *g, SCM proc, Axis a)
56 {
57   chain_callback (g, proc, axis_offset_symbol (a));
58 }