LEFT | RIGHT |
(no file at all) | |
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--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2012 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 Item * | 177 Item * |
178 Spanner::get_bound (Direction d) const | 178 Spanner::get_bound (Direction d) const |
179 { | 179 { |
180 return spanned_drul_[d]; | 180 return spanned_drul_[d]; |
181 } | 181 } |
182 | 182 |
183 /* | 183 /* |
184 Set the items that this spanner spans. If D == LEFT, we also set the | 184 Set the items that this spanner spans. If D == LEFT, we also set the |
185 X-axis parent of THIS to S. | 185 X-axis parent of THIS to S: usually, the horizontal posisition of a |
| 186 spanner's left edge should be specified relative to its left bound. |
| 187 |
| 188 For example, when a slur crosses a line break, it's broken into two |
| 189 pieces. The second piece shouldn't be positioned relative to the |
| 190 original X-parent (i.e. the NoteColumn to which the beginning of the |
| 191 Slur was attached), but rather to a PaperColumn after the break. |
| 192 |
| 193 Also, sometimes a grob that would normally be the X-parent is empty. |
| 194 For example, TupletNumber's default X-parent is TupletBracket, but |
| 195 when the TupletBracket isn't displayed, another grob should be used |
| 196 as TupletNumber's X-parent. |
| 197 |
| 198 (TODO: maybe we shouldn't use such parents at all? |
| 199 In other words, maybe we should check if a parent isn't empty when |
| 200 we're setting it, and if necessary use another grob back then?) |
| 201 |
| 202 There's an exception when we don't want to set X-parent, see below. |
186 */ | 203 */ |
187 void | 204 void |
188 Spanner::set_bound (Direction d, Grob *s) | 205 Spanner::set_bound (Direction d, Grob *s) |
189 { | 206 { |
190 Item *i = dynamic_cast<Item *> (s); | 207 Item *i = dynamic_cast<Item *> (s); |
191 if (!i) | 208 if (!i) |
192 { | 209 { |
193 programming_error ("must have Item for spanner bound of " + name ()); | 210 programming_error ("must have Item for spanner bound of " + name ()); |
194 return; | 211 return; |
195 } | 212 } |
196 | 213 |
197 spanned_drul_[d] = i; | 214 spanned_drul_[d] = i; |
198 | 215 |
199 /** | 216 /** |
200 We check for System to prevent the column -> line_of_score | 217 We check for System to prevent the column -> line_of_score |
201 -> column -> line_of_score -> etc situation */ | 218 -> column -> line_of_score -> etc situation */ |
202 if (d == LEFT && !dynamic_cast<System *> (this)) | 219 if (d == LEFT && !dynamic_cast<System *> (this)) |
203 set_parent (i, X_AXIS); | 220 /* |
| 221 In case of MultiMeasureRestTexts, MultiMeasureRestNumbers and |
| 222 PercentRepeatCounters, their X-parents (MultiMeasureRest and |
| 223 PercentRepeat, respectively) are spanners as well, so they are |
| 224 split into pieces across linebreaks, too. |
| 225 Therefore we don't need to overwrite these X-parents with i |
| 226 (which would be a NonMusicalPaperColumn in that case). This allows |
| 227 us to calc the alignment of MMRNumbers, MMRTexts and PRCounters |
| 228 in a straightforward way (we can simply center on X-parent). |
| 229 |
| 230 (TODO: maybe we should move this part of set_bound into |
| 231 a separate function?) |
| 232 */ |
| 233 if (this->name () != "MultiMeasureRestText" |
| 234 && this->name () != "MultiMeasureRestNumber" |
| 235 && this->name () != "PercentRepeatCounter") |
| 236 set_parent (i, X_AXIS); |
204 | 237 |
205 /* | 238 /* |
206 Signal that this column needs to be kept alive. They need to be | 239 Signal that this column needs to be kept alive. They need to be |
207 kept alive to have meaningful position and linebreaking. | 240 kept alive to have meaningful position and linebreaking. |
208 | 241 |
209 [maybe we should try keeping all columns alive?, and perhaps | 242 [maybe we should try keeping all columns alive?, and perhaps |
210 inherit position from their (non-)musical brother] | 243 inherit position from their (non-)musical brother] |
211 */ | 244 */ |
212 if (dynamic_cast<Paper_column *> (i)) | 245 if (dynamic_cast<Paper_column *> (i)) |
213 Pointer_group_interface::add_grob (i, ly_symbol2scm ("bounded-by-me"), this)
; | 246 Pointer_group_interface::add_grob (i, ly_symbol2scm ("bounded-by-me"), this)
; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 " point of the spanner.", | 572 " point of the spanner.", |
540 | 573 |
541 /* properties */ | 574 /* properties */ |
542 "other-half " | 575 "other-half " |
543 "normalized-endpoints " | 576 "normalized-endpoints " |
544 "minimum-length " | 577 "minimum-length " |
545 "spanner-broken " | 578 "spanner-broken " |
546 "spanner-id " | 579 "spanner-id " |
547 "to-barline " | 580 "to-barline " |
548 ); | 581 ); |
LEFT | RIGHT |