1 #include "scommands.hh"
11 Score::set(Paperdef*p)
18 Score::output(String s)
21 if (paper_->outfile=="")
24 *mlog << "output to " << paper_->outfile << "...\n";
25 Tex_stream the_output(paper_->outfile);
26 pscore_->output(the_output);
33 *mlog << "Processing ... ";
34 set(commands_->parse(last()));
38 paper_ = new Paperdef;
40 commands_->clean(last());
42 /// distribute commands to disciples
43 distribute_commands();
45 pscore_ = new PScore(paper_);
46 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
47 sc->set_output(pscore_);
51 // do this after processing, staffs first have to generate PCols.
58 pscore_->preprocess();
59 *mlog << "Calculating ... ";
60 pscore_->calc_breaking();
61 pscore_->postprocess();
63 // TODO: calculate vertical structs
64 // TODO: calculate mixed structs.
68 // remove empty cols with no spacing attached.
69 /* should rethink ownership of cols
74 for (PCursor<Staff * > sc(staffs_); sc.ok(); sc++)
77 for (PCursor<Score_column*> c(cols_); c.ok(); ) {
79 mtor << "removing : ";
86 pscore_->clean_cols();
88 /* this sux. We should have Score_column create the appropriate PCol.
89 Unfortunately, PCols don't know about their position.
92 PCursor<Score_column*>
93 Score::create_cols(Real w)
95 Score_column* c1 = new Score_column(w);
96 Score_column* c2 = new Score_column(w);
101 PCursor<Score_column*> scc(cols_);
103 for (; scc.ok(); scc++) {
104 assert(scc->when != w);
110 cols_.bottom().add(c1);
111 cols_.bottom().add(c2);
112 scc = cols_.bottom();
123 Score::find_col(Real w,bool mus)
125 PCursor<Score_column*> scc(cols_);
126 for (; scc.ok(); scc++) {
127 if (scc->when == w && scc->musical == mus)
132 scc = create_cols(w);
139 Score::distribute_commands(void)
141 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
142 sc->add_commands(*commands_);
149 staffs_.bottom().add(s);
156 PCursor<Score_column*> sc(cols_);
157 for (; sc.ok(); sc++) {
158 pscore_->add(sc->pcol);
165 for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
166 l = MAX(l, stc->last());
175 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
177 assert(sc->score_ == this);
181 for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
182 assert(cc->when <= (cc+1)->when);
194 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
197 for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
209 commands_ = new Score_commands;
220 Score::set(Score_commands*c)