10 Score::add(Command
*c
)
12 commands_
.bottom().add(new Command(*c
));
19 staffs_
.bottom().add(s
);
26 PCursor
<Score_column
*> sc(cols_
);
27 for (;sc
.ok(); sc
++) {
28 pscore_
->add(sc
->pcol
);
32 this sux. Really makeshift.
42 commands_
.top().insert(new Command(c
));
44 commands_
.top().insert(new Command(c
));
45 c
.code
= BREAK_MIDDLE
;
46 commands_
.top().insert(new Command(c
));
48 commands_
.top().insert(new Command(c
));
50 PCursor
<Command
*> bot(commands_
.bottom());
52 while (bot
.ok() && bot
->when
> c
.when
) {
53 // mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
55 bot
= commands_
.bottom();
59 bot
.add(new Command(c
));
61 c
.code
= BREAK_MIDDLE
;
62 bot
.add(new Command(c
));
65 bot
.add(new Command(c
));
68 bot
.add(new Command(c
));
77 for (PCursor
<Staff
*> stc(staffs_
); stc
.ok(); stc
++) {
78 l
= MAX(l
, stc
->last());
83 Score::clean_commands()
86 for (PCursor
<Command
*> cc(commands_
); cc
.ok(); cc
++) {
98 /// distribute commands to disciples
99 distribute_commands();
101 pscore_
= new PScore
;
102 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
103 sc
->set_output(pscore_
);
111 pscore_
->calc_breaking();
114 // remove empty cols with no spacing attached.
115 /* should rethink ownership of cols
120 for (PCursor
<Staff
* > sc(staffs_
); sc
.ok(); sc
++)
122 for (PCursor
<Score_column
*> c(cols_
); c
.ok(); c
++) {
123 if (!c
->pcol
->used
) {
124 // mtor << "removing : "; c->print();
129 pscore_
->clean_cols();
131 /* this sux. We should have Score_column create the appropriate PCol.
132 Unfortunately, PCols don't know about their position.
135 PCursor
<Score_column
*>
136 Score::create_cols(Mtime w
)
138 Score_column
* c1
= new Score_column(w
);
139 Score_column
* c2
= new Score_column(w
);
144 PCursor
<Score_column
*> scc(cols_
);
146 for (; scc
.ok(); scc
++) {
147 assert(scc
->when
!= w
);
153 cols_
.bottom().add(c1
);
154 cols_
.bottom().add(c2
);
155 scc
= cols_
.bottom();
166 Score::find_col(Mtime w
,bool mus
)
168 PCursor
<Score_column
*> scc(cols_
);
169 for (; scc
.ok(); scc
++) {
170 if (scc
->when
== w
&& scc
->musical
== mus
)
175 scc
= create_cols(w
);
182 Score::distribute_commands(void)
184 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
185 sc
->add_commands(commands_
);
191 Score::output(String s
)
194 mtor
<< "output to " << s
<< "...\n";
196 Tex_stream
the_output(s
);
197 the_output
<< "% Automatically generated by LilyPond 0.0 at";
199 the_output
<< ctime(&t
)<<"\n";
200 the_output
<< "% from input file ..\n";
201 pscore_
->output(the_output
);
207 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
209 assert(sc
->score_
== this);
213 for (PCursor
<Score_column
*> cc(cols_
); cc
.ok() && (cc
+1).ok(); cc
++) {
214 assert(cc
->when
<= (cc
+1)->when
);
216 for (PCursor
<Command
*> cc(commands_
); cc
.ok() && (cc
+1).ok(); cc
++) {
217 assert(cc
->when
<= (cc
+1)->when
);
226 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
229 for (PCursor
<Score_column
*> sc(cols_
); sc
.ok(); sc
++) {
235 /****************************************************************/
237 Score_column::Score_column(Mtime w
)
245 Score_column::used() {
250 Score_column::print() const
252 mtor
<< "Score_column { mus "<< musical
<<" at " << when
<<'\n';
253 mtor
<< " # symbols: " << pcol
->its
.size() << "\n";
254 mtor
<< "durations: [" ;
255 for (int i
=0; i
< durations
.sz(); i
++)
256 mtor
<< durations
[i
] << " ";