]> git.donarmstrong.com Git - lilypond.git/blob - lily/time-signature-engraver.cc
release: 1.1.29
[lilypond.git] / lily / time-signature-engraver.cc
1 /*
2   time_signature-reg.cc -- implement Time_signature_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 "time-signature-engraver.hh"
10 #include "time-signature.hh"
11 #include "command-request.hh"
12 #include "timing-engraver.hh"
13 #include "engraver-group.hh"
14
15 Time_signature_engraver::Time_signature_engraver()
16
17   time_signature_p_ =0;
18 }
19
20 void
21 Time_signature_engraver::do_process_requests()
22 {
23   Translator * result =
24     daddy_grav_l()->get_simple_translator ("Timing_engraver");  // ugh
25
26   if (!result)
27     {
28       warning (_ ("lost in time") + ": " + _ ("can't find") 
29         + " Timing_translator");
30       return ;
31     }
32   
33   Timing_engraver * timing_grav_l= dynamic_cast<Timing_engraver *> (result);
34   
35   Time_signature_change_req *req = timing_grav_l->time_signature_req_l();
36   if (req)
37     {
38       Array<int> args;
39       args.push (req->beats_i_);
40       args.push (req->one_beat_i_);
41         
42       time_signature_p_ = new Time_signature ();
43       time_signature_p_->args_ = args;
44       time_signature_p_->break_priority_i_ = 1; // ugh
45     }
46
47   
48   if (time_signature_p_)
49     announce_element (Score_element_info (time_signature_p_, req));
50 }
51
52 void
53 Time_signature_engraver::do_pre_move_processing()
54 {
55   if (time_signature_p_) 
56     {
57       Scalar sigstyle = get_property ("timeSignatureStyle", 0);
58       if (sigstyle.length_i ())
59         {
60           time_signature_p_->time_sig_type_str_ = sigstyle;
61         }
62
63       typeset_element (time_signature_p_);
64       time_signature_p_ =0;
65     }
66 }
67
68
69 ADD_THIS_TRANSLATOR(Time_signature_engraver);
70