]> git.donarmstrong.com Git - lilypond.git/blob - simplestaff.cc
release: 0.0.6
[lilypond.git] / simplestaff.cc
1 #include "request.hh"
2 #include "debug.hh"
3 #include "staff.hh"
4 #include "command.hh"
5 #include "simplestaff.hh"
6 #include "sccol.hh" 
7
8
9
10
11 Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
12     : Staff_column(s)
13 {
14     the_note = 0;
15     staff_ = rs;
16 }
17
18 Simple_staff::Simple_staff()
19 {
20     theline = 0;
21 }
22
23 // should integrate handling of BREAK commands into Staff_column
24 void
25 Simple_column::process_commands( )
26 {
27     int breakstat = BREAK_END - BREAK_PRE;
28     for (int i = 0 ; i < s_commands.sz(); i++) {
29         Command *com = s_commands[i];
30         switch (com->code){
31         case INTERPRET:
32             break;
33         case BREAK_PRE:
34         case BREAK_MIDDLE:
35         case BREAK_POST:
36         case BREAK_END:
37             score_column->set_breakable();
38             breakstat = com->code- BREAK_PRE;
39             break;
40             
41         case TYPESET:
42             typeset_command ( com , breakstat);
43             break;
44         default :
45             break;
46         }       
47     }
48 }
49 /**
50  accept:
51
52     BREAK: all
53     TYPESET: bar, meter
54
55     */
56
57
58
59 void
60 Simple_column::process_requests()
61 {
62     for (int i = 0 ; i < v_elts.sz(); i ++)
63         for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
64             Request *rq= rqc;
65             if (rq->rhythmic()){
66                 if (the_note){
67                     WARN << "too many notes.\n";
68                     return;
69                 }
70                 the_note = rq;
71             }
72             break;
73         }
74 }
75
76 void
77 Simple_staff::grant_requests()
78 {
79     for  (PCursor<Staff_column*> cc(cols); cc.ok(); cc++) {
80         Simple_column *rp = (Simple_column*)*cc;
81         if (rp->the_note)
82             rp->typeset_req( rp->the_note);
83     }
84 }
85
86