summaryrefslogtreecommitdiff
path: root/simplestaff.cc
blob: 97250b48cb9206b51dd8d34f0d11029ed46722a5 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "request.hh"
#include "debug.hh"
#include "staff.hh"
#include "command.hh"
#include "simplestaff.hh"
#include "sccol.hh" 




Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
    : Staff_column(s)
{
    the_note = 0;
    stem_ = 0;    
    staff_ = rs;
}

Simple_staff::Simple_staff()
{
    theline = 0;
}

void
Simple_column::process_commands( )
{
    int breakstat = BREAK_END - BREAK_PRE;
    for (int i = 0 ; i < s_commands.sz(); i++) {
	Command *com = s_commands[i];
	switch (com->code){
	case INTERPRET:
	    break;
	case BREAK_PRE:
	case BREAK_MIDDLE:
	case BREAK_POST:
	case BREAK_END:
	    score_column->set_breakable();
	    breakstat = com->code- BREAK_PRE;
	    break;
	    
	case TYPESET:
	    typeset_command ( com , breakstat);
	    break;
	default :
	    break;
	}	
    }
}
/**
 accept:

    BREAK: all
    TYPESET: bar, meter,

    */



void
Simple_column::process_requests()
{
    for (int i = 0 ; i < v_elts.sz(); i ++)
	for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
	    Request *rq= rqc;
	    if (rq->rhythmic()){
		if (the_note){
		    WARN << "too many notes.\n";		    
		}
		the_note = rq;
		
	    }
	    if (rq->stem()) {
		stem_ = rq->stem();
	    }

	}
}

void
Simple_staff::grant_requests()
{
    for  (PCursor<Staff_column*> cc(cols); cc.ok(); cc++) {
	Simple_column *rp = (Simple_column*)*cc;
	if (rp->the_note)
	    rp->typeset_req( rp->the_note);
	if (rp->stem_)
	    rp->typeset_stem(rp->stem_->stem());
    }
}