CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/10/05 13:05:45

Modified files:
        .              : ChangeLog 
        lily           : align-interface.cc figured-bass-engraver.cc 
                         horizontal-bracket.cc parser.yy 
        ly             : engraver-init.ly 
        scm            : bass-figure.scm define-context-properties.scm 
                         define-grobs.scm define-markup-commands.scm 
Added files:
        lily           : figured-bass-continuation.cc 
                         new-figured-bass-engraver.cc 
        lily/include   : horizontal-bracket.hh 

Log message:
        * lily/horizontal-bracket.cc (make_bracket): new function.
        
        * scm/define-grobs.scm (all-grob-descriptions): new grobs
        NewBassFigure, BassFigureBracket, BassFigureContinuation,
        BassFigureLine, BassFigureAlignment
        
        * lily/new-figured-bass-engraver.cc (process_music): new file.
        
        * lily/figured-bass-continuation.cc: new file.
        
        * lily/include/horizontal-bracket.hh (struct Horizontal_bracket):
        new file.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4155&tr2=1.4156&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/figured-bass-continuation.cc?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/new-figured-bass-engraver.cc?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/align-interface.cc.diff?tr1=1.84&tr2=1.85&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/figured-bass-engraver.cc.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/horizontal-bracket.cc.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/parser.yy.diff?tr1=1.490&tr2=1.491&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/horizontal-bracket.hh?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ly/engraver-init.ly.diff?tr1=1.252&tr2=1.253&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/bass-figure.scm.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-context-properties.scm.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.238&tr2=1.239&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-markup-commands.scm.diff?tr1=1.116&tr2=1.117&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4155 lilypond/ChangeLog:1.4156
--- lilypond/ChangeLog:1.4155   Tue Oct  4 12:33:26 2005
+++ lilypond/ChangeLog  Wed Oct  5 13:05:44 2005
@@ -1,3 +1,18 @@
+2005-10-05  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
+
+       * lily/horizontal-bracket.cc (make_bracket): new function.
+
+       * scm/define-grobs.scm (all-grob-descriptions): new grobs
+       NewBassFigure, BassFigureBracket, BassFigureContinuation,
+       BassFigureLine, BassFigureAlignment
+
+       * lily/new-figured-bass-engraver.cc (process_music): new file.
+
+       * lily/figured-bass-continuation.cc: new file.
+
+       * lily/include/horizontal-bracket.hh (struct Horizontal_bracket):
+       new file.
+
 2005-10-04  Mats Bengtsson  <[EMAIL PROTECTED]>
 
        * scripts/lilypond-book.py: Bug fix, put the quote around the
Index: lilypond/lily/align-interface.cc
diff -u lilypond/lily/align-interface.cc:1.84 
lilypond/lily/align-interface.cc:1.85
--- lilypond/lily/align-interface.cc:1.84       Mon Oct  3 11:30:40 2005
+++ lilypond/lily/align-interface.cc    Wed Oct  5 13:05:44 2005
@@ -159,9 +159,14 @@
   if (a == Y_AXIS
       && me_spanner)
     {
+#if 0
+      /*
+       TODO: messes up for figured bass alignments. 
+       */
       if (me_spanner->get_bound (LEFT)->break_status_dir () == CENTER)
        me->warning (_ ("vertical alignment called before line-breaking. "
                        "Only do cross-staff spanners with PianoStaff."));
+#endif
 
       SCM details =  me_spanner->get_bound (LEFT)->get_property 
("line-break-system-details");
       SCM extra_space_handle = scm_assoc (ly_symbol2scm 
("alignment-extra-space"), details);
Index: lilypond/lily/figured-bass-engraver.cc
diff -u lilypond/lily/figured-bass-engraver.cc:1.41 
lilypond/lily/figured-bass-engraver.cc:1.42
--- lilypond/lily/figured-bass-engraver.cc:1.41 Thu Aug 11 12:52:30 2005
+++ lilypond/lily/figured-bass-engraver.cc      Wed Oct  5 13:05:44 2005
@@ -11,6 +11,8 @@
 #include "item.hh"
 #include "context.hh"
 
+#include "translator.icc"
+
 class Figured_bass_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Figured_bass_engraver);
@@ -82,8 +84,6 @@
        }
     }
 }
