1 #include "scommands.hh"
11 Score::set(Paperdef*p)
17 Score::output(String s)
20 if (paper_->outfile=="")
23 *mlog << "output to " << paper_->outfile << "...\n";
24 Tex_stream the_output(paper_->outfile);
25 pscore_->output(the_output);
32 set(commands_->parse(last()));
36 paper_ = new Paperdef;
38 commands_->clean(last());
40 /// distribute commands to disciples
41 distribute_commands();
44 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
45 sc->set_output(pscore_);
49 // do this after processing, staffs first have to generate PCols.
55 pscore_->calc_breaking();
56 // TODO: calculate vertical structs
57 // TODO: calculate mixed structs.
60 // remove empty cols with no spacing attached.
61 /* should rethink ownership of cols
66 for (PCursor<Staff * > sc(staffs_); sc.ok(); sc++)
69 for (PCursor<Score_column*> c(cols_); c.ok(); ) {
71 mtor << "removing : ";
78 pscore_->clean_cols();
80 /* this sux. We should have Score_column create the appropriate PCol.
81 Unfortunately, PCols don't know about their position.
84 PCursor<Score_column*>
85 Score::create_cols(Real w)
87 Score_column* c1 = new Score_column(w);
88 Score_column* c2 = new Score_column(w);
93 PCursor<Score_column*> scc(cols_);
95 for (; scc.ok(); scc++) {
96 assert(scc->when != w);
102 cols_.bottom().add(c1);
103 cols_.bottom().add(c2);
104 scc = cols_.bottom();
115 Score::find_col(Real w,bool mus)
117 PCursor<Score_column*> scc(cols_);
118 for (; scc.ok(); scc++) {
119 if (scc->when == w && scc->musical == mus)
124 scc = create_cols(w);
131 Score::distribute_commands(void)
133 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
134 sc->add_commands(*commands_);
141 staffs_.bottom().add(s);
148 PCursor<Score_column*> sc(cols_);
149 for (; sc.ok(); sc++) {
150 pscore_->add(sc->pcol);
157 for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
158 l = MAX(l, stc->last());
167 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
169 assert(sc->score_ == this);
173 for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
174 assert(cc->when <= (cc+1)->when);
186 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
189 for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
201 commands_ = new Score_commands;
212 Score::set(Score_commands*c)