X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftie.cc;h=dcc53ad44e61c7af5ee5522ce3d8b18a19b56eb4;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=57cbf6e3f4587f73757600c6d7fcc46b3b7af8d8;hpb=0f51786ea76c51bf5a788c748066a85bd7943a15;p=lilypond.git diff --git a/lily/tie.cc b/lily/tie.cc index 57cbf6e3f4..dcc53ad44e 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -45,13 +45,20 @@ bool Tie::less (Grob *g1, Grob *g2) { Spanner *s1 = dynamic_cast (g1); + if (!s1) + { + g1->programming_error ("grob is not a tie"); + return false; + } + Spanner *s2 = dynamic_cast (g2); - if (s1 && s2) { - return get_position (s1) < get_position (s2); - } + if (!s2) + { + g2->programming_error ("grob is not a tie"); + return true; + } - programming_error ("grob is not a tie"); - return false; + return get_position (s1) < get_position (s2); } void @@ -64,7 +71,7 @@ Item * Tie::head (Spanner *me, Direction d) { Item *it = me->get_bound (d); - return Note_head::has_interface (it) ? it : 0; + return has_interface (it) ? it : 0; } int @@ -93,21 +100,6 @@ Tie::get_position (Spanner *me) return 0; } -int -Tie::get_position_generic (Grob *me) // TODO: do away with this -{ - Spanner *spanner = dynamic_cast (me); - if (spanner) - return get_position (spanner); - - Item *item = dynamic_cast (me); - if (item) - return Semi_tie::get_position (item); - - programming_error ("grob is neither a tie nor a semi-tie"); - return 0; -} - /* Default: Put the tie oppositie of the stem [Wanske p231] @@ -161,8 +153,8 @@ Tie::calc_direction (SCM smob) // types. It might be clearer to use a template. Grob *me = unsmob (smob); Grob *yparent = me->get_parent (Y_AXIS); - if ((Tie_column::has_interface (yparent) - || Semi_tie_column::has_interface (yparent)) + if ((has_interface (yparent) + || has_interface (yparent)) && unsmob (yparent->get_object ("ties")) // && unsmob (yparent->get_object ("ties"))->size () > 1 ) @@ -224,8 +216,8 @@ Tie::calc_control_points (SCM smob) Spanner *me = LY_ASSERT_SMOB(Spanner, smob, 1); Grob *yparent = me->get_parent (Y_AXIS); - if ((Tie_column::has_interface (yparent) - || Semi_tie_column::has_interface (yparent)) + if ((has_interface (yparent) + || has_interface (yparent)) && unsmob (yparent->get_object ("ties"))) { extract_grob_set (yparent, "ties", ties);