LEFT | RIGHT |
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) 2011--2012 Mike Solomon <mike@apollinemike.com> | 4 Copyright (C) 2011--2012 Mike Solomon <mike@apollinemike.com> |
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 23 matching lines...) Expand all Loading... |
34 TRANSLATOR_DECLARATIONS (Footnote_engraver); | 34 TRANSLATOR_DECLARATIONS (Footnote_engraver); |
35 | 35 |
36 DECLARE_TRANSLATOR_LISTENER (footnote); | 36 DECLARE_TRANSLATOR_LISTENER (footnote); |
37 DECLARE_ACKNOWLEDGER (grob); | 37 DECLARE_ACKNOWLEDGER (grob); |
38 DECLARE_END_ACKNOWLEDGER (grob); | 38 DECLARE_END_ACKNOWLEDGER (grob); |
39 vector<Stream_event *> events_; | 39 vector<Stream_event *> events_; |
40 vector<Drul_array<Spanner *> > annotated_spanners_; | 40 vector<Drul_array<Spanner *> > annotated_spanners_; |
41 | 41 |
42 void stop_translation_timestep (); | 42 void stop_translation_timestep (); |
43 void finalize (); | 43 void finalize (); |
| 44 virtual void derived_mark () const; |
44 | 45 |
45 void footnotify (Grob *, Stream_event *); | 46 void footnotify (Grob *, Stream_event *); |
46 }; | 47 }; |
47 | 48 |
48 IMPLEMENT_TRANSLATOR_LISTENER (Footnote_engraver, footnote); | 49 IMPLEMENT_TRANSLATOR_LISTENER (Footnote_engraver, footnote); |
49 void | 50 void |
50 Footnote_engraver::listen_footnote (Stream_event *ev) | 51 Footnote_engraver::listen_footnote (Stream_event *ev) |
51 { | 52 { |
52 events_.push_back (ev); | 53 events_.push_back (ev); |
53 } | 54 } |
54 | 55 |
55 void | 56 void |
56 Footnote_engraver::stop_translation_timestep () | 57 Footnote_engraver::stop_translation_timestep () |
57 { | 58 { |
58 events_.clear (); | 59 events_.clear (); |
59 } | 60 } |
60 | 61 |
61 void | 62 void |
62 Footnote_engraver::finalize () | 63 Footnote_engraver::finalize () |
63 { | 64 { |
64 annotated_spanners_.resize (0); | 65 annotated_spanners_.clear (); |
| 66 } |
| 67 |
| 68 void |
| 69 Footnote_engraver::derived_mark () const |
| 70 { |
| 71 for (vsize i = 0; i < events_.size (); ++i) |
| 72 scm_gc_mark (events_[i]->self_scm ()); |
65 } | 73 } |
66 | 74 |
67 Footnote_engraver::Footnote_engraver () | 75 Footnote_engraver::Footnote_engraver () |
68 { | 76 { |
69 } | 77 } |
70 | 78 |
71 void | 79 void |
72 Footnote_engraver::footnotify (Grob *g, Stream_event *event) | 80 Footnote_engraver::footnotify (Grob *g, Stream_event *event) |
73 { | 81 { |
74 Spanner *s = dynamic_cast<Spanner *>(g); | 82 Spanner *s = dynamic_cast<Spanner *>(g); |
(...skipping 19 matching lines...) Expand all Loading... |
94 Footnote_engraver::acknowledge_grob (Grob_info info) | 102 Footnote_engraver::acknowledge_grob (Grob_info info) |
95 { | 103 { |
96 Music *mus = unsmob_music (info.grob ()->get_property ("footnote-music")); | 104 Music *mus = unsmob_music (info.grob ()->get_property ("footnote-music")); |
97 | 105 |
98 if (mus) | 106 if (mus) |
99 { | 107 { |
100 if (!mus->is_mus_type ("footnote-event")) { | 108 if (!mus->is_mus_type ("footnote-event")) { |
101 mus->origin ()->programming_error (_ ("Must be footnote-event.")); | 109 mus->origin ()->programming_error (_ ("Must be footnote-event.")); |
102 return; | 110 return; |
103 } | 111 } |
104 footnotify (info.grob (), mus->to_event (context ())); | 112 Stream_event *ev = mus->to_event (context ()); |
| 113 footnotify (info.grob (), ev); |
| 114 ev->unprotect (); |
105 return; | 115 return; |
106 } | 116 } |
107 | 117 |
108 // The following performance hog should eventually be removed: | 118 // The following performance hog should eventually be removed: |
109 // instead of adding a -\footnote ... \default articulation at the | 119 // instead of adding a -\footnote ... \default articulation at the |
110 // end of a note, you can perfectly well use \footnote ... before | 120 // end of a note, you can perfectly well use \footnote ... before |
111 // the note. This is just for the sake of automatic convert-ly | 121 // the note. This is just for the sake of automatic convert-ly |
112 // rules. | 122 // rules. |
113 | 123 |
114 Stream_event *cause = info.event_cause (); | 124 Stream_event *cause = info.event_cause (); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 /* create */ | 169 /* create */ |
160 "FootnoteItem " | 170 "FootnoteItem " |
161 "FootnoteSpanner ", | 171 "FootnoteSpanner ", |
162 | 172 |
163 /*read*/ | 173 /*read*/ |
164 "currentMusicalColumn ", | 174 "currentMusicalColumn ", |
165 | 175 |
166 /*write*/ | 176 /*write*/ |
167 "" | 177 "" |
168 ); | 178 ); |
LEFT | RIGHT |