lilypond-1.3.145
[lilypond.git] / lily / bar-column-engraver.cc
blobd3c0a1af5675a36ac23d6d8ab9d516f63ed069f4
1 /*
2 bar-column-grav.cc -- implement Bar_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
10 #include "bar-column-engraver.hh"
11 #include "bar-column.hh"
12 #include "request.hh"
13 #include "script.hh"
14 #include "bar.hh"
15 #include <typeinfo>
17 Bar_column_engraver::Bar_column_engraver()
19 bar_l_ =0;
20 barcol_p_ =0;
21 break_priority_i_ = 0;
24 void
25 Bar_column_engraver::do_creation_processing ()
30 void
31 Bar_column_engraver::do_process_requests ()
33 Scalar pri = get_property ("barColumnPriority", 0);
34 if (pri.length_i() && pri.isnum_b ())
36 break_priority_i_ = int(pri);
40 void
41 Bar_column_engraver::create_column ()
43 if (!barcol_p_)
45 barcol_p_ = new Bar_column;
46 barcol_p_->breakable_b_ =true;
47 barcol_p_->break_priority_i_ = break_priority_i_;
48 announce_element (Score_element_info (barcol_p_, 0));
53 void
54 Bar_column_engraver::acknowledge_element (Score_element_info info)
56 Item * it = dynamic_cast <Item *> (info.elem_l_);
57 if (!it)
58 return;
59 Script *s = dynamic_cast<Script*> (it);
60 Bar *b = dynamic_cast<Bar*> (it);
61 if (s
62 && it->breakable_b_
63 && info.origin_grav_l_arr_.size() == 1
64 && it->break_priority_i_ == break_priority_i_)
66 create_column ();
67 barcol_p_->add_script (s);
69 else if (info.origin_grav_l_arr_.size() == 1
70 && it->break_priority_i_ == break_priority_i_
71 && it->breakable_b_
72 &&b)
75 create_column ();
76 barcol_p_->set_bar (b);
81 void
82 Bar_column_engraver::process_acknowledged ()
88 void
89 Bar_column_engraver::do_pre_move_processing()
91 if (barcol_p_)
93 typeset_element (barcol_p_);
94 barcol_p_ =0;
98 void
99 Bar_column_engraver::do_post_move_processing()
101 script_l_arr_.clear();
102 bar_l_ =0;
106 ADD_THIS_TRANSLATOR(Bar_column_engraver);