2 request.cc -- implement all musical requests.
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "musical-request.hh"
12 #include "music-list.hh"
15 Span_req::do_print () const
18 DEBUG_OUT << span_dir_;
22 Tremolo_req::Tremolo_req ()
28 Tremolo_req::do_print () const
31 DEBUG_OUT << "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 const* r) const
52 Melodic_req const* m= dynamic_cast <Melodic_req const*> (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 const* r) const
80 Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
82 return rh && !compare (*this, *rh);
86 Rhythmic_req::do_print () const
89 DEBUG_OUT << "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 DEBUG_OUT << "text = " << text_str_;
117 Note_req::do_equal_b (Request const* r) const
119 Note_req const* n = dynamic_cast<Note_req const*> (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 DEBUG_OUT << " force cautionary accidental\n";
141 else if (forceacc_b_)
143 DEBUG_OUT << " force accidental\n";
145 Rhythmic_req::do_print ();
151 Span_req::do_equal_b (Request const*r) const
153 Span_req const* s = dynamic_cast <Span_req const*> (r);
154 return s && span_dir_ == s->span_dir_;
157 Span_req::Span_req ()
163 Text_script_req::do_print () const
165 DEBUG_OUT << "text" << text_str_
166 << ", style = " << style_str_;
170 Text_script_req::do_equal_b (Request const* r) const
172 Text_script_req const* t = dynamic_cast<Text_script_req const*> (r);
173 return t && t->text_str_ == text_str_ && t->style_str_ == style_str_;
177 Articulation_req::do_print () const
179 DEBUG_OUT << articulation_str_;
183 Articulation_req::do_equal_b (Request const* r) const
185 Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
187 return a && articulation_str_ == a->articulation_str_;
191 Script_req::Script_req ()
193 set_direction (CENTER);