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 "note-column.hh"
15 #include "paper-column.hh"
17 #include "paper-def.hh"
18 #include "volta-spanner.hh"
20 #include "dimension-cache.hh"
21 #include "group-interface.hh"
22 #include "side-position-interface.hh"
23 #include "directional-element-interface.hh"
25 Volta_spanner::Volta_spanner ()
27 set_elt_property ("bars", SCM_EOL);
28 Side_position_interface (this).set_axis (Y_AXIS);
29 directional_element (this).set (UP);
34 this is too complicated. Yet another version of side-positioning,
39 * Should look for system_start_delim to find left edge of staff.
44 Volta_spanner::do_brew_molecule () const
48 Link_array<Bar> bar_arr
49 = Group_interface__extract_elements (this, (Bar*)0, "bars");
54 bool no_vertical_start = false;
55 bool no_vertical_end = to_boolean (get_elt_property ("last-volta"));
56 Spanner *orig_span = dynamic_cast<Spanner*> (original_l_);
57 if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)this))
58 no_vertical_start = true;
59 if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)this))
60 no_vertical_end = true;
64 if (bar_arr.top ()->get_elt_property (type_str_.length_i () > 1)
65 no_vertical_end = false;
68 Real staff_space = paper_l ()->get_var ("interline");
69 Real half_space = staff_space / 2;
71 Real w = spanner_length ()
72 - get_broken_left_end_align ()
74 Real h = paper_l()->get_var ("volta_spanner_height");
75 Real t = paper_l ()->get_var ("volta_thick");
77 SCM at = (gh_list (ly_symbol2scm ("volta"),
81 gh_int2scm (no_vertical_start),
82 gh_int2scm (no_vertical_end),
85 Box b (Interval (0, w), Interval (0, h));
86 Molecule volta (b, at);
87 mol.add_molecule (volta);
89 Molecule num (lookup_l ()->text ("volta",
90 ly_scm2string (get_elt_property("text")),
93 mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
99 Volta_spanner::do_add_processing ()
102 Link_array<Bar> bar_arr
103 = Group_interface__extract_elements (this, (Bar*)0, "bars");
107 set_bound (LEFT, bar_arr[0]);
108 set_bound (RIGHT, bar_arr.top ());
113 Volta_spanner::after_line_breaking ()
115 Side_position_interface (this).add_staff_support ();
119 Volta_spanner::add_bar (Bar* b)
121 Group_interface gi(this, "bars");
124 Side_position_interface (this).add_support (b);
129 Volta_spanner::add_column (Note_column* c)
131 Side_position_interface (this).add_support (c);