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