]> git.donarmstrong.com Git - lilypond.git/blob - lily/timing-engraver.cc
release: 1.2.15
[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--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "score-engraver.hh"
10 #include "timing-engraver.hh"
11 #include "command-request.hh"
12 #include "score-element-info.hh"
13 #include "multi-measure-rest.hh"
14
15 void
16 Timing_engraver::fill_staff_info (Staff_info &inf)
17 {
18   inf.time_C_ = &time_;
19 }
20
21
22 ADD_THIS_TRANSLATOR(Timing_engraver);
23
24
25 void
26 Timing_engraver::do_post_move_processing( )
27 {
28   bar_req_l_ = 0;
29   Timing_translator::do_post_move_processing ();
30 }
31
32 bool
33 Timing_engraver::do_try_music (Music*m)
34 {
35   if (Bar_req  * b= dynamic_cast <Bar_req *> (m))
36     {
37       if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
38         return false;
39       
40       bar_req_l_ = b;
41       return true;
42     }
43   
44   return Timing_translator::do_try_music (m);
45 }
46
47
48 String
49 Timing_engraver::which_bar ()
50 {
51   if (!bar_req_l_)
52     {
53       if (!now_mom ())
54         return "|";
55
56       Scalar nonauto = get_property ("barNonAuto", 0);
57       if (!nonauto.to_bool ())
58         {
59           Scalar always = get_property ("barAlways", 0);
60           if (!time_.whole_in_measure_ || always.to_bool ())
61             return get_property ("defaultBarType" ,0);
62         }
63       return "";
64     }
65   else
66     {
67       return bar_req_l_->type_str_;
68     }
69 }