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"
15 #include "paper-def.hh"
16 #include "volta-spanner.hh"
17 #include "group-interface.hh"
18 #include "side-position-interface.hh"
19 #include "directional-element-interface.hh"
23 Volta_spanner::set_interface (Score_element*me)
25 me->set_elt_property ("bars", SCM_EOL);
26 Side_position::set_axis (me, Y_AXIS);
27 Directional_element_interface::set (me, UP);
32 this is too complicated. Yet another version of side-positioning,
37 * Should look for system_start_delim to find left edge of staff.
42 MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule);
44 Volta_spanner::brew_molecule (SCM smob)
46 Score_element *me = unsmob_element (smob);
47 Link_array<Item> bar_arr
48 = Pointer_group_interface__extract_elements (me, (Item*)0, "bars");
53 bool no_vertical_start = false;
54 bool no_vertical_end = to_boolean (me->get_elt_property ("last-volta"));
55 Spanner *orig_span = dynamic_cast<Spanner*> (me->original_l_);
56 if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)me))
57 no_vertical_start = true;
58 if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)me))
59 no_vertical_end = true;
63 if (bar_arr.top ()->me->get_elt_property (type_str_.length_i () > 1)
64 no_vertical_end = false;
67 Real staff_space = me->paper_l ()->get_var ("interline");
68 Real half_space = staff_space / 2;
69 Real left = dynamic_cast<Spanner*>(me)->get_broken_left_end_align ();
70 Real w = dynamic_cast<Spanner*>(me)->spanner_length () - left - half_space;
71 Real h = me->paper_l()->get_var ("volta_spanner_height");
72 Real t = me->paper_l ()->get_var ("volta_thick");
75 ugh: should build from line segments.
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));
87 Molecule num (me->lookup_l ()->text ("volta",
88 ly_scm2string (me->get_elt_property("text")),
91 mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
93 mol.translate_axis (left, X_AXIS);
94 return mol.create_scheme();
99 Volta_spanner::add_bar (Score_element *me, Item* b)
101 Pointer_group_interface gi(me, "bars");
104 Side_position::add_support (me,b);
105 add_bound_item (dynamic_cast<Spanner*>(me), b);
109 Volta_spanner::add_column (Score_element*me, Score_element* c)
111 Side_position::add_support (me,c);