2 request.cc -- implement all musical requests.
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "musical-request.hh"
13 #include "music-list.hh"
16 Span_req::do_print () const
23 Tremolo_req::Tremolo_req ()
29 Tremolo_req::do_print () const
32 DOUT
<< "type " << type_i_
<< '\n';
40 Melodic_req::transpose (Musical_pitch delta
)
42 pitch_
.transpose (delta
);
44 if (abs (pitch_
.accidental_i_
) > 2)
46 warning (_f ("transposition by %s makes accidental larger than two",
54 Melodic_req::do_equal_b (Request
*r
) const
56 Melodic_req
* m
= dynamic_cast <Melodic_req
*> (r
);
57 return m
&& !compare (*m
, *this);
61 Melodic_req::compare (Melodic_req
const &m1
, Melodic_req
const&m2
)
63 return Musical_pitch::compare (m1
.pitch_
, m2
.pitch_
);
67 Melodic_req::do_print () const
76 Rhythmic_req::compare (Rhythmic_req
const &r1
, Rhythmic_req
const &r2
)
78 return (r1
.length_mom () - r2
.length_mom ());
82 Rhythmic_req::do_equal_b (Request
*r
) const
84 Rhythmic_req
* rh
= dynamic_cast <Rhythmic_req
*> (r
);
86 return rh
&& !compare (*this, *rh
);
90 Rhythmic_req::do_print () const
93 DOUT
<< "duration { " <<duration_
.str () << "}";
99 Rhythmic_req::length_mom () const
101 return duration_
.length_mom ();
105 Rhythmic_req::compress (Moment m
)
107 duration_
.compress (m
);
111 Lyric_req::do_print () const
114 Rhythmic_req::do_print ();
115 DOUT
<< "text = " << text_str_
;
121 Note_req::do_equal_b (Request
*r
) const
123 Note_req
*n
= dynamic_cast<Note_req
*> (r
);
124 return n
&& Rhythmic_req::do_equal_b (n
) && Melodic_req::do_equal_b (n
);
128 Note_req::Note_req ()
130 cautionary_b_
= false;
137 Note_req::do_print () const
140 Melodic_req::do_print ();
143 DOUT
<< " force cautionary accidental\n";
145 else if (forceacc_b_
)
147 DOUT
<< " force accidental\n";
149 Rhythmic_req::do_print ();
155 Span_req::do_equal_b (Request
*r
) const
157 Span_req
* s
= dynamic_cast <Span_req
*> (r
);
158 return s
&& span_dir_
== s
->span_dir_
;
161 Span_req::Span_req ()
168 Text_script_req::do_print () const
170 DOUT
<< "text" << text_str_
171 << ", style = " << style_str_
;
175 Text_script_req::do_equal_b (Request
*r
) const
177 Text_script_req
* t
= dynamic_cast<Text_script_req
*>(r
);
178 return t
&& t
->text_str_
== text_str_
&& t
->style_str_
== style_str_
;
182 Articulation_req::do_print () const
184 DOUT
<< articulation_str_
;
188 Articulation_req::do_equal_b (Request
*r
) const
190 Articulation_req
* a
= dynamic_cast<Articulation_req
*>(r
);
192 return a
&& articulation_str_
== a
->articulation_str_
;