-
-#include "translator.icc"
 
 ADD_TRANSLATOR (Figured_bass_engraver,
                /* doc */ "Make figured bass numbers.",
Index: lilypond/lily/horizontal-bracket.cc
diff -u lilypond/lily/horizontal-bracket.cc:1.25 
lilypond/lily/horizontal-bracket.cc:1.26
--- lilypond/lily/horizontal-bracket.cc:1.25    Fri Aug 12 00:04:46 2005
+++ lilypond/lily/horizontal-bracket.cc Wed Oct  5 13:05:44 2005
@@ -13,12 +13,7 @@
 #include "output-def.hh"
 #include "staff-symbol-referencer.hh"
 #include "tuplet-bracket.hh"   // ugh.
-
-struct Horizontal_bracket
-{
-  DECLARE_SCHEME_CALLBACK (print, (SCM));
-  static bool has_interface (Grob *);
-};
+#include "horizontal-bracket.hh"       // ugh.
 
 /*
   TODO:
@@ -27,51 +22,70 @@
 
   Support texts on the brackets?
 */
-MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
 
-SCM
-Horizontal_bracket::print (SCM smob)
+Stencil
+Horizontal_bracket::make_bracket (Grob *me, Grob *common,
+                                 Link_array<Grob> grobs, Axis a, Direction dir)
 {
-  Grob *me = unsmob_grob (smob);
-  Spanner *sp = dynamic_cast<Spanner *> (me);
+  Axis other = other_axis (a);
+  
+  Grob *cx = common_refpoint_of_array (grobs, common, a);
 
-  extract_grob_set (me, "columns", gs);
-  if (!gs.size ())
-    {
-      me->suicide ();
-      return SCM_EOL;
-    }
-  Grob *cx = common_refpoint_of_array (gs, me, X_AXIS);
-  cx = cx->common_refpoint (sp->get_bound (LEFT), X_AXIS);
-  cx = cx->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
-
-  Interval ext = gs.top ()->extent (cx, X_AXIS);
-  ext.unite (gs[0]->extent (cx, X_AXIS));
+  Interval ext = grobs.top ()->extent (cx, a);
+  ext.unite (grobs[0]->extent (cx, a));
 
   Drul_array<Real> edge_height = robust_scm2interval (me->get_property 
("edge-height"),
                                                      Interval (1.0, 1.0));
-
   Drul_array<Real> flare = robust_scm2interval (me->get_property 
("bracket-flare"),
                                                Interval (0, 0));
-
   Drul_array<Real> shorten = robust_scm2interval (me->get_property 
("shorten-pair"),
                                                  Interval (0, 0));
 
   // Make sure that it points in the correct direction:
-  Real dir = get_grob_direction (me);
-  scale_drul (&edge_height, -dir);
+  scale_drul (&edge_height, Real (-dir));
 
   Interval empty;
+  Offset start;
+  start[a] = ext.length ();
   Stencil b
-    = Tuplet_bracket::make_bracket (me, Y_AXIS, Offset (ext.length (), 0),
+    = Tuplet_bracket::make_bracket (me, other, start, 
                                    edge_height, empty, flare, shorten);
 
-  b.translate_axis (ext[LEFT] - sp->get_bound (LEFT)->relative_coordinate (cx, 
X_AXIS), X_AXIS);
+  b.translate_axis (ext[LEFT], a);
+
+  return b;
+}
+
+MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
+SCM
+Horizontal_bracket::print (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  Spanner *sp = dynamic_cast<Spanner *> (me);
+
+  extract_grob_set (me, "columns", gs);
+  if (!gs.size ())
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  Grob *cx = me->common_refpoint (sp->get_bound (LEFT), X_AXIS);
+  cx = cx->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
+
+  Stencil b = make_bracket (me, cx, gs, X_AXIS, get_grob_direction (me));
+ 
+  b.translate_axis (- sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), 
X_AXIS);
 
   return b.smobbed_copy ();
 }
 
 ADD_INTERFACE (Horizontal_bracket, "horizontal-bracket-interface",
               "A horizontal bracket encompassing notes.",
-              "columns bracket-flare shorten-pair edge-height");
+
+              /* props */                
+              "columns "
+              "bracket-flare "
+              "shorten-pair "
+              "edge-height");
 
Index: lilypond/lily/parser.yy
diff -u lilypond/lily/parser.yy:1.490 lilypond/lily/parser.yy:1.491
--- lilypond/lily/parser.yy:1.490       Mon Sep 26 23:25:58 2005
+++ lilypond/lily/parser.yy     Wed Oct  5 13:05:44 2005
@@ -212,7 +212,9 @@
 deleting them.  Let's hope that a stack overflow doesnt trigger a move
 of the parse stack onto the heap. */
 
