LEFT | RIGHT |
(no file at all) | |
1 #include "grob.hh" | 1 #include "grob.hh" |
2 #include "simple-closure.hh" | 2 #include "simple-closure.hh" |
3 #include "unpure-pure-container.hh" | 3 #include "unpure-pure-container.hh" |
4 | 4 |
5 SCM | 5 SCM |
6 axis_offset_symbol (Axis a) | 6 axis_offset_symbol (Axis a) |
7 { | 7 { |
8 return a == X_AXIS | 8 return a == X_AXIS |
9 ? ly_symbol2scm ("X-offset") | 9 ? ly_symbol2scm ("X-offset") |
10 : ly_symbol2scm ("Y-offset"); | 10 : ly_symbol2scm ("Y-offset"); |
11 } | 11 } |
12 | 12 |
13 SCM | 13 SCM |
14 axis_parent_positioning (Axis a) | 14 axis_parent_positioning (Axis a) |
15 { | 15 { |
16 return (a == X_AXIS) | 16 return (a == X_AXIS) |
17 ? Grob::x_parent_positioning_proc | 17 ? Grob::x_parent_positioning_proc |
18 : Grob::y_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 data = g->get_property_data (axis_offset_symbol (a)); | |
34 if (!scm_is_number (data) | |
35 && !ly_is_procedure (data) | |
36 && !is_simple_closure (data)) | |
37 { | |
38 g->set_property (axis_offset_symbol (a), proc); | |
39 return; | |
40 } | |
41 | |
42 if (ly_is_procedure (data) || is_unpure_pure_container (data)) | |
43 data = ly_make_simple_closure (scm_list_1 (data)); | |
44 else if (is_simple_closure (data)) | |
45 data = simple_closure_expression (data); | |
46 | |
47 SCM plus = ly_lily_module_constant ("+"); | |
48 | |
49 if (ly_is_procedure (proc)) | |
50 proc = ly_make_simple_closure (scm_list_1 (proc)); | |
51 | |
52 SCM expr = scm_list_3 (plus, proc, data); | |
53 g->set_property (axis_offset_symbol (a), ly_make_simple_closure (expr)); | |
54 } | 19 } |
55 | 20 |
56 /* | 21 /* |
57 replace | 22 replace |
58 | 23 |
59 (orig-proc GROB) | 24 (orig-proc GROB) |
60 | 25 |
61 by | 26 by |
62 | 27 |
63 (PROC GROB (orig-proc GROB)) | 28 (PROC GROB (orig-proc GROB)) |
(...skipping 21 matching lines...) Expand all Loading... |
85 // twice: one as a wrapper for grob property routines, | 50 // twice: one as a wrapper for grob property routines, |
86 // once for the actual delayed binding. | 51 // once for the actual delayed binding. |
87 ly_make_simple_closure (ly_make_simple_closure (expr))); | 52 ly_make_simple_closure (ly_make_simple_closure (expr))); |
88 } | 53 } |
89 | 54 |
90 void | 55 void |
91 chain_offset_callback (Grob *g, SCM proc, Axis a) | 56 chain_offset_callback (Grob *g, SCM proc, Axis a) |
92 { | 57 { |
93 chain_callback (g, proc, axis_offset_symbol (a)); | 58 chain_callback (g, proc, axis_offset_symbol (a)); |
94 } | 59 } |
LEFT | RIGHT |