summaryrefslogtreecommitdiff
path: root/simpleprint.cc
blob: b8f02c57987a19dc5fd450a41d1a068e259b7976 (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
#include "lookupsyms.hh"
#include "request.hh"
#include "pscore.hh"
#include "paper.hh"
#include "simplestaff.hh"
#include "molecule.hh"
#include "sccol.hh"

Molecule *
Simple_column::create_req_mol(Request *rq)
{
    Symbol s;
    int dots=0;

    if (rq->note())
	s = staff_->paper()->lookup_->ball(rq->note()->balltype);
    else if (rq->rest())
	s = staff_->paper()->lookup_->rest(rq->rest()->balltype);

    if (rq->rhythmic())
	dots=rq->rhythmic()->dots;


    Molecule *m = new Molecule(Atom(s));
    if (dots) {
	Symbol d = staff_->paper()->lookup_->dots(dots);
	Molecule dm;
	dm.add(Atom(d));
	m->add_right(dm);
    }
    return m;
}
Molecule *
Simple_column::create_command_mol(Command *com)
{
    Symbol s;

    if (com -> args[0] ==  "BAR" ) {
	s = staff_->paper()->lookup_->bar(com->args[1]);	
    } else if (com->args[0] == "METER") {
	Parametric_symbol *p = staff_->paper()->lookup_->meter("general");
	svec<String> arg( com->args);
	arg.del(0);
	s = p->eval(arg);
    } else
	assert(false);

    Molecule * m =new Molecule(Atom(s));
    {
	Interval wid;
	svec<Item*> sv(staff_->pscore_->
		       select_items(staff_->theline, score_column->pcol));
	for (int j=0; j<sv.sz(); j++) {
	    wid.unite(sv[j]->output->extent().x);
	}
	if (!wid.empty())
	    m->translate(Offset(wid.max,0));
    }
    
    return m;
}

void
Simple_column::typeset_item(Item *i, int breakst)
{
    // ugh
    staff_->pscore_->typeset_item(i, score_column->pcol,
				  staff_->theline,breakst);
}

void
Simple_staff::set_output(PScore* ps )
{
    pscore_ = ps;
    pscore_->add(theline);
}