X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftie.cc;h=0f7f0830cefac107bdf7951194c0ccda7457e815;hb=4cb2a5267e16d233b13089ab37a467c3d19da235;hp=2dea2b88467b2182386ab7ffd454fac25d372cf1;hpb=d9b43b93f2c885409bafdb157138158f65cc49aa;p=lilypond.git diff --git a/lily/tie.cc b/lily/tie.cc index 2dea2b8846..0f7f0830ce 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -50,14 +50,8 @@ void Tie::set_interface (Grob*me) { me->set_grob_property ("heads", gh_cons (SCM_EOL, SCM_EOL)); - me->set_interface (ly_symbol2scm ("tie-interface")); } -bool -Tie::has_interface (Grob*me) -{ - return me->has_interface (ly_symbol2scm ("tie-interface")); -} Grob* Tie::head (Grob*me, Direction d) @@ -122,9 +116,11 @@ Tie::get_control_points (SCM smob) me->suicide (); return SCM_UNSPECIFIED; } + if (!Directional_element_interface::get (me)) Directional_element_interface::set (me, Tie::get_default_dir (me)); + Direction dir = Directional_element_interface::get (me); Real staff_space = Staff_symbol_referencer::staff_space (me); @@ -139,15 +135,24 @@ Tie::get_control_points (SCM smob) Real left_x; /* - this is a kludge: the tie has to be long enough to be - visible, but should not go through key sigs. - - (please fixme) + the tie has to be long enough to be visible, but should not go + through key sigs. In the 1.5 series the pref.matter - note + distance is fixed , so this won't be a problem anymore. */ - Real lambda = 0.5; + Real lambda = 0.9; if (Note_head::has_interface (l)) - left_x = l->extent (l, X_AXIS)[RIGHT] + x_gap_f; + { + Real where = RIGHT; + + /* + This correction is due te the shape of the black note head. + */ + if (Rhythmic_head::duration_log (l) == 2) + where += dir* 0.2; + left_x = l->extent (l, X_AXIS).linear_combination (where) + + x_gap_f; + } else left_x = l->extent (l, X_AXIS).linear_combination (lambda); @@ -173,7 +178,7 @@ Tie::get_control_points (SCM smob) - 2 * x_gap_f; } - Direction dir = Directional_element_interface::get (me); + SCM details = me->get_grob_property ("details"); @@ -249,6 +254,18 @@ Tie::get_control_points (SCM smob) { Real y1 = ry + clear; Real y2 = ry - clear; + + /* + ugh, we shove the 0.5 out of our sleeves. + + Any way. This test is to make sure that staffline + collision avoidance does not result in completely flat + ties. + */ + if (fabs (y1 - ypos) < 0.5) + y1 = y2; + else if (fabs (y2 - ypos) < 0.5) + y2 = y1; newy = (fabs (y1 - y) < fabs (y2 - y)) ? y1 : y2; @@ -295,7 +312,7 @@ Tie::brew_molecule (SCM smob) Real thick = gh_scm2double (me->get_grob_property ("thickness")) - * me->paper_l ()->get_var ("stafflinethickness"); + * me->paper_l ()->get_var ("linethickness"); Bezier b; int i = 0; @@ -311,3 +328,8 @@ Tie::brew_molecule (SCM smob) } + +ADD_INTERFACE (Tie,"tie-interface", + "A tie connecting two noteheads. +direction = Forced direction for all ties", + "y-offset staffline-clearance control-points heads details thickness x-gap direction minimum-length");