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) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2010 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 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #include "bar-line.hh" | 20 #include "bar-line.hh" |
21 | 21 |
22 #include "all-font-metrics.hh" | 22 #include "all-font-metrics.hh" |
23 #include "font-interface.hh" | 23 #include "font-interface.hh" |
| 24 #include "line-interface.hh" |
24 #include "lookup.hh" | 25 #include "lookup.hh" |
25 #include "output-def.hh" | 26 #include "output-def.hh" |
26 #include "paper-column.hh" | 27 #include "paper-column.hh" |
27 #include "staff-symbol-referencer.hh" | 28 #include "staff-symbol-referencer.hh" |
28 #include "line-interface.hh" | |
29 | 29 |
30 MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_extent, 1) | 30 MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_extent, 1) |
31 SCM | 31 SCM |
32 Bar_line::calc_bar_extent (SCM smob) | 32 Bar_line::calc_bar_extent (SCM smob) |
33 { | 33 { |
34 Grob *me = unsmob_grob (smob); | 34 Grob *me = unsmob_grob (smob); |
35 | 35 |
36 SCM size = me->get_property ("bar-size"); | 36 SCM size = me->get_property ("bar-size"); |
37 | 37 |
38 if (!scm_is_number (size) | 38 if (!scm_is_number (size) |
39 || !Staff_symbol_referencer::get_staff_symbol (me)) | 39 || !Staff_symbol_referencer::get_staff_symbol (me)) |
40 return ly_interval2scm (Interval ()); | 40 return ly_interval2scm (Interval ()); |
41 | 41 |
42 Real h = scm_to_double (size); | 42 Real h = scm_to_double (size); |
43 return ly_interval2scm (Interval (-h/2, h/2)); | 43 return ly_interval2scm (Interval (-h/2, h/2)); |
44 } | 44 } |
45 | 45 |
46 Interval | 46 Interval |
47 Bar_line::bar_y_extent (Grob *me, Grob *refpoint) | 47 Bar_line::bar_y_extent (Grob *me, Grob *refpoint) |
48 { | 48 { |
49 Interval iv = robust_scm2interval (me->get_property ("bar-extent"), Interval (
)); | 49 Interval iv = robust_scm2interval (me->get_property ("bar-extent"), Interval (
)); |
50 | 50 |
51 iv.translate (me->relative_coordinate (refpoint, Y_AXIS)); | 51 iv.translate (me->relative_coordinate (refpoint, Y_AXIS)); |
52 return iv; | 52 return iv; |
53 } | 53 } |
54 | 54 |
| 55 bool |
| 56 Bar_line::non_empty_barline (Grob *me) |
| 57 { |
| 58 return has_interface (me) && !me->extent (me, X_AXIS).is_empty (); |
| 59 } |
| 60 |
55 MAKE_SCHEME_CALLBACK (Bar_line, print, 1); | 61 MAKE_SCHEME_CALLBACK (Bar_line, print, 1); |
56 SCM | 62 SCM |
57 Bar_line::print (SCM smob) | 63 Bar_line::print (SCM smob) |
58 { | 64 { |
59 Grob *me = unsmob_grob (smob); | 65 Grob *me = unsmob_grob (smob); |
60 | 66 |
61 SCM s = me->get_property ("glyph-name"); | 67 SCM s = me->get_property ("glyph-name"); |
62 SCM barsize = me->get_property ("bar-size"); | 68 SCM barsize = me->get_property ("bar-size"); |
63 | 69 |
64 if (scm_is_string (s) && scm_is_number (barsize)) | 70 if (scm_is_string (s) && scm_is_number (barsize)) |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 "gap " | 467 "gap " |
462 "kern " | 468 "kern " |
463 "thin-kern " | 469 "thin-kern " |
464 "hair-thickness " | 470 "hair-thickness " |
465 "thick-thickness " | 471 "thick-thickness " |
466 "glyph " | 472 "glyph " |
467 "glyph-name " | 473 "glyph-name " |
468 "bar-size " | 474 "bar-size " |
469 "bar-extent " | 475 "bar-extent " |
470 ); | 476 ); |
OLD | NEW |