]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ottava-bracket.cc
unsmob_pitch -> Pitch::unsmob and related
[lilypond.git] / lily / ottava-bracket.cc
index 3aced1d37f26c614e304c9c1d55b67c25a89725e..7def9bf96cf9887297de6432997f3a7e7acab80c 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2004--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
@@ -17,6 +17,7 @@
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "axis-group-interface.hh"
 #include "text-interface.hh"
 #include "spanner.hh"
 #include "font-interface.hh"
@@ -48,15 +49,14 @@ MAKE_SCHEME_CALLBACK (Ottava_bracket, print, 1);
 SCM
 Ottava_bracket::print (SCM smob)
 {
-  Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+  Spanner *me = dynamic_cast<Spanner *> (Grob::unsmob (smob));
   Interval span_points;
 
   Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
   Output_def *layout = me->layout ();
 
   Drul_array<bool> broken;
-  Direction d = LEFT;
-  do
+  for (LEFT_and_RIGHT (d))
     {
       Item *b = me->get_bound (d);
       broken[d] = (b->break_status_dir () != CENTER);
@@ -74,13 +74,12 @@ Ottava_bracket::print (SCM smob)
             }
         }
     }
-  while (flip (&d) != LEFT);
 
   SCM properties = Font_interface::text_font_alist_chain (me);
   SCM markup = me->get_property ("text");
   Stencil text;
   if (Text_interface::is_markup (markup))
-    text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (),
+    text = *Stencil::unsmob (Text_interface::interpret_markup (layout->self_scm (),
                                                               properties, markup));
 
   Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
@@ -90,7 +89,7 @@ Ottava_bracket::print (SCM smob)
     TODO: we should check if there are ledgers, and modify length of
     the spanner to that.
   */
-  do
+  for (LEFT_and_RIGHT (d))
     {
       Item *b = me->get_bound (d);
 
@@ -114,14 +113,13 @@ Ottava_bracket::print (SCM smob)
 
       if (broken[d])
         {
-          span_points[d] = b->extent (common, X_AXIS)[RIGHT];
+          span_points[d] = Axis_group_interface::generic_bound_extent (b, common, X_AXIS)[RIGHT];
           shorten[d] = 0.;
         }
 
       else
         span_points[d] = ext[d];
     }
-  while (flip (&d) != LEFT);
 
   /*
     0.3 is ~ italic correction.
@@ -143,13 +141,12 @@ Ottava_bracket::print (SCM smob)
   Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
                                                 Interval (0, 0));
 
-  do
+  for (LEFT_and_RIGHT (d))
     {
       edge_height[d] *= -get_grob_direction (me);
       if (broken[d])
         edge_height[d] = 0.0;
     }
-  while (flip (&d) != LEFT);
 
   Stencil b;
   Interval empty;