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) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Paper_column::Paper_column (Paper_column const &src) | 91 Paper_column::Paper_column (Paper_column const &src) |
92 : Item (src) | 92 : Item (src) |
93 { | 93 { |
94 system_ = 0; | 94 system_ = 0; |
95 rank_ = src.rank_; | 95 rank_ = src.rank_; |
96 } | 96 } |
97 | 97 |
98 Moment | 98 Moment |
99 Paper_column::when_mom (Grob *me) | 99 Paper_column::when_mom (Grob *me) |
100 { | 100 { |
101 SCM m = me->get_property ("when"); | 101 SCM m = get_property (me, "when"); |
102 if (Moment *when = unsmob<Moment> (m)) | 102 if (Moment *when = unsmob<Moment> (m)) |
103 return *when; | 103 return *when; |
104 return Moment (0); | 104 return Moment (0); |
105 } | 105 } |
106 | 106 |
107 bool | 107 bool |
108 Paper_column::is_musical (Grob *me) | 108 Paper_column::is_musical (Grob *me) |
109 { | 109 { |
110 SCM m = me->get_property ("shortest-starter-duration"); | 110 SCM m = get_property (me, "shortest-starter-duration"); |
111 if (Moment *s = unsmob<Moment> (m)) | 111 if (Moment *s = unsmob<Moment> (m)) |
112 return *s != Moment (0); | 112 return *s != Moment (0); |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 bool | 116 bool |
117 Paper_column::is_used (Grob *me) | 117 Paper_column::is_used (Grob *me) |
118 { | 118 { |
119 extract_grob_set (me, "elements", elts); | 119 extract_grob_set (me, "elements", elts); |
120 if (elts.size ()) | 120 if (elts.size ()) |
121 return true; | 121 return true; |
122 | 122 |
123 extract_grob_set (me, "bounded-by-me", bbm); | 123 extract_grob_set (me, "bounded-by-me", bbm); |
124 if (bbm.size ()) | 124 if (bbm.size ()) |
125 return true; | 125 return true; |
126 | 126 |
127 if (Paper_column::is_breakable (me)) | 127 if (Paper_column::is_breakable (me)) |
128 return true; | 128 return true; |
129 | 129 |
130 if (to_boolean (me->get_property ("used"))) | 130 if (to_boolean (get_property (me, "used"))) |
131 return true; | 131 return true; |
132 | 132 |
133 if (scm_is_pair (me->get_property ("labels"))) | 133 if (scm_is_pair (get_property (me, "labels"))) |
134 return true; | 134 return true; |
135 | 135 |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 bool | 139 bool |
140 Paper_column::is_breakable (Grob *me) | 140 Paper_column::is_breakable (Grob *me) |
141 { | 141 { |
142 return scm_is_symbol (me->get_property ("line-break-permission")); | 142 return scm_is_symbol (get_property (me, "line-break-permission")); |
143 } | 143 } |
144 | 144 |
145 Real | 145 Real |
146 Paper_column::minimum_distance (Grob *left, Grob *right) | 146 Paper_column::minimum_distance (Grob *left, Grob *right) |
147 { | 147 { |
148 Drul_array<Grob *> cols (left, right); | 148 Drul_array<Grob *> cols (left, right); |
149 Drul_array<Skyline> skys = Drul_array<Skyline> (Skyline (RIGHT), Skyline (LEFT
)); | 149 Drul_array<Skyline> skys = Drul_array<Skyline> (Skyline (RIGHT), Skyline (LEFT
)); |
150 | 150 |
151 for (LEFT_and_RIGHT (d)) | 151 for (LEFT_and_RIGHT (d)) |
152 { | 152 { |
153 Skyline_pair *sp = unsmob<Skyline_pair> (cols[d]->get_property ("horizonta
l-skylines")); | 153 Skyline_pair *sp = unsmob<Skyline_pair> (get_property (cols[d], "horizonta
l-skylines")); |
154 if (sp) | 154 if (sp) |
155 skys[d] = (*sp)[-d]; | 155 skys[d] = (*sp)[-d]; |
156 } | 156 } |
157 | 157 |
158 skys[RIGHT].merge (Separation_item::conditional_skyline (right, left)); | 158 skys[RIGHT].merge (Separation_item::conditional_skyline (right, left)); |
159 | 159 |
160 return std::max (0.0, skys[LEFT].distance (skys[RIGHT])); | 160 return std::max (0.0, skys[LEFT].distance (skys[RIGHT])); |
161 } | 161 } |
162 | 162 |
163 Interval | 163 Interval |
(...skipping 19 matching lines...) Expand all Loading... |
183 align = Pointer_group_interface::find_grob | 183 align = Pointer_group_interface::find_grob |
184 (me, ly_symbol2scm ("elements"), | 184 (me, ly_symbol2scm ("elements"), |
185 (scm_is_eq (align_sym, ly_symbol2scm ("staff-bar")) | 185 (scm_is_eq (align_sym, ly_symbol2scm ("staff-bar")) |
186 ? Bar_line::non_empty_barline | 186 ? Bar_line::non_empty_barline |
187 : has_interface<Break_alignment_interface>)); | 187 : has_interface<Break_alignment_interface>)); |
188 else | 188 else |
189 { | 189 { |
190 extract_grob_set (me, "elements", elts); | 190 extract_grob_set (me, "elements", elts); |
191 for (vsize i = 0; i < elts.size (); i++) | 191 for (vsize i = 0; i < elts.size (); i++) |
192 { | 192 { |
193 if (scm_is_eq (align_sym, elts[i]->get_property ("break-align-symb
ol")) | 193 if (scm_is_eq (align_sym, get_property (elts[i], "break-align-symb
ol")) |
194 // TODO SCM: there must be a simpler way to put this. | 194 // TODO SCM: there must be a simpler way to put this. |
195 && !elts[i]->extent (elts[i], X_AXIS).is_empty ()) | 195 && !elts[i]->extent (elts[i], X_AXIS).is_empty ()) |
196 { | 196 { |
197 align = elts[i]; | 197 align = elts[i]; |
198 break; | 198 break; |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 " its moment in time, a blue arrow showing the" | 260 " its moment in time, a blue arrow showing the" |
261 " ideal distance, and a red arrow showing the" | 261 " ideal distance, and a red arrow showing the" |
262 " minimum distance between columns."); | 262 " minimum distance between columns."); |
263 SCM | 263 SCM |
264 Paper_column::print (SCM p) | 264 Paper_column::print (SCM p) |
265 { | 265 { |
266 Paper_column *me = unsmob<Paper_column> (p); | 266 Paper_column *me = unsmob<Paper_column> (p); |
267 | 267 |
268 string r = std::to_string (me->get_rank ()); | 268 string r = std::to_string (me->get_rank ()); |
269 | 269 |
270 Moment *mom = unsmob<Moment> (me->get_property ("when")); | 270 Moment *mom = unsmob<Moment> (get_property (me, "when")); |
271 string when = mom ? mom->to_string () : "?/?"; | 271 string when = mom ? mom->to_string () : "?/?"; |
272 | 272 |
273 Font_metric *musfont = Font_interface::get_default_font (me); | 273 Font_metric *musfont = Font_interface::get_default_font (me); |
274 SCM properties = Font_interface::text_font_alist_chain (me); | 274 SCM properties = Font_interface::text_font_alist_chain (me); |
275 SCM scm_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), | 275 SCM scm_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), |
276 properties, | 276 properties, |
277 ly_string2scm (r)); | 277 ly_string2scm (r)); |
278 SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), | 278 SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), |
279 properties, | 279 properties, |
280 ly_string2scm (when)); | 280 ly_string2scm (when)); |
281 Stencil t = *unsmob<Stencil> (scm_mol); | 281 Stencil t = *unsmob<Stencil> (scm_mol); |
282 t.scale (1.2, 1.4); | 282 t.scale (1.2, 1.4); |
283 t.add_at_edge (Y_AXIS, DOWN, *unsmob<Stencil> (when_mol), 0.1); | 283 t.add_at_edge (Y_AXIS, DOWN, *unsmob<Stencil> (when_mol), 0.1); |
284 t.align_to (X_AXIS, LEFT); | 284 t.align_to (X_AXIS, LEFT); |
285 // compensate for font serifs and half letter-distance | 285 // compensate for font serifs and half letter-distance |
286 t.translate (Offset (-0.1, 0)); | 286 t.translate (Offset (-0.1, 0)); |
287 t.align_to (Y_AXIS, DOWN); | 287 t.align_to (Y_AXIS, DOWN); |
288 | 288 |
289 Stencil l = Lookup::filled_box (Box (Interval (0, 0.02), | 289 Stencil l = Lookup::filled_box (Box (Interval (0, 0.02), |
290 Interval (-8, -1))); | 290 Interval (-8, -1))); |
291 | 291 |
292 Real small_pad = 0.15; | 292 Real small_pad = 0.15; |
293 Real big_pad = 0.35; | 293 Real big_pad = 0.35; |
294 | 294 |
295 // number of printed arrows from *both* loops | 295 // number of printed arrows from *both* loops |
296 int j = 0; | 296 int j = 0; |
297 | 297 |
298 for (SCM s = me->get_object ("ideal-distances"); | 298 for (SCM s = get_object (me, "ideal-distances"); |
299 scm_is_pair (s); s = scm_cdr (s)) | 299 scm_is_pair (s); s = scm_cdr (s)) |
300 { | 300 { |
301 Spring *sp = unsmob<Spring> (scm_caar (s)); | 301 Spring *sp = unsmob<Spring> (scm_caar (s)); |
302 if (!unsmob<Grob> (scm_cdar (s)) | 302 if (!unsmob<Grob> (scm_cdar (s)) |
303 || !unsmob<Grob> (scm_cdar (s))->get_system ()) | 303 || !unsmob<Grob> (scm_cdar (s))->get_system ()) |
304 continue; | 304 continue; |
305 | 305 |
306 j++; | 306 j++; |
307 | 307 |
308 Stencil arrowhead (musfont->find_by_name ("arrowheads.open.01")); | 308 Stencil arrowhead (musfont->find_by_name ("arrowheads.open.01")); |
(...skipping 24 matching lines...) Expand all Loading... |
333 pts.push_back (p2); | 333 pts.push_back (p2); |
334 | 334 |
335 Stencil id_stencil = Lookup::points_to_line_stencil (0.1, pts); | 335 Stencil id_stencil = Lookup::points_to_line_stencil (0.1, pts); |
336 id_stencil.add_stencil (arrowhead.translated (p2)); | 336 id_stencil.add_stencil (arrowhead.translated (p2)); |
337 id_stencil.add_stencil (number_stc->translated (num_off)); | 337 id_stencil.add_stencil (number_stc->translated (num_off)); |
338 // use a lighter shade of blue so it will remain legible on black backgrou
nd. | 338 // use a lighter shade of blue so it will remain legible on black backgrou
nd. |
339 id_stencil = id_stencil.in_color (0.2, 0.4, 1.0); | 339 id_stencil = id_stencil.in_color (0.2, 0.4, 1.0); |
340 l.add_stencil (id_stencil); | 340 l.add_stencil (id_stencil); |
341 } | 341 } |
342 | 342 |
343 for (SCM s = me->get_object ("minimum-distances"); | 343 for (SCM s = get_object (me, "minimum-distances"); |
344 scm_is_pair (s); s = scm_cdr (s)) | 344 scm_is_pair (s); s = scm_cdr (s)) |
345 { | 345 { |
346 Real dist = scm_to_double (scm_cdar (s)); | 346 Real dist = scm_to_double (scm_cdar (s)); |
347 Grob *other = unsmob<Grob> (scm_caar (s)); | 347 Grob *other = unsmob<Grob> (scm_caar (s)); |
348 if (!other || other->get_system () != me->get_system ()) | 348 if (!other || other->get_system () != me->get_system ()) |
349 continue; | 349 continue; |
350 | 350 |
351 j++; | 351 j++; |
352 | 352 |
353 Stencil arrowhead (musfont->find_by_name ("arrowheads.open.01")); | 353 Stencil arrowhead (musfont->find_by_name ("arrowheads.open.01")); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 bounded-by-me | 400 bounded-by-me |
401 | 401 |
402 THIS IS BROKEN KLUDGE. WE SHOULD INVENT SOMETHING BETTER. | 402 THIS IS BROKEN KLUDGE. WE SHOULD INVENT SOMETHING BETTER. |
403 */ | 403 */ |
404 MAKE_SCHEME_CALLBACK (Paper_column, before_line_breaking, 1); | 404 MAKE_SCHEME_CALLBACK (Paper_column, before_line_breaking, 1); |
405 SCM | 405 SCM |
406 Paper_column::before_line_breaking (SCM grob) | 406 Paper_column::before_line_breaking (SCM grob) |
407 { | 407 { |
408 Grob *me = unsmob<Grob> (grob); | 408 Grob *me = unsmob<Grob> (grob); |
409 | 409 |
410 if (Grob_array *ga = unsmob<Grob_array> (me->get_object ("bounded-by-me"))) | 410 if (Grob_array *ga = unsmob<Grob_array> (get_object (me, "bounded-by-me"))) |
411 ga->filter (grob_is_live); | 411 ga->filter (grob_is_live); |
412 | 412 |
413 return SCM_UNSPECIFIED; | 413 return SCM_UNSPECIFIED; |
414 } | 414 } |
415 | 415 |
416 /* FIXME: This is a hack that we use to identify columns that used to | 416 /* FIXME: This is a hack that we use to identify columns that used to |
417 contain note-heads but whose note-heads were moved by one of the ligature | 417 contain note-heads but whose note-heads were moved by one of the ligature |
418 engravers. Once the ligature engravers are fixed to behave nicely, this | 418 engravers. Once the ligature engravers are fixed to behave nicely, this |
419 function can be removed. | 419 function can be removed. |
420 */ | 420 */ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 "page-break-penalty " | 467 "page-break-penalty " |
468 "page-break-permission " | 468 "page-break-permission " |
469 "page-turn-penalty " | 469 "page-turn-penalty " |
470 "page-turn-permission " | 470 "page-turn-permission " |
471 "rhythmic-location " | 471 "rhythmic-location " |
472 "shortest-playing-duration " | 472 "shortest-playing-duration " |
473 "shortest-starter-duration " | 473 "shortest-starter-duration " |
474 "spacing " | 474 "spacing " |
475 "used " | 475 "used " |
476 "when "); | 476 "when "); |
LEFT | RIGHT |