2 volta-spanner.cc -- implement Volta_spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "molecule.hh"
14 #include "note-column.hh"
16 #include "paper-def.hh"
17 #include "volta-spanner.hh"
19 #include "text-def.hh"
22 Hmm, should probably make generic Bracket_spanner,
23 or and derive Plet and volta spanner from that.
26 Volta_spanner::Volta_spanner ()
30 tdef_p_.set_p (new Text_def);
31 tdef_p_->align_dir_ = CENTER;
32 tdef_p_->style_str_ = "nummer";
36 Volta_spanner::brew_molecule_p () const
38 Molecule* mol_p = new Molecule;
40 if (column_arr_.size ()){
41 Real w = width ().length ();
42 Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_]
43 - column_arr_[0]->extent (Y_AXIS) [dir_];
45 Atom num (tdef_p_->get_atom (paper (), CENTER));
46 mol_p->add_atom (num);
47 mol_p->add_atom (lookup_l ()->volta (w, last_b_));
53 Volta_spanner::do_add_processing ()
55 if (column_arr_.size ())
57 set_bounds (LEFT, column_arr_[0]);
58 set_bounds (RIGHT, column_arr_.top ());
63 Volta_spanner::do_post_processing ()
65 if (column_arr_.size())
66 translate_axis (column_arr_[0]->extent (Y_AXIS)[dir_], Y_AXIS);
70 Volta_spanner::do_substitute_dependency (Score_element* o, Score_element* n)
72 if (Note_column *onc = dynamic_cast <Note_column *> (o))
73 column_arr_.substitute (onc, dynamic_cast<Note_column*> (n));
77 Volta_spanner::add_column (Note_column*n)