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