]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tie.cc
Merge branch 'issue4032'
[lilypond.git] / lily / tie.cc
index b52f84db0f7b391a7aaf1f4524b7010f2f3305db..b2a138e1a68b283a3465da295aecd4abdce48aa0 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ Tie::head (Grob *me, Direction d)
       Direction hd = to_dir (me->get_property ("head-direction"));
 
       return (hd == d)
-             ? unsmob_grob (me->get_object ("note-head"))
+             ? Grob::unsmob (me->get_object ("note-head"))
              : 0;
     }
 
@@ -92,21 +92,19 @@ Tie::get_column_rank (Grob *me, Direction d)
 int
 Tie::get_position (Grob *me)
 {
-  Direction d = LEFT;
-  do
+  for (LEFT_and_RIGHT (d))
     {
       Grob *h = head (me, d);
       if (h)
         return (int) rint (Staff_symbol_referencer::get_position (h));
     }
-  while (flip (&d) != LEFT);
 
   /*
     TODO: this is theoretically possible for ties across more than 2
     systems.. We should look at the first broken copy.
 
   */
-  programming_error ("Tie without heads. Suicide");
+  programming_error ("Tie without heads.  Suicide");
   me->suicide ();
   return 0;
 }
@@ -125,8 +123,7 @@ Direction
 Tie::get_default_dir (Grob *me)
 {
   Drul_array<Grob *> stems;
-  Direction d = LEFT;
-  do
+  for (LEFT_and_RIGHT (d))
     {
       Grob *one_head = head (me, d);
       if (!one_head && dynamic_cast<Spanner *> (me))
@@ -138,7 +135,6 @@ Tie::get_default_dir (Grob *me)
 
       stems[d] = stem;
     }
-  while (flip (&d) != LEFT);
 
   if (stems[LEFT] && stems[RIGHT])
     {
@@ -161,12 +157,12 @@ MAKE_SCHEME_CALLBACK (Tie, calc_direction, 1);
 SCM
 Tie::calc_direction (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = Grob::unsmob (smob);
   Grob *yparent = me->get_parent (Y_AXIS);
   if ((Tie_column::has_interface (yparent)
        || Semi_tie_column::has_interface (yparent))
-      && unsmob_grob_array (yparent->get_object ("ties"))
-      //      && unsmob_grob_array (yparent->get_object ("ties"))->size () > 1
+      && Grob_array::unsmob (yparent->get_object ("ties"))
+      //      && Grob_array::unsmob (yparent->get_object ("ties"))->size () > 1
      )
     {
       /* trigger positioning. */
@@ -189,7 +185,6 @@ Tie::get_default_control_points (Grob *me_grob)
   Tie_formatting_problem problem;
   problem.from_tie (me);
 
-  Tie_specification spec = problem.get_tie_specification (0);
   if (!me->is_live ())
     return SCM_EOL;
 
@@ -223,12 +218,12 @@ MAKE_SCHEME_CALLBACK (Tie, calc_control_points, 1);
 SCM
 Tie::calc_control_points (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = Grob::unsmob (smob);
 
   Grob *yparent = me->get_parent (Y_AXIS);
   if ((Tie_column::has_interface (yparent)
        || Semi_tie_column::has_interface (yparent))
-      && unsmob_grob_array (yparent->get_object ("ties")))
+      && Grob_array::unsmob (yparent->get_object ("ties")))
     {
       extract_grob_set (yparent, "ties", ties);
       if (me->original () && ties.size () == 1
@@ -255,7 +250,7 @@ MAKE_SCHEME_CALLBACK (Tie, print, 1);
 SCM
 Tie::print (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = Grob::unsmob (smob);
 
   SCM cp = me->get_property ("control-points");
 
@@ -286,7 +281,7 @@ Tie::print (SCM smob)
       string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
-      Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
+      Stencil tm = *Stencil::unsmob (Text_interface::interpret_markup
                                     (me->layout ()->self_scm (), properties,
                                      annotation));
       tm.translate (Offset (b.control_[3][X_AXIS] + 0.5,