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) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 TODO: This is way too hairy | 7 TODO: This is way too hairy |
8 | 8 |
9 TODO: fix naming. | 9 TODO: fix naming. |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int len = scm_ilength (lst); | 81 int len = scm_ilength (lst); |
82 return max (len, 0); | 82 return max (len, 0); |
83 } | 83 } |
84 | 84 |
85 Interval | 85 Interval |
86 Stem::head_positions (Grob *me) | 86 Stem::head_positions (Grob *me) |
87 { | 87 { |
88 if (head_count (me)) | 88 if (head_count (me)) |
89 { | 89 { |
90 Drul_array<Grob *> e (extremal_heads (me)); | 90 Drul_array<Grob *> e (extremal_heads (me)); |
| 91 if (!e[DOWN] && !e[UP]) |
| 92 return Interval (); |
91 return Interval (Staff_symbol_referencer::get_position (e[DOWN]), | 93 return Interval (Staff_symbol_referencer::get_position (e[DOWN]), |
92 Staff_symbol_referencer::get_position (e[UP])); | 94 Staff_symbol_referencer::get_position (e[UP])); |
93 } | 95 } |
94 return Interval (); | 96 return Interval (); |
95 } | 97 } |
96 | 98 |
97 Real | 99 Real |
98 Stem::chord_start_y (Grob *me) | 100 Stem::chord_start_y (Grob *me) |
99 { | 101 { |
100 Interval hp = head_positions (me); | 102 Interval hp = head_positions (me); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Drul_array<int> extpos; | 167 Drul_array<int> extpos; |
166 extpos[DOWN] = inf; | 168 extpos[DOWN] = inf; |
167 extpos[UP] = -inf; | 169 extpos[UP] = -inf; |
168 | 170 |
169 Drul_array<Grob *> exthead (0, 0); | 171 Drul_array<Grob *> exthead (0, 0); |
170 extract_grob_set (me, "note-heads", heads); | 172 extract_grob_set (me, "note-heads", heads); |
171 | 173 |
172 for (vsize i = heads.size (); i--;) | 174 for (vsize i = heads.size (); i--;) |
173 { | 175 { |
174 Grob *n = heads[i]; | 176 Grob *n = heads[i]; |
175 if (to_boolean (n->get_property ("stem-ignore"))) | 177 if (n->get_property_data ("stem-attachment") == SCM_BOOL_F) |
176 continue; | 178 continue; |
177 int p = Staff_symbol_referencer::get_rounded_position (n); | 179 int p = Staff_symbol_referencer::get_rounded_position (n); |
178 | 180 |
179 Direction d = LEFT; | 181 Direction d = LEFT; |
180 do | 182 do |
181 { | 183 { |
182 if (d * p > d * extpos[d]) | 184 if (d * p > d * extpos[d]) |
183 { | 185 { |
184 exthead[d] = n; | 186 exthead[d] = n; |
185 extpos[d] = p; | 187 extpos[d] = p; |
186 } | 188 } |
187 } | 189 } |
188 while (flip (&d) != DOWN); | 190 while (flip (&d) != DOWN); |
189 } | 191 } |
190 return exthead; | 192 return exthead; |
191 } | 193 } |
192 | 194 |
193 /* The positions, in ascending order. */ | 195 /* The positions, in ascending order. */ |
194 vector<int> | 196 vector<int> |
195 Stem::note_head_positions (Grob *me) | 197 Stem::note_head_positions (Grob *me) |
196 { | 198 { |
197 vector<int> ps; | 199 vector<int> ps; |
198 extract_grob_set (me, "note-heads", heads); | 200 extract_grob_set (me, "note-heads", heads); |
199 | 201 |
200 for (vsize i = heads.size (); i--;) | 202 for (vsize i = heads.size (); i--;) |
201 { | 203 { |
202 Grob *n = heads[i]; | 204 Grob *n = heads[i]; |
203 if (to_boolean (n->get_property ("stem-ignore"))) | |
204 continue; | |
205 int p = Staff_symbol_referencer::get_rounded_position (n); | 205 int p = Staff_symbol_referencer::get_rounded_position (n); |
206 | 206 |
207 ps.push_back (p); | 207 ps.push_back (p); |
208 } | 208 } |
209 | 209 |
210 vector_sort (ps, less<int> ()); | 210 vector_sort (ps, less<int> ()); |
211 return ps; | 211 return ps; |
212 } | 212 } |
213 | 213 |
214 void | 214 void |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 ideal_y_ = shortest_y_ = 0; | 1125 ideal_y_ = shortest_y_ = 0; |
1126 dir_ = CENTER; | 1126 dir_ = CENTER; |
1127 } | 1127 } |
1128 | 1128 |
1129 void | 1129 void |
1130 Stem_info::scale (Real x) | 1130 Stem_info::scale (Real x) |
1131 { | 1131 { |
1132 ideal_y_ *= x; | 1132 ideal_y_ *= x; |
1133 shortest_y_ *= x; | 1133 shortest_y_ *= x; |
1134 } | 1134 } |
LEFT | RIGHT |