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