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) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> |
5 Han-Wen Nienhuys <hanwen@xs4all.nl> | 5 Han-Wen Nienhuys <hanwen@xs4all.nl> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // text_[0] is a MultiMeasureRestNumber grob | 56 // text_[0] is a MultiMeasureRestNumber grob |
57 // the rest are optional MultiMeasureRestText grobs | 57 // the rest are optional MultiMeasureRestText grobs |
58 vector<Spanner *> text_; | 58 vector<Spanner *> text_; |
59 Stream_event *rest_ev_; | 59 Stream_event *rest_ev_; |
60 Spanner *mmrest_; | 60 Spanner *mmrest_; |
61 Moment stop_moment_; | 61 Moment stop_moment_; |
62 int start_measure_; | 62 int start_measure_; |
63 // Ugh, this is a kludge - need this for multi-measure-rest-grace.ly | 63 // Ugh, this is a kludge - need this for multi-measure-rest-grace.ly |
64 Item *last_command_item_; | 64 Item *last_command_item_; |
65 bool first_time_; | 65 bool first_time_; |
| 66 int number_threshold_; |
66 }; | 67 }; |
67 | 68 |
68 Multi_measure_rest_engraver::Multi_measure_rest_engraver (Context *c) | 69 Multi_measure_rest_engraver::Multi_measure_rest_engraver (Context *c) |
69 : Engraver (c), | 70 : Engraver (c), |
70 rest_ev_ (0), | 71 rest_ev_ (0), |
71 mmrest_ (0), | 72 mmrest_ (0), |
72 start_measure_ (0), | 73 start_measure_ (0), |
73 last_command_item_ (0), | 74 last_command_item_ (0), |
74 first_time_ (true) | 75 first_time_ (true) |
75 { | 76 { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Multi_measure_rest_engraver::set_measure_count (int n) | 176 Multi_measure_rest_engraver::set_measure_count (int n) |
176 { | 177 { |
177 SCM n_scm = scm_from_int (n); | 178 SCM n_scm = scm_from_int (n); |
178 assert (mmrest_); | 179 assert (mmrest_); |
179 mmrest_->set_property ("measure-count", n_scm); | 180 mmrest_->set_property ("measure-count", n_scm); |
180 | 181 |
181 Grob *g = text_[0]; // the MultiMeasureRestNumber | 182 Grob *g = text_[0]; // the MultiMeasureRestNumber |
182 assert (g); | 183 assert (g); |
183 if (scm_is_null (g->get_property ("text"))) | 184 if (scm_is_null (g->get_property ("text"))) |
184 { | 185 { |
185 SCM thres = get_property ("restNumberThreshold"); | 186 if (n <= number_threshold_) |
186 int t = 1; | |
187 if (scm_is_number (thres)) | |
188 t = scm_to_int (thres); | |
189 | |
190 if (n <= t) | |
191 g->suicide (); | 187 g->suicide (); |
192 else | 188 else |
193 { | 189 { |
194 SCM text = scm_number_to_string (n_scm, scm_from_int (10)); | 190 SCM text = scm_number_to_string (n_scm, scm_from_int (10)); |
195 g->set_property ("text", text); | 191 g->set_property ("text", text); |
196 } | 192 } |
197 } | 193 } |
198 } | 194 } |
199 | 195 |
200 void | 196 void |
(...skipping 25 matching lines...) Expand all Loading... |
226 initialize_grobs (); | 222 initialize_grobs (); |
227 text_events_.clear (); | 223 text_events_.clear (); |
228 | 224 |
229 if (last_command_item_) | 225 if (last_command_item_) |
230 { | 226 { |
231 add_bound_item_to_grobs (last_command_item_); | 227 add_bound_item_to_grobs (last_command_item_); |
232 last_command_item_ = 0; | 228 last_command_item_ = 0; |
233 } | 229 } |
234 | 230 |
235 start_measure_ = scm_to_int (get_property ("internalBarNumber")); | 231 start_measure_ = scm_to_int (get_property ("internalBarNumber")); |
| 232 number_threshold_ = robust_scm2int (get_property ("restNumberThreshold"),
1); |
236 } | 233 } |
237 | 234 |
238 first_time_ = false; | 235 first_time_ = false; |
239 } | 236 } |
240 | 237 |
241 void | 238 void |
242 Multi_measure_rest_engraver::start_translation_timestep () | 239 Multi_measure_rest_engraver::start_translation_timestep () |
243 { | 240 { |
244 clear_lapsed_events (now_mom ()); | 241 clear_lapsed_events (now_mom ()); |
245 } | 242 } |
(...skipping 20 matching lines...) Expand all Loading... |
266 /* read */ | 263 /* read */ |
267 "internalBarNumber " | 264 "internalBarNumber " |
268 "restNumberThreshold " | 265 "restNumberThreshold " |
269 "currentCommandColumn " | 266 "currentCommandColumn " |
270 "measurePosition " | 267 "measurePosition " |
271 "whichBar ", | 268 "whichBar ", |
272 | 269 |
273 /* write */ | 270 /* write */ |
274 "" | 271 "" |
275 ); | 272 ); |
OLD | NEW |