void
Stem::set_stemend(Real se)
{
- assert(!output);
+
// todo: margins
assert((dir > 0 && se >= maxnote) || (se <= minnote && dir <0));
void
Stem::add(Notehead *n)
{
+ assert(status < PRECALCED);
+
if (n->balltype == 1)
return;
int p = n->position;
if ( p> maxnote)
maxnote = p;
heads.add(n);
+ n->dependencies.add(this);
}
Stem::set_noteheads()
{
heads.sort(Notehead::compare);
- int parity=0;
+ int parity=1;
int lastpos = heads[0]->position;
for (int i=1; i < heads.sz(); i ++) {
- if (abs(lastpos- heads[i]->position) == 1) {
+ int dy =abs(lastpos- heads[i]->position);
+
+ if (dy <= 1) {
if (parity)
heads[i]->x_dir = (stem_xoffset>0) ? 1:-1;
parity = !parity;
}
void
-Stem::postprocess()
+Stem::do_pre_processing()
{
if (bot == top)
set_default_extents();
set_noteheads();
- brew_molecole();
}
+
Interval
Stem::width()const
{
return r;
}
-void
-Stem::brew_molecole()
+Molecule*
+Stem::brew_molecule()const return out;
{
assert(pstaff_);
assert(bot!=top);
- assert(!output);
+
Paperdef *p =paper();
Symbol ss =p->lookup_->stem(bot*dy,top*dy);
- output = new Molecule(Atom(ss));
+ out = new Molecule(Atom(ss));
if (print_flag&&abs(flag) > 4){
Symbol fl = p->lookup_->flag(flag);
Molecule m(fl);
if (flag < -4){
- output->add_bottom(m);
+ out->add_bottom(m);
} else if (flag > 4) {
- output->add_top(m);
+ out->add_top(m);
} else
assert(false);
}
- output->translate(Offset(stem_xoffset,0));
-
+ out->translate(Offset(stem_xoffset,0));
}
Real
}
-void
-Stem::preprocess()
-{
- set_default_extents(); // needed for the flags.
-}