+%left PREC_TOP
 %left ADDLYRICS
+%left PREC_BOT
 
 %union {
        Book *book;
@@ -477,8 +479,8 @@
 %type <scm> assignment_id
 %type <scm> bare_number
 %type <scm> bass_figure
-%type <scm> bass_number
 %type <scm> br_bass_figure
+%type <scm> bass_number
 %type <scm> chord_body_elements
 %type <scm> chord_item
 %type <scm> chord_items
@@ -2165,14 +2167,10 @@
 
 bass_number:
        DIGIT   {
-               $$ = scm_number_to_string (scm_from_int ($1), scm_from_int 
(10));
-               $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
-                               $$);
+               $$ = scm_from_int ($1);
        }
        | UNSIGNED {
-               $$ = scm_number_to_string (scm_from_int ($1), scm_from_int 
(10));
-               $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
-                               $$);
+               $$ = scm_from_int ($1);
        }
        | STRING { $$ = $1; }
        | full_markup { $$ = $1; }
@@ -2194,9 +2192,17 @@
                Music *bfr = MY_MAKE_MUSIC ("BassFigureEvent");
                $$ = bfr->self_scm ();
 
-               bfr->set_property ("figure", $1);
+               if (scm_is_number ($1))
+                       bfr->set_property ("figure", $1);
+               else if (Text_interface::is_markup ($1))
+                       bfr->set_property ("text", $1);
+
                bfr->unprotect ();
        }
