2 vertical-align-grav.cc -- implement Vertical_align_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 #include "translator-group.hh"
9 #include "axis-group-engraver.hh"
10 #include "paper-column.hh"
11 #include "vertical-align-engraver.hh"
12 #include "axis-align-spanner.hh"
13 #include "axis-group-spanner.hh"
14 #include "span-bar.hh"
15 #include "axis-group-interface.hh"
17 Vertical_align_engraver::Vertical_align_engraver()
23 Vertical_align_engraver::do_creation_processing()
25 valign_p_ =new Axis_align_spanner;
26 valign_p_->set_axis (Y_AXIS);
27 valign_p_->set_elt_property ("stacking-dir", gh_int2scm (DOWN));
29 valign_p_->set_bound(LEFT,get_staff_info().command_pcol_l ());
30 announce_element (Score_element_info (valign_p_ , 0));
34 Vertical_align_engraver::do_removal_processing()
36 SCM min = get_property ("maxVerticalAlign");
37 SCM max = get_property ("minVerticalAlign");
39 if (gh_number_p (min) || gh_number_p (max))
41 min = gh_number_p (min) ? min : gh_double2scm (0.0);
42 max = gh_number_p (max) ? max : gh_double2scm (infinity_f);
44 valign_p_->set_elt_property ("threshold",
47 valign_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ());
48 typeset_element (valign_p_);
54 Vertical_align_engraver::qualifies_b (Score_element_info i) const
56 int sz = i.origin_trans_l_arr ((Translator*)this).size() ;
59 Axis_group_interface agi(i.elem_l_);
61 return sz > 1 && agi.has_interface_b ()
62 && !i.elem_l_->parent_l (Y_AXIS) && agi.axis_b (Y_AXIS);
66 Vertical_align_engraver::acknowledge_element (Score_element_info i)
70 valign_p_->add_element (i.elem_l_);
75 else if (dynamic_cast<Span_bar*>(i.elem_l_) && i.origin_trans_l_arr (this).size ())
77 i.elem_l_->add_dependency (valign_p_);
83 ADD_THIS_TRANSLATOR(Vertical_align_engraver);