static Item *head (Spanner *, Direction);
static int get_column_rank (Spanner *, Direction);
static int get_position (Spanner *);
- static int get_position_generic (Grob *);
static Direction get_default_dir (Spanner *);
static SCM get_control_points (Grob *, Grob *,
Tie_configuration const &,
#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"
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")))
{
has_manual_dir_ = true;
}
- position_ = Tie::get_position_generic (tie);
+ if (Spanner *spanner = dynamic_cast<Spanner *> (tie))
+ position_ = Tie::get_position (spanner);
+ else if (Item *item = dynamic_cast<Item *> (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))
{
return 0;
}
-int
-Tie::get_position_generic (Grob *me) // TODO: do away with this
-{
- Spanner *spanner = dynamic_cast<Spanner *> (me);
- if (spanner)
- return get_position (spanner);
-
- Item *item = dynamic_cast<Item *> (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]