2 bar-script-engraver.cc -- implement Bar_script_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "bar-script-engraver.hh"
12 #include "clef-item.hh"
13 #include "g-staff-side.hh"
14 #include "g-text-item.hh"
15 #include "lily-guile.hh"
17 Bar_script_engraver::Bar_script_engraver ()
22 hang_on_clef_b_ = false;
24 = gh_eval_str ("non_postbreak_visibility");
28 Bar_script_engraver::do_creation_processing ()
30 Scalar prop = get_property (type_ + "HangOnClef", 0);
33 hang_on_clef_b_ = true;
38 Bar_script_engraver::do_acknowledge_element (Item *i)
40 Axis other_axis = Axis((axis_ + 1)%2);
41 if (staff_side_p_ && !staff_side_p_->dim_cache_[other_axis].parent_l_)
43 staff_side_p_->dim_cache_[other_axis].parent_l_
44 = &i->dim_cache_[other_axis];
45 staff_side_p_->dim_cache_[axis_].parent_l_
46 = &i->dim_cache_[axis_];
48 staff_side_p_->add_support (i);
49 i->add_dependency (staff_side_p_); // UGH.
55 Bar_script_engraver::cast_to_interesting_item (Score_element *e)
60 Clef_item * c = dynamic_cast<Clef_item*> (e);
64 if (c) // && c->default_b_)
71 i = dynamic_cast<Bar*> (e);
77 Bar_script_engraver::acknowledge_element (Score_element_info inf)
79 if (inf.origin_grav_l_arr_.size () == 1)
81 Item *i=cast_to_interesting_item (inf.elem_l_);
85 /* Only put numbers on bars that are at our own level (don't put
86 numbers over the staffs of a GrandStaff, only over the GrandStaff
88 if (inf.origin_grav_l_arr_.size () != 1)
91 do_acknowledge_element (i);
96 Bar_script_engraver::do_pre_move_processing ()
100 typeset_element (text_p_);
106 typeset_element (staff_side_p_);
113 Bar_script_engraver::create_items (Request *rq)
115 if (staff_side_p_ || text_p_)
118 staff_side_p_ = new G_staff_side_item;
119 staff_side_p_->axis_ = axis_;
120 staff_side_p_->set_elt_property (breakable_scm_sym, SCM_BOOL_T); // ugh
123 text_p_ = new G_text_item;
124 text_p_->set_elt_property (breakable_scm_sym, SCM_BOOL_T); // ugh
126 Scalar prop = get_property (type_ + "Direction", 0);
129 staff_side_p_->dir_ = (Direction) (int) prop;
133 staff_side_p_->dir_ = UP;
136 staff_side_p_->set_victim(text_p_);
138 Scalar padding = get_property (type_ + "ScriptPadding", 0);
139 if (padding.length_i() && padding.isnum_b ())
141 staff_side_p_->padding_f_ = Real(padding);
145 staff_side_p_->set_elt_property (visibility_lambda_scm_sym,
147 text_p_->set_elt_property (visibility_lambda_scm_sym,
150 announce_element (Score_element_info (text_p_, rq));
151 announce_element (Score_element_info (staff_side_p_, rq));