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 (SCM s)
28 set_elt_pointer ("bars", SCM_EOL);
29 Side_position_interface (this).set_axis (Y_AXIS);
30 directional_element (this).set (UP);
35 this is too complicated. Yet another version of side-positioning,
40 * Should look for system_start_delim to find left edge of staff.
45 GLUE_SCORE_ELEMENT(Volta_spanner,brew_molecule);
47 Volta_spanner::member_brew_molecule () const
51 Link_array<Bar> bar_arr
52 = Pointer_group_interface__extract_elements (this, (Bar*)0, "bars");
55 return mol.create_scheme();
57 bool no_vertical_start = false;
58 bool no_vertical_end = to_boolean (get_elt_property ("last-volta"));
59 Spanner *orig_span = dynamic_cast<Spanner*> (original_l_);
60 if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)this))
61 no_vertical_start = true;
62 if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)this))
63 no_vertical_end = true;
67 if (bar_arr.top ()->get_elt_property (type_str_.length_i () > 1)
68 no_vertical_end = false;
71 Real staff_space = paper_l ()->get_var ("interline");
72 Real half_space = staff_space / 2;
74 Real w = spanner_length ()
75 - get_broken_left_end_align ()
77 Real h = paper_l()->get_var ("volta_spanner_height");
78 Real t = paper_l ()->get_var ("volta_thick");
80 SCM at = (gh_list (ly_symbol2scm ("volta"),
84 gh_int2scm (no_vertical_start),
85 gh_int2scm (no_vertical_end),
88 Box b (Interval (0, w), Interval (0, h));
89 Molecule volta (b, at);
90 mol.add_molecule (volta);
92 Molecule num (lookup_l ()->text ("volta",
93 ly_scm2string (get_elt_property("text")),
96 mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
98 return mol.create_scheme();
102 Volta_spanner::do_add_processing ()
104 Link_array<Bar> bar_arr
105 = Pointer_group_interface__extract_elements (this, (Bar*)0, "bars");
109 set_bound (LEFT, bar_arr[0]);
110 set_bound (RIGHT, bar_arr.top ());
114 GLUE_SCORE_ELEMENT(Volta_spanner,after_line_breaking);
116 Volta_spanner::member_after_line_breaking ()
118 Side_position_interface (this).add_staff_support ();
119 return SCM_UNDEFINED;
123 Volta_spanner::add_bar (Bar* b)
125 Pointer_group_interface gi(this, "bars");
128 Side_position_interface (this).add_support (b);
133 Volta_spanner::add_column (Note_column* c)
135 Side_position_interface (this).add_support (c);