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