lilypond-1.4.4
[lilypond.git] / lily / musical-request.cc
blobe4866b6064908b5aa236a9b710713c86fd5617ef
1 /*
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>
7 */
9 #include "musical-request.hh"
10 #include "misc.hh"
11 #include "debug.hh"
12 #include "music-list.hh"
15 Tremolo_req::Tremolo_req ()
19 void
20 Melodic_req::transpose (Pitch delta)
22 Pitch p = *unsmob_pitch (get_mus_property ("pitch"));
24 p.transpose (delta);
26 if (abs (p.alteration_i_) > 2)
28 warning (_f ("Transposition by %s makes accidental larger than two",
29 delta.str ()));
32 set_mus_property ("pitch", p.smobbed_copy ());
35 bool
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);
42 bool
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);
52 Moment
53 Rhythmic_req::length_mom () const
55 return unsmob_duration (get_mus_property ("duration"))->length_mom ();
59 void
60 Rhythmic_req::compress (Moment m)
62 Duration *d = unsmob_duration (get_mus_property ("duration"));
64 set_mus_property ("duration", d ->compressed (m).smobbed_copy ());
67 bool
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);
75 Note_req::Note_req ()
80 bool
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 ();
87 Span_req::Span_req ()
92 bool
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"));
100 bool
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"));