On 18/01/10 14:21, lilyp...@googlecode.com wrote:
Updates:
Owner: ---
Labels: Frog

Comment #3 on issue 405 by percival.music.ca: tupletBracket not printed
despite #'bracket-visibility=##t
http://code.google.com/p/lilypond/issues/detail?id=405

Frog: 5 hours?

I mean, fundamentally all you need to do is take out the check if the
bracket-visibility is set to ##t, so it would probably only take Carl or
Neil 5
minutes. Not counting any debate needed on -devel.

I've had a quick look at this with gdb, stepping through Tuplet_bracket:print, and the solution doesn't seem as simple as you suggest here, I even tried patching in a modified routine implementing the override if the property is set, but it doesn't do the job.

I've attached the patch, also attached is the lily source file I compiled and the pdf it produced.

Cheers,
Ian Hulin


>From 7842ca6af9ef850d8a9506334a6f52d183a53679 Mon Sep 17 00:00:00 2001
From: Ian Hulin <i...@hulin.org.uk>
Date: Sun, 24 Jan 2010 19:49:51 +0000
Subject: [PATCH] T405 - Respect setting bracket-visibility property.

---
 lily/tuplet-bracket.cc |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index 0fd0150..d89a566 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -137,10 +137,10 @@ Tuplet_bracket::calc_connect_to_neighbors (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
 
-  Direction dir = get_grob_direction (me); 
+  Direction dir = get_grob_direction (me);
   Drul_array<Item *> bounds (get_x_bound_item (me, LEFT, dir),
 			     get_x_bound_item (me, RIGHT, dir));
-  
+
   Drul_array<bool> connect_to_other (false, false);
   Direction d = LEFT;
   do
@@ -169,11 +169,11 @@ Tuplet_bracket::calc_connect_to_neighbors (SCM smob)
   if (connect_to_other[LEFT] || connect_to_other[RIGHT])
     return scm_cons (scm_from_bool (connect_to_other[LEFT]),
 		     scm_from_bool (connect_to_other[RIGHT]));
-		     
+
   return SCM_EOL;
 }
 
-Grob * 
+Grob *
 Tuplet_bracket::get_common_x (Spanner *me)
 {
   extract_grob_set (me, "note-columns", columns);
@@ -286,12 +286,14 @@ Tuplet_bracket::print (SCM smob)
   /*
     Fixme: the type of this prop is sucky.
   */
-  SCM bracket = me->get_property ("bracket-visibility");
-  if (scm_is_bool (bracket))
-    bracket_visibility = ly_scm2bool (bracket);
-  else if (bracket == ly_symbol2scm ("if-no-beam"))
+  SCM bracket_vis_prop = me->get_property ("bracket-visibility");
+  bool bracket_prop = ly_scm2bool (bracket_vis_prop);
+  bool bracket = (bracket_vis_prop == ly_symbol2scm ("if-no-beam"));
+  if (scm_is_bool (bracket_vis_prop))
+    bracket_visibility = bracket_prop;
+  else if (bracket)
     bracket_visibility = !par_beam;
-  
+
   /*
     Don't print a tuplet bracket and number if
     no control-points were calculated
@@ -303,13 +305,17 @@ Tuplet_bracket::print (SCM smob)
       return SCM_EOL;
     }
   /*  if the tuplet does not span any time, i.e. a single-note tuplet, hide
-      the bracket, but still let the number be displayed */
-  if (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
-      == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
+      the bracket, but still let the number be displayed.
+      Only do this if the user has not explicitly specified bracket-visibility = #t.
+  */
+  if (!bracket_prop)
   {
-      bracket_visibility = false;
+      if (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
+	  == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
+      {
+	  bracket_visibility = false;
+      }
   }
-
   Drul_array<Offset> points;
   points[LEFT] = ly_scm2offset (scm_car (cpoints));
   points[RIGHT] = ly_scm2offset (scm_cadr (cpoints));
@@ -621,7 +627,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
       points.push_back (Offset (x0 - x0, staff[dir]));
       points.push_back (Offset (x1 - x0, staff[dir]));
     }
-  
+
   /*
     This is a slight hack. We compute two encompass points from the
     bbox of the smaller tuplets.
@@ -679,7 +685,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
     Kind of pointless since we put them outside the staff anyway, but
     let's leave code for the future when possibly allow them to move
     into the staff once again.
-  
+
     This doesn't seem to support cross-staff tuplets atm.
   */
   if (*dy == 0
-- 
1.6.3.3

\version "2.11.29"
% If ragged-right = ##f, the music is spaced more broadly and the bug 
% doesn't  occur.
\paper {
        ragged-right = ##t
}

% The bracket for the middle tuplet won't be printed, despite the
% property.
\relative c' {
        \override TupletBracket #'bracket-visibility = ##t
        \times 2/3 {r8 c4} \times 2/3 {r8 c'4} \times 2/3 {r8 c c}
}


Attachment: tuplet-bracket-override-test.pdf
Description: Adobe PDF document

_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to