]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar-check-iterator.cc
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[lilypond.git] / lily / bar-check-iterator.cc
1 /*   
2
3      bar-check-iterator.cc -- implement Bar_check_iterator
4
5      source file of the GNU LilyPond music typesetter
6
7      (c) 2001--2002  Han-Wen Nienhuys <hanwen@cs.uu.nl>
8
9  */
10
11 #include "simple-music-iterator.hh"
12 #include "command-request.hh"
13 #include "translator-group.hh"
14
15 /*
16   Check bar checks. We do this outside the engravers so that you can
17   race through the score using skipTypesetting to correct durations.
18  */
19 class Bar_check_iterator : Simple_music_iterator
20 {
21 public:
22   VIRTUAL_COPY_CONS(Bar_check_iterator);
23   virtual void process (Moment);
24   Bar_check_iterator( );
25   DECLARE_SCHEME_CALLBACK(constructor, ());
26 };
27
28 IMPLEMENT_CTOR_CALLBACK(Bar_check_iterator);
29
30 Music * get_barcheck ()
31 {
32   Music *bc = new Music;
33   bc->set_mus_property ("iterator-ctor", Bar_check_iterator::constructor_proc);
34   return bc;
35 }
36
37 Bar_check_iterator::Bar_check_iterator()
38 {
39 }
40
41 void
42 Bar_check_iterator::process (Moment m)
43 {
44   Simple_music_iterator::process(m);
45   if (!m.to_bool ())
46     {
47       Translator_group *tr = report_to ();
48
49       SCM mp = tr->get_property ("measurePosition");
50       SCM sync= tr->get_property ("barCheckSynchronize");
51
52       Moment * where =unsmob_moment (mp);
53       if (!where)
54         return;
55       
56       if (where->main_part_)
57         {
58           get_music ()->origin ()->warning (_f ("barcheck failed at: %s", 
59                                               where->string ()));
60           if (to_boolean (sync))
61             {
62               tr = tr->where_defined (ly_symbol2scm("measurePosition"));
63               Moment zero;
64               tr->set_property ("measurePosition", zero.smobbed_copy ());
65             }
66         }
67     }
68 }