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