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