]> git.donarmstrong.com Git - lilypond.git/blob - lily/script-def.cc
release: 0.1.11
[lilypond.git] / lily / script-def.cc
1 /*
2   script-def.cc -- implement 
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "debug.hh"
10 #include "script-def.hh"
11 #include "symbol.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14
15 Script_def::Script_def()
16 {
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;
23 }
24
25 void
26 Script_def::set_from_input (String idx,  bool follow, int stem, int staff ,bool invert, int priority_i)
27 {
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;
34 }
35
36
37 void
38 Script_def::do_print() const
39 {
40 #ifndef NPRINT
41   DOUT << "Script_def{ idx: " << symidx_str_ 
42        << " direction, stem: " << rel_stem_dir_ << " staff : " << staff_dir_ << "}\n";
43 #endif
44 }
45
46 bool
47 Script_def::do_equal_b (General_script_def const *g) const 
48 {
49   Script_def const * c = (Script_def const*) g;
50   return (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_);
54 }
55
56 Direction
57 Script_def::staff_dir() const
58 {
59   return staff_dir_; 
60 }
61
62 Direction
63 Script_def::rel_stem_dir() const
64 {
65   return rel_stem_dir_; 
66 }
67
68 bool
69 Script_def::inside_b() const
70 {
71   return inside_staff_b_; 
72 }
73
74 Atom
75 Script_def::get_atom (Paper_def *p , Direction d) const
76 {
77   String preidx_str ="";
78   if (invertsym_b_&& d < 0) 
79     preidx_str = "-";
80
81   return p->lookup_l()->script (preidx_str + symidx_str_);
82 }
83
84
85 IMPLEMENT_IS_TYPE_B1(Script_def,General_script_def);
86
87 int
88 Script_def::priority_i() const
89 {
90   return priority_i_;
91 }
92         
93   
94