From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Sun, 7 Apr 2002 19:16:16 +0000 (+0000)
Subject: ''
X-Git-Tag: release/1.5.51~4
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a23ddaecd681dd516e95131544dded48e93833b0;p=lilypond.git

''
---

diff --git a/input/test/tuplet.ly b/input/test/tuplet.ly
index 5191612043..4c9ab55589 100644
--- a/input/test/tuplet.ly
+++ b/input/test/tuplet.ly
@@ -1,27 +1,38 @@
-\version "1.3.146"
+\version "1.5.50"
 
 
 \score { 
-  \context Voice \notes\relative c'' {
-
-	\times 2/3 { c'8 c,, c }
-	\times 2/3 { c'8 c'' c,, }
-
-  
-  \times 2/3 { [c8 c c]  }
-  \times 2/3 { c8 [c c]  }
-
-    \times 2/3 { [c8 c c]  }
-  \times 2/4 { r8 [c, c'] r8 }
-
-
-  
-  \property Voice.TupletBracket \set #'tuplet-bracket-visibility = #'if-no-beam  
-  \times 2/3 { [c8 c c]  }
-  \property Voice.TupletBracket \set #'direction = #1
-  \property Voice.TupletBracket \set #'tuplet-number-visibility = ##f
-  \times 2/3 { c8 [c c]  }
-    
-
-}
+    \context Voice \notes\relative c'' {
+
+ 	\times 2/3 { c'8 c,, c }
+ 	\times 2/3 { c'8 c'' c,, }
+
+	
+ 	\times 2/3 { [c8 c c]  }
+ 	\times 2/3 { c8 [c c]  }
+
+ 	\times 2/3 { [c8 c c]  }
+ 	\times 2/4 { r8 [c, c'] r8 }
+
+
+	
+ 	\property Voice.TupletBracket \override #'bracket-visibility = #'if-no-beam  
+ 	\times 2/3 { [c8 c c]  }
+	\property Voice.TupletBracket \override #'direction = #1
+ 	\property Voice.TupletBracket \override #'number-visibility = ##f
+ 	\times 2/3 { c8 [c c]  }
+ 	\property Voice.TupletBracket \revert #'number-visibility
+
+	\property Voice.TupletBracket \override #'bracket-visibility = ##t
+	\property Voice.TupletBracket \override #'edge-height = #'(0.0 . 0.0)
+	\property Voice.TupletBracket \override #'shorten-pair = #'(2.0 . 2.0)
+	\times 4/6 { c f b  b f c}	
+	\property Voice.TupletBracket \revert #'edge-height
+	\property Voice.TupletBracket \revert #'shorten-pair
+    	\property Voice.TupletBracket \override #'edge-width = #'(-0.5 . 0.5)
+	\times 2/3 { b b b }
+ 	\property Voice.TupletBracket \revert #'direction
+	\times 2/3 { b b b }
+
+    }
 }
diff --git a/lily/include/tuplet-bracket.hh b/lily/include/tuplet-bracket.hh
index 86a89262f7..97c10572dc 100644
--- a/lily/include/tuplet-bracket.hh
+++ b/lily/include/tuplet-bracket.hh
@@ -32,9 +32,10 @@ public:
 
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
   static Molecule make_bracket (Axis protusion_axis,
-				Real dx, Real dy, Real thick, Real lprotrusion,
-				Real rprotrusion, Real gap, Real left_widen,
-				Real right_widen);
+				Real dx, Real dy, Real thick, Real left_height,
+				Real right_height, Real gap, Real left_widen,
+				Real right_widen, Real left_shorten, 
+				Real right_shorten);
   static Direction get_default_dir (Grob*);
 };
 
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index bb397a27fa..bdb6ed922c 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -163,15 +163,31 @@ Tuplet_bracket::brew_molecule (SCM smob)
 	lt *= gh_scm2double (thick);
       
       SCM gap = me->get_grob_property ("gap");
-
-      Real prot_size = 0.7;	// magic.
-
+      SCM ew = me->get_grob_property ("edge-width");
+      SCM eh = me->get_grob_property ("edge-height");
+      SCM sp = me->get_grob_property ("shorten-pair");
+      
+      Direction d = LEFT;
+      Drul_array<Real> height, width, shorten;
+      do {
+	width[d] =  height[d] = shorten[d] = 0.0;
+	if ( gh_pair_p (ew) )
+	  width[d] +=  gh_scm2double (index_cell (ew, d)) * d;
+	if ( gh_pair_p (eh) )
+	  height[d] += gh_scm2double (index_cell (eh, d));
+	if ( gh_pair_p (sp) )
+	  shorten[d] +=  gh_scm2double (index_cell (sp, d));
+      }
+      while (flip (&d) != LEFT);
+      
       Molecule brack = make_bracket (Y_AXIS,
-				     w, ry-ly, lt,
-				     -prot_size*dir, -prot_size*dir,
+				     w, ry - ly, lt,
+				     -height[LEFT]*dir, -height[RIGHT]*dir,
 				     gh_scm2double (gap),
-				     0.0, 0.0);
+				     width[LEFT], width[RIGHT],
+				     shorten[LEFT], shorten[RIGHT]);
       mol.add_molecule (brack);
+      mol.translate_axis (dir * max(height[LEFT], height[RIGHT]), Y_AXIS);
     }
 
   mol.translate_axis (ly, Y_AXIS);
@@ -184,31 +200,36 @@ Tuplet_bracket::brew_molecule (SCM smob)
  */
 Molecule
 Tuplet_bracket::make_bracket (Axis protusion_axis,
-			      Real dx, Real dy, Real thick, Real lprotrusion,
-			      Real rprotrusion, Real gap, Real left_widen,
-			      Real right_widen)
+			      Real dx, Real dy, Real thick, Real left_height,
+			      Real right_height, Real gap, Real left_widen,
+			      Real right_widen, Real left_shorten, Real right_shorten)
 {
   Real len = Offset (dx,dy).length ();
-  Real gapx = dx*  (gap /  len);
-  Real gapy = dy*  (gap /  len);
+  Real gapx = dx * (gap /  len);
+  Real gapy = dy * (gap /  len);
+  Real lshortx = dx * (left_shorten /  len);
+  Real lshorty = dy * (left_shorten /  len);
+  Real rshortx = dx * (right_shorten /  len);
+  Real rshorty = dy * (right_shorten /  len);
   Axis other = other_axis (protusion_axis);
-
-  Molecule l1 = Lookup::line (thick, Offset(0,0),
+  
+  Molecule l1 = Lookup::line (thick, Offset(lshortx, lshorty),
 			      Offset ( (dx - gapx)/2, (dy - gapy)/2 ));
+
   Molecule l2 = Lookup::line (thick, Offset((dx + gapx) / 2,(dy + gapy) / 2),
-			      
-			      Offset (dx,dy));
+			      Offset (dx - rshortx, dy - rshorty));
 
   Offset protusion;
-  protusion[other] = left_widen;
-  protusion[protusion_axis] = lprotrusion;
-  
-  Molecule p1 = Lookup::line (thick, Offset(0,0), protusion);
-
+  protusion[other] = -left_widen;
+  protusion[protusion_axis] = left_height;
+  Molecule p1 = Lookup::line (thick, 
+			      Offset(lshortx, lshorty), 
+			      Offset(lshortx, lshorty) + protusion);
   protusion[other] = right_widen;
-  protusion[protusion_axis] = rprotrusion;
-  Molecule p2 = Lookup::line (thick, Offset(dx,dy),Offset(dx,dy) + protusion);  
-
+  protusion[protusion_axis] = right_height;
+  Molecule p2 = Lookup::line (thick, 
+			      Offset(dx - rshortx, dy - rshorty), 
+			      Offset(dx - rshortx, dy - rshorty) + protusion);  
 
   Molecule m;
   m.add_molecule (p1);
diff --git a/scm/grob-description.scm b/scm/grob-description.scm
index 7244f1f54d..5f775ddd5c 100644
--- a/scm/grob-description.scm
+++ b/scm/grob-description.scm
@@ -911,6 +911,9 @@
 	(gap . 2.0)
 	(padding . 0.9)
 	(thickness . 1.6)
+	(edge-width . (0.0 . 0.0))
+	(edge-height . (0.7 . 0.7))
+	(shorten-pair . (0.0 . 0.0))
 	(before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
 	(after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking)
 	(molecule-callback . ,Tuplet_bracket::brew_molecule)