]> git.donarmstrong.com Git - lilypond.git/blob - lily/musical-request.cc
release: 1.5.29
[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 "debug.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     Moment m ;
40     programming_error("Rhythmic_req has no duration");
41     return m;
42   }
43   return d->length_mom ();
44 }
45
46 void
47 Rhythmic_req::compress (Moment m)
48 {
49   Duration *d =  unsmob_duration (get_mus_property ("duration"));
50   if (d)
51     set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ());
52 }
53
54 bool
55 Note_req::do_equal_b (Request const* r) const
56 {
57   Note_req const* n = dynamic_cast<Note_req const*> (r);
58   return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
59 }
60
61
62 Note_req::Note_req ()
63 {
64 }
65
66
67 bool
68 Span_req::do_equal_b (Request const*r) const
69 {
70   Span_req const* s = dynamic_cast <Span_req const*> (r);
71   return s && get_span_dir () == s->get_span_dir ();
72 }
73
74 Span_req::Span_req ()
75 {
76 }
77
78
79 bool
80 Text_script_req::do_equal_b (Request const* r) const
81 {
82   Text_script_req const* t  = dynamic_cast<Text_script_req const*> (r);
83   return t && gh_equal_p (get_mus_property ("text"),
84                           t->get_mus_property ("text"));
85 }
86
87 bool
88 Articulation_req::do_equal_b (Request const* r) const
89 {
90   Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
91   
92   return a && gh_equal_p (get_mus_property ("articulation-type"),
93                           r->get_mus_property ("articulation-type"))
94     && get_direction () == a->get_direction ();
95 }
96
97
98