]> git.donarmstrong.com Git - lilypond.git/blob - lily/timing-engraver.cc
f74a9be590d798e39af84a1b3b75f88e05fd1dfd
[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
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
16
17 ADD_THIS_TRANSLATOR(Timing_engraver);
18
19
20 void
21 Timing_engraver::do_post_move_processing( )
22 {
23   bar_req_l_ = 0;
24   Timing_translator::do_post_move_processing ();
25 }
26
27 bool
28 Timing_engraver::do_try_music (Music*m)
29 {
30   if (Bar_req  * b= dynamic_cast <Bar_req *> (m))
31     {
32       if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
33         return false;
34       
35       bar_req_l_ = b;
36       return true;
37     }
38   
39   return Timing_translator::do_try_music (m);
40 }
41
42
43 String
44 Timing_engraver::which_bar ()
45 {
46   if (!bar_req_l_)
47     {
48       if (!now_mom ())
49         return "|";
50
51       SCM nonauto = get_property ("barNonAuto");
52       if (!to_boolean (nonauto))
53         {
54           SCM always = get_property ("barAlways");
55           if (!measure_position ()
56               || (to_boolean (always)))
57             {
58               SCM def=get_property ("defaultBarType" );
59               return (gh_string_p (def))? ly_scm2string (def) : "";
60             }
61         }
62       return "";
63     }
64   else
65     {
66       return bar_req_l_->type_str_;
67     }
68 }