lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: other_brackets


From: Chris Jackson
Subject: Re: other_brackets
Date: Sun, 30 Jun 2002 17:55:13 +0100
User-agent: Mutt/1.3.28i

On Sat, Jun 29, 2002 at 12:25:32PM +0000, David Bobroff wrote:
> I asked a question some time ago about bracketing some notes but never got
> a suggestion.  I'm not talking about the same kind of brackteing as the
> recent bracket thread.  What I would like to do is something like this:
> 
>  __                        __
> |      *     *     *     *   |
> |     |     |     |     |    |
> |     |     |     |     |    |
> |     |     |     |     |    |
> |     |     |     |     |    |
> |     -------------------    |
> |__   -------------------  __|
> 
> I want the bracket to extend above and below the group of notes in
> question.  I want a large version of '[ ]' and not '( )'.


Currently it is possible to use \arpeggio to draw a bracket to group
together the set of note heads in a chord - see the Piano
Music->Arpeggio section of the development version reference manual.

(CC'd to lilypond-devel...)

If you apply the patch below to the latest CVS version of lilypond,
then you'll be able to extend the bottom of the bracket to embrace the
stems as well. This is done by modifying the 'shorten-pair' property
of these fake arpeggios. Then you can achieve the above using
something like...

\score {
    \notes \relative c'' {
        \property Staff.Arpeggio \override #'molecule-callback = 
\arpeggioBracket
        \property Staff.Arpeggio \override #'shorten-pair = #'(0.0 . -3.0)
        [ e16 \arpeggio e e 
        \property Staff.Arpeggio \override #'direction = #1
        e \arpeggio ]
    }
}


-- 
chris


Index: ChangeLog
===================================================================
RCS file: /home/lilypond/lilypond/ChangeLog,v
retrieving revision 1.250
diff -p -u -r1.250 ChangeLog
--- ChangeLog   30 Jun 2002 15:17:11 -0000      1.250
+++ ChangeLog   30 Jun 2002 16:47:39 -0000
@@ -1,3 +1,8 @@
+2002-06-30  Chris Jackson  <address@hidden>
+
+       * lily/arpeggio.cc: shorten-pair property added to 'arpeggio'
+       vertical brackets. direction property mirrors the bracket on the
+       right of the notes.
+
 2002-06-30  Jan Nieuwenhuizen  <address@hidden>
 
        * lily/grob.cc (mark_smob): don't mark parents, explain why.
Index: lily/arpeggio.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/arpeggio.cc,v
retrieving revision 1.16
diff -p -u -r1.16 arpeggio.cc
--- lily/arpeggio.cc    10 Apr 2002 17:25:35 -0000      1.16
+++ lily/arpeggio.cc    30 Jun 2002 16:47:40 -0000
@@ -17,7 +17,6 @@
 #include "font-interface.hh"
 #include "lookup.hh"
 
-
 MAKE_SCHEME_CALLBACK (Arpeggio, brew_molecule, 1);
 SCM 
 Arpeggio::brew_molecule (SCM smob) 
@@ -89,7 +88,7 @@ Arpeggio::brew_molecule (SCM smob) 
   return mol.smobbed_copy () ;
 }
 
-/* Draws a vertical bracket to the left of a chord 
+/* Draws a vertical bracket to the left or right of a chord 
    Chris Jackson <address@hidden> */
 
 MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_bracket, 1);
@@ -119,10 +118,19 @@ Arpeggio::brew_chord_bracket (SCM smob) 
     }
 
   Real lt =  me->paper_l ()->get_var ("linethickness");
-  Real sp = 1.5 * Staff_symbol_referencer::staff_space (me);
-  Real dy = heads.length() + sp;
-  Real x = 0.7;
-
+  Drul_array<Real> sp;
+  SCM s = me->get_grob_property ("shorten-pair");
+  Real pad = 1.5 * Staff_symbol_referencer::staff_space (me);
+  sp[UP] = sp[DOWN] = 0.0;
+  if (gh_pair_p(s)) {
+    sp[UP] += gh_scm2double (ly_car (s));
+    sp[DOWN] += gh_scm2double (ly_cdr (s));
+  }
+  
+  Real dy = heads.length() + pad - sp[UP] - sp[DOWN];
+  int dir = to_dir (me->get_grob_property ("direction"));
+  Real x = 0.7 * (- dir);
+  
   Molecule l1     = Lookup::line (lt, Offset(0, 0),  Offset (0, dy));
   Molecule bottom = Lookup::line (lt, Offset(0, 0),  Offset (x, 0));
   Molecule top    = Lookup::line (lt, Offset(0, dy), Offset (x, dy));
@@ -130,7 +138,9 @@ Arpeggio::brew_chord_bracket (SCM smob) 
   mol.add_molecule (l1);
   mol.add_molecule (bottom);
   mol.add_molecule (top);
-  mol.translate_axis (heads[LEFT] - sp/2.0, Y_AXIS);
+  mol.translate_axis (heads[LEFT] - pad/2.0 + sp[DOWN], Y_AXIS);
+  if (dir == 1)
+    mol.translate_axis (-x, X_AXIS);
   return mol.smobbed_copy();
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]