]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
patch::: 1.1.23.ms1
[lilypond.git] / lily / include / musical-request.hh
1 /*
2   musical-request.hh -- declare Musical requests
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
12
13 #include "lily-proto.hh"
14 #include "request.hh"
15 #include "duration.hh"
16 #include "musical-pitch.hh"
17
18 /**
19   A request which is coupled to a note (that has duration).
20   Base class only
21  */
22 class Musical_req  : public virtual Request  {
23 public:
24
25
26   REQUESTMETHODS(Musical_req);
27 };
28
29
30
31 /** a request with a duration.
32   This request is used only used as a base class.
33  */
34 class Rhythmic_req  : public virtual Musical_req  {
35 public:
36   Duration duration_;
37     
38   bool do_equal_b (Request*) const;
39   void compress (Moment);
40   virtual Moment duration() const;
41   static int compare (Rhythmic_req const&,Rhythmic_req const&);
42   REQUESTMETHODS(Rhythmic_req);
43 };
44
45 class Skip_req  : public Rhythmic_req  {
46 public:
47   REQUESTMETHODS(Skip_req);
48 };
49
50 struct Spacing_req :virtual Request {
51   Moment next;
52   Real distance;
53   Real strength;
54   Spacing_req();
55   REQUESTMETHODS(Spacing_req);
56 };
57
58 struct Abbreviation_req : public Musical_req {
59   REQUESTMETHODS (Abbreviation_req);
60   Abbreviation_req ();
61   int type_i_;
62 };
63
64 class Blank_req  : public Spacing_req, Rhythmic_req  {
65 public:
66   REQUESTMETHODS(Spacing_req);
67 };
68
69 /// Put a text above or below (?) this staff.
70 class Text_req  : public virtual Musical_req  {
71 public:
72   /// preferred position (above/below)
73   Direction dir_;
74   /// the characteristics of the text
75   Text_def *tdef_p_;
76
77   Text_req (int d, Text_def*);
78   ~Text_req();
79   Text_req (Text_req const&);
80
81   REQUESTMETHODS(Text_req);
82 };
83
84 /** a syllable  or lyric is a string with rhythm.
85   */
86 class Lyric_req  : public  Rhythmic_req  {
87 public:
88   String text_str_;
89   REQUESTMETHODS(Lyric_req);
90 };
91
92
93
94 /// request which has some kind of pitch
95 struct Melodic_req :virtual Musical_req
96 {
97   Musical_pitch pitch_;
98   /// transpose. #delta# is relative to central c.
99   virtual void transpose (Musical_pitch delta);
100   Melodic_req();
101   bool do_equal_b (Request*) const;
102   static int compare (Melodic_req const&,Melodic_req const&);
103   REQUESTMETHODS(Melodic_req);
104 };
105
106 /// Put a note of specified type, height, and with accidental on the staff.
107 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
108 public:
109     
110   /// force/supress printing of accidental.
111   bool forceacc_b_;
112   /// Cautionary, i.e. parenthesized accidental.
113   bool cautionary_b_;
114   Note_req();
115   bool do_equal_b (Request*) const;
116   REQUESTMETHODS(Note_req);
117 };
118
119 /**
120 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.
121 */
122 class Rest_req : public Rhythmic_req {
123 public:
124   REQUESTMETHODS(Rest_req);
125 };
126
127 /**
128  Part: typeset a measure with the number of measures rest
129  Score: typeset all individual measures ass full rests
130  */
131 class Multi_measure_rest_req : public Rhythmic_req  {
132 public:
133   REQUESTMETHODS(Multi_measure_rest_req);
134
135 };
136
137 class Musical_span_req : public Span_req, public virtual Musical_req
138 {
139 public:
140   REQUESTMETHODS(Musical_span_req);
141   
142 };
143
144
145 /** 
146  Start / stop an abbreviation beam at this note. 
147  */
148 class Abbreviation_beam_req : public Musical_span_req  {
149 public:
150   REQUESTMETHODS (Abbreviation_beam_req);
151
152   Abbreviation_beam_req ();
153
154   int type_i_;
155 };
156
157
158
159 /// a slur
160 class Slur_req  : public Musical_span_req  {
161 public:
162   REQUESTMETHODS(Slur_req);
163
164 };
165
166 /// an extender line
167 class Extender_req : public Musical_span_req  {
168 public:
169   REQUESTMETHODS(Extender_req);
170   Extender_req ();
171 };
172
173 class Musical_script_req : public Musical_req,  public Script_req {
174 public:
175   REQUESTMETHODS(Musical_script_req);
176 };
177
178
179 class Dynamic_req  : public virtual Musical_req  {
180 public:
181   /**
182     for absolute dynamics
183
184     This sux. We'd want increasing numbers for FFF till PPP, but not 
185     for FP, SF, SFZ (FP is *not* louder than FFF)
186    */
187   enum Loudness {
188     FFFFFF, FFFFF, FFFF, FFF, FF, F, MF, MP, P, PP, PPP, PPPP, PPPPP, PPPPPP, FP, SF, SFF, SFZ, SP, SPP, RFZ };
189   static String loudness_static_str (Loudness);
190   REQUESTMETHODS(Dynamic_req);
191 };
192
193 class Absolute_dynamic_req  : public Dynamic_req  {
194 public:
195   Loudness loudness_;
196   virtual bool do_equal_b (Request*) const;
197   String loudness_str () const;
198   Absolute_dynamic_req();
199   REQUESTMETHODS(Absolute_dynamic_req);
200 };
201
202 class Span_dynamic_req  : public Dynamic_req, public Musical_span_req  {
203 public:
204   virtual bool do_equal_b (Request*) const;
205   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
206   Direction dynamic_dir_;
207   Span_dynamic_req();
208   REQUESTMETHODS(Span_dynamic_req);
209 };
210
211 #endif // MUSICALREQUESTS_HH