X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftie-specification.cc;h=f404ad597c4b9514885b3d1e7aa2aed5cddbec18;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=0ccf2c5beb3298e44e0f1d5e3e0814ed8ee029b6;hpb=e8d5061834a5a658c5ffd078237e9cd660069a7d;p=lilypond.git diff --git a/lily/tie-specification.cc b/lily/tie-specification.cc index 0ccf2c5beb..f404ad597c 100644 --- a/lily/tie-specification.cc +++ b/lily/tie-specification.cc @@ -1,5 +1,8 @@ #include "tie-formatting-problem.hh" #include "grob.hh" +#include "item.hh" +#include "semi-tie.hh" +#include "spanner.hh" #include "tie.hh" #include "libc-extension.hh" #include "tie-specification.hh" @@ -22,6 +25,8 @@ Tie_specification::Tie_specification () void Tie_specification::from_grob (Grob *tie) { + // In this method, Tie and Semi_tie require the same logic with different + // types. It might be clearer to use a template. tie_grob_ = tie; if (scm_is_number (tie->get_property_data ("direction"))) { @@ -29,7 +34,16 @@ Tie_specification::from_grob (Grob *tie) has_manual_dir_ = true; } - position_ = Tie::get_position (tie); + if (Spanner *spanner = dynamic_cast (tie)) + position_ = Tie::get_position (spanner); + else if (Item *item = dynamic_cast (tie)) + position_ = Semi_tie::get_position (item); + else + { + programming_error ("grob is neither a tie nor a semi-tie"); + position_ = 0; + } + SCM pos_scm = tie->get_property ("staff-position"); if (scm_is_number (pos_scm)) {