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 "g-staff-side.hh"
13 #include "g-text-item.hh"
14 #include "lily-guile.hh"
16 Bar_script_engraver::Bar_script_engraver ()
22 = gh_eval_str ("(lambda (d) (if (= d -1) '(#t . #t) '(#f . #f)))");
26 Bar_script_engraver::acknowledge_element (Score_element_info i)
28 Axis other_axis = Axis((axis_ + 1)%2);
30 if (staff_side_p_ && !staff_side_p_->dim_cache_[other_axis].parent_l_)
32 Bar * bar_l = dynamic_cast<Bar*> (i.elem_l_);
36 /* Only put numbers on bars that are at our own level (don't put
37 numbers over the staffs of a GrandStaff, only over the GrandStaff
39 if (i.origin_grav_l_arr_.size () == 1)
41 staff_side_p_->dim_cache_[other_axis].parent_l_ = &bar_l->dim_cache_[other_axis];
42 // staff_side_p_->dim_cache_[axis_].parent_l_ = &bar_l->dim_cache_[axis_];
43 staff_side_p_->add_support (i.elem_l_);
44 bar_l->add_dependency (staff_side_p_); // UGH.
50 Bar_script_engraver::do_pre_move_processing ()
54 text_p_->breakable_b_ = true; // ugh
55 typeset_element (text_p_);
61 staff_side_p_->breakable_b_ = true; // ugh
62 typeset_element (staff_side_p_);
69 Bar_script_engraver::create_items (Request *rq)
71 if (staff_side_p_ || text_p_)
74 staff_side_p_ = new G_staff_side_item;
75 staff_side_p_->axis_ = axis_;
77 text_p_ = new G_text_item;
79 Scalar prop = get_property (type_ + "Direction", 0);
82 staff_side_p_->dir_ = (Direction) (int) prop;
86 staff_side_p_->dir_ = UP;
89 staff_side_p_->set_victim(text_p_);
91 Scalar padding = get_property (type_ + "ScriptPadding", 0);
92 if (padding.length_i() && padding.isnum_b ())
94 staff_side_p_->padding_f_ = Real(padding);
97 staff_side_p_->visibility_lambda_ = visibility_lambda_;
98 text_p_->visibility_lambda_ = visibility_lambda_;
100 announce_element (Score_element_info (text_p_, rq));
101 announce_element (Score_element_info (staff_side_p_, rq));