]> git.donarmstrong.com Git - lilypond.git/blob - lily/command-request.cc
release: 1.2.6
[lilypond.git] / lily / command-request.cc
1 /*
2   command-request.cc -- implement non-musical reqs
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "command-request.hh"
10 #include "debug.hh"
11 #include "musical-request.hh"
12
13 void
14 Cadenza_req::do_print () const
15 {
16 #ifndef NPRINT
17   DOUT << (int)on_b_;
18 #endif
19 }
20
21 bool
22 Cadenza_req::do_equal_b (Request const *r) const
23 {
24   Cadenza_req const*cad =  dynamic_cast <Cadenza_req const *> (r);
25   return cad && cad->on_b_ == on_b_;
26 }
27
28 Cadenza_req::Cadenza_req (bool b)
29 {
30   on_b_ =b;
31 }
32
33
34
35 bool
36 Bar_req::do_equal_b (Request const *r) const
37 {
38   Bar_req  const* b = dynamic_cast <Bar_req const *> (r);
39   return b && type_str_ == b->type_str_;
40 }
41
42 void
43 Bar_req::do_print () const
44 {
45 #ifndef NPRINT
46   DOUT << type_str_;
47 #endif
48 }
49
50 Bar_req::Bar_req (String s)
51 {
52   type_str_ = s;
53 }
54
55 Partial_measure_req::Partial_measure_req (Moment m)
56 {
57   length_mom_ =m;
58 }
59
60 bool
61 Partial_measure_req::do_equal_b (Request const* r) const
62 {
63   Partial_measure_req  const*p = dynamic_cast <Partial_measure_req  const*> (r);
64
65   return p&& p->length_mom_ == length_mom_;
66 }
67
68 bool
69 Barcheck_req::do_equal_b (Request const *r) const
70 {
71   Barcheck_req  const*b = dynamic_cast<Barcheck_req const*> (r);
72   return b;
73 }
74
75 void
76 Clef_change_req::do_print () const
77 {
78 #ifndef NPRINT
79   DOUT << clef_str_ ;
80 #endif
81 }
82
83 Clef_change_req::Clef_change_req (String s)
84 {
85   clef_str_ = s;
86 }
87
88 void
89 Partial_measure_req::do_print () const
90 {
91   DOUT << length_mom_;
92 }
93
94 void
95 Time_signature_change_req::do_print () const
96 {
97 #ifndef NPRINT
98   DOUT << beats_i_ << "/" << one_beat_i_;
99 #endif
100 }
101
102 bool
103 Time_signature_change_req::do_equal_b (Request const *r) const
104 {
105   Time_signature_change_req  const* m
106     = dynamic_cast <Time_signature_change_req  const*> (r);
107
108   return m && m->beats_i_ == beats_i_
109     && one_beat_i_ == m->one_beat_i_;
110 }
111
112 Time_signature_change_req::Time_signature_change_req ()
113 {
114   beats_i_ = 0;
115   one_beat_i_ =0;
116 }
117
118
119 Tempo_req::Tempo_req ()
120 {
121   metronome_i_ = 60;
122   dur_. durlog_i_ = 2;
123 }
124
125 void
126 Tempo_req::do_print () const
127 {
128   DOUT << dur_.str () << " = " << metronome_i_;
129 }
130
131
132 bool
133 Tempo_req::do_equal_b (Request const *r) const
134 {
135   Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
136
137   return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
138 }
139
140
141
142
143 void
144 Key_change_req::do_print () const
145 {
146 #ifndef NPRINT
147   for (int i=0; i < key_.pitch_arr_.size (); i++)
148     {
149       key_.pitch_arr_[i].print ();
150     }
151 #endif
152 }
153
154 Key_change_req::Key_change_req ()
155 {
156 }
157
158 Break_req::Break_req ()
159 {
160   penalty_i_ = 0;
161 }
162
163 Mark_req::Mark_req (String s)
164 {
165   str_ = s;
166 }
167
168 void
169 Mark_req::do_print () const
170 {
171   DOUT << str_;
172 }
173 void
174 Key_change_req::transpose (Musical_pitch p)
175 {
176   key_.transpose (p);
177 }
178
179
180