2 request.cc -- implement all musical requests.
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "musicalrequest.hh"
12 #include "scriptdef.hh"
16 Stem_req::do_print() const
18 Rhythmic_req::do_print();
19 mtor
<< "dir : " << dir_i_
;
22 Stem_req::Stem_req(int s
, int d
)
29 void Musical_req::do_print()const{}
30 void Request::do_print() const{}
35 Request::print() const
37 mtor
<< name() << " {";
45 Span_req::do_print() const
57 Request::Request(Request
const&src
)
60 defined_ch_c_l_
= src
.defined_ch_c_l_
;
63 Spacing_req::Spacing_req()
70 Spacing_req::do_print()const
72 mtor
<< "next " << next
<< "dist " << distance
<< "strength\n";
75 Blank_req::do_print()const
77 Spacing_req::do_print();
80 Melodic_req::Melodic_req()
89 Melodic_req::do_print() const
91 mtor
<< "notename: " << notename_i_
<< " oct: "<< octave_i_
;
95 Melodic_req::height() const
97 return notename_i_
+ octave_i_
*7;
100 /* *************** */
102 Rhythmic_req::compare(const Rhythmic_req
&r1
, const Rhythmic_req
&r2
)
104 return sign(r1
.duration() - r2
.duration());
106 Rhythmic_req::Rhythmic_req(int b
, int d
)
113 Rhythmic_req::Rhythmic_req()
121 Rhythmic_req::do_print() const
123 mtor
<< "ball: " << balltype
;
128 mtor
<<", plet factor"<<plet_factor
<<"\n";
133 Rhythmic_req::duration() const {
134 return wholes(balltype
,dots
)*plet_factor
;
136 /* *************** */
138 Lyric_req::Lyric_req(Text_def
* def_p
)
141 def_p
->align_i_
= 1; // raggedright
142 dir_i_
= -1; // lyrics below (invisible) staff
146 Lyric_req::do_print() const
148 Rhythmic_req::do_print();
149 Text_req::do_print();
151 /* *************** */
153 Note_req::do_print() const
155 Melodic_req::do_print();
156 Rhythmic_req::do_print();
158 /* *************** */
160 Rest_req::do_print() const
162 Rhythmic_req::do_print();
165 /* *************** */
171 void Beam_req::do_print()const{}
172 /* *************** */
173 void Slur_req::do_print()const{}
174 /* *************** */
176 Span_req:: compare(const Span_req
&r1
, const Span_req
&r2
)
178 return r1
.spantype
- r2
.spantype
;
186 /* *************** */
187 Script_req::Script_req(int d
, Script_def
*def
)
194 Script_req::compare(const Script_req
&d1
, const Script_req
&d2
)
196 return d1
.dir_i_
== d2
.dir_i_
&&
197 d1
.scriptdef_p_
->compare(*d2
.scriptdef_p_
);
200 Script_req::Script_req(Script_req
const &s
)
204 scriptdef_p_
= new Script_def(*s
.scriptdef_p_
);
208 Script_req::do_print() const
210 mtor
<< " dir " << dir_i_
;
211 scriptdef_p_
->print();
215 Script_req::~Script_req()
219 /* *************** */
221 Text_req:: compare(const Text_req
&r1
, const Text_req
&r2
)
223 bool b1
= (r1
.dir_i_
== r2
.dir_i_
);
224 bool b2
= (r1
.tdef_p_
->compare(*r2
.tdef_p_
));
227 Text_req::~Text_req()
233 Text_req::Text_req(Text_req
const& src
)
235 tdef_p_
= new Text_def(*src
.tdef_p_
);
239 Text_req::Text_req(int dir_i
, Text_def
* tdef_p
)
246 Text_req::do_print() const
248 mtor
<< " dir " << dir_i_
;
252 /* *************** */
255 Skip_req::duration() const
261 Skip_req::do_print() const
263 mtor
<< "duration: " << duration();