2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2001--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
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
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
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/>.
22 #include "international.hh"
24 #include "simple-music-iterator.hh"
27 Check bar checks. We do this outside the engravers so that you can
28 race through the score using skipTypesetting to correct durations.
30 class Bar_check_iterator : Simple_music_iterator
33 virtual void process (Moment);
34 Bar_check_iterator ();
35 DECLARE_SCHEME_CALLBACK (constructor, ());
38 IMPLEMENT_CTOR_CALLBACK (Bar_check_iterator);
40 Bar_check_iterator::Bar_check_iterator ()
45 Bar_check_iterator::process (Moment m)
47 Simple_music_iterator::process (m);
50 Context *tr = get_outlet ();
52 SCM check = tr->get_property ("ignoreBarChecks");
53 if (to_boolean (check))
56 SCM mp = tr->get_property ("measurePosition");
57 SCM sync = tr->get_property ("barCheckSynchronize");
59 Moment *where = Moment::unsmob (mp);
63 if (where->main_part_)
66 if (to_boolean (sync))
69 tr = tr->where_defined (ly_symbol2scm ("measurePosition"), &mp);
71 tr->set_property ("measurePosition", zero.smobbed_copy ());
75 SCM lf = tr->get_property ("barCheckLastFail");
76 if (Moment::is_smob (lf)
77 && *Moment::unsmob (lf) == *where)
80 tr->set_property ("barCheckLastFail", mp);
84 get_music ()->origin ()->warning (_f ("barcheck failed at: %s",
85 where->to_string ()));