10 Score::add(Command *c)
12 if (c->code == TYPESET && c->args[0] == "BAR") {
13 /* should be encapsulated in BREAKs
22 commands_.bottom().add(new Command(k));
23 commands_.bottom().add(new Command(*c));
24 k.code = BREAK_MIDDLE;
25 commands_.bottom().add(new Command(k));
26 commands_.bottom().add(new Command(*c));
28 commands_.bottom().add(new Command(k));
30 commands_.bottom().add(new Command(k));
33 commands_.bottom().add(new Command(*c));
42 staffs_.bottom().add(s);
49 PCursor<Score_column*> sc(cols_);
50 for (;sc.ok(); sc++) {
51 pscore_->add(sc->pcol);
55 this sux. Really makeshift.
65 commands_.top().insert(new Command(c));
67 commands_.top().insert(new Command(c));
68 c.code = BREAK_MIDDLE;
69 commands_.top().insert(new Command(c));
71 commands_.top().insert(new Command(c));
73 PCursor<Command*> bot(commands_.bottom());
75 while (bot.ok() && bot->when > c.when) {
76 // mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
78 bot = commands_.bottom();
82 bot.add(new Command(c));
84 c.code = BREAK_MIDDLE;
85 bot.add(new Command(c));
88 bot.add(new Command(c));
91 bot.add(new Command(c));
100 for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
101 l = MAX(l, stc->last());
106 Score::clean_commands()
109 for (PCursor<Command*> cc(commands_); cc.ok(); cc++) {
111 mtor << "remming \n";
121 /// distribute commands to disciples
122 distribute_commands();
124 pscore_ = new PScore;
125 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
126 sc->set_output(pscore_);
130 // do this after processing, staffs first have to generate PCols.
136 pscore_->calc_breaking();
137 // TODO: calculate vertical structs
138 // TODO: calculate mixed structs.
141 // remove empty cols with no spacing attached.
142 /* should rethink ownership of cols
147 for (PCursor<Staff * > sc(staffs_); sc.ok(); sc++)
149 for (PCursor<Score_column*> c(cols_); c.ok(); c++) {
150 if (!c->pcol->used) {
151 // mtor << "removing : "; c->print();
156 pscore_->clean_cols();
158 /* this sux. We should have Score_column create the appropriate PCol.
159 Unfortunately, PCols don't know about their position.
162 PCursor<Score_column*>
163 Score::create_cols(Mtime w)
165 Score_column* c1 = new Score_column(w);
166 Score_column* c2 = new Score_column(w);
171 PCursor<Score_column*> scc(cols_);
173 for (; scc.ok(); scc++) {
174 assert(scc->when != w);
180 cols_.bottom().add(c1);
181 cols_.bottom().add(c2);
182 scc = cols_.bottom();
193 Score::find_col(Mtime w,bool mus)
195 PCursor<Score_column*> scc(cols_);
196 for (; scc.ok(); scc++) {
197 if (scc->when == w && scc->musical == mus)
202 scc = create_cols(w);
209 Score::distribute_commands(void)
211 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
212 sc->add_commands(commands_);
218 Score::output(String s)
221 mtor << "output to " << s << "...\n";
223 Tex_stream the_output(s);
224 the_output << "% Automatically generated by LilyPond 0.0 at";
226 the_output << ctime(&t)<<"\n";
227 the_output << "% from input file ..\n";
228 pscore_->output(the_output);
234 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
236 assert(sc->score_ == this);
240 for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
241 assert(cc->when <= (cc+1)->when);
243 for (PCursor<Command*> cc(commands_); cc.ok() && (cc+1).ok(); cc++) {
244 assert(cc->when <= (cc+1)->when);
253 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
256 for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
262 /****************************************************************/
264 Score_column::Score_column(Mtime w)
272 Score_column::used() {
277 Score_column::print() const
279 mtor << "Score_column { mus "<< musical <<" at " << when<<'\n';
280 mtor << " # symbols: " << pcol->its.size() << "\n";
281 mtor << "durations: [" ;
282 for (int i=0; i < durations.sz(); i++)
283 mtor << durations[i] << " ";