]> git.donarmstrong.com Git - lilypond.git/blob - lily/timing-engraver.cc
patch::: 1.3.116.jcn4
[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 "translator-group.hh"
9 #include "command-request.hh"
10 #include "grob-info.hh"
11 #include "multi-measure-rest.hh"
12 #include "timing-translator.hh"
13 #include "engraver.hh"
14
15 /**
16   Do time bookkeeping
17  */
18 class Timing_engraver : public Timing_translator, public Engraver
19 {   
20 protected:
21   virtual void start_translation_timestep ();
22   virtual void stop_translation_timestep ();
23   virtual void process_music ();
24 public:
25   VIRTUAL_COPY_CONS(Translator);
26 };
27
28 ADD_THIS_TRANSLATOR(Timing_engraver);
29
30 void
31 Timing_engraver::start_translation_timestep( )
32 {
33   Timing_translator::start_translation_timestep ();
34
35   SCM nonauto = get_property ("barNonAuto");
36
37   SCM which = get_property ("whichBar");
38   if (!gh_string_p (which))
39     which = now_mom ()
40       ? 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           /* should this work, or be junked?  See input/bugs/no-bars.ly */
49           which=get_property ("defaultBarType" );
50         }
51     }
52
53   daddy_trans_l_->set_property ("whichBar", which);
54 }
55
56 void
57 Timing_engraver::stop_translation_timestep ()
58 {
59   Timing_translator::stop_translation_timestep ();
60   daddy_trans_l_->set_property ("whichBar", SCM_EOL);  
61 }
62
63
64 /*
65   ugh. Translator doesn't do process_music ().
66  */
67 void
68 Timing_engraver::process_music ()
69 {
70   Timing_translator::process_music ();
71 }