]> git.donarmstrong.com Git - lilypond.git/blob - hdr/musicalrequest.hh
partial: 0.0.39-1.jcn
[lilypond.git] / hdr / musicalrequest.hh
1 /*
2   musicalrequests.hh -- declare Musical requests
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
12
13 #include "request.hh"
14
15
16 /**
17   A request which is coupled to a #Voice_element# with nonzero duration.
18   Base class only
19  */
20 struct Musical_req : virtual Request {
21     virtual Skip_req* skip() { return 0; }
22     REQUESTMETHODS(Musical_req, musical);
23 };
24
25
26 struct Skip_req : Musical_req {
27     Moment duration_;
28     
29     virtual Moment duration() const;
30     REQUESTMETHODS(Skip_req, skip);
31 };
32 /** a request with a duration.
33   This request is used only a base class.
34  */
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);
45 };
46
47 struct Spacing_req :virtual Request {
48     Moment next;
49     Real distance;
50     Real strength;
51     /* *************** */
52     Spacing_req();
53     REQUESTMETHODS(Spacing_req, spacing);
54 };
55
56 struct Blank_req : Spacing_req, Rhythmic_req {
57     REQUESTMETHODS(Spacing_req, spacing);
58     
59 };
60
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);
73 };
74
75 /** Put a text in lyric_staff
76   @see Lyric_staff
77   */
78 struct Lyric_req : public Rhythmic_req, Text_req {
79     Lyric_req(Text_def* t_p);
80     REQUESTMETHODS(Lyric_req, lreq_l);
81 };
82
83 /// request which has some kind of pitch
84 struct Melodic_req :virtual Musical_req
85 {
86     /// 0 is c, 6 is b
87     int notename_i_;
88     /// 0 is central c
89     int octave_i_;
90
91     /// 0 natural, 1 sharp, etc
92     int accidental_i_;
93
94     /// force/supress printing of accidental.
95     bool forceacc_b_;
96
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();
102    
103     REQUESTMETHODS(Melodic_req,melodic);
104 };
105
106 /// Put a note of specified type, height, and with accidental on the staff.
107 struct Note_req : Rhythmic_req, virtual Melodic_req {
108     
109
110     Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
111     REQUESTMETHODS(Note_req, note);
112  };
113
114 /**
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.
116 */
117 class Rest_req : public Rhythmic_req {
118 public:
119     REQUESTMETHODS(Rest_req,rest);
120 };
121
122 /**
123   attach a stem to the noteball.
124   Rhythmic_req parent needed to  determine if it will fit inside a beam.
125   */
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);
131 };
132
133 /**
134   Requests to start or stop something.
135  This type of request typically results in the creation of a #Spanner#
136 */
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);
144
145     Span_req();
146   
147 };
148
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();
155  
156      REQUESTMETHODS(Plet_req,plet);
157 };
158 /** 
159 */
160
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
163     */
164 struct Beam_req : Span_req {
165     int nplet;
166
167     /* *************** */
168      REQUESTMETHODS(Beam_req,beam);
169
170     Beam_req();
171 };
172
173 /// a slur
174 struct Slur_req : Span_req {
175  REQUESTMETHODS(Slur_req,slur);
176
177 };
178
179
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_;
186
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&);
193 };
194
195
196
197
198 #endif // MUSICALREQUESTS_HH