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';
39 Melodic_req::transpose (Musical_pitch delta)
41 pitch_.transpose (delta);
43 if (abs (pitch_.accidental_i_) > 2)
45 warning (_f ("transposition by %s makes accidental larger than two",
53 Melodic_req::do_equal_b (Request*r) const
55 Melodic_req* m= dynamic_cast <Melodic_req *> (r);
56 return m&& !compare (*m, *this);
60 Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2)
62 return Musical_pitch::compare (m1.pitch_, m2.pitch_);
66 Melodic_req::do_print () const
75 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
77 return (r1.length_mom () - r2.length_mom ());
81 Rhythmic_req::do_equal_b (Request*r) const
83 Rhythmic_req* rh = dynamic_cast <Rhythmic_req *> (r);
85 return rh && !compare (*this, *rh);
89 Rhythmic_req::do_print () const
92 DOUT << "duration { " <<duration_.str () << "}";
98 Rhythmic_req::length_mom () const
100 return duration_.length_mom ();
104 Rhythmic_req::compress (Moment m)
106 duration_.compress (m);
110 Lyric_req::do_print () const
113 Rhythmic_req::do_print ();
114 DOUT << "text = " << text_str_;
120 Note_req::do_equal_b (Request*r) const
122 Note_req *n = dynamic_cast<Note_req*> (r);
123 return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
127 Note_req::Note_req ()
129 cautionary_b_ = false;
136 Note_req::do_print () const
139 Melodic_req::do_print ();
142 DOUT << " force cautionary accidental\n";
144 else if (forceacc_b_)
146 DOUT << " force accidental\n";
148 Rhythmic_req::do_print ();
154 Span_req::do_equal_b (Request*r) const
156 Span_req * s = dynamic_cast <Span_req *> (r);
157 return s && span_dir_ == s->span_dir_;
160 Span_req::Span_req ()
167 Text_script_req::do_print () const
169 DOUT << "text" << text_str_
170 << ", style = " << style_str_;
174 Text_script_req::do_equal_b (Request *r) const
176 Text_script_req * t = dynamic_cast<Text_script_req*>(r);
177 return t && t->text_str_ == text_str_ && t->style_str_ == style_str_;
181 Articulation_req::do_print () const
183 DOUT << articulation_str_;
187 Articulation_req::do_equal_b (Request*r) const
189 Articulation_req * a = dynamic_cast<Articulation_req*>(r);
191 return a && articulation_str_ == a->articulation_str_;