2 request.cc -- implement all musical requests.
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "musical-request.hh"
12 #include "music-list.hh"
15 Tremolo_req::Tremolo_req ()
20 Melodic_req::transpose (Pitch delta)
22 Pitch p = *unsmob_pitch (get_mus_property ("pitch"));
26 if (abs (p.alteration_i_) > 2)
28 warning (_f ("Transposition by %s makes accidental larger than two",
32 set_mus_property ("pitch", p.smobbed_copy ());
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 Rhythmic_req::do_equal_b (Request const* r) const
45 Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
47 return rh; // ; && !compare (*this, *rh);
53 Rhythmic_req::length_mom () const
55 return unsmob_duration (get_mus_property ("duration"))->length_mom ();
60 Rhythmic_req::compress (Moment m)
62 Duration *d = unsmob_duration (get_mus_property ("duration"));
64 set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ());
68 Note_req::do_equal_b (Request const* r) const
70 Note_req const* n = dynamic_cast<Note_req const*> (r);
71 return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
81 Span_req::do_equal_b (Request const*r) const
83 Span_req const* s = dynamic_cast <Span_req const*> (r);
84 return s && get_span_dir () == s->get_span_dir ();
93 Text_script_req::do_equal_b (Request const* r) const
95 Text_script_req const* t = dynamic_cast<Text_script_req const*> (r);
96 return t && gh_equal_p (get_mus_property ("text"),
97 t->get_mus_property ("text"));
101 Articulation_req::do_equal_b (Request const* r) const
103 Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
105 return a && gh_equal_p (get_mus_property ("articulation-type"),
106 r->get_mus_property ("articulation-type"))
107 && get_direction () == a->get_direction ();