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