]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/command-request.hh
patch::: 1.1.27.jcn2: hat
[lilypond.git] / lily / include / command-request.hh
1 /*
2   command-request.hh -- declare non-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 COMMANDREQUEST_HH
11 #define COMMANDREQUEST_HH
12
13 #include "request.hh"
14 #include "array.hh"
15 #include "duration.hh"
16 #include "musical-pitch.hh"
17
18 /** Request which are  assumed to be "happening" before the
19   musical requests.  Not coupled to a note or rest. */
20 class Command_req  : public virtual Request  {
21 public:
22   REQUESTMETHODS(Command_req);
23
24 };
25
26
27 class Break_req : public Command_req {
28 public:
29   enum { DISALLOW = -10000, FORCE = 10000 };
30   int penalty_i_;
31   Break_req ();
32   REQUESTMETHODS (Break_req);
33 };
34
35 class Mark_req : public Command_req {
36 public:
37   Mark_req (String);
38   String str_;
39   REQUESTMETHODS (Mark_req);
40 };
41
42 class Command_script_req : public Command_req,  public Script_req {
43 public:
44   // huh? 
45   Command_script_req();
46   ~Command_script_req();
47   REQUESTMETHODS(Command_script_req);
48 };
49
50
51 /** Baseclass for time_signature/partial req. It has to be handled by
52   Staff_{walker,column} baseclass.  */
53 class Timing_req  : public Command_req  {
54 public:
55   REQUESTMETHODS(Timing_req);
56 };
57
58
59 class Tempo_req : public Timing_req
60 {
61 public:
62   Duration dur_;
63   int metronome_i_;
64
65   Tempo_req();
66   REQUESTMETHODS(Tempo_req);
67   bool do_equal_b (Request *) const;
68 };
69
70 class Partial_measure_req  : public Timing_req  {
71 public:
72   Moment length_mom_;
73
74   Partial_measure_req (Moment);
75   REQUESTMETHODS(Partial_measure_req);
76   bool do_equal_b (Request*) const;
77 };
78
79 /**
80   todo: allow C time_signature
81  */
82 class Time_signature_change_req  : public Timing_req  {
83 public:
84   int beats_i_, one_beat_i_;
85
86   Time_signature_change_req();
87   bool do_equal_b (Request*) const;
88   REQUESTMETHODS(Time_signature_change_req);
89 };
90
91 /// toggle Cadenza mode
92 class Cadenza_req  : public Timing_req  {
93 public:
94   /// turn on?
95   bool on_b_;
96   bool do_equal_b (Request*) const;
97   Cadenza_req (bool);
98   REQUESTMETHODS(Cadenza_req);
99 };
100
101 /// check if we're at start of a  measure.
102 class Barcheck_req  : public Timing_req  {
103 public:
104   bool do_equal_b (Request *) const;
105   REQUESTMETHODS(Barcheck_req);
106 };
107
108 class Measure_grouping_req : public Timing_req  {
109 public:
110   Array<int> beat_i_arr_;
111   Array<Moment> elt_length_arr_;
112   bool do_equal_b (Request *) const;
113   REQUESTMETHODS(Measure_grouping_req);
114 };
115
116 /** draw a (repeat)-bar. This something different than #Barcheck_req#,
117   the latter should only happen at the start of a measure.  */
118 class Bar_req  : public Command_req  {
119 public:
120   String type_str_;
121   Bar_req (String);
122   bool do_equal_b (Request*) const;
123
124   REQUESTMETHODS(Bar_req);
125 };
126
127
128 /**
129     Handle key changes.
130     Routines for sharps and flats are separated, 
131     so that caller may identify non-conventional keys.
132 */
133 class Key_change_req  : public Command_req  {
134 public:
135   Array<Musical_pitch> pitch_arr_;
136   int modality_i_;
137   bool ordinary_key_b_;
138
139   Key_change_req();
140   REQUESTMETHODS(Key_change_req);
141
142   /// squash the octaves to 1
143   void squash_octaves();
144   /// return number of flats in key
145   int flats_i();
146
147   /// return number of sharps in key
148   int sharps_i();
149
150   void transpose (Musical_pitch  d);
151   bool minor_b() const;
152 };
153
154 class Clef_change_req  : public Command_req  {
155 public:
156   String clef_str_;
157   Clef_change_req (String);
158   REQUESTMETHODS(Clef_change_req);
159 };
160
161 class Bracket_req :  public Span_req, public Command_req {
162
163 public:
164   REQUESTMETHODS(Bracket_req);
165 };
166
167
168 #endif // COMMANDREQUEST_HH