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--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2011 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 void | 243 void |
244 System::get_footnote_grobs_in_range (vector<Grob *> &out, vsize start, vsize end
) | 244 System::get_footnote_grobs_in_range (vector<Grob *> &out, vsize start, vsize end
) |
245 { | 245 { |
246 if (!checked_footnotes_) | 246 if (!checked_footnotes_) |
247 populate_footnote_grob_vector (); | 247 populate_footnote_grob_vector (); |
248 | 248 |
249 for (vsize i = 0; i < footnote_grobs_.size (); i++) | 249 for (vsize i = 0; i < footnote_grobs_.size (); i++) |
250 { | 250 { |
251 int pos = footnote_grobs_[i]->spanned_rank_interval ()[LEFT]; | 251 int pos = footnote_grobs_[i]->spanned_rank_interval ()[LEFT]; |
252 bool end_of_line_visible = true; | |
253 if (Spanner *s = dynamic_cast<Spanner *>(footnote_grobs_[i])) | 252 if (Spanner *s = dynamic_cast<Spanner *>(footnote_grobs_[i])) |
254 { | 253 { |
255 Direction spanner_placement = robust_scm2dir (s->get_property ("spanne
r-placement"), LEFT); | 254 Direction spanner_placement = robust_scm2dir (s->get_property ("spanne
r-placement"), LEFT); |
256 if (spanner_placement == CENTER) | 255 if (spanner_placement == CENTER) |
257 spanner_placement = LEFT; | 256 spanner_placement = LEFT; |
258 | 257 |
259 pos = s->spanned_rank_interval ()[spanner_placement]; | 258 pos = s->spanned_rank_interval ()[spanner_placement]; |
260 } | 259 } |
261 | 260 |
262 if (Item *item = dynamic_cast<Item *>(footnote_grobs_[i])) | 261 if (Item *item = dynamic_cast<Item *>(footnote_grobs_[i])) |
263 { | 262 { |
264 if (!Item::break_visible (item)) | 263 if (!Item::break_visible (item)) |
265 continue; | 264 continue; |
266 // safeguard to bring down the column rank so that end of line footnot
es show up on the correct line | 265 // safeguard to bring down the column rank so that end of line footnot
es show up on the correct line |
267 end_of_line_visible = (LEFT == item->break_status_dir ()); | 266 if (pos == int (start) && item->break_status_dir () != RIGHT) |
| 267 continue; |
| 268 if (pos == int (end) && item->break_status_dir () != LEFT) |
| 269 continue; |
| 270 if (pos != int (end) && pos != int (start) && item->break_status_dir (
) != CENTER) |
| 271 continue; |
268 } | 272 } |
269 | 273 |
270 if (pos < int (start)) | 274 if (pos < int (start)) |
271 continue; | 275 continue; |
272 if (pos > int (end)) | 276 if (pos > int (end)) |
273 break; | 277 break; |
274 if (pos == int (start) && end_of_line_visible) | |
275 continue; | |
276 if (pos == int (end) && !end_of_line_visible) | |
277 continue; | |
278 if (!footnote_grobs_[i]->is_live ()) | 278 if (!footnote_grobs_[i]->is_live ()) |
279 continue; | 279 continue; |
280 | 280 |
281 out.push_back (footnote_grobs_[i]); | 281 out.push_back (footnote_grobs_[i]); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 vector<Stencil *> | 285 vector<Real> |
286 System::get_footnotes_in_range (vsize start, vsize end) | 286 System::get_footnote_heights_in_range (vsize start, vsize end) |
| 287 { |
| 288 return internal_get_note_heights_in_range (start, end, true); |
| 289 } |
| 290 |
| 291 vector<Real> |
| 292 System::get_in_note_heights_in_range (vsize start, vsize end) |
| 293 { |
| 294 return internal_get_note_heights_in_range (start, end, false); |
| 295 } |
| 296 |
| 297 vector<Real> |
| 298 System::internal_get_note_heights_in_range (vsize start, vsize end, bool foot) |
287 { | 299 { |
288 vector<Grob *> footnote_grobs; | 300 vector<Grob *> footnote_grobs; |
289 get_footnote_grobs_in_range (footnote_grobs, start, end); | 301 get_footnote_grobs_in_range (footnote_grobs, start, end); |
290 vector<Stencil *> out; | 302 vector<Real> out; |
| 303 |
| 304 for (vsize i = footnote_grobs.size (); i--;) |
| 305 if (foot |
| 306 ? !to_boolean (footnote_grobs[i]->get_property ("footnote")) |
| 307 : to_boolean (footnote_grobs[i]->get_property ("footnote"))) |
| 308 footnote_grobs.erase (footnote_grobs.begin () + i); |
291 | 309 |
292 for (vsize i = 0; i < footnote_grobs.size (); i++) | 310 for (vsize i = 0; i < footnote_grobs.size (); i++) |
293 { | 311 { |
294 SCM footnote_markup = footnote_grobs[i]->get_property ("footnote-text"); | 312 SCM footnote_markup = footnote_grobs[i]->get_property ("footnote-text"); |
295 | 313 |
296 if (!Text_interface::is_markup (footnote_markup)) | 314 if (!Text_interface::is_markup (footnote_markup)) |
297 continue; | 315 continue; |
298 | 316 |
299 SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-prop
erties"), | 317 SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-prop
erties"), |
300 pscore_->layout ()->self_scm ()); | 318 pscore_->layout ()->self_scm ()); |
301 | 319 |
302 SCM footnote_stl = Text_interface::interpret_markup (pscore_->layout ()->s
elf_scm (), | 320 SCM footnote_stl = Text_interface::interpret_markup (pscore_->layout ()->s
elf_scm (), |
303 props, footnote_marku
p); | 321 props, footnote_marku
p); |
304 | 322 |
305 Stencil *footnote_stencil = unsmob_stencil (footnote_stl); | 323 Stencil *footnote_stencil = unsmob_stencil (footnote_stl); |
306 out.push_back (footnote_stencil); | 324 out.push_back (footnote_stencil->extent (Y_AXIS).length ()); |
307 } | 325 } |
308 | 326 |
309 return out; | 327 return out; |
310 } | 328 } |
311 | 329 |
312 vsize | 330 vsize |
313 System::num_footnotes () | 331 System::num_footnotes () |
314 { | 332 { |
315 return footnote_grobs_.size (); | 333 return footnote_grobs_.size (); |
316 } | 334 } |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 916 |
899 | 917 |
900 ADD_INTERFACE (System, | 918 ADD_INTERFACE (System, |
901 "This is the top-level object: Each object in a score" | 919 "This is the top-level object: Each object in a score" |
902 " ultimately has a @code{System} object as its X and" | 920 " ultimately has a @code{System} object as its X and" |
903 " Y@tie{}parent.", | 921 " Y@tie{}parent.", |
904 | 922 |
905 /* properties */ | 923 /* properties */ |
906 "all-elements " | 924 "all-elements " |
907 "columns " | 925 "columns " |
| 926 "footnote-stencil " |
| 927 "in-note-direction " |
| 928 "in-note-padding " |
| 929 "in-note-stencil " |
908 "labels " | 930 "labels " |
909 "pure-Y-extent " | 931 "pure-Y-extent " |
910 "skyline-horizontal-padding " | 932 "skyline-horizontal-padding " |
911 ); | 933 ); |
OLD | NEW |