lilypond-1.3.11
[lilypond.git] / lily / separating-line-group-engraver.cc
blobb2ae354ab9752613a3ca22b6d025cb1fc587a7db
1 /*
2 separating-line-group-grav.cc -- implement Separating_line_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "separating-line-group-engraver.hh"
11 #include "separating-group-spanner.hh"
12 #include "single-malt-grouping-item.hh"
13 #include "paper-column.hh"
14 #include "paper-def.hh"
16 Separating_line_group_engraver::Separating_line_group_engraver ()
18 sep_span_p_ = 0;
19 break_malt_p_ = 0;
20 nobreak_malt_p_ =0;
23 void
24 Separating_line_group_engraver::do_creation_processing ()
26 sep_span_p_ = new Separating_group_spanner;
27 announce_element (Score_element_info (sep_span_p_, 0));
28 sep_span_p_->set_bounds (LEFT, get_staff_info ().command_pcol_l ());
31 void
32 Separating_line_group_engraver::do_removal_processing ()
34 sep_span_p_->set_bounds (RIGHT, get_staff_info ().command_pcol_l ());
35 typeset_element (sep_span_p_);
36 sep_span_p_ =0;
39 void
40 Separating_line_group_engraver::acknowledge_element (Score_element_info i)
42 Item * it = dynamic_cast <Item *> (i.elem_l_);
43 if (it && !it->parent_l (X_AXIS))
45 bool ib =it->breakable_b ();
46 Single_malt_grouping_item *&p_ref_ (ib ? break_malt_p_
47 : nobreak_malt_p_);
49 if (!p_ref_)
51 p_ref_ = new Single_malt_grouping_item;
52 if (ib)
53 p_ref_->set_elt_property ("breakable", SCM_BOOL_T);
54 announce_element (Score_element_info (p_ref_, 0));
56 p_ref_->add_item (it);
60 void
61 Separating_line_group_engraver::do_pre_move_processing ()
63 if (break_malt_p_)
65 sep_span_p_->add_spacing_unit (break_malt_p_);
67 typeset_element (break_malt_p_);
68 break_malt_p_ =0;
70 if (nobreak_malt_p_)
72 sep_span_p_->add_spacing_unit (nobreak_malt_p_);
73 typeset_element (nobreak_malt_p_);
74 nobreak_malt_p_ =0;
80 ADD_THIS_TRANSLATOR( Separating_line_group_engraver);