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