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_atom (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_atom (paper (), dir_
).extent ().y ();
100 Script::symbol_width () const
102 return specs_p_
->width (paper ());
106 Script::brew_molecule_p () const
110 Molecule
*mol_p
= new Molecule (specs_p_
->get_atom (paper (), dir_
));
112 ugh, staccato dots are not centred between stafflines (how?)?
115 if (axis_
== Y_AXIS
){
116 dx
= paper ()->note_width ()/2;
117 correct
= - (Real
)dir_
* 2.0 * paper ()->rule_thickness ();
118 mol_p
->translate_axis (dx
, X_AXIS
); // FIXME! ugh
121 mol_p
->translate_axis (coordinate_offset_f_
+ correct
, axis_
);
130 Script::compare (Script
*const&l1
, Script
*const&l2
)
132 return l1
->specs_p_
->priority_i() - l2
->specs_p_
->priority_i ();
140 Script::Script (Script
const&s
)
141 : Item (s
), Staff_side(s
)
143 specs_p_
= s
.specs_p_
? s
.specs_p_
->clone (): 0;
145 postbreak_only_b_
= s
.postbreak_only_b_
;