#include "proto.hh"
#include "misc.hh"
#include "debug.hh"
+#include "dimension-cache.hh"
#include "align-element.hh"
#include "stem.hh"
// for simplicity, we calculate as if dir == UP
idealy_f_ *= beam_dir_;
-
+
+ bool grace_b = stem_l_->get_elt_property (grace_scm_sym) != SCM_BOOL_F;
+
int stem_max = (int)rint(paper_l->get_var ("stem_max"));
- Real min_stem_f = paper_l->get_var (String ("minimum_stem_length")
- + to_str (mult_i_ <? stem_max));
- Real stem_f = paper_l->get_var (String ("stem_length")
- + to_str (mult_i_ <? stem_max));
+ String type_str = grace_b ? "grace_" : "";
+ Real min_stem_f = paper_l->get_var (type_str + "minimum_stem_length"
+ + to_str (mult_i_ <? stem_max)) * internote_f;
+ Real stem_f = paper_l->get_var (type_str + "stem_length"
+ + to_str (mult_i_ <? stem_max))* internote_f;
if (!beam_dir_ || (beam_dir_ == dir_))
/* normal beamed stem */
idealy_f_ += stem_f;
miny_f_ += min_stem_f;
- // lowest beam of (UP) beam must never be lower than second staffline
- miny_f_ = miny_f_ >? (- 2 * internote_f - beam_f
- + (mult_i_ > 0) * beam_f + interbeam_f * (mult_i_ - 1));
+ /*
+ lowest beam of (UP) beam must never be lower than second staffline
+
+ Hmm, reference (Wanske?)
+
+ Although this (additional) rule is probably correct,
+ I expect that highest beam (UP) should also never be lower
+ than middle staffline, just as normal stems.
+
+ */
+ if (!grace_b)
+ {
+ //highest beam of (UP) beam must never be lower than middle staffline
+ miny_f_ = miny_f_ >? 0;
+ //lowest beam of (UP) beam must never be lower than second staffline
+ miny_f_ = miny_f_ >? (- 2 * internote_f - beam_f
+ + (mult_i_ > 0) * beam_f + interbeam_f * (mult_i_ - 1));
+ }
}
else
/* knee */
// interstaff beam
Beam* beam_l = stem_l_->beam_l_;
- Dimension_cache *common = stem_l_->common_group (beam_l, Y_AXIS);
- Align_element * align = dynamic_cast<Align_element*> (common->element_l ());
+ Graphical_element *common = stem_l_->common_refpoint (beam_l, Y_AXIS);
+ Align_element * align = dynamic_cast<Align_element*> (common);
if (align && align->axis() == Y_AXIS)
{
if (align->threshold_interval_[MIN] !=
interstaff_f_ = align->threshold_interval_[MIN] / internote_f;
- Dimension_cache * beam_refpoint = beam_l->dim_cache_[Y_AXIS];
- Dimension_cache * stem_refpoint = stem_l_->dim_cache_[Y_AXIS];
+ Graphical_element * beam_refpoint = beam_l;
+ Graphical_element * stem_refpoint = stem_l_;
- while (beam_refpoint->parent_l_ != common)
- beam_refpoint = beam_refpoint->parent_l_;
- while (stem_refpoint->parent_l_ != common)
- stem_refpoint = stem_refpoint->parent_l_;
+ while (beam_refpoint->parent_l (Y_AXIS) != common)
+ beam_refpoint = beam_refpoint->parent_l (Y_AXIS);
+ while (stem_refpoint->parent_l (Y_AXIS) != common)
+ stem_refpoint = stem_refpoint->parent_l (Y_AXIS);
int beam_prio =
- align->get_priority (dynamic_cast<Score_element*> (beam_refpoint->element_l ()));
+ align->get_priority (dynamic_cast<Score_element*> (beam_refpoint));
int stem_prio =
- align->get_priority (dynamic_cast<Score_element*> (stem_refpoint->element_l ()));
+ align->get_priority (dynamic_cast<Score_element*> (stem_refpoint));
/*
our staff is lower -> interstaff_f_ *= -1