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 Abbreviation_req::Abbreviation_req ()
29 Abbreviation_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 Articulation_req::do_print () const
177 DOUT << articulation_str_;
181 Articulation_req::do_equal_b (Request*r) const
183 Articulation_req * a = dynamic_cast<Articulation_req*>(r);
185 return a && articulation_str_ == a->articulation_str_;