2 encompass-info.cc -- implement Encompass_info
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
12 #include "note-column.hh"
13 #include "paper-def.hh"
14 #include "encompass-info.hh"
16 #include "staff-symbol.hh"
17 #include "note-head.hh"
20 Encompass_info::Encompass_info ()
25 Encompass_info::Encompass_info (Note_column const* note, Direction dir, Slur const* slur_l)
29 Paper_def* paper = note->paper_l ();
32 Real notewidth = paper->note_width () * 0.8;
35 Stem* stem_l = note->stem_l_;
36 Real internote = stem_l-> staff_line_leading_f ()/2.;
39 set o_.x () to middle of notehead or on the exact position of stem,
40 according to slur direction
42 o_.x () = stem_l->hpos_f ();
53 if (stem_l->dir_ != dir)
54 o_.x () -= 0.5 * notewidth * stem_l->dir_;
56 o_.y () = stem_l->extent (Y_AXIS)[dir];
58 leave a gap: slur mustn't touch head/stem
60 o_.y () += 2.5 * internote * dir;
62 if (stem_l->dir_ != dir)
63 o_.y () += 1.0 * internote * dir;
65 if (slur_l->encompass_arr_.size ()
66 && stem_l->staff_symbol_l () != slur_l->encompass_arr_[0]->stem_l_->staff_symbol_l ())
68 if (slur_l->vertical_align_drul_[MIN] !=
69 slur_l->vertical_align_drul_[MAX])
70 warning (_ ("minVerticalAlign != maxVerticalAlign: interstaff slurs may be broken"));
71 interstaff_f_ = slur_l->vertical_align_drul_[MIN];
72 /* urg, guess staff order */
73 int d = note->head_l_arr_.top ()->position_i_
74 - slur_l->encompass_arr_[0]->head_l_arr_[0]->position_i_;
76 interstaff_f_ *= sign (d);
77 else if (stem_l->chord_start_f () >
78 slur_l->encompass_arr_[0]->stem_l_->chord_start_f ())
80 o_.y () += interstaff_f_;