]> git.donarmstrong.com Git - lilypond.git/blob - simpleprint.cc
b069978dce169219b494f5628fe56a12f0f8bddf
[lilypond.git] / simpleprint.cc
1 #include "lookupsyms.hh"
2 #include "request.hh"
3 #include "pscore.hh"
4 #include "paper.hh"
5 #include "simplestaff.hh"
6 #include "molecule.hh"
7 #include "sccol.hh"
8
9 Molecule *
10 Simple_column::create_req_mol(Request *rq)
11 {
12     assert(rq->rest());
13     Symbol s;
14     int dots=0;
15     if (rq->rest())
16         s = staff_->paper()->lookup_->rest(rq->rest()->balltype);
17
18     if (rq->rhythmic())
19         dots=rq->rhythmic()->dots;
20
21
22     Molecule *m = new Molecule(Atom(s));
23     if (dots) {
24         Symbol d = staff_->paper()->lookup_->dots(dots);
25         Molecule dm;
26         dm.add(Atom(d));
27         m->add_right(dm);
28     }
29     return m;
30 }
31
32 Molecule *
33 Simple_column::create_command_mol(Command *com)
34 {
35     Symbol s;
36
37     if (com -> args[0] ==  "BAR" ) {
38         s = staff_->paper()->lookup_->bar(com->args[1]);        
39     } else if (com->args[0] == "METER") {
40         Parametric_symbol *p = staff_->paper()->lookup_->meter("general");
41         svec<String> arg( com->args);
42         arg.del(0);
43         s = p->eval(arg);
44     } else
45         assert(false);
46
47     Molecule * m =new Molecule(Atom(s));
48     {
49         Interval wid;
50         svec<Item*> sv(staff_->pscore_->
51                        select_items(staff_->theline, score_column->pcol));
52         for (int j=0; j<sv.sz(); j++) {
53             wid.unite(sv[j]->output->extent().x);
54         }
55         if (!wid.empty())
56             m->translate(Offset(wid.max,0));
57     }
58     
59     return m;
60 }
61
62 void
63 Simple_column::typeset_item(Item *i, int breakst)
64 {
65     // ugh
66     staff_->pscore_->typeset_item(i, score_column->pcol,
67                                   staff_->theline,breakst);
68 }
69
70 void
71 Simple_staff::set_output(PScore* ps )
72 {
73     pscore_ = ps;
74     pscore_->add(theline);
75 }