2 script.cc -- implement Script
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 #include "script-def.hh"
9 #include "musical-request.hh"
10 #include "paper-def.hh"
13 #include "molecule.hh"
17 Script::do_print () const
25 Script::do_substitute_element_pointer (Score_element*o,Score_element*n)
27 Staff_side::do_substitute_element_pointer (o,n);
30 stem_l_ = dynamic_cast<Stem *> (n);
35 Script::set_stem (Stem*st_l)
51 Script::set_default_dir ()
53 int s_i=specs_p_->rel_stem_dir ();
57 dir_ = Direction (stem_l_->dir_ * s_i);
60 specs_p_->warning (_ ("script needs stem direction"));
66 dir_ =specs_p_->staff_dir ();
73 Script::do_width () const
75 return specs_p_->get_molecule (paper_l (), dir_).extent ().x ();
79 Script::do_pre_processing ()
81 Staff_side::do_pre_processing ();
82 if (axis_ == Y_AXIS && !dir_)
87 Script::symbol_height () const
89 return specs_p_->get_molecule (paper_l (), dir_).extent ().y ();
94 Script::do_brew_molecule_p () const
98 Molecule*mol_p = new Molecule (specs_p_->get_molecule (paper_l (), dir_));
100 ugh, staccato dots are not centred between stafflines (how?)?
103 if (axis_ == Y_AXIS){
104 dx = paper_l ()->note_width ()/2;
105 correct = - (Real)dir_ * 2.0 * paper_l ()->rule_thickness ();
106 mol_p->translate_axis (dx, X_AXIS); // FIXME! ugh
109 mol_p->translate_axis (coordinate_offset_f_ + correct, axis_);
118 Script::compare (Script *const&l1, Script *const&l2)
120 return l1->specs_p_->priority_i() - l2->specs_p_->priority_i ();
128 Script::Script (Script const&s)
129 : Item (s), Staff_side(s)
131 specs_p_ = s.specs_p_ ? s.specs_p_->clone (): 0;