X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstem-info.cc;h=6935bf39098654387d74e0697f5464a3532e1c41;hb=refs%2Ftags%2Frelease%2F1.1.43;hp=e3dfdfba057ec475a6a33bde0e5dd94f7530cc0f;hpb=8aad615ea7bb31f49a0c2afc21eea5ff5de20437;p=lilypond.git diff --git a/lily/stem-info.cc b/lily/stem-info.cc index e3dfdfba05..6935bf3909 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -11,28 +11,34 @@ #include "misc.hh" #include "debug.hh" +#include "align-element.hh" #include "stem.hh" #include "paper-def.hh" #include "lookup.hh" #include "stem-info.hh" #include "beam.hh" -#include "staff-sym.hh" +#include "staff-symbol.hh" Stem_info::Stem_info () { } +/* + FIXME: y dims should not be in internote. + */ -Stem_info::Stem_info (Stem*s) +Stem_info::Stem_info (Stem*s, int mult) { + mult_i_ =mult; stem_l_ = s; x_ = stem_l_->hpos_f (); dir_ = stem_l_->dir_; - beam_dir_ = stem_l_->beam_dir_; - mult_i_ = stem_l_->mult_i_; + SCM bd = stem_l_->remove_elt_property (beam_dir_scm_sym); + + beam_dir_ = gh_scm2int (SCM_CDR(bd)); interstaff_f_ = 0; - Paper_def* paper_l = stem_l_->paper (); - Real internote_f = paper_l->internote_f (); + Paper_def* paper_l = stem_l_->paper_l (); + Real internote_f = stem_l_->staff_line_leading_f ()/2; Real interbeam_f = paper_l->interbeam_f (mult_i_); Real beam_f = paper_l->beam_thickness_f (); @@ -104,29 +110,38 @@ Stem_info::Stem_info (Stem*s) idealy_f_ = miny_f_ >? idealy_f_; // interstaff beam - Beam* beam_l_ = stem_l_->beam_l_; - if (beam_l_->sinfo_.size () - && stem_l_->staff_sym_l_ != beam_l_->sinfo_[0].stem_l_->staff_sym_l_) + Beam* beam_l = stem_l_->beam_l_; + + Dimension_cache *common = stem_l_->common_group (beam_l, Y_AXIS); + Align_element * align = dynamic_cast (common->element_l ()); + if (align && align->axis() == Y_AXIS) { -#if 0 // this is nonsense..., don't issue warning - if (stem_l_->staff_sym_l_->dim_cache_[Y_AXIS].valid_b ()) - { - interstaff_f_ = stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS) - - beam_l_->sinfo_[0].stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS) / internote_f; - } - else -#endif - { - // warning (_ ("invalid dimension cache: guessing staff position")); - if (beam_l_->vertical_align_drul_[MIN] != - beam_l_->vertical_align_drul_[MAX]) - warning (_ ("minVerticalAlign != maxVerticalAlign: interstaff slurs may be broken")); - interstaff_f_ = beam_l_->vertical_align_drul_[MIN] / internote_f; - // urg, guess staff order: - // if our stem ends higher, our staff is probably lower... - if (idealy_f_ * beam_dir_ > beam_l_->sinfo_[0].idealy_f_ * beam_dir_) - interstaff_f_ *= -1; - } + if (align->threshold_interval_[MIN] != + align->threshold_interval_[MAX]) + warning (_ ("minVerticalAlign != maxVerticalAlign: interstaff beams/slurs may be broken")); + + 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]; + + while (beam_refpoint->parent_l_ != common) + beam_refpoint = beam_refpoint->parent_l_; + while (stem_refpoint->parent_l_ != common) + stem_refpoint = stem_refpoint->parent_l_; + + + int beam_prio = + align->get_priority (dynamic_cast (beam_refpoint->element_l ())); + int stem_prio = + align->get_priority (dynamic_cast (stem_refpoint->element_l ())); + + /* + our staff is lower -> interstaff_f_ *= -1 + */ + if (beam_prio < stem_prio) + interstaff_f_ *= -1; + idealy_f_ += interstaff_f_ * beam_dir_; miny_f_ += interstaff_f_ * beam_dir_; maxy_f_ += interstaff_f_ * beam_dir_;