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) 2008--2015 Han-Wen Nienhuys <hanwen@lilypond.org> | 4 Copyright (C) 2008--2015 Han-Wen Nienhuys <hanwen@lilypond.org> |
5 | 5 |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void | 69 void |
70 Dynamic_align_engraver::create_line_spanner (Grob *cause) | 70 Dynamic_align_engraver::create_line_spanner (Grob *cause) |
71 { | 71 { |
72 if (!line_) | 72 if (!line_) |
73 line_ = make_spanner ("DynamicLineSpanner", cause->self_scm ()); | 73 line_ = make_spanner ("DynamicLineSpanner", cause->self_scm ()); |
74 } | 74 } |
75 | 75 |
76 void | 76 void |
77 Dynamic_align_engraver::acknowledge_end_dynamic (Grob_info info) | 77 Dynamic_align_engraver::acknowledge_end_dynamic (Grob_info info) |
78 { | 78 { |
79 if (has_interface<Spanner> (info.grob ())) | 79 Spanner *sp = dynamic_cast<Spanner *> (info.grob ()); |
80 ended_.push_back (info.spanner ()); | 80 if (!sp) |
| 81 return; |
| 82 |
| 83 ended_.push_back (sp); |
| 84 |
| 85 if (!line_) |
| 86 return; |
81 | 87 |
82 /* If the break flag is set, store the current spanner and let new dynamics | 88 /* If the break flag is set, store the current spanner and let new dynamics |
83 * create a new spanner | 89 * create a new spanner |
84 */ | 90 */ |
85 bool spanner_broken = current_dynamic_spanner_ == info.spanner () | 91 bool spanner_broken = (current_dynamic_spanner_ == sp) |
86 && to_boolean (current_dynamic_spanner_->get_property ("
spanner-broken")); | 92 && to_boolean (sp->get_property ("spanner-broken")); |
87 if (spanner_broken && line_) | 93 if (spanner_broken) |
88 { | 94 { |
89 if (ended_line_) | 95 if (ended_line_) |
90 programming_error ("already have a force-ended DynamicLineSpanner."); | 96 programming_error ("already have a force-ended DynamicLineSpanner."); |
91 ended_line_ = line_; | 97 ended_line_ = line_; |
92 line_ = 0; | 98 line_ = 0; |
93 current_dynamic_spanner_ = 0; | 99 current_dynamic_spanner_ = 0; |
94 } | 100 } |
95 } | 101 } |
96 | 102 |
97 void | 103 void |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (grob_dir && (line_dir != grob_dir)) | 136 if (grob_dir && (line_dir != grob_dir)) |
131 { | 137 { |
132 if (!ended_line_) | 138 if (!ended_line_) |
133 ended_line_ = line_; | 139 ended_line_ = line_; |
134 line_ = 0; | 140 line_ = 0; |
135 current_dynamic_spanner_ = 0; | 141 current_dynamic_spanner_ = 0; |
136 } | 142 } |
137 } | 143 } |
138 | 144 |
139 create_line_spanner (info.grob ()); | 145 create_line_spanner (info.grob ()); |
140 if (has_interface<Spanner> (info.grob ())) | 146 if (Spanner *sp = dynamic_cast<Spanner *> (info.grob ())) |
141 { | 147 { |
142 started_.push_back (info.spanner ()); | 148 started_.push_back (sp); |
143 current_dynamic_spanner_ = info.spanner (); | 149 current_dynamic_spanner_ = sp; |
144 } | 150 } |
145 else if (info.item ()) | 151 else if (Item *item = dynamic_cast<Item *> (info.grob ())) |
146 scripts_.push_back (info.item ()); | 152 scripts_.push_back (item); |
147 else | 153 else |
148 info.grob ()->programming_error ("unknown dynamic grob"); | 154 info.grob ()->programming_error ("unknown dynamic grob"); |
149 | 155 |
150 Axis_group_interface::add_element (line_, info.grob ()); | 156 Axis_group_interface::add_element (line_, info.grob ()); |
151 | 157 |
152 if (cause) | 158 if (cause) |
153 { | 159 { |
154 if (Direction d = to_dir (cause->get_property ("direction"))) | 160 if (Direction d = to_dir (cause->get_property ("direction"))) |
155 set_grob_direction (line_, d); | 161 set_grob_direction (line_, d); |
156 } | 162 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 250 |
245 /* create */ | 251 /* create */ |
246 "DynamicLineSpanner ", | 252 "DynamicLineSpanner ", |
247 | 253 |
248 /* read */ | 254 /* read */ |
249 "currentMusicalColumn ", | 255 "currentMusicalColumn ", |
250 | 256 |
251 /* write */ | 257 /* write */ |
252 "" | 258 "" |
253 ); | 259 ); |
OLD | NEW |