2 global-translator.cc -- implement Global_translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "music-list.hh"
13 #include "music-iterator.hh"
14 #include "global-translator.hh"
16 Global_translator::Global_translator ()
21 Global_translator::add_moment_to_process (Moment m
)
27 programming_error ("Trying to freeze in time.");
29 for (int i
=0; i
< extra_mom_pq_
.size (); i
++)
30 if (extra_mom_pq_
[i
] == m
)
32 extra_mom_pq_
.insert (m
);
36 Global_translator::sneaky_insert_extra_moment (Moment w
)
38 while (extra_mom_pq_
.size () && extra_mom_pq_
.front () <= w
)
39 w
= extra_mom_pq_
.get ();
44 Global_translator::moments_left_i () const
46 return extra_mom_pq_
.size ();
50 Global_translator::prepare (Moment m
)
57 Global_translator::now_mom () const
65 Global_translator::get_output_p ()
71 Global_translator::one_time_step ()
75 Global_translator::start ()
79 Global_translator::finish ()
84 Global_translator::run_iterator_on_me (Music_iterator
* iter
)
87 prev_mom_
= now_mom_
= iter
->pending_moment ();
90 while (iter
->ok () || moments_left_i ())
96 w
= iter
->pending_moment ();
99 w
= sneaky_insert_extra_moment (w
);
101 cout
<< "Proccing " << w
<< endl
;
107 set_property (ly_symbol2scm ("measurePosition"), w
.smobbed_copy ());