#include <math.h>
-#include "new-beaming.hh"
+#include "chord-tremolo.hh"
+#include "beaming.hh"
#include "proto.hh"
#include "dimensions.hh"
#include "beam.hh"
Beam::add_stem (Stem*s)
{
#if 0
+ /*
+ should figure out why this didn't work.
+
+ --hwn.
+ */
if (!stems_.size ())
{
- dim_cache_[Y_AXIS]->parent_l_ = s->dim_cache_[Y_AXIS];
+ set_parent (s, Y_AXIS);
}
#endif
stems_.push (s);
mol_p->add_molecule (sb);
}
mol_p->translate_axis (x0
- - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS);
+ - spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS), X_AXIS);
return mol_p;
}
count[UP] = count[DOWN] = 0;
Direction d = DOWN;
- Direction beamdir;
for (int i=0; i <stems_.size (); i++)
do {
Stem *s = stems_[i];
If dir is not determined: up (see stem::get_default_dir ())
*/
+ Direction beam_dir;
+ Direction neutral_dir = (Direction)(int)paper_l ()->get_var ("stem_default_neutral_direction");
+
Dir_algorithm a = (Dir_algorithm)rint(paper_l ()->get_var ("beam_dir_algorithm"));
switch (a)
{
case MAJORITY:
- beamdir = (count[UP] >= count[DOWN]) ? UP : DOWN;
+ beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
+ : (count[UP] > count[DOWN]) ? UP : DOWN;
break;
case MEAN:
// mean center distance
- beamdir = (total[UP] >= total[DOWN]) ? UP : DOWN;
+ beam_dir = (total[UP] == total[DOWN]) ? neutral_dir
+ : (total[UP] > total[DOWN]) ? UP : DOWN;
break;
default:
case MEDIAN:
// median center distance
- if (!count[DOWN])
- beamdir = UP;
- if (!count[UP])
- beamdir = DOWN;
+ if (!count[DOWN] || !count[UP])
+ {
+ beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
+ : (count[UP] > count[DOWN]) ? UP : DOWN;
+ }
else
- beamdir = (total[UP] / count[UP] >= total[DOWN] / count[DOWN]) ? UP : DOWN;
+ {
+ beam_dir = (total[UP] / count[UP] == total[DOWN] / count[DOWN])
+ ? neutral_dir
+ : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN;
+ }
break;
}
- return beamdir;
+ return beam_dir;
}
void
{
// when all too short, normal stems win..
if (dy_f < -epsilon_f)
- warning (_ ("weird beam shift, check your knees"));
- dy_f = dy_f >? sinfo_[i].miny_f_ - y;
+ warning (_ ("weird beam vertical offset"));
+ dy_f = dy_f >? sinfo_[i].miny_f_ - y;
}
}
return dy_f;
for (int i=0; i < stems_.size (); i++)
{
Stem *s = stems_[i];
- if (s->invisible_b ())
- continue;
+ /*
+ Chord tremolo needs to beam over invisible stems of wholes
+ */
+ if (!dynamic_cast<Chord_tremolo*> (this))
+ {
+ if (s->invisible_b ())
+ continue;
+ }
Stem_info info (s, multiple_i_);
if (leftx == 0)
Molecule rightbeams;
// UGH
- Real nw_f = paper_l ()->note_width () * 0.8;
+ Real nw_f;
+ if (!here->head_l_arr_.size ())
+ nw_f = 0;
+ else if (here->type_i ()== 1)
+ nw_f = paper_l ()->get_var ("wholewidth");
+ else if (here->type_i () == 2)
+ nw_f = paper_l ()->note_width () * 0.8;
+ else
+ nw_f = paper_l ()->get_var ("quartwidth");
/* half beams extending to the left. */
if (prev)
SCM gap = get_elt_property (beam_gap_scm_sym);
if (gap != SCM_BOOL_F)
{
- int gap_i = gh_scm2int (gap);
+ int gap_i = gh_scm2int (SCM_CDR (gap));
int nogap = rwholebeams - gap_i;
for (; j < nogap; j++)
for (; j < rwholebeams; j++)
{
Molecule b (a);
- b.translate (Offset (gap_f, -dir_ * dy * j));
+ if (!here->invisible_b ())
+ b.translate (Offset (gap_f, -dir_ * dy * j));
+ else
+ b.translate (Offset (0, -dir_ * dy * j));
rightbeams.add_molecule (b);
}