OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 put item in spanner. Adjust local key; etc. | 41 put item in spanner. Adjust local key; etc. |
42 | 42 |
43 Default: ignore the info | 43 Default: ignore the info |
44 */ | 44 */ |
45 virtual void acknowledge_grob (Grob_info) {} | 45 virtual void acknowledge_grob (Grob_info) {} |
46 virtual void announce_grob (Grob_info, Context *reroute_context = 0); | 46 virtual void announce_grob (Grob_info, Context *reroute_context = 0); |
47 virtual void announce_end_grob (Grob_info, Context *reroute_context = 0); | 47 virtual void announce_end_grob (Grob_info, Context *reroute_context = 0); |
48 Engraver_group *get_daddy_engraver () const; | 48 Engraver_group *get_daddy_engraver () const; |
49 | 49 |
50 public: | 50 public: |
51 using Translator::trampoline; | |
52 template <class T, void (T::*callback) (Grob_info)> | |
53 static SCM trampoline (SCM target, SCM grob, SCM source_engraver) | |
54 { | |
55 T *t = LY_ASSERT_SMOB (T, target, 1); | |
56 Grob *g = LY_ASSERT_SMOB (Grob, grob, 2); | |
57 Engraver *e = LY_ASSERT_SMOB (Engraver, source_engraver, 3); | |
58 | |
59 (t->*callback) (Grob_info (e, g)); | |
60 return SCM_UNSPECIFIED; | |
61 } | |
62 | |
63 /** | 51 /** |
64 Announce element. Default: pass on to daddy. Utility | 52 Announce element. Default: pass on to daddy. Utility |
65 */ | 53 */ |
66 void announce_grob (Grob *, SCM cause); | 54 void announce_grob (Grob *, SCM cause); |
67 void announce_end_grob (Grob *, SCM cause); | 55 void announce_end_grob (Grob *, SCM cause); |
68 | 56 |
69 Grob_info make_grob_info (Grob *, SCM cause); | 57 Grob_info make_grob_info (Grob *, SCM cause); |
70 | 58 |
71 Item *internal_make_item (SCM sym, SCM cause, | 59 Item *internal_make_item (SCM sym, SCM cause, |
72 char const *f, int l, char const *fun); | 60 char const *f, int l, char const *fun); |
73 Spanner *internal_make_spanner (SCM sym, SCM cause, | 61 Spanner *internal_make_spanner (SCM sym, SCM cause, |
74 char const *f, int l, char const *fun); | 62 char const *f, int l, char const *fun); |
75 Paper_column *internal_make_column (SCM sym, | 63 Paper_column *internal_make_column (SCM sym, |
76 char const *f, int l, char const *fun); | 64 char const *f, int l, char const *fun); |
77 | 65 |
78 /** | 66 /** |
79 override other ctor | 67 override other ctor |
80 */ | 68 */ |
81 OVERRIDE_CLASS_NAME (Engraver); | 69 OVERRIDE_CLASS_NAME (Engraver); |
82 Engraver (Context *); | 70 Engraver (Context *); |
83 }; | 71 }; |
84 | 72 |
85 #define make_item(x, cause) internal_make_item (ly_symbol2scm (x), cause, __FILE
__, __LINE__, __FUNCTION__) | 73 #define make_item(x, cause) internal_make_item (ly_symbol2scm (x), cause, __FILE
__, __LINE__, __FUNCTION__) |
86 #define make_spanner(x, cause) internal_make_spanner (ly_symbol2scm (x), cause,
__FILE__, __LINE__, __FUNCTION__) | 74 #define make_spanner(x, cause) internal_make_spanner (ly_symbol2scm (x), cause,
__FILE__, __LINE__, __FUNCTION__) |
87 #define make_paper_column(x) internal_make_column (ly_symbol2scm (x), __FILE__,
__LINE__, __FUNCTION__) | 75 #define make_paper_column(x) internal_make_column (ly_symbol2scm (x), __FILE__,
__LINE__, __FUNCTION__) |
88 | 76 |
89 bool ly_is_grob_cause (SCM obj); | 77 bool ly_is_grob_cause (SCM obj); |
90 | 78 |
| 79 |
| 80 // Acknowledger trampolines |
| 81 template <class T, void (T::*callback) (Grob_info)> |
| 82 SCM Callbacks::trampoline (SCM target, SCM grob, SCM source_engraver) |
| 83 { |
| 84 T *t = LY_ASSERT_SMOB (T, target, 1); |
| 85 Grob *g = LY_ASSERT_SMOB (Grob, grob, 2); |
| 86 Engraver *e = LY_ASSERT_SMOB (Engraver, source_engraver, 3); |
| 87 |
| 88 (t->*callback) (Grob_info (e, g)); |
| 89 return SCM_UNSPECIFIED; |
| 90 } |
| 91 |
91 #endif // ENGRAVER_HH | 92 #endif // ENGRAVER_HH |
OLD | NEW |