]> git.donarmstrong.com Git - lilypond.git/blob - lily/timing-engraver.cc
release: 1.3.110
[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 "grob-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 start_translation_timestep ();
24   virtual void stop_translation_timestep ();
25   virtual void process_music ();
26 public:
27   VIRTUAL_COPY_CONS(Translator);
28 };
29
30 ADD_THIS_TRANSLATOR(Timing_engraver);
31
32 void
33 Timing_engraver::start_translation_timestep( )
34 {
35   Timing_translator::start_translation_timestep ();
36
37   SCM nonauto = get_property ("barNonAuto");
38
39   SCM which = get_property ("whichBar");
40   if (!gh_string_p (which))
41     which = now_mom ()
42       ? SCM_EOL : ly_str02scm ("|");
43   
44   if (!gh_string_p (which) && !to_boolean (nonauto))
45     {
46       SCM always = get_property ("barAlways");
47       if (!measure_position ()
48           || (to_boolean (always)))
49         {
50           which=get_property ("defaultBarType" );
51         }
52     }
53
54   daddy_trans_l_->set_property ("whichBar", which);
55 }
56
57 void
58 Timing_engraver::stop_translation_timestep ()
59 {
60   Timing_translator::stop_translation_timestep ();
61   daddy_trans_l_->set_property ("whichBar", SCM_EOL);  
62 }
63
64
65 /*
66   ugh. Translator doesn't do process_music ().
67  */
68 void
69 Timing_engraver::process_music ()
70 {
71   Timing_translator::process_music ();
72 }