1 // utility functions for PScore
7 #include "scoreline.hh"
15 for (PCursor<PCol *> c(cols); c.ok(); )
24 PScore::add(PStaff *s)
26 assert(s->pscore_ == this);
27 staffs.bottom().add(s);
31 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
34 // assert(!breakstat != 4 || c->breakable() );
36 typeset_item(i, c->prebreak, s);
41 typeset_item(i, c->postbreak, s);
50 /* first do this, because i->width() may follow the 0-pointer */
54 if (c->daddy && c == c->daddy->prebreak) { // makeshift.
56 Interval iv (i->width());
58 svec<Item*> col_its (select_items(s, c));
59 for (int j =0; j < col_its.sz(); j++)
60 col_its[j]->translate(Offset(-iv.length(),0));
61 i->translate (Offset(-iv.max, 0));
68 PScore::typeset_spanner(Spanner*sp, PStaff*ps)
72 spanners.bottom().add(sp);
73 ps->spans.bottom().add(sp);
74 sp->left->starters.bottom().add(sp);
75 sp->right->stoppers.bottom().add(sp);
80 PScore::add_line(svec<const PCol *> curline, svec<Real> config)
82 Line_of_score *p = new Line_of_score(curline,this);
83 lines.bottom().add(p);
84 for (int i=0; i < curline.sz(); i++){
85 PCol *c=(PCol *)curline[i]; // so, this isn't really const.
91 PScore::get_spacing(PCol*l, PCol*r)
94 for (PCursor<Idealspacing*> ic (suz); ic.ok(); ic++) {
95 if (ic->left == l && ic->right == r){
100 Idealspacing*ip =new Idealspacing(l,r);
101 suz.bottom().add(ip);
108 return all breakable columns
111 PScore::find_breaks() const
113 svec<const PCol *> retval;
114 for (PCursor<PCol *> c(cols); c.ok(); c++)
124 cols.bottom().add(p);
127 PScore::PScore( Paperdef*p)
133 PScore::output(Tex_stream &ts)
137 for (PCursor<Line_of_score*> lic(lines); lic.ok(); lic++) {
138 ts << "% line of score no. " << l++ <<"\n";
139 ts << lic->TeXstring();
141 ts << "\\interscoreline\n";
147 PScore::select_items(PStaff*ps , PCol*pc)
151 for (PCursor<const Item*> ic(pc->its); ic.ok(); ic++){
152 if (ic->pstaff_ == ps)
153 ret.add((Item*)(const Item*)ic);
162 for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
164 for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
170 PScore::print() const
175 mtor << "\ncolumns: ";
176 for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
179 mtor << "\nideals: ";
180 for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
190 for (PCursor<Item*> ic(its); ic.ok(); ic++){
197 PScore::postprocess()
199 for (PCursor<Spanner*> ic(spanners); ic.ok(); ic++) {
202 for (PCursor<Item*> ic(its); ic.ok(); ic++){