LEFT | RIGHT |
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--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--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 |
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 "align-interface.hh" | |
21 #include "bar-line.hh" | 20 #include "bar-line.hh" |
22 #include "item.hh" | 21 #include "item.hh" |
23 #include "span-bar.hh" | 22 #include "span-bar.hh" |
24 #include "engraver.hh" | 23 #include "engraver.hh" |
25 | 24 |
26 /** | 25 /** |
27 | 26 |
28 Make bars that span multiple "staves". Catch bars, and span a | 27 Make bars that span multiple "staves". Catch bars, and span a |
29 Span_bar over them if we find more than 2 bars. Vertical alignment | 28 Span_bar over them if we find more than 2 bars. Vertical alignment |
30 of staves changes the appearance of spanbars. It is up to the | 29 of staves changes the appearance of spanbars. It is up to the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (bars_.size () >= 2 && !spanbar_) | 62 if (bars_.size () >= 2 && !spanbar_) |
64 make_spanbar_ = true; | 63 make_spanbar_ = true; |
65 } | 64 } |
66 } | 65 } |
67 | 66 |
68 void | 67 void |
69 Span_bar_engraver::process_acknowledged () | 68 Span_bar_engraver::process_acknowledged () |
70 { | 69 { |
71 if (make_spanbar_) | 70 if (make_spanbar_) |
72 { | 71 { |
73 Grob *vag = Align_interface::get_vertical_alignment (bars_[0]); | 72 Grob *vag = Grob::get_root_vertical_alignment (bars_[0]); |
74 if (vag) | 73 if (vag) |
75 vector_sort (bars_, Align_interface::vertical_sort); | 74 vector_sort (bars_, Grob::vertical_less); |
76 spanbar_ = make_item ("SpanBar", SCM_EOL); | 75 spanbar_ = make_item ("SpanBar", SCM_EOL); |
77 | 76 |
78 spanbar_->set_parent (bars_[0], X_AXIS); | 77 spanbar_->set_parent (bars_[0], X_AXIS); |
79 for (vsize i = 0; i < bars_.size (); i++) | 78 for (vsize i = 0; i < bars_.size (); i++) |
80 Span_bar::add_bar (spanbar_, bars_[i]); | 79 Span_bar::add_bar (spanbar_, bars_[i]); |
81 make_spanbar_ = false; | 80 make_spanbar_ = false; |
82 } | 81 } |
83 } | 82 } |
84 | 83 |
85 void | 84 void |
86 Span_bar_engraver::stop_translation_timestep () | 85 Span_bar_engraver::stop_translation_timestep () |
87 { | 86 { |
88 if (spanbar_) | 87 if (spanbar_) |
89 { | 88 { |
90 vector_sort (bars_, Align_interface::vertical_sort); | 89 vector_sort (bars_, Grob::vertical_less); |
91 for (vsize i = 0; i < bars_.size (); i++) | 90 for (vsize i = 0; i < bars_.size (); i++) |
92 Span_bar::add_bar (spanbar_, bars_[i]); | 91 Span_bar::add_bar (spanbar_, bars_[i]); |
93 | 92 |
94 SCM vissym = ly_symbol2scm ("break-visibility"); | 93 SCM vissym = ly_symbol2scm ("break-visibility"); |
95 SCM vis = bars_[0]->internal_get_property (vissym); | 94 SCM vis = bars_[0]->internal_get_property (vissym); |
96 if (ly_is_equal (spanbar_->internal_get_property (vissym), vis)) | 95 if (ly_is_equal (spanbar_->internal_get_property (vissym), vis)) |
97 spanbar_->set_property (vissym, vis); | 96 spanbar_->set_property (vissym, vis); |
98 | 97 |
99 spanbar_ = 0; | 98 spanbar_ = 0; |
100 } | 99 } |
(...skipping 10 matching lines...) Expand all Loading... |
111 | 110 |
112 /* create */ | 111 /* create */ |
113 "SpanBar ", | 112 "SpanBar ", |
114 | 113 |
115 /* read */ | 114 /* read */ |
116 "", | 115 "", |
117 | 116 |
118 /* write */ | 117 /* write */ |
119 "" | 118 "" |
120 ); | 119 ); |
LEFT | RIGHT |