2 musical-request.hh -- declare Musical requests
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
13 #include "lily-proto.hh"
15 #include "duration.hh"
19 A request which is coupled to a #Request_chord#
22 class Musical_req : public virtual Request {
25 virtual Lyric_req* lreq_l() { return 0; }
26 virtual Note_req *note() { return 0;}
27 virtual Stem_req *stem() { return 0;}
28 virtual Melodic_req *melodic() { return 0; }
29 virtual Slur_req *slur() { return 0 ; }
30 virtual Beam_req *beam() { return 0 ; }
31 virtual Rhythmic_req*rhythmic() { return 0; }
32 virtual Musical_script_req*musicalscript() { return 0; }
33 virtual Text_req*text() { return 0; }
34 virtual Rest_req *rest() { return 0; }
35 virtual Skip_req* skip() { return 0; }
36 virtual Dynamic_req* dynamic() { return 0; }
37 virtual Absolute_dynamic_req * absdynamic() { return 0; }
38 virtual Tie_req * tie() { return 0; }
39 virtual Span_dynamic_req * span_dynamic() { return 0; }
40 REQUESTMETHODS(Musical_req, musical);
45 /** a request with a duration.
46 This request is used only a base class.
48 class Rhythmic_req : public virtual Musical_req {
53 void set_duration(Duration);
54 static int compare(const Rhythmic_req &, const Rhythmic_req &);
55 virtual Moment duration() const;
57 REQUESTMETHODS(Rhythmic_req, rhythmic);
60 class Skip_req : public Rhythmic_req {
62 REQUESTMETHODS(Skip_req, skip);
64 struct Spacing_req :virtual Request {
70 REQUESTMETHODS(Spacing_req, spacing);
73 class Blank_req : public Spacing_req, Rhythmic_req {
75 REQUESTMETHODS(Spacing_req, spacing);
79 /// Put a text above or below (?) this staff.
80 class Text_req : public virtual Musical_req {
82 /// preferred position (above/below)
84 /// the characteristics of the text
88 Text_req(int d, Text_def*);
90 Text_req(Text_req const&);
91 static int compare(const Text_req&,const Text_req&);
92 REQUESTMETHODS(Text_req,text);
95 /** Put a text in lyric_staff
98 class Lyric_req : public Rhythmic_req, public Text_req {
100 Lyric_req(Text_def* t_p);
101 REQUESTMETHODS(Lyric_req, lreq_l);
104 /// request which has some kind of pitch
105 struct Melodic_req :virtual Musical_req
112 /// 0 natural, 1 sharp, etc
115 /// return height from central c (in halflines)
118 /// transpose. #delta# is relative to central c.
119 void transpose(Melodic_req const &delta);
120 /// return pitch from central c (in halfnotes)
123 static int compare(Melodic_req const&, Melodic_req const&);
125 REQUESTMETHODS(Melodic_req,melodic);
128 /// Put a note of specified type, height, and with accidental on the staff.
129 class Note_req : public Rhythmic_req, virtual public Melodic_req {
132 /// force/supress printing of accidental.
135 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
136 REQUESTMETHODS(Note_req, note);
140 Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
142 class Rest_req : public Rhythmic_req {
144 REQUESTMETHODS(Rest_req,rest);
148 attach a stem to the noteball.
149 Rhythmic_req parent needed to determine if it will fit inside a beam.
151 class Stem_req : public Rhythmic_req {
153 /// preferred direction for the stem
156 REQUESTMETHODS(Stem_req,stem);
160 Requests to start or stop something.
161 This type of request typically results in the creation of a #Spanner#
163 class Span_req : public virtual Musical_req {
165 /// should the spanner start or stop, or is it unwanted?
169 static int compare(const Span_req &r1, const Span_req &r2);
170 REQUESTMETHODS(Span_req,span);
176 /** Start / stop a beam at this note. if #nplet# is set, the staff
177 will try to put an appropriate number over the beam */
178 class Beam_req : public Span_req {
182 /* *************** */
183 REQUESTMETHODS(Beam_req,beam);
189 Start a tie at this voice element, end it at the next
191 class Tie_req : public Musical_req {
193 REQUESTMETHODS(Tie_req, tie);
197 class Slur_req : public Span_req {
199 REQUESTMETHODS(Slur_req,slur);
203 class Musical_script_req : public Musical_req, public Script_req {
205 REQUESTMETHODS(Musical_script_req, musicalscript);
209 class Dynamic_req : public virtual Musical_req {
211 /// for absolute dynamics
213 FFF, FF, F, MF, MP, P, PP, PPP
215 static String loudness_str(Loudness);
216 REQUESTMETHODS(Dynamic_req, dynamic);
219 class Absolute_dynamic_req : public Dynamic_req {
222 Absolute_dynamic_req();
223 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
226 class Span_dynamic_req : public Dynamic_req, public Span_req {
228 /// Grow or shrink the volume: 1=cresc, -1 = decresc
231 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
234 #endif // MUSICALREQUESTS_HH