X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsemi-tie.cc;h=2d0c1133a879f9e769900c014c8ba1c62c7e7bcc;hb=90e4d7057f3857da049dfda3d130017d4719bd6b;hp=1fbe8a3820dbdcb3cc0058f592d27e8557c7fe8e;hpb=e7aa6c445f463844dbaa52d38ea4aac2882b5601;p=lilypond.git diff --git a/lily/semi-tie.cc b/lily/semi-tie.cc index 1fbe8a3820..2d0c1133a8 100644 --- a/lily/semi-tie.cc +++ b/lily/semi-tie.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2014 Han-Wen Nienhuys + Copyright (C) 2005--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify @@ -22,12 +22,25 @@ #include "semi-tie.hh" #include "directional-element-interface.hh" #include "grob.hh" +#include "paper-column.hh" #include "tie.hh" #include "warn.hh" #include "staff-symbol-referencer.hh" ADD_INTERFACE (Semi_tie, - "A tie which is only on one side connected to a note head.", + "A tie which is only connected to a note head on one side." + "\n" + "The following properties may be set in the @code{details}" + " list:\n" + "\n" + "@table @code\n" + "@item height-limit\n" + "Maximum tie height: The longer the tie, the closer it is" + " to this height.\n" + "@item ratio\n" + "Parameter for tie shape. The higher this number, the" + " quicker the tie attains its @code{height-limit}.\n" + "@end table\n", /* properties */ "control-points " @@ -36,39 +49,65 @@ ADD_INTERFACE (Semi_tie, "head-direction " "note-head " "thickness " + "line-thickness " ); MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1) SCM Semi_tie::calc_control_points (SCM smob) { - Grob *me = unsmob_grob (smob); + Item *me = LY_ASSERT_SMOB(Item, smob, 1); + (void) me->get_property ("direction"); - if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS))) - { - me->get_parent (Y_AXIS)->get_property ("positioning-done"); - } - else + Grob *yparent = me->get_parent (Y_AXIS); + if (has_interface (yparent)) { - programming_error ("lv tie without Semi_tie_column. Killing lv tie."); - me->suicide (); + /* trigger positioning. */ + yparent->get_property ("positioning-done"); + + return me->get_property_data ("control-points"); } - return me->get_property_data ("control-points"); + programming_error ("lv tie without Semi_tie_column. Killing lv tie."); + me->suicide (); + return SCM_EOL; +} + +int +Semi_tie::get_column_rank (Item *me) +{ + return Paper_column::get_rank (me->get_column ()); } int -Semi_tie::get_position (Grob *me) +Semi_tie::get_position (Item *me) { - Grob *h = unsmob_grob (me->get_object ("note-head")); - return (int) rint (Staff_symbol_referencer::get_position (h)); + return (int) rint (Staff_symbol_referencer::get_position (head (me))); } bool -Semi_tie::less (Grob *const &s1, - Grob *const &s2) +Semi_tie::less (Grob *g1, Grob *g2) { - return get_position (s1) < get_position (s2); + Item *i1 = dynamic_cast (g1); + if (!i1) + { + g1->programming_error ("grob is not a semi-tie"); + return false; + } + + Item *i2 = dynamic_cast (g2); + if (!i2) + { + g2->programming_error ("grob is not a semi-tie"); + return true; + } + + return get_position (i1) < get_position (i2); } +Item * +Semi_tie::head (Item *me) +{ + return unsmob (me->get_object ("note-head")); +}