]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/command-request.hh
release: 0.0.67
[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
16 /** Request which are  assumed to be "happening" before the
17   musical requests. */
18 class Command_req  : public virtual Request  {
19 public:
20     REQUESTMETHODS(Command_req, command);
21     virtual Terminate_voice_req *terminate() {return 0;}
22     virtual Group_change_req * groupchange() { return 0;}
23     virtual Group_feature_req * groupfeature() { return 0; }
24     virtual Measure_grouping_req * measuregrouping() { return 0; }
25     virtual Clef_change_req * clefchange() { return 0; }
26     virtual Key_change_req * keychange() { return 0; }
27     virtual Partial_measure_req * partial() { return 0; }
28     virtual Meter_change_req * meterchange() { return 0; }
29     virtual Bar_req *bar() { return 0; }
30     virtual Cadenza_req *cadenza() { 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     REQUESTMETHODS(Command_script_req, commandscript);
39 };
40
41
42
43 /** Baseclass for meter/partial req. It has to be handled by
44   Staff_{walker,column} baseclass.  */
45 class Timing_req  : public Command_req  {
46 public:
47     REQUESTMETHODS(Timing_req, timing);
48 };
49
50
51 class Partial_measure_req  : public Timing_req  {
52 public:
53     Moment duration_;
54
55     Partial_measure_req(Moment);
56     REQUESTMETHODS(Partial_measure_req, partial);
57 };
58
59 /**
60   todo: allow C meter
61  */
62 class Meter_change_req  : public Timing_req  {
63 public:
64     int beats_i_, one_beat_i_;
65
66     int compare(Meter_change_req const&);
67     Meter_change_req();
68     void set(int,int);
69     REQUESTMETHODS(Meter_change_req, meterchange);
70 };
71
72 /// toggle Cadenza mode
73 class Cadenza_req  : public Timing_req  {
74 public:
75     /// turn on?
76     bool on_b_;
77     Cadenza_req(bool);
78     REQUESTMETHODS(Cadenza_req,cadenza);
79 };
80
81 /// check if we're at start of a  measure.
82 class Barcheck_req  : public Timing_req  {
83 public:
84
85     REQUESTMETHODS(Barcheck_req,barcheck);
86 };
87
88 class Measure_grouping_req : public Timing_req  {
89 public:
90     Array<int> beat_i_arr_;
91     Array<Moment> elt_length_arr_;
92
93     REQUESTMETHODS(Measure_grouping_req, measuregrouping);
94 };
95
96 class Group_change_req  : public Command_req  {
97 public:
98     String newgroup_str_;
99     REQUESTMETHODS(Group_change_req, groupchange);
100 };
101
102 /** draw a (repeat)-bar. This something different than #Barcheck_req#,
103   the latter should only happen at the start of a measure.  */
104 class Bar_req  : public Command_req  {
105 public:
106     String type_str_;
107     Bar_req(String);
108     int compare(const Bar_req&)const;
109     REQUESTMETHODS(Bar_req,bar);
110 };
111 class Terminate_voice_req  : public Command_req  {
112 public:
113     REQUESTMETHODS(Terminate_voice_req,terminate);
114 };
115
116 class Group_feature_req  : public Command_req  {
117 public:
118     String type_str_;
119     String value_str_;
120     
121     REQUESTMETHODS(Group_feature_req, groupfeature);
122 };
123
124
125 /**
126     Handle key changes.
127     Routines for sharps and flats are separated, 
128     so that caller may identify non-conventional keys.
129 */
130 class Key_change_req  : public Command_req  {
131 public:
132     Array<Melodic_req*> melodic_p_arr_;
133     bool minor_b_;
134
135     /// don't ignore the  octaves in #melodic_p_arr_#?
136     bool multi_octave_b_;
137     Key_change_req();
138     Key_change_req(Key_change_req const&);
139     ~Key_change_req();
140     REQUESTMETHODS(Key_change_req, keychange);
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(Melodic_req const & d) const;
151     /// is minor key?
152     int minor_b();
153 };
154
155 class Clef_change_req  : public Command_req  {
156 public:
157     String clef_str_;
158     Clef_change_req(String);
159     REQUESTMETHODS(Clef_change_req, clefchange);
160 };
161
162 #endif // COMMANDREQUEST_HH