]> git.donarmstrong.com Git - lilypond.git/blob - lily/timing-engraver.cc
release: 1.3.107
[lilypond.git] / lily / timing-engraver.cc
1 /*
2   timing-grav.cc -- implement Timing_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #include <iostream.h>
9
10 #include "translator-group.hh"
11 #include "command-request.hh"
12 #include "score-element-info.hh"
13 #include "multi-measure-rest.hh"
14 #include "timing-translator.hh"
15 #include "engraver.hh"
16
17 /**
18   Do time bookkeeping
19  */
20 class Timing_engraver : public Timing_translator, public Engraver
21 {   
22 protected:
23   virtual void do_post_move_processing ();
24   virtual void do_pre_move_processing ();
25 public:
26   VIRTUAL_COPY_CONS(Translator);
27 };
28
29 ADD_THIS_TRANSLATOR(Timing_engraver);
30
31 void
32 Timing_engraver::do_post_move_processing( )
33 {
34   Timing_translator::do_post_move_processing ();
35
36   SCM nonauto = get_property ("barNonAuto");
37
38   SCM which = get_property ("whichBar");
39   if (!gh_string_p (which))
40     which = now_mom () ? SCM_EOL : ly_str02scm ("|");
41   
42   if (!gh_string_p (which) && !to_boolean (nonauto))
43     {
44       SCM always = get_property ("barAlways");
45       if (!measure_position ()
46           || (to_boolean (always)))
47         {
48           which=get_property ("defaultBarType" );
49         }
50     }
51
52   daddy_trans_l_->set_property ("whichBar", which);
53 }
54
55 void
56 Timing_engraver::do_pre_move_processing ()
57 {
58   Timing_translator::do_pre_move_processing ();
59   daddy_trans_l_->set_property ("whichBar", SCM_EOL);  
60 }
61
62
63