lilypond-1.3.65
[lilypond.git] / lily / separating-line-group-grav.cc
blob889c8db670d24899af060865ecd1dea5fb52b814
1 /*
2 separating-line-group-grav.cc -- implement Separating_line_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
8 */
10 #include "separating-line-group-grav.hh"
11 #include "separating-group-spanner.hh"
12 #include "single-malt-grouping-item.hh"
13 #include "p-col.hh"
15 Separating_line_group_engraver::Separating_line_group_engraver ()
17 sep_span_p_ = 0;
18 break_malt_p_ = 0;
19 nobreak_malt_p_ =0;
22 void
23 Separating_line_group_engraver::do_creation_processing ()
25 sep_span_p_ = new Separating_group_spanner;
26 announce_element ( Score_elem_info (sep_span_p_, 0));
27 sep_span_p_->set_bounds (LEFT, get_staff_info ().command_pcol_l ());
30 void
31 Separating_line_group_engraver::do_removal_processing ()
33 sep_span_p_->set_bounds (RIGHT, get_staff_info ().command_pcol_l ());
34 typeset_element (sep_span_p_);
35 sep_span_p_ =0;
38 void
39 Separating_line_group_engraver::acknowledge_element (Score_elem_info i)
41 Item * it = i.elem_l_->item ();
42 if (it && !it->axis_group_l_a_[X_AXIS])
44 Single_malt_grouping_item *&p_ref_ (it->breakable_b_ ?
45 break_malt_p_ : nobreak_malt_p_);
47 if (!p_ref_)
49 p_ref_ = new Single_malt_grouping_item;
50 p_ref_->breakable_b_ = it->breakable_b_;
51 announce_element (Score_elem_info (p_ref_, 0));
53 p_ref_->add (it);
57 void
58 Separating_line_group_engraver::do_pre_move_processing ()
60 if (break_malt_p_)
62 sep_span_p_->add_spacing_unit (break_malt_p_);
64 typeset_element (break_malt_p_);
65 break_malt_p_ =0;
67 if (nobreak_malt_p_)
69 sep_span_p_->add_spacing_unit (nobreak_malt_p_);
70 typeset_element (nobreak_malt_p_);
71 nobreak_malt_p_ =0;
76 IMPLEMENT_IS_TYPE_B1 (Separating_line_group_engraver, Line_group_engraver);
77 ADD_THIS_TRANSLATOR( Separating_line_group_engraver);