]> git.donarmstrong.com Git - lilypond.git/blob - src/melodicstaff.cc
release: 0.0.20
[lilypond.git] / src / melodicstaff.cc
1 #include "melodicstaff.hh"
2 #include "keyitem.hh"
3 #include "stem.hh"
4 #include "rest.hh"
5 #include "notehead.hh"
6 #include "paper.hh"
7 #include "molecule.hh"
8 #include "linestaff.hh"
9 #include "rhythmstaff.hh"
10 #include "sccol.hh" 
11 #include "localkeyitem.hh"
12 #include "request.hh"
13
14 const int NO_LINES=5;
15
16
17 void
18 Melodic_staff::set_output(PScore*ps)
19 {
20     theline = new Linestaff(NO_LINES,ps);
21     Simple_staff::set_output(ps);
22 }
23
24
25 Notehead*
26 Melodic_staff::get_notehead(Note_req *rq, int bottom)
27 {        
28     int b  = rq->rhythmic()->balltype;
29     int d  = rq->rhythmic()->dots;
30     
31     Notehead *n =new Notehead((NO_LINES-1)*2);
32     n->balltype =b;
33     n->dots = d;
34     n->position = rq->note()->height() + bottom;
35     return n;
36 }
37
38 Item *
39 Melodic_staff::get_TYPESET_item(Command*com)
40 {
41     if (com->args[0] == "KEY") {
42         return new Keyitem(NO_LINES);   // urgh. depends on clef.
43     } else
44         return Simple_staff::get_TYPESET_item(com);
45 }
46
47 Stem *
48 Melodic_staff::get_stem(Stem_req*rq, Moment dur)
49 {
50     Stem * s = new Stem(NO_LINES-1, dur);
51     s->flag = rq->stem_number;
52     return s;
53 }
54
55 /*
56   creation
57   */
58 Staff *
59 get_new_melodicstaff()
60 {
61     return new Melodic_staff;
62 }
63
64 Rest*
65 Melodic_staff::get_rest(Rest_req*rq)
66 {
67     Rest*r = Simple_staff::get_rest(rq);
68     if (rq->balltype <= 2)
69         r->translate(Offset(0, NO_LINES * paper()->internote()));
70     return r;
71 }
72
73 Local_key_item*
74 Melodic_staff::get_local_key_item()
75 {
76     return new Local_key_item(-2);
77 }
78