]> git.donarmstrong.com Git - lilypond.git/blob - src/request.cc
release: 0.0.26
[lilypond.git] / src / request.cc
1 #include "request.hh"
2 #include "misc.hh"
3 #include "debug.hh"
4 #include "scriptdef.hh"
5 #include "textdef.hh"
6
7 #include "inputcommand.hh"
8
9 void
10 Stem_req::do_print() const
11 {
12     Rhythmic_req::do_print();    
13 }
14
15 Stem_req::Stem_req(int s, int d)
16     : Rhythmic_req(s,d)
17 {
18 }
19
20 /****************/
21 void
22 Barcheck_req::do_print() const    
23 {
24 #ifndef NPRINT
25
26 #endif
27 }
28
29 /****************/
30
31 void
32 Request::print() const
33
34 {
35     mtor << name() << " {";
36     do_print();
37     mtor << "}\n";
38 }
39      
40
41 void
42 Request::do_print() const    
43 {
44 #ifndef NPRINT
45 #endif
46 }
47
48 void
49 Span_req::do_print() const    
50 {
51 #ifndef NPRINT
52     mtor  << spantype ;
53 #endif
54 }
55
56 Request::Request()
57 {
58     elt_l_ = 0;
59 }
60 Request::Request(Request const&)
61 {
62     elt_l_ = 0;
63 }
64 /****************/
65 Melodic_req::Melodic_req()
66 {
67     notename = 0;
68     octave = 0;
69     accidental = 0;
70     forceacc = false;
71 }
72
73 void
74 Melodic_req::do_print() const
75 {
76     mtor << "notename: " << notename << " oct: "<< octave;
77 }
78
79 int
80 Melodic_req::height() const
81 {
82     return  notename + octave*7;
83 }
84
85 /****************/
86 int
87 Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
88 {
89     return r1.duration() - r2.duration();
90 }
91 Rhythmic_req::Rhythmic_req(int b, int d)
92 {
93     plet_factor = 1;
94     balltype = b;
95     dots = d;
96 }
97
98 Rhythmic_req::Rhythmic_req()
99 {
100     plet_factor = 1;
101     balltype = 1;
102     dots = 0;
103 }
104
105 void
106 Rhythmic_req::do_print() const
107 {
108     mtor << "ball: " << balltype ;
109     int d =dots;
110     while (d--)
111         mtor << '.';
112     
113     mtor<<", plet factor"<<plet_factor<<"\n";
114 }
115
116
117 Moment
118 Rhythmic_req::duration() const {    
119     return wholes(balltype,dots)*plet_factor;
120 }
121 /****************/
122
123 Lyric_req::Lyric_req(Text_def* def_p)
124     :Text_req(0, def_p)
125 {
126     def_p->align_i_ = 1;        // raggedright
127     dir_i_ = -1;                // lyrics below (invisible) staff
128 }
129
130 void
131 Lyric_req::do_print() const
132 {    
133     Rhythmic_req::do_print();
134     Text_req::do_print();
135 }
136 /****************/
137 void
138 Note_req::do_print() const
139 {
140     Melodic_req::do_print();
141     Rhythmic_req::do_print();
142 }
143 /****************/
144 void
145 Rest_req::do_print() const
146 {
147         Rhythmic_req::do_print();
148 }
149
150 /****************/
151 Beam_req::Beam_req()
152 {
153     nplet = 0;
154 }
155
156 void Beam_req::do_print()const{}
157 /****************/
158 void Slur_req::do_print()const{}
159 /****************/
160 int
161 Span_req:: compare(const Span_req &r1, const Span_req &r2)
162 {
163      return r1.spantype - r2.spantype;
164 }
165
166 Span_req::Span_req()
167 {
168     spantype = NOSPAN;
169 }
170 /****************/
171 Script_req::Script_req(int d , Script_def*def)
172 {
173     dir = d;
174     scriptdef = def;
175 }
176
177 Script_req::Script_req(Script_req const &s)
178 {
179     dir = s.dir;
180     scriptdef = new Script_def(*s.scriptdef);
181 }
182
183 void
184 Script_req::do_print() const
185 {
186     mtor << " dir " << dir ;
187     scriptdef->print();
188 }
189
190
191 Script_req::~Script_req()
192 {
193     delete scriptdef;
194 }
195 /****************/
196
197 Text_req::~Text_req()
198 {
199     delete tdef_p_;
200     tdef_p_ = 0;
201 }
202
203 Text_req::Text_req(Text_req const& src)
204 {
205     tdef_p_ = new Text_def(*src.tdef_p_);
206     dir_i_ = src.dir_i_;
207 }
208
209 Text_req::Text_req(int dir_i, Text_def* tdef_p) 
210 {
211     dir_i_ = dir_i;
212     tdef_p_ = tdef_p;
213 }
214
215 void
216 Text_req::do_print() const
217 {
218     mtor << " dir " << dir_i_ ;
219     tdef_p_->print();
220 }
221
222
223
224 /****************/
225
226 Mark_req::Mark_req(String s)
227 {
228     mark_str_ = s;
229 }
230
231 void
232 Mark_req::do_print()const
233 {
234 #ifndef NDEBUG
235     mtor<< " `" << mark_str_ << "\'\n";
236 #endif
237 }
238 /****************/
239 Staff_command_req::Staff_command_req(Input_command * p)
240 {
241     com_p_ = p;
242 }
243 Staff_command_req::~Staff_command_req()
244 {
245     delete com_p_;
246 }
247 Staff_command_req::Staff_command_req(Staff_command_req const&src)
248 {
249     com_p_ = new Input_command(*src.com_p_);
250 }
251 void
252 Staff_command_req::do_print()const
253 {
254     com_p_->print();
255 }
256
257