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 Tremolo_req::Tremolo_req ()
22 Melodic_req::transpose (Musical_pitch delta)
24 pitch_.transpose (delta);
26 if (abs (pitch_.accidental_i_) > 2)
28 warning (_f ("Transposition by %s makes accidental larger than two",
36 Melodic_req::do_equal_b (Request const* r) const
38 Melodic_req const* m= dynamic_cast <Melodic_req const*> (r);
39 return m&& !compare (*m, *this);
43 Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2)
45 return Musical_pitch::compare (m1.pitch_, m2.pitch_);
53 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
55 return (r1.length_mom () - r2.length_mom ());
59 Rhythmic_req::do_equal_b (Request const* r) const
61 Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
63 return rh && !compare (*this, *rh);
69 Rhythmic_req::length_mom () const
71 return duration_.length_mom ();
75 Rhythmic_req::compress (Moment m)
77 duration_.compress (m);
83 Note_req::do_equal_b (Request const* r) const
85 Note_req const* n = dynamic_cast<Note_req const*> (r);
86 return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
92 cautionary_b_ = false;
101 Span_req::do_equal_b (Request const*r) const
103 Span_req const* s = dynamic_cast <Span_req const*> (r);
104 return s && span_dir_ == s->span_dir_;
107 Span_req::Span_req ()
114 Text_script_req::do_equal_b (Request const* r) const
116 Text_script_req const* t = dynamic_cast<Text_script_req const*> (r);
117 return t && gh_equal_p (get_mus_property ("text"),
118 t->get_mus_property ("text"));
123 Articulation_req::do_equal_b (Request const* r) const
125 Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
127 return a && articulation_str_ == a->articulation_str_;
131 Script_req::Script_req ()
133 set_direction (CENTER);