*** empty log message ***
[lilypond.git] / lily / bar-check-iterator.cc
blobc95c064a45bb7b6387b7cd265aec90f8765e4229
1 /*
3 bar-check-iterator.cc -- implement Bar_check_iterator
5 source file of the GNU LilyPond music typesetter
7 (c) 2001--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 */
11 #include "simple-music-iterator.hh"
12 #include "event.hh"
13 #include "translator-group.hh"
16 Check bar checks. We do this outside the engravers so that you can
17 race through the score using skipTypesetting to correct durations.
19 class Bar_check_iterator : Simple_music_iterator
21 public:
22 VIRTUAL_COPY_CONS(Bar_check_iterator);
23 virtual void process (Moment);
24 Bar_check_iterator( );
25 DECLARE_SCHEME_CALLBACK(constructor, ());
28 IMPLEMENT_CTOR_CALLBACK(Bar_check_iterator);
30 Bar_check_iterator::Bar_check_iterator()
34 void
35 Bar_check_iterator::process (Moment m)
37 Simple_music_iterator::process(m);
38 if (!m.to_bool ())
40 Translator_group *tr = report_to ();
42 SCM mp = tr->get_property ("measurePosition");
43 SCM sync= tr->get_property ("barCheckSynchronize");
45 Moment * where =unsmob_moment (mp);
46 if (!where)
47 return;
49 if (where->main_part_)
51 get_music ()->origin ()->warning (_f ("barcheck failed at: %s",
52 where->to_string ()));
53 if (to_boolean (sync))
55 tr = tr->where_defined (ly_symbol2scm("measurePosition"));
56 Moment zero;
57 tr->set_property ("measurePosition", zero.smobbed_copy ());