]> git.donarmstrong.com Git - lilypond.git/blob - lily/priority-halign-engraver.cc
release: 1.0.1
[lilypond.git] / lily / priority-halign-engraver.cc
1 /*
2   score-halign-reg.cc -- implement Priority_horizontal_align_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "bar.hh"
10 #include "break-align-item.hh"
11 #include "priority-halign-engraver.hh"
12 #include "score-priority-engraver.hh"
13
14 Priority_horizontal_align_engraver::Priority_horizontal_align_engraver()
15 {
16   halign_p_ =0;
17 }
18
19 void
20 Priority_horizontal_align_engraver::do_pre_move_processing()
21 {
22   if (halign_p_) 
23     {
24       typeset_element (halign_p_);
25       halign_p_ =0;
26     }
27 }
28
29 void
30 Priority_horizontal_align_engraver::acknowledge_element (Score_element_info i)
31 {
32   Engraver* reg = i.origin_grav_l_arr_[0];
33   if (reg->is_type_b (Score_priority_engraver::static_name()))
34     {
35       if (!halign_p_) 
36         {
37           halign_p_ = new Break_align_item;
38           halign_p_->breakable_b_ = true;
39           announce_element (Score_element_info (halign_p_,0));
40         }
41       Item * it = i.elem_l_->access_Item ();
42       if (it->break_priority_i_ == 0)
43         halign_p_->center_l_ = it;
44
45       halign_p_->add_item (it, it->break_priority_i_);
46     }
47 }
48
49 IMPLEMENT_IS_TYPE_B1(Priority_horizontal_align_engraver,Engraver);
50 ADD_THIS_TRANSLATOR(Priority_horizontal_align_engraver);