]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/command-request.hh
527ffbce016b5ab7d30b0ae03d906865de02e566
[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 class Command_tie_req : public Command_req {
51 public:
52   REQUESTMETHODS(Command_tie_req);
53 };
54
55 /** Baseclass for time_signature/partial req. It has to be handled by
56   Staff_{walker,column} baseclass.  */
57 class Timing_req  : public Command_req  {
58 public:
59   REQUESTMETHODS(Timing_req);
60 };
61
62
63 class Tempo_req : public Timing_req
64 {
65 public:
66   Duration dur_;
67   int metronome_i_;
68
69   Tempo_req();
70   REQUESTMETHODS(Tempo_req);
71   bool do_equal_b (Request *) const;
72 };
73
74 class Partial_measure_req  : public Timing_req  {
75 public:
76   Moment duration_;
77
78   Partial_measure_req (Moment);
79   REQUESTMETHODS(Partial_measure_req);
80   bool do_equal_b (Request*) const;
81 };
82
83 /**
84   todo: allow C time_signature
85  */
86 class Time_signature_change_req  : public Timing_req  {
87 public:
88   int beats_i_, one_beat_i_;
89
90   Time_signature_change_req();
91   bool do_equal_b (Request*) const;
92   REQUESTMETHODS(Time_signature_change_req);
93 };
94
95 /// toggle Cadenza mode
96 class Cadenza_req  : public Timing_req  {
97 public:
98   /// turn on?
99   bool on_b_;
100   bool do_equal_b (Request*) const;
101   Cadenza_req (bool);
102   REQUESTMETHODS(Cadenza_req);
103 };
104
105 /// check if we're at start of a  measure.
106 class Barcheck_req  : public Timing_req  {
107 public:
108   bool do_equal_b (Request *) const;
109   REQUESTMETHODS(Barcheck_req);
110 };
111
112 class Measure_grouping_req : public Timing_req  {
113 public:
114   Array<int> beat_i_arr_;
115   Array<Moment> elt_length_arr_;
116   bool do_equal_b (Request *) const;
117   REQUESTMETHODS(Measure_grouping_req);
118 };
119
120 /** draw a (repeat)-bar. This something different than #Barcheck_req#,
121   the latter should only happen at the start of a measure.  */
122 class Bar_req  : public Command_req  {
123 public:
124   String type_str_;
125   Bar_req (String);
126   bool do_equal_b (Request*) const;
127
128   REQUESTMETHODS(Bar_req);
129 };
130
131
132 /**
133     Handle key changes.
134     Routines for sharps and flats are separated, 
135     so that caller may identify non-conventional keys.
136 */
137 class Key_change_req  : public Command_req  {
138 public:
139   Array<Musical_pitch> pitch_arr_;
140   int modality_i_;
141   bool ordinary_key_b_;
142
143   Key_change_req();
144   REQUESTMETHODS(Key_change_req);
145
146   /// squash the octaves to 1
147   void squash_octaves();
148   /// return number of flats in key
149   int flats_i();
150
151   /// return number of sharps in key
152   int sharps_i();
153
154   void transpose (Musical_pitch  d);
155   bool minor_b() const;
156 };
157
158 class Clef_change_req  : public Command_req  {
159 public:
160   String clef_str_;
161   Clef_change_req (String);
162   REQUESTMETHODS(Clef_change_req);
163 };
164
165 class Bracket_req :  public Span_req, public Command_req {
166
167 public:
168   REQUESTMETHODS(Bracket_req);
169 };
170
171 #endif // COMMANDREQUEST_HH