lilypond-1.5.9
[lilypond.git] / lily / script-def.cc
blobb2ea20deb99678f89a433491f75335d25d2ac366
1 /*
2 script-def.cc -- implement
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "debug.hh"
10 #include "script-def.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
15 Script_def::Script_def()
17 inside_staff_b_ = false;
18 symidx_str_ = "unknown" ;
19 rel_stem_dir_ =CENTER;
20 staff_dir_ = DOWN;
21 invertsym_b_ = 0;
22 priority_i_ =0;
25 void
26 Script_def::set_from_input (String idx, bool follow, int stem, int staff ,bool invert, int priority_i)
28 inside_staff_b_ = follow;
29 symidx_str_ = idx ;
30 rel_stem_dir_ =Direction(stem);
31 staff_dir_ = Direction(staff);
32 invertsym_b_ = invert;
33 priority_i_ =priority_i;
37 void
38 Script_def::do_print() const
40 #ifndef NPRINT
41 DOUT << "Script_def{ idx: " << symidx_str_
42 << " direction, stem: " << rel_stem_dir_ << " staff : " << staff_dir_ << "}\n";
43 #endif
46 bool
47 Script_def::do_equal_b (General_script_def const *g) const
49 Script_def const * c = dynamic_cast<Script_def const*> (g);
50 return c&& (symidx_str_ == c->symidx_str_ &&
51 rel_stem_dir_ == c->rel_stem_dir_&&
52 staff_dir_ == c->staff_dir_&&
53 invertsym_b_ == c->invertsym_b_);
56 Direction
57 Script_def::staff_dir() const
59 return staff_dir_;
62 Direction
63 Script_def::rel_stem_dir() const
65 return rel_stem_dir_;
68 bool
69 Script_def::inside_b() const
71 return inside_staff_b_;
74 Molecule
75 Script_def::get_molecule (Paper_def *p , Direction d) const
77 String preidx_str ="";
78 if (invertsym_b_)
79 preidx_str = (d < 0)? "d" : "u";
81 return p->lookup_l(0)->script (preidx_str + symidx_str_);
87 int
88 Script_def::priority_i() const
90 return priority_i_;