]> git.donarmstrong.com Git - lilypond.git/blob - lily/musical-request.cc
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[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--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "musical-request.hh"
10 #include "misc.hh"
11 #include "warn.hh"
12 #include "music-list.hh"
13
14
15 Tremolo_req::Tremolo_req ()
16 {
17 }
18
19 bool
20 Melodic_req::do_equal_b (Request const* r) const
21 {
22   Melodic_req const* m= dynamic_cast <Melodic_req const*> (r);
23   return m; // && !compare (*m, *this);
24 }
25
26 bool
27 Rhythmic_req::do_equal_b (Request const* r) const
28 {
29   Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
30
31   return rh; // ;  && !compare (*this, *rh);
32 }
33
34 Moment
35 Rhythmic_req::length_mom () const
36 {
37   Duration *d = unsmob_duration (get_mus_property ("duration"));
38   if (!d)
39     {
40       Moment m ;
41       programming_error("Rhythmic_req has no duration");
42       return m;
43     }
44   return d->length_mom ();
45 }
46
47 void
48 Rhythmic_req::compress (Moment m)
49 {
50   Duration *d =  unsmob_duration (get_mus_property ("duration"));
51   if (d)
52     set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ());
53 }
54
55 bool
56 Note_req::do_equal_b (Request const* r) const
57 {
58   Note_req const* n = dynamic_cast<Note_req const*> (r);
59   return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
60 }
61
62
63 Note_req::Note_req ()
64 {
65 }
66
67
68 bool
69 Span_req::do_equal_b (Request const*r) const
70 {
71   Span_req const* s = dynamic_cast <Span_req const*> (r);
72   return s && get_span_dir () == s->get_span_dir ();
73 }
74
75 Span_req::Span_req ()
76 {
77 }
78
79
80 bool
81 Text_script_req::do_equal_b (Request const* r) const
82 {
83   Text_script_req const* t  = dynamic_cast<Text_script_req const*> (r);
84   return t && gh_equal_p (get_mus_property ("text"),
85                           t->get_mus_property ("text"));
86 }
87
88 bool
89 String_number_req::do_equal_b (Request const* r) const
90 {
91   String_number_req const* s  = dynamic_cast<String_number_req const*> (r);
92   return s && gh_equal_p (get_mus_property ("string"),
93                           s->get_mus_property ("string"));
94 }
95
96
97 bool
98 Articulation_req::do_equal_b (Request const* r) const
99 {
100   Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
101   
102   return a && gh_equal_p (get_mus_property ("articulation-type"),
103                           r->get_mus_property ("articulation-type"))
104     && get_direction () == a->get_direction ();
105 }
106
107 ADD_MUSIC(String_number_req);