]> git.donarmstrong.com Git - lilypond.git/blob - lily/musical-request.cc
release: 1.3.105
[lilypond.git] / lily / musical-request.cc
1 /*
2   request.cc -- implement all musical requests.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "musical-request.hh"
10 #include "misc.hh"
11 #include "debug.hh"
12 #include "music-list.hh"
13
14
15 Tremolo_req::Tremolo_req ()
16 {
17 }
18
19
20 void
21 Melodic_req::transpose (Musical_pitch delta)
22 {
23   pitch_.transpose (delta);
24   
25   if (abs (pitch_.accidental_i_) > 2)
26     {
27         warning (_f ("Transposition by %s makes accidental larger than two",
28           delta.str ()));
29     }
30 }
31
32 bool
33 Melodic_req::do_equal_b (Request const* r) const
34 {
35   Melodic_req const* m= dynamic_cast <Melodic_req const*> (r);
36   return m&& !compare (*m, *this);
37 }
38
39 int
40 Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2)
41 {
42   return Musical_pitch::compare (m1.pitch_, m2.pitch_);
43 }
44
45 int
46 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
47 {
48   return (r1.length_mom () - r2.length_mom ());
49 }
50
51 bool
52 Rhythmic_req::do_equal_b (Request const* r) const
53 {
54   Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
55
56   return rh && !compare (*this, *rh);
57 }
58
59
60
61 Moment
62 Rhythmic_req::length_mom () const
63 {
64   return duration_.length_mom ();
65 }
66
67 void
68 Rhythmic_req::compress (Moment m)
69 {
70   duration_.compress (m);
71 }
72
73
74
75 bool
76 Note_req::do_equal_b (Request const* r) const
77 {
78   Note_req const* n = dynamic_cast<Note_req const*> (r);
79   return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
80 }
81
82
83 Note_req::Note_req ()
84 {
85 }
86
87
88
89
90
91 bool
92 Span_req::do_equal_b (Request const*r) const
93 {
94   Span_req const* s = dynamic_cast <Span_req const*> (r);
95   return s && get_span_dir () == s->get_span_dir ();
96 }
97
98 Span_req::Span_req ()
99 {
100 }
101
102
103 bool
104 Text_script_req::do_equal_b (Request const* r) const
105 {
106   Text_script_req const* t  = dynamic_cast<Text_script_req const*> (r);
107   return t && gh_equal_p (get_mus_property ("text"),
108                           t->get_mus_property ("text"));
109 }
110
111
112 bool
113 Articulation_req::do_equal_b (Request const* r) const
114 {
115   Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
116   
117   return a; //  &&  articulation_str_ == a->articulation_str_;
118 }
119
120