]> git.donarmstrong.com Git - lilypond.git/blob - lily/musical-request.cc
release: 1.3.107
[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   Musical_pitch p = *unsmob_pitch (get_mus_property ("pitch"));
24   
25   p.transpose (delta);
26   
27   if (abs (p.alteration_i_) > 2)
28     {
29         warning (_f ("Transposition by %s makes accidental larger than two",
30           delta.str ()));
31     }
32
33   set_mus_property ("pitch", p.smobbed_copy ());
34 }
35
36 bool
37 Melodic_req::do_equal_b (Request const* r) const
38 {
39   Melodic_req const* m= dynamic_cast <Melodic_req const*> (r);
40   return m; // && !compare (*m, *this);
41 }
42
43 bool
44 Rhythmic_req::do_equal_b (Request const* r) const
45 {
46   Rhythmic_req const* rh = dynamic_cast <Rhythmic_req const*> (r);
47
48   return rh; // ;  && !compare (*this, *rh);
49 }
50
51
52
53 Moment
54 Rhythmic_req::length_mom () const
55 {
56   return  unsmob_duration (  get_mus_property( "duration"))->length_mom ();
57
58 }
59
60 void
61 Rhythmic_req::compress (Moment m)
62 {
63   Duration *d =  unsmob_duration (get_mus_property( "duration"));
64
65   set_mus_property ("duration", d ->compressed (m).smobbed_copy());
66 }
67
68 bool
69 Note_req::do_equal_b (Request const* r) const
70 {
71   Note_req const* n = dynamic_cast<Note_req const*> (r);
72   return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
73 }
74
75
76 Note_req::Note_req ()
77 {
78 }
79
80
81
82
83
84 bool
85 Span_req::do_equal_b (Request const*r) const
86 {
87   Span_req const* s = dynamic_cast <Span_req const*> (r);
88   return s && get_span_dir () == s->get_span_dir ();
89 }
90
91 Span_req::Span_req ()
92 {
93 }
94
95
96 bool
97 Text_script_req::do_equal_b (Request const* r) const
98 {
99   Text_script_req const* t  = dynamic_cast<Text_script_req const*> (r);
100   return t && gh_equal_p (get_mus_property ("text"),
101                           t->get_mus_property ("text"));
102 }
103
104
105 bool
106 Articulation_req::do_equal_b (Request const* r) const
107 {
108   Articulation_req const* a = dynamic_cast<Articulation_req const*> (r);
109   
110   return a; //  &&  articulation_str_ == a->articulation_str_;
111 }
112
113