]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/command-request.hh
848d4d9e43c58149a3e069070c51c518700a9ca4
[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 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef COMMANDREQUEST_HH
11 #define COMMANDREQUEST_HH
12
13 #include "request.hh"
14 #include "varray.hh"
15 #include "duration.hh"
16
17 /** Request which are  assumed to be "happening" before the
18   musical requests. */
19 class Command_req  : public virtual Request  {
20 public:
21     REQUESTMETHODS(Command_req, command);
22     virtual Group_feature_req * groupfeature() { return 0; }
23     virtual Measure_grouping_req * measuregrouping() { return 0; }
24     virtual Clef_change_req * clefchange() { return 0; }
25     virtual Key_change_req * keychange() { return 0; }
26     virtual Partial_measure_req * partial() { return 0; }
27     virtual Meter_change_req * meterchange() { return 0; }
28     virtual Bar_req *bar() { return 0; }
29     virtual Cadenza_req *cadenza() { return 0; }
30     virtual Disallow_break_req *disallowbreak() { return 0; }
31     virtual Timing_req*timing() {  return 0; }
32     virtual Command_script_req*commandscript() { return 0;}
33 };
34
35
36 class Command_script_req : public Command_req,  public Script_req {
37 public:
38     // huh? 
39     Command_script_req();
40     REQUESTMETHODS(Command_script_req, commandscript);
41 };
42
43
44 class Disallow_break_req : public Command_req {
45 public:
46     REQUESTMETHODS(Disallow_break_req, disallowbreak);
47 };
48
49
50 /** Baseclass for meter/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, timing);
55     virtual Tempo_req * tempo(){return 0; }
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, tempo);
67     bool do_equal_b (Request *) const;
68 };
69
70 class Partial_measure_req  : public Timing_req  {
71 public:
72     Moment duration_;
73
74     Partial_measure_req (Moment);
75     REQUESTMETHODS(Partial_measure_req, partial);
76     bool do_equal_b (Request*) const;
77 };
78
79 /**
80   todo: allow C meter
81  */
82 class Meter_change_req  : public Timing_req  {
83 public:
84     int beats_i_, one_beat_i_;
85
86     Meter_change_req();
87     void set (int,int);
88     bool do_equal_b (Request*) const;
89     REQUESTMETHODS(Meter_change_req, meterchange);
90 };
91
92 /// toggle Cadenza mode
93 class Cadenza_req  : public Timing_req  {
94 public:
95     /// turn on?
96     bool on_b_;
97     bool do_equal_b (Request*) const;
98     Cadenza_req (bool);
99     REQUESTMETHODS(Cadenza_req,cadenza);
100 };
101
102 /// check if we're at start of a  measure.
103 class Barcheck_req  : public Timing_req  {
104 public:
105     bool do_equal_b (Request *) const;
106     REQUESTMETHODS(Barcheck_req,barcheck);
107 };
108
109 class Measure_grouping_req : public Timing_req  {
110 public:
111     Array<int> beat_i_arr_;
112     Array<Moment> elt_length_arr_;
113     bool do_equal_b (Request *) const;
114     REQUESTMETHODS(Measure_grouping_req, measuregrouping);
115 };
116
117 /** draw a (repeat)-bar. This something different than #Barcheck_req#,
118   the latter should only happen at the start of a measure.  */
119 class Bar_req  : public Command_req  {
120 public:
121     String type_str_;
122     Bar_req (String);
123     bool do_equal_b (Request*) const;
124
125     REQUESTMETHODS(Bar_req,bar);
126 };
127
128 class Group_feature_req  : public Command_req  {
129 public:
130     String type_str_;
131     String value_str_;
132     
133     REQUESTMETHODS(Group_feature_req, groupfeature);
134 };
135
136
137 /**
138     Handle key changes.
139     Routines for sharps and flats are separated, 
140     so that caller may identify non-conventional keys.
141 */
142 class Key_change_req  : public Command_req  {
143 public:
144     Array<Melodic_req*> melodic_p_arr_;
145     bool minor_b_;
146
147     /// don't ignore the  octaves in #melodic_p_arr_#?
148     bool multi_octave_b_;
149     Key_change_req();
150     Key_change_req (Key_change_req const&);
151     ~Key_change_req();
152     REQUESTMETHODS(Key_change_req, keychange);
153
154     /// squash the octaves to 1
155     void squash_octaves();
156     /// return number of flats in key
157     int flats_i();
158
159     /// return number of sharps in key
160     int sharps_i();
161
162     void transpose (Melodic_req const & d) const;
163     /// is minor key?
164     int minor_b();
165 };
166
167 class Clef_change_req  : public Command_req  {
168 public:
169     String clef_str_;
170     Clef_change_req (String);
171     REQUESTMETHODS(Clef_change_req, clefchange);
172 };
173
174 #endif // COMMANDREQUEST_HH