]> git.donarmstrong.com Git - lilypond.git/blob - src/request.cc
release: 0.0.23
[lilypond.git] / src / request.cc
1 #include "request.hh"
2 #include "misc.hh"
3 #include "debug.hh"
4 #include "scriptdef.hh"
5 #include "textdef.hh"
6
7 #define VIRTUALCONS(T,R) R *T::clone() const { return  new T(*this); } struct T
8 #define RCONS(T) VIRTUALCONS(T, Request)
9
10 RCONS(Rest_req);
11 RCONS(Barcheck_req);
12 RCONS(Text_req);
13 RCONS(Rhythmic_req);
14 RCONS(Mark_req);
15 RCONS(Stem_req);
16 RCONS(Script_req);
17 RCONS(Note_req);
18 RCONS(Melodic_req);
19 RCONS(Span_req);
20 RCONS(Slur_req);
21 RCONS(Beam_req);
22 void
23 Stem_req::print() const
24 {
25     mtor << "Stem\n";
26 }
27 void
28 Barcheck_req::print() const    
29 {
30 #ifndef NPRINT
31     mtor << "Barcheck\n";
32 #endif
33 }
34
35 void
36 Request::print() const    
37 {
38 #ifndef NPRINT
39     mtor << "Req{ unknown }\n";
40 #endif
41 }
42
43 void
44 Span_req::print() const    
45 {
46 #ifndef NPRINT
47     mtor << "Span_req {" << spantype << "}\n";
48 #endif
49 }
50
51 Request::Request()
52 {
53     elt_l_ = 0;
54 }
55 Request::Request(Request const&)
56 {
57     elt_l_ = 0;
58 }
59 Melodic_req::Melodic_req()
60 {
61     name = 0;
62     octave = 0;
63     accidental = 0;
64     forceacc = false;
65 }
66
67 int
68 Melodic_req::height() const
69 {
70     return  name + octave*7;
71 }
72
73 Rhythmic_req::Rhythmic_req()
74 {
75     plet_factor = 1;
76     balltype = 1;
77     dots = 0;
78 }
79
80 void
81 Rhythmic_req::print() const
82 {
83     mtor << "rhythmic: " << balltype ;
84     int d =dots;
85     while (d--)
86         mtor << '.';
87     
88     mtor<<", plet factor"<<plet_factor<<"\n";
89 }
90
91 void
92 Melodic_req::print() const
93 {
94     mtor << "note: " << name << " oct: "<< octave;
95 }
96
97 void
98 Note_req::print() const
99 {
100     Melodic_req::print();
101     Rhythmic_req::print();
102 }
103
104 void
105 Rest_req::print() const
106 {
107     mtor << "rest, " ;
108     Rhythmic_req::print();
109 }
110
111
112 Moment
113 Rhythmic_req::duration() const {    
114     return wholes(balltype,dots)*plet_factor;
115 }
116
117 Beam_req::Beam_req()
118 {
119     nplet = 0;
120 }
121
122 Span_req::Span_req()
123 {
124     spantype = NOSPAN;
125 }
126
127 Script_req::Script_req(int d , Script_def*def)
128 {
129     dir = d;
130     scriptdef = def;
131 }
132
133 Script_req::Script_req(Script_req const &s)
134 {
135     dir = s.dir;
136     scriptdef = new Script_def(*s.scriptdef);
137 }
138
139 void
140 Script_req::print() const
141 {
142     mtor << " dir " << dir ;
143     scriptdef->print();
144 }
145
146
147 Script_req::~Script_req()
148 {
149     delete scriptdef;
150 }
151
152 Text_req::Text_req(Text_req const& s)
153 {
154     spec = new Text_def(*s.spec);
155     dir = s.dir;
156 }
157 Text_req::Text_req(int d , Text_def*def)
158 {
159     dir = d;
160     spec = def;
161 }
162
163 void
164 Text_req::print() const
165 {
166     mtor << " dir " << dir ;
167     spec->print();
168 }
169
170
171 Text_req::~Text_req()
172 {
173     delete spec;
174 }
175
176 Mark_req::Mark_req(String s)
177 {
178     mark_str_ = s;
179 }
180
181 void
182 Mark_req::print()const
183 {
184 #ifndef NDEBUG
185     mtor<< "Mark `" << mark_str_ << "\'\n";
186 #endif
187 }