]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/horizontal-bracket.cc
Issue 5064 Let analysis brackets support text
[lilypond.git] / lily / horizontal-bracket.cc
index 7f3c839e9121bb261c2487e57ab7c007e0c5d58e..cf37516d5c0c0b697659f10d003ffafd05ec9392 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2002--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2002--2015 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
@@ -53,8 +53,7 @@ Horizontal_bracket::make_bracket (Grob *me,
     = robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
                            Drul_array<bool> (false, false));
 
-  Direction d = LEFT;
-  do
+  for (LEFT_and_RIGHT (d))
     {
       if (connect_to_other[d])
         {
@@ -63,7 +62,6 @@ Horizontal_bracket::make_bracket (Grob *me,
           shorten[d] = 0.0;
         }
     }
-  while (flip (&d) != LEFT);
 
   /*
     ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
@@ -94,16 +92,11 @@ Horizontal_bracket::make_enclosing_bracket (Grob *me, Grob *refpoint,
     }
 }
 
-/*
-  TODO:
-
-  Support texts on the brackets?
-*/
 MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
 SCM
 Horizontal_bracket::print (SCM smob)
 {
-  Spanner *me = unsmob_spanner (smob);
+  Spanner *me = unsmob<Spanner> (smob);
   extract_grob_set (me, "columns", gs);
 
   vector<Grob *> enclosed = gs;
@@ -113,14 +106,12 @@ Horizontal_bracket::print (SCM smob)
       return SCM_EOL;
     }
 
-  Direction d = LEFT;
-  do
+  for (LEFT_and_RIGHT (d))
     {
       Item *b = me->get_bound (d);
       if (b->break_status_dir ())
         enclosed.push_back (b);
     }
-  while (flip (&d) != LEFT);
 
   Stencil b = make_enclosing_bracket (me, me, enclosed, X_AXIS, get_grob_direction (me));
   return b.smobbed_copy ();
@@ -131,6 +122,7 @@ ADD_INTERFACE (Horizontal_bracket,
 
                /* properties */
                "bracket-flare "
+               "bracket-text "
                "columns "
                "edge-height "
                "shorten-pair "