2 script.cc -- implement Script
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 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_dependency (Score_element*o,Score_element*n)
27 Staff_side::do_substitute_dependency (o,n);
30 stem_l_ = dynamic_cast<Stem *> (n);
35 Script::set_stem (Stem*st_l)
47 postbreak_only_b_ = true;
52 Script::set_default_dir ()
54 int s_i=specs_p_->rel_stem_dir ();
58 dir_ = Direction (stem_l_->dir_ * s_i);
61 specs_p_->warning (_ ("script needs stem direction"));
67 dir_ =specs_p_->staff_dir ();
74 Script::do_width () const
76 return specs_p_->get_molecule (paper (), dir_).extent ().x ();
80 Script::do_pre_processing ()
82 Staff_side::do_pre_processing ();
83 if (breakable_b_ && postbreak_only_b_ && (break_status_dir () != RIGHT))
85 transparent_b_ = true;
89 if (axis_ == Y_AXIS && !dir_)
94 Script::symbol_height () const
96 return specs_p_->get_molecule (paper (), dir_).extent ().y ();
101 Script::do_brew_molecule_p () const
105 Molecule*mol_p = new Molecule (specs_p_->get_molecule (paper (), dir_));
107 ugh, staccato dots are not centred between stafflines (how?)?
110 if (axis_ == Y_AXIS){
111 dx = paper ()->note_width ()/2;
112 correct = - (Real)dir_ * 2.0 * paper ()->rule_thickness ();
113 mol_p->translate_axis (dx, X_AXIS); // FIXME! ugh
116 mol_p->translate_axis (coordinate_offset_f_ + correct, axis_);
125 Script::compare (Script *const&l1, Script *const&l2)
127 return l1->specs_p_->priority_i() - l2->specs_p_->priority_i ();
135 Script::Script (Script const&s)
136 : Item (s), Staff_side(s)
138 specs_p_ = s.specs_p_ ? s.specs_p_->clone (): 0;
140 postbreak_only_b_ = s.postbreak_only_b_;