]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tie.cc
Web-ja: update introduction
[lilypond.git] / lily / tie.cc
index 57cbf6e3f4587f73757600c6d7fcc46b3b7af8d8..dcc53ad44e61c7af5ee5522ce3d8b18a19b56eb4 100644 (file)
@@ -45,13 +45,20 @@ bool
 Tie::less (Grob *g1, Grob *g2)
 {
   Spanner *s1 = dynamic_cast<Spanner *> (g1);
+  if (!s1)
+    {
+      g1->programming_error ("grob is not a tie");
+      return false;
+    }
+
   Spanner *s2 = dynamic_cast<Spanner *> (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<Note_head> (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<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]
 
@@ -161,8 +153,8 @@ Tie::calc_direction (SCM smob)
   // types.  It might be clearer to use a template.
   Grob *me = unsmob<Grob> (smob);
   Grob *yparent = me->get_parent (Y_AXIS);
-  if ((Tie_column::has_interface (yparent)
-       || Semi_tie_column::has_interface (yparent))
+  if ((has_interface<Tie_column> (yparent)
+       || has_interface<Semi_tie_column> (yparent))
       && unsmob<Grob_array> (yparent->get_object ("ties"))
       //      && unsmob<Grob_array> (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<Tie_column> (yparent)
+       || has_interface<Semi_tie_column> (yparent))
       && unsmob<Grob_array> (yparent->get_object ("ties")))
     {
       extract_grob_set (yparent, "ties", ties);