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"
12 #include "music-list.hh"
15 Span_req::do_print () const
22 Tremolo_req::Tremolo_req ()
28 Tremolo_req::do_print () const
31 DOUT << "type " << type_i_ << '\n';
36 Melodic_req::transpose (Musical_pitch delta)
38 pitch_.transpose (delta);
40 if (abs (pitch_.accidental_i_) > 2)
42 warning (_f ("transposition by %s makes accidental larger than two",
50 Melodic_req::do_equal_b (Request*r) const
52 Melodic_req* m= dynamic_cast <Melodic_req *> (r);
53 return m&& !compare (*m, *this);
57 Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2)
59 return Musical_pitch::compare (m1.pitch_, m2.pitch_);
63 Melodic_req::do_print () const
72 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
74 return (r1.length_mom () - r2.length_mom ());
78 Rhythmic_req::do_equal_b (Request*r) const
80 Rhythmic_req* rh = dynamic_cast <Rhythmic_req *> (r);
82 return rh && !compare (*this, *rh);
86 Rhythmic_req::do_print () const
89 DOUT << "duration { " <<duration_.str () << "}";
95 Rhythmic_req::length_mom () const
97 return duration_.length_mom ();
101 Rhythmic_req::compress (Moment m)
103 duration_.compress (m);
107 Lyric_req::do_print () const
110 Rhythmic_req::do_print ();
111 DOUT << "text = " << text_str_;
117 Note_req::do_equal_b (Request*r) const
119 Note_req *n = dynamic_cast<Note_req*> (r);
120 return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
124 Note_req::Note_req ()
126 cautionary_b_ = false;
133 Note_req::do_print () const
136 Melodic_req::do_print ();
139 DOUT << " force cautionary accidental\n";
141 else if (forceacc_b_)
143 DOUT << " force accidental\n";
145 Rhythmic_req::do_print ();
151 Span_req::do_equal_b (Request*r) const
153 Span_req * s = dynamic_cast <Span_req *> (r);
154 return s && span_dir_ == s->span_dir_;
157 Span_req::Span_req ()
162 Abbreviation_beam_req::Abbreviation_beam_req ()
168 Abbreviation_beam_req::do_print () const
176 Text_script_req::do_print () const
178 DOUT << "text" << text_str_
179 << ", style = " << style_str_;
183 Text_script_req::do_equal_b (Request *r) const
185 Text_script_req * t = dynamic_cast<Text_script_req*>(r);
186 return t && t->text_str_ == text_str_ && t->style_str_ == style_str_;
190 Articulation_req::do_print () const
192 DOUT << articulation_str_;
196 Articulation_req::do_equal_b (Request*r) const
198 Articulation_req * a = dynamic_cast<Articulation_req*>(r);
200 return a && articulation_str_ == a->articulation_str_;