]> git.donarmstrong.com Git - lilypond.git/blob - melodicstaff.cc
release: 0.0.7
[lilypond.git] / melodicstaff.cc
1 #include "melodicstaff.hh"
2 #include "stem.hh"
3
4 #include "paper.hh"
5 #include "molecule.hh"
6 #include "linestaff.hh"
7 #include "rhythmstaff.hh"
8 #include "sccol.hh" 
9
10 const int NO_LINES=5;
11 const int BOTTOM_POSITION=2;    // e is on bottom line of 5-staff...
12
13 void
14 Melodic_staff::set_output(PScore*ps)
15 {
16     theline = new Linestaff(NO_LINES,ps);
17     Simple_staff::set_output(ps);
18 }
19
20 void
21 Melodic_column::typeset_command(Command *com, int breakst)
22 {
23     Molecule*m=create_command_mol(com);
24     Item *i =new Item;
25     i->output = m;
26     typeset_item(i, breakst);
27 }
28
29 void
30 Melodic_column::typeset_req(Request *rq)
31 {
32     Item *i =new Item;
33     Molecule*m=create_req_mol(rq);
34
35     if (rq->note()) {
36         int h = rq->note()->height();
37         Real dy = staff_->paper()->interline()/2;
38         m->translate(Offset(0,(h-BOTTOM_POSITION)*dy));
39     }
40     i->output = m;
41     typeset_item(i);
42 }
43
44
45 void
46 Melodic_column::typeset_stem(Stem_req*rq)
47 {
48     Stem * s = new Stem(NO_LINES);
49     int n = the_note->note()->height()-BOTTOM_POSITION;
50     s->minnote =s->maxnote=n;
51     s->flag = rq->stem_number;
52     s->calculate();
53     typeset_item(s);
54     
55     s->brew_molecole();
56 }
57
58 /*
59   creation
60   */
61 Staff *
62 get_new_melodicstaff()
63 {
64     return new Melodic_staff;
65 }
66
67
68 Staff_column*
69 Melodic_staff::create_col(Score_column*s)
70 {
71     return new Melodic_column(s,this);
72 }
73
74 Melodic_staff*
75 Melodic_staff::clone()const
76 {
77     return new Melodic_staff(*this);
78 }