lilypond-0.0.61
[lilypond.git] / hdr / musicalrequest.hh
blob240b72afd9c7cb96da5ec58a8d3cdc3923d42e61
1 /*
2 musicalrequests.hh -- declare Musical requests
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
13 #include "request.hh"
16 /**
17 A request which is coupled to a #Voice_element# with nonzero duration.
18 Base class only
20 struct Musical_req : virtual Request {
21 virtual Skip_req* skip() { return 0; }
22 REQUESTMETHODS(Musical_req, musical);
26 struct Skip_req : Musical_req {
27 Moment duration_;
29 virtual Moment duration() const;
30 REQUESTMETHODS(Skip_req, skip);
32 /** a request with a duration.
33 This request is used only a base class.
35 struct Rhythmic_req : virtual Musical_req {
36 int balltype;
37 int dots;
38 Moment plet_factor;
39 /* *************** */
40 static int compare(const Rhythmic_req &, const Rhythmic_req &);
41 virtual Moment duration() const;
42 Rhythmic_req();
43 Rhythmic_req(int,int);
44 REQUESTMETHODS(Rhythmic_req, rhythmic);
47 struct Spacing_req :virtual Request {
48 Moment next;
49 Real distance;
50 Real strength;
51 /* *************** */
52 Spacing_req();
53 REQUESTMETHODS(Spacing_req, spacing);
56 struct Blank_req : Spacing_req, Rhythmic_req {
57 REQUESTMETHODS(Spacing_req, spacing);
61 /// Put a text above or below (?) this staff.
62 struct Text_req : virtual Musical_req {
63 /// preferred position (above/below)
64 int dir_i_;
65 /// the characteristics of the text
66 Text_def *tdef_p_;
67 /* *************** */
68 Text_req(int d, Text_def*);
69 ~Text_req();
70 Text_req(Text_req const&);
71 static int compare(const Text_req&,const Text_req&);
72 REQUESTMETHODS(Text_req,text);
75 /** Put a text in lyric_staff
76 @see Lyric_staff
78 struct Lyric_req : public Rhythmic_req, Text_req {
79 Lyric_req(Text_def* t_p);
80 REQUESTMETHODS(Lyric_req, lreq_l);
83 /// request which has some kind of pitch
84 struct Melodic_req :virtual Musical_req
86 /// 0 is c, 6 is b
87 int notename_i_;
88 /// 0 is central c
89 int octave_i_;
91 /// 0 natural, 1 sharp, etc
92 int accidental_i_;
94 /// force/supress printing of accidental.
95 bool forceacc_b_;
97 /// return height from central c (in halflines)
98 int height()const;
99 /// return pitch from central c (in halfnotes)
100 int pitch()const;
101 Melodic_req();
103 REQUESTMETHODS(Melodic_req,melodic);
106 /// Put a note of specified type, height, and with accidental on the staff.
107 struct Note_req : Rhythmic_req, virtual Melodic_req {
110 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
111 REQUESTMETHODS(Note_req, note);
115 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.
117 class Rest_req : public Rhythmic_req {
118 public:
119 REQUESTMETHODS(Rest_req,rest);
123 attach a stem to the noteball.
124 Rhythmic_req parent needed to determine if it will fit inside a beam.
126 struct Stem_req : Rhythmic_req {
127 /// preferred direction for the stem
128 int dir_i_;
129 Stem_req(int s, int dots);
130 REQUESTMETHODS(Stem_req,stem);
134 Requests to start or stop something.
135 This type of request typically results in the creation of a #Spanner#
137 struct Span_req : Musical_req {
138 /// should the spanner start or stop, or is it unwanted?
139 enum {
140 NOSPAN, START, STOP
141 } spantype ;
142 static int compare(const Span_req &r1, const Span_req &r2);
143 REQUESTMETHODS(Span_req,span);
145 Span_req();
149 /// request for backward plet generation
150 struct Plet_req : Request {
151 char type_c_;
152 int dur_i_;
153 int type_i_;
154 Plet_req();
156 REQUESTMETHODS(Plet_req,plet);
158 /**
161 /** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
162 appropriate number over the beam
164 struct Beam_req : Span_req {
165 int nplet;
167 /* *************** */
168 REQUESTMETHODS(Beam_req,beam);
170 Beam_req();
173 /// a slur
174 struct Slur_req : Span_req {
175 REQUESTMETHODS(Slur_req,slur);
180 /**Put a script above or below this ``note''. eg upbow, downbow. Why a
181 request? These symbols may conflict with slurs and brackets, so this
182 also a request */
183 struct Script_req : Musical_req {
184 int dir_i_;
185 Script_def *scriptdef_p_;
187 /* *************** */
188 static int compare(const Script_req &, const Script_req &);
189 Script_req(int d, Script_def*);
190 REQUESTMETHODS(Script_req,script);
191 ~Script_req();
192 Script_req(Script_req const&);
198 #endif // MUSICALREQUESTS_HH