+       | bass_figure ']' {
+               $$ = $1;
+               unsmob_music ($1)->set_property ("bracket-stop", SCM_BOOL_T);
+       }
        | bass_figure bass_mod {
                Music *m = unsmob_music ($1);
                if ($2) {
@@ -2210,17 +2216,14 @@
        }
        ;
 
+
 br_bass_figure:
-       '[' bass_figure {
-               $$ = $2;
-               unsmob_music ($$)->set_property ("bracket-start", SCM_BOOL_T);
-       }
-       | bass_figure   {
+       bass_figure {
                $$ = $1;
        }
-       | br_bass_figure ']' {
-               $$ = $1;
-               unsmob_music ($1)->set_property ("bracket-stop", SCM_BOOL_T);
+       | '[' bass_figure {
+               $$ = $2;
+               unsmob_music ($$)->set_property ("bracket-start", SCM_BOOL_T);
        }
        ;
 
Index: lilypond/ly/engraver-init.ly
diff -u lilypond/ly/engraver-init.ly:1.252 lilypond/ly/engraver-init.ly:1.253
--- lilypond/ly/engraver-init.ly:1.252  Mon Oct  3 11:30:40 2005
+++ lilypond/ly/engraver-init.ly        Wed Oct  5 13:05:45 2005
@@ -552,6 +552,7 @@
 
 %%
   bassFigureFormatFunction = #format-bass-figure
+  newFiguredBassFormatter = #format-new-bass-figure
   metronomeMarkFormatter = #format-metronome-markup
   graceSettings = #`(
     (Voice Stem direction 1)
@@ -596,7 +597,6 @@
   \name FiguredBass 
 
   \consists "Figured_bass_engraver"
-  \consists "Rest_swallow_translator"
   \consists "Note_swallow_translator"
   \consists "Skip_event_swallow_translator"
   \consists "Separating_line_group_engraver"
Index: lilypond/scm/bass-figure.scm
diff -u lilypond/scm/bass-figure.scm:1.23 lilypond/scm/bass-figure.scm:1.24
--- lilypond/scm/bass-figure.scm:1.23   Fri Feb  4 13:48:10 2005
+++ lilypond/scm/bass-figure.scm        Wed Oct  5 13:05:45 2005
@@ -11,6 +11,31 @@
  "A bass figure, including bracket"
  '())
 
+
+(define-public (format-new-bass-figure figure event context)
+  (let* ((fig (ly:music-property event 'figure))
+        (fig-markup (markup #:number (number->string figure 10)))
+
+        (alt (ly:music-property event 'alteration))
+        (alt-markup
+         (if (number? alt)
+             (alteration->text-accidental-markup alt)
+             #f))
+        (alt-dir (ly:context-property context 'figuredBassAlterationDirection))
+        
+        )
+    
+    (if alt-markup
+       (set! fig-markup
+             (markup #:put-adjacent fig-markup X
+                     (if (number? alt-dir)
+                         alt-dir
+                         LEFT)
+                     #:raise .33  
+                     #:pad-around 0.5 #:smaller alt-markup )))
+
+    fig-markup))
+
 (define-public (format-bass-figure figures context grob)
   ;; TODO: support slashed numerals here.
   (define (fig-to-markup fig-music)
Index: lilypond/scm/define-context-properties.scm
diff -u lilypond/scm/define-context-properties.scm:1.51 
lilypond/scm/define-context-properties.scm:1.52
--- lilypond/scm/define-context-properties.scm:1.51     Fri Aug 19 10:13:08 2005
+++ lilypond/scm/define-context-properties.scm  Wed Oct  5 13:05:45 2005
@@ -22,6 +22,11 @@
    (lambda (x)
      (apply translator-property-description x))
    `(
+
+     ;; TODO FIXME
+     (useBassFigureExtenders ,boolean? "")
+     (figuredBassAlterationDirection ,ly:dir? "")
+     
      (aDueText ,string? "Text to print at a unisono passage.")
      (alignBelowContext ,string? "Where to insert newly created context in 
vertiical alignment.")
      (alignAboveContext ,string? "Where to insert newly created context in 
vertiical alignment.")
Index: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.238 lilypond/scm/define-grobs.scm:1.239
--- lilypond/scm/define-grobs.scm:1.238 Tue Oct  4 12:21:15 2005
+++ lilypond/scm/define-grobs.scm       Wed Oct  5 13:05:45 2005
@@ -204,6 +204,47 @@
                                bass-figure-interface
                                self-alignment-interface
                                font-interface))))))
+
+    (NewBassFigure
+     . (
+       (print-function . ,Text_interface::print)
+       (meta . ((class . Item)
+                (interfaces . (text-interface
+                               rhythmic-grob-interface
+                               bass-figure-interface
+                               font-interface))))))
+
+    (BassFigureBracket
+     . ((print-function . ,Figured_bass_bracket::print)
+       (edge-height . (0.2 . 0.2))
+       (meta . ((class . Item)
+                (interfaces . (figured-bass-bracket-interface)) ))
+       ))
+    (BassFigureContinuation
+     . (
+       (print-function . ,Figured_bass_continuation::print)
+       (Y-offset-callbacks . (,Figured_bass_continuation::center_on_figures))
+       (meta . ((class . Spanner)
+                (interfaces . (figured-bass-continuation-interface))
+                ))))
+    (BassFigureLine
+     . (
+       (axes . (,Y))
+       (Y-extent-callback . ,Axis_group_interface::group_extent_callback)
+       (meta . ((class . Spanner)
+                (interfaces . (axis-group-interface
+                               ))))))
+
+    (BassFigureAlignment
+     . (
+       (axes . (,Y))
+       (threshold . (2.4 . 1000))
+       (Y-extent-callback . ,Axis_group_interface::group_extent_callback)
+       (stacking-dir . -1)
+       (meta . ((class . Spanner)
+                (interfaces . (align-interface
+                               axis-group-interface))))))
+    
     (Beam
      . (
        ;; todo: clean this up a bit: the list is getting
Index: lilypond/scm/define-markup-commands.scm
diff -u lilypond/scm/define-markup-commands.scm:1.116 
lilypond/scm/define-markup-commands.scm:1.117
--- lilypond/scm/define-markup-commands.scm:1.116       Sun Oct  2 01:16:08 2005
+++ lilypond/scm/define-markup-commands.scm     Wed Oct  5 13:05:45 2005
@@ -629,6 +629,30 @@
     (ly:stencil-aligned-to m X dir)))
 
 
+(def-markup-command (pad-around layout props amount arg) (number? markup?)
+
+  "Add padding @var{amount} all around @var{arg}. "
+  
+  (let*
+      ((m (interpret-markup layout props arg))
+       (x (ly:stencil-extent m X))
+       (y (ly:stencil-extent m Y)))
+    
+       
+    (ly:make-stencil (ly:stencil-expr m)
+                    (interval-widen x amount)
+                    (interval-widen y amount))
+   ))
+(def-markup-command (put-adjacent layout props arg1 axis dir arg2) (markup? 
integer? ly:dir?  markup?)
+
+  "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}.  "
+  
+  (let* ((m1 (interpret-markup layout props arg1))
+        (m2 (interpret-markup layout props arg2)))
+
+    (ly:stencil-combine-at-edge m1 axis dir m2 0.0 0.0)
+  ))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; property
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to