]> git.donarmstrong.com Git - lilypond.git/blob - lily/global-translator.cc
release: 0.1.9
[lilypond.git] / lily / global-translator.cc
1 /*
2   global-translator.cc -- implement 
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "music.hh"
10 #include "global-translator.hh"
11 #include "score.hh"
12 #include "score-column.hh"
13
14 Global_translator::Global_translator()
15 {
16   score_l_ = 0;
17   last_mom_ = 0;
18 }
19
20 Translator*
21 Global_translator::ancestor_l (int)
22 {
23   return this;
24 }
25
26 void
27 Global_translator::add_moment_to_process (Moment m)
28 {
29   if (m  > last_mom_)
30         return;
31   
32   for (int i=0; i <  extra_mom_pq_.size(); i++)
33         if (extra_mom_pq_[i] == m)
34             return;
35   extra_mom_pq_.insert (m);
36 }
37
38 int
39 Global_translator::depth_i()const
40 {
41   return 0;
42 }
43
44 void
45 Global_translator::set_score (Score *s)
46 {
47   score_l_ = s;
48   last_mom_ = score_l_->music_p_->time_int().max ();
49 }
50
51 void
52 Global_translator::modify_next (Moment &w)
53 {
54   while (extra_mom_pq_.size() && 
55         extra_mom_pq_.front() <= w)
56         
57         w =extra_mom_pq_.get();
58 }
59
60 int
61 Global_translator::moments_left_i()const
62 {
63   return extra_mom_pq_.size();
64 }
65
66 void
67 Global_translator::prepare (Moment)
68 {
69 }
70
71
72 IMPLEMENT_IS_TYPE_B1(Global_translator, Translator);