2 volta-spanner.cc -- implement Volta_spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "molecule.hh"
14 #include "paper-column.hh"
16 #include "paper-def.hh"
17 #include "volta-spanner.hh"
18 #include "group-interface.hh"
19 #include "side-position-interface.hh"
20 #include "directional-element-interface.hh"
24 Volta_spanner::set_interface (Score_element*me)
26 me->set_elt_pointer ("bars", SCM_EOL);
27 Side_position_interface (me).set_axis (Y_AXIS);
28 Directional_element_interface (me).set (UP);
33 me is too complicated. Yet another version of side-positioning,
38 * Should look for system_start_delim to find left edge of staff.
43 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Volta_spanner,brew_molecule);
45 Volta_spanner::brew_molecule (SCM smob)
47 Score_element *me = unsmob_element (smob);
48 Link_array<Bar> bar_arr
49 = Pointer_group_interface__extract_elements (me, (Bar*)0, "bars");
54 bool no_vertical_start = false;
55 bool no_vertical_end = to_boolean (me->get_elt_property ("last-volta"));
56 Spanner *orig_span = dynamic_cast<Spanner*> (me->original_l_);
57 if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)me))
58 no_vertical_start = true;
59 if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)me))
60 no_vertical_end = true;
64 if (bar_arr.top ()->me->get_elt_property (type_str_.length_i () > 1)
65 no_vertical_end = false;
68 Real staff_space = me->paper_l ()->get_var ("interline");
69 Real half_space = staff_space / 2;
70 Real left = dynamic_cast<Spanner*>(me)->get_broken_left_end_align ();
71 Real w = dynamic_cast<Spanner*>(me)->spanner_length () - left - half_space;
72 Real h = me->paper_l()->get_var ("volta_spanner_height");
73 Real t = me->paper_l ()->get_var ("volta_thick");
75 SCM at = (gh_list (ly_symbol2scm ("volta"),
79 gh_int2scm (no_vertical_start),
80 gh_int2scm (no_vertical_end),
83 Box b (Interval (0, w), Interval (0, h));
85 Molecule num (me->lookup_l ()->text ("volta",
86 ly_scm2string (me->get_elt_property("text")),
89 mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
91 mol.translate_axis (left, X_AXIS);
92 return mol.create_scheme();
97 Volta_spanner::add_bar (Score_element *me, Item* b)
99 Pointer_group_interface gi(me, "bars");
102 Side_position_interface (me).add_support (b);
103 add_bound_item (dynamic_cast<Spanner*>(me), b);
107 Volta_spanner::add_column (Score_element*me, Score_element* c)
109 Side_position_interface (me).add_support (c);