]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/figured-bass-engraver.cc (process_music): change calling
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Mar 2004 19:05:02 +0000 (19:05 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Mar 2004 19:05:02 +0000 (19:05 +0000)
convention.

* scm/bass-figure.scm (format-bass-figure): rewrite function.

* scm/define-markup-commands.scm (bracketed-y-column): new markup
command.

* lily/include/stencil.hh (class Stencil): add origin field.

* lily/stencil-scheme.cc (LY_DEFINE): ly:stencil-move-to-edge: new
function.

* lily/grob-scheme.cc (LY_DEFINE): ly:grob-alist-chain: new function.

* lily/lexer.ll: remove support for \$ and $ in identifiers

* lily/sequential-iterator.cc: remove copy_grace_fixups
(get_grace_fixup): slight abstraction of fixup code.

* input/test/title-markup.ly (spaceTest): vary staff sizes.

24 files changed:
ChangeLog
Documentation/topdocs/NEWS.texi
Documentation/user/music-glossary.tely
Documentation/user/notation.itely
input/test/title-markup.ly
lily/figured-bass-engraver.cc
lily/grob-property.cc
lily/grob-scheme.cc
lily/include/sequential-iterator.hh
lily/include/stencil.hh
lily/lexer.ll
lily/lookup.cc
lily/parse-scm.cc
lily/parser.yy
lily/sequential-iterator.cc
lily/staff-performer.cc
lily/stencil-scheme.cc
lily/stencil.cc
ly/engraver-init.ly
scm/bass-figure.scm
scm/define-context-properties.scm
scm/define-markup-commands.scm
scm/page-layout.scm
scm/part-combiner.scm

index 9d5f84c792a8ebadd38b284df204cae41652afdd..293cc67b1dd91d4e5ea02b758549c145ee2bed10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2004-03-12  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/figured-bass-engraver.cc (process_music): change calling
+       convention.
+
+       * scm/bass-figure.scm (format-bass-figure): rewrite function. 
+
+       * scm/define-markup-commands.scm (bracketed-y-column): new markup
+       command.
+
+       * lily/include/stencil.hh (class Stencil): add origin field.
+
+       * lily/stencil-scheme.cc (LY_DEFINE): ly:stencil-move-to-edge: new
+       function.
+
+       * lily/grob-scheme.cc (LY_DEFINE): ly:grob-alist-chain: new function. 
+
+       * lily/lexer.ll: remove support for \$ and $ in identifiers
+
+       * lily/sequential-iterator.cc: remove copy_grace_fixups
+       (get_grace_fixup): slight abstraction of fixup code.
+
+       * input/test/title-markup.ly (spaceTest): vary staff sizes.
+
 2004-03-12  Heikki Junes <hjunes@cc.hut.fi>
 
        * vim/lilypond-indent.vim: use <C-F> (default) as indent key
 
        * lily/paper-book.cc (output): Bugfix.
 
+2004-03-11  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * VERSION (MY_PATCH_LEVEL): release 2.1.30
+       
+2004-03-11  Jan Nieuwenhuizen  <janneke@gnu.org>
+
        * Documentation/user/lilypond.tely: Bugfix: Remove './' from
        direntries.
 
index 5a87cbd95bc529b9afcf04b4c5ebdb74c6b5b049..5f4aaacf457a6b0866558fa6228e32c6fd92a2f2 100644 (file)
@@ -8,6 +8,10 @@
 @chapter New features in 2.1 since 2.0
 
 @itemize @bullet
+@item The pmx2ly script has been removed from the distribution.
+
+@item Pedal brackets will now run to the last bar of a piece if they are not
+explicitly ended.
 
 @item Context definitions now use the word @code{\context} instead of @code{\translator}.
 
index 722a73c7bcfe84c9ad6a71c4a3a88776abf8b0c2..a005d1277326f1dacb13fc4f3cca48fef5c244f4 100644 (file)
@@ -293,7 +293,7 @@ FI: alttoavain.
 C clef setting middle C on the middle line of the staff
 @aref{C clef}.
 
-@aitem{ambitus}
+@aitem{ambit}
 ES: ambitus,
 I: ambitus,
 F: ambitus,
@@ -303,9 +303,9 @@ DK: ambitus,
 S: ambitus,
 FI: ambitus, @"a@"aniala, soitinala.
 
-The term ambitus (plural: ambituses) denotes a range of pitches for a
-given voice in a part of music. It also may denote the pitch range
-that a musical instrument is capable of playing.
+The term ambit (from latin: ambitus, plural: ambitus) denotes a range
+of pitches for a given voice in a part of music. It also may denote
+the pitch range that a musical instrument is capable of playing.
 
 @aitem{ancient minor scale}
 I: scala minore naturale,
index 5187c581242c3b102264de3d2a5c0453fc9c8adf..2c38f4efaf91a78afcb05a5799f5b823abad1702 100644 (file)
@@ -1064,7 +1064,15 @@ indicating how much of the measure has passed at this point.
 Bar lines and bar numbers are calculated automatically. For unmetered
 music (e.g. cadenzas), this is not desirable.  By setting
 @code{Score.timing} to false, this automatic timing can be switched
-off.
+off. Empty bar lines,
+
+@example
+  \bar ""
+@end example
+
+@noindent
+indicate where line breaks can occur.
+
 
 
 @refcommands
index 3e088c59241258ef4cd657c2fe66eef8095a5cb7..5b5311b4031566a01aa711fb9e39fef2394173a0 100644 (file)
@@ -64,6 +64,9 @@ spaceTest = \markup { "two space chars" }
     \context Staff \notes \relative c' {
        c2-\sizeTest c2-\spaceTest
     }
+    \paper {
+       #(paper-set-staff-size (* 11.0 pt)) 
+       }
 }
 
 \header {
index d5bb6aad248d6fe963d26a526ffbd27ab5bc9792..b7114de9eaab23a7bd8c79629fa52f2e475874e4 100644 (file)
@@ -78,14 +78,15 @@ Figured_bass_engraver::process_music ()
       if (gh_procedure_p (proc)) 
        {
          SCM l = SCM_EOL;
-
-         for (int i = 0; i <figures_.size (); i++)
-           l = gh_cons (figures_[i]->self_scm (), l);
-
-         SCM markup = scm_call_2 (proc, l, daddy_context_->self_scm ());
-
+         SCM * t = &l;
+         for (int i = 0; i < figures_.size (); i++)
+           {
+             *t = scm_cons (figures_[i]->self_scm (), SCM_EOL);
+             t = SCM_CDRLOC (*t);
+           }
          figure_ = make_item ("BassFigure");
-         figure_->set_property ("text", markup);
+         scm_call_3 (proc, l, daddy_context_->self_scm (),
+                     figure_->self_scm ());
          announce_grob (figure_, figures_[0]->self_scm ()); // todo
        }
     }
index fd45e40c34674f681a447c0ff1c3174f1bdc27aa..46d032c64f8800d0431551490084cd180eecf6ed 100644 (file)
 SCM
 Grob::get_property_alist_chain (SCM def) const
 {
-  return  scm_list_n (mutable_property_alist_,
-                     immutable_property_alist_,
-                     def,
-                     SCM_UNDEFINED);
+  return scm_list_n (mutable_property_alist_,
+                    immutable_property_alist_,
+                    def,
+                    SCM_UNDEFINED);
 }
 
 
index 87b6ba4a4651a68730a9475f8320455bc1c41679..f7158e7f4577bc3001031ba65166c07731d0707f 100644 (file)
@@ -68,6 +68,21 @@ LY_DEFINE (ly_grob_paper,"ly:grob-paper", 1, 0, 0,
   return sc->get_paper ()->self_scm ();
 }
 
+
+LY_DEFINE(ly_grob_alist_chain, "ly:grob-alist-chain",
+         1, 0, 0,
+         (SCM g),
+         "Get an alist chain for grob @var{g}."
+         )
+{
+  Grob * sc = unsmob_grob (g);
+  SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
+
+  SCM defaults = sc->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
+  return sc->get_property_alist_chain (defaults);
+}
+
+
 LY_DEFINE (ly_get_extent, "ly:grob-extent", 3, 0, 0,
           (SCM grob, SCM refp, SCM axis),
           "Get the extent in @var{axis} direction of @var{grob} relative to "
index b8bf6354f7f13b1000a3b38a5f4510d4803e032d..eac01f3f7741a17940b4fd4378a81ea1fe35427e 100644 (file)
@@ -51,8 +51,6 @@ struct Grace_fixup
 class Sequential_iterator :  public Music_iterator
 {
 public:
-  Grace_fixup * grace_fixups_;
-  
   DECLARE_SCHEME_CALLBACK(constructor, ());
   Sequential_iterator ();
   Sequential_iterator (Sequential_iterator const&);
@@ -70,14 +68,21 @@ protected:
   virtual Music_iterator *try_music_in_children (Music *) const;
   virtual bool run_always () const;
 protected:
-  Moment here_mom_;
   Music_iterator * iter_;
-  SCM  list_;
+  virtual SCM get_music_list ()const;
+  virtual void next_element (bool side_effect);
+
+
+  Grace_fixup *get_grace_fixup () const;
+  void next_grace_fixup ();
+  
+private:
+  Moment here_mom_;
+  SCM list_;
   SCM cursor_;
+  Grace_fixup * grace_fixups_;
   
-  virtual void next_element (bool side_effect);
   virtual void descend_to_child ();
-  virtual SCM get_music_list ()const;
 };
 
 #endif /* SEQUENTIAL_ITERATOR_HH */
index 9d81bdc13ae9e612d9d25704344de3ad871ff145..234681b7a798258b7da343540cd96ba19a4364a1 100644 (file)
@@ -42,7 +42,8 @@
 class Stencil
 {
   friend SCM ly_stencil_set_extent_x (SCM, SCM, SCM);
-  
+
+  Offset origin_;
   Box dim_;
   SCM expr_;
   
@@ -50,14 +51,17 @@ class Stencil
 public:
   Stencil (Box, SCM s);
   Stencil ();
-
-
+  
+  Offset origin () const;
   SCM smobbed_copy () const;
   SCM get_expr () const;
 
   /**
      Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */
   void set_empty (bool);
+  Stencil moved_to_edge (Axis a, Direction d, const Stencil &m, Real padding,
+                        Real minimum) const;
+
   void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding,
                    Real minimum);
   void add_stencil (Stencil const &m);
index ea5ed739e491d5ddd6bc09801bdc6e500272ab53..2a5a667c442fc16b615f086cb125e36e48c32256 100644 (file)
@@ -264,25 +264,6 @@ HYPHEN             --
 <chords,notes,figures>R                {
        return MULTI_MEASURE_REST;
 }
-<INITIAL,chords,lyrics,notes,figures>\\\${BLACK}*{WHITE}       {
-       String s=YYText () + 2;
-       s=s.left_string (s.length () - 1);
-       return scan_escaped_word (s); 
-}
-<INITIAL,chords,lyrics,notes,figures>\${BLACK}*{WHITE}         {
-       String s=YYText () + 1;
-       s=s.left_string (s.length () - 1);
-       return scan_bare_word (s);
-}
-<INITIAL,chords,lyrics,notes,figures>\\\${BLACK}*              { // backup rule
-       error (_("white expected"));
-       exit (1);
-}
-<INITIAL,chords,lyrics,notes,figures>\${BLACK}*                { // backup rule
-       error (_("white expected"));
-       exit (1);
-}
-
 <INITIAL,markup,chords,lyrics,notes,figures>#  { //embedded scm
        //char const* s = YYText () + 1;
        char const* s = here_str0 ();
index e7d46808252bf04a7d8402acf201da1c0b6d733d..3d395f137c60bb18521cb1424232a6178411176e 100644 (file)
@@ -701,9 +701,6 @@ Lookup::triangle (Interval iv, Real thick, Real protude)
 }
 
 
-/*
-  TODO: use rounded boxes.
- */
 LY_DEFINE (ly_bracket ,"ly:bracket",
          4, 0, 0,
          (SCM a, SCM iv, SCM t, SCM p),
@@ -720,7 +717,7 @@ LY_DEFINE (ly_bracket ,"ly:bracket",
   return Lookup::bracket ((Axis)gh_scm2int (a), ly_scm2interval (iv),
                          gh_scm2double (t),
                          gh_scm2double (p),
-                         gh_scm2double (t)).smobbed_copy ();
+                         0.95 * gh_scm2double (t)).smobbed_copy ();
 }
 
 
index f909b5aa2cc8772eff0a4407cf39977d66745797..e95eb644f7c84d5bf02ecfcb40c4523bd31e22c4 100644 (file)
@@ -32,7 +32,11 @@ internal_ly_parse_scm (Parse_start * ps, bool safe)
     {
       if (safe)
        {
-         SCM safe_module = scm_primitive_eval (ly_symbol2scm ("safe-module"));
+         static SCM safe_module;
+         if (!safe_module)
+           safe_module = scm_primitive_eval (ly_symbol2scm ("safe-module"));
+
+         
          answer = scm_eval (form, safe_module);
        }
       else
index 190b42ce83770d0511eda246be92e06a43a41977..17adedcc94d35f499ae666ff4eae8f7264c5014c 100644 (file)
@@ -125,9 +125,13 @@ is_regular_identifier (SCM id)
   char const *s = str.to_str0 () ;
 
   bool v = true;
+/*
+  isalpha (*s);
+  s++;
+*/
   while (*s && v)
    {
-        v = v && isalpha (*s);
+        v = v && isalnum (*s);
         s++;
    }
   return v;
@@ -1936,7 +1940,7 @@ bass_figure:
                Music *m = unsmob_music ($1);
                if ($2) {
                        SCM salter =m->get_property ("alteration");
-                       int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
+                       int alter = gh_number_p (salter) ? gh_scm2int (salter) : 0;
                        m->set_property ("alteration",
                                gh_int2scm (alter + $2));
                } else {
index 6aed08927c306cd3c1b68b552a577229913989ae..81e9dac2963a6e12bd38a2a1014c970b4d0c1264 100644 (file)
@@ -11,7 +11,6 @@
 #include "sequential-iterator.hh"
 #include "music-list.hh"
 
-Grace_fixup *copy_grace_fixups (Grace_fixup* src);
 Grace_fixup *get_grace_fixups (SCM cursor);
 
 /*
@@ -42,7 +41,7 @@ Sequential_iterator::Sequential_iterator ()
   list_ = SCM_EOL;
   cursor_ = SCM_EOL; 
   grace_fixups_ = 0;
-  iter_ =0;
+  iter_ = 0;
 }
 
 SCM 
@@ -80,7 +79,7 @@ Sequential_iterator::derived_substitute (Context *f,Context *t)
 }
 
 Grace_fixup *
-get_grace_fixups (SCM cursor)
+create_grace_fixup_list (SCM cursor)
 {
   Moment here;
   Moment last (-1);
@@ -89,15 +88,15 @@ get_grace_fixups (SCM cursor)
 
   for (; gh_pair_p (cursor); cursor = ly_cdr (cursor))
     {
-      Music * mus = unsmob_music (ly_car (cursor));
+      Music *mus = unsmob_music (ly_car (cursor));
       Moment s = mus->start_mom ();
-      Moment l =mus->get_length () - s;
+      Moment l = mus->get_length () - s;
 
       if (s.grace_part_)
        {
          if (last != Moment (-1))
            {
-             Grace_fixup *p =new Grace_fixup;
+             Grace_fixup *p = new Grace_fixup;
              p->start_ = last;
              p->length_ = here - last;
              p->grace_start_ = s.grace_part_;
@@ -115,22 +114,7 @@ get_grace_fixups (SCM cursor)
          here += l;
        }
     }
-  return  head;
-}
-
-Grace_fixup *
-copy_grace_fixups (Grace_fixup* src)
-{
-  Grace_fixup * head = 0;
-  Grace_fixup **dest = &head;
-
-  while (src)
-    {
-      *dest = new Grace_fixup (*src);
-      dest = & (*dest)->next_;
-      src = src ->next_;
-    }
-
+  
   return head;
 }
 
@@ -153,7 +137,7 @@ Sequential_iterator::construct_children ()
     }
 
   here_mom_ = get_music ()->start_mom ();
-  grace_fixups_ = get_grace_fixups (cursor_);
+  grace_fixups_ = create_grace_fixup_list (cursor_);
 
   /*
     iter_->ok () is tautology, but what the heck.
@@ -173,15 +157,15 @@ Sequential_iterator::next_element (bool)
   Moment len =iter_->music_get_length () - iter_->music_start_mom ();
   assert (!grace_fixups_  || grace_fixups_->start_ >= here_mom_);
   
-  if (len.main_part_ && grace_fixups_ &&
-      grace_fixups_->start_ == here_mom_)
+  if (len.main_part_
+      && get_grace_fixup ())
     {
-      here_mom_ += grace_fixups_->length_;
-      here_mom_.grace_part_ += grace_fixups_->grace_start_;
+      Grace_fixup *gf = get_grace_fixup ();
+      
+      here_mom_ += gf->length_;
+      here_mom_.grace_part_ += gf->grace_start_;
 
-      Grace_fixup * n =grace_fixups_->next_;
-      delete grace_fixups_;
-      grace_fixups_ = n;
+      next_grace_fixup ();
     }
   else if (len.grace_part_ && !len.main_part_)
     {
@@ -221,7 +205,7 @@ Sequential_iterator::descend_to_child ()
   Context * c = child_report;
   while (c && c != me_report)
     {
-      c= c->daddy_context_;
+      c = c->daddy_context_;
     }
   
   if (c == me_report)
@@ -235,10 +219,10 @@ Sequential_iterator::process (Moment until)
 {
   while (iter_)
     {
-      if (grace_fixups_ &&
-         grace_fixups_->start_ == here_mom_
-         && (grace_fixups_->start_ + grace_fixups_->length_
-             + Moment (Rational (0), grace_fixups_->grace_start_) == until))
+      Grace_fixup * gf = get_grace_fixup ();
+      if (gf
+         && gf->start_ + gf->length_
+             + Moment (Rational (0), gf->grace_start_) == until)
        {
          /*
            do the stuff/note/rest preceding a grace.
@@ -248,7 +232,6 @@ Sequential_iterator::process (Moment until)
       else
        {
          Moment w = until - here_mom_ + iter_->music_start_mom ();
-         //      if (w >= Moment (0)) 
          iter_->process (w);
        }
       
@@ -274,10 +257,11 @@ Sequential_iterator::pending_moment () const
   /*
     Fix-up a grace note halfway in the music.
   */
-  if (grace_fixups_ && here_mom_ == grace_fixups_->start_
-      && grace_fixups_->length_ + iter_->music_start_mom () == cp)
+  Grace_fixup * gf = get_grace_fixup ();
+  if (gf
+      && gf->length_ + iter_->music_start_mom () == cp)
     {
-      return here_mom_ + grace_fixups_->length_ + Moment (0, grace_fixups_->grace_start_);
+      return here_mom_ + gf->length_ + Moment (0, gf->grace_start_);
     }
 
   /*
@@ -306,3 +290,21 @@ Sequential_iterator::run_always () const
 {
   return iter_ ? iter_->run_always () : false; 
 }
+
+void
+Sequential_iterator::next_grace_fixup ()
+{
+  Grace_fixup * n = grace_fixups_->next_;
+  delete grace_fixups_;
+  grace_fixups_ = n;
+}
+
+
+Grace_fixup*
+Sequential_iterator::get_grace_fixup () const
+{
+  if (grace_fixups_ && grace_fixups_->start_ == here_mom_)
+    return grace_fixups_;
+  else
+    return 0;
+}
index adacd1c6c0806eb7f3a1ebd96c87061209ae3723..a969143440e992eda497c973067eaac92b905e36 100644 (file)
@@ -91,9 +91,6 @@ Staff_performer::create_audio_elements ()
 void
 Staff_performer::stop_translation_timestep ()
 {
-  /*
-    UGH. -> don't use eval.
-  */
   static SCM proc;
   if (!proc)
     proc = scm_primitive_eval (ly_symbol2scm ("percussion?"));
index e274677fc41bbfdebfd3c1ac34c5b263d4846d7f..4e30e129aea4b8049284bee7de98a3c654bd6cc5 100644 (file)
@@ -9,7 +9,9 @@
 #include "font-metric.hh"
 #include "stencil.hh"
 
-
+/*
+  TODO: naming add/combine.
+ */
 /*
   UMGH. junkme!
   
@@ -33,18 +35,18 @@ LY_DEFINE (ly_stencil_set_extent_x,"ly:stencil-set-extent!",
 
 LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis",
           3, 0, 0, (SCM stil, SCM amount, SCM axis),
-          "Return a @var{stil}, "
-          "but translated by @var{amount} in @var{axis} direction.")
+          "Return a copy of @var{stil} but translated by @var{amount} in @var{axis} direction.")
 {
   Stencil *s = unsmob_stencil (stil);
   SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
   SCM_ASSERT_TYPE (gh_number_p (amount), amount, SCM_ARG2, __FUNCTION__, "number pair");
   SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
 
-  Stencil q (*s);
-  q.translate_axis (gh_scm2double (amount), Axis (gh_scm2int (axis)));
+  SCM new_s = s->smobbed_copy ();
+  Stencil *q = unsmob_stencil (new_s);
+  q->translate_axis (gh_scm2double (amount), Axis (gh_scm2int (axis)));
+  return new_s;
 
-  return q.smobbed_copy ();
 }
 
 LY_DEFINE (ly_translate_stencil,"ly:stencil-translate",
@@ -57,9 +59,10 @@ LY_DEFINE (ly_translate_stencil,"ly:stencil-translate",
   SCM_ASSERT_TYPE (is_number_pair (offset), offset, SCM_ARG2, __FUNCTION__, "number pair");
   Offset o = ly_scm2offset (offset);
 
-  Stencil q (*s);
-  q.translate (o);
-  return q.smobbed_copy ();
+  SCM new_s = s->smobbed_copy ();
+  Stencil *q =unsmob_stencil (new_s);
+  q->translate (o);
+  return new_s;
 }
 
 LY_DEFINE (ly_stencil_get_expr, "ly:stencil-get-expr",
@@ -83,8 +86,51 @@ LY_DEFINE (ly_stencil_get_extent,
   return ly_interval2scm (s->extent (Axis (gh_scm2int (axis))));
 }
 
-LY_DEFINE (ly_stencil_combined_at_edge,
-          "ly:stencil-combine-at-edge",
+LY_DEFINE (ly_stencil_moved_to_edge, "ly:stencil-moved-to-edge",
+          4, 2, 0,  (SCM first, SCM axis, SCM direction,
+                     SCM second,
+                     SCM padding,
+                     SCM minimum),
+          "Similar to @code{ly:stencil-combine-edge}, but returns "
+          "@var{second} positioned to be next to @var{first}. ")
+{
+  /*
+    C&P from combine-at-edge.
+   */
+  Stencil *s1 = unsmob_stencil (first);
+  Stencil *s2 = unsmob_stencil (second);
+  Stencil first_stencil;
+
+  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+  SCM_ASSERT_TYPE (is_direction (direction), direction, SCM_ARG4, __FUNCTION__, "dir");
+
+  Real p = 0.0;
+  if (padding != SCM_UNDEFINED)
+    {
+      SCM_ASSERT_TYPE (gh_number_p (padding), padding, SCM_ARG5, __FUNCTION__, "number");
+      p = gh_scm2double (padding);
+    }
+  Real m = 0.0;
+  if (minimum != SCM_UNDEFINED)
+    {
+      SCM_ASSERT_TYPE (gh_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
+      m = gh_scm2double (minimum);
+    }
+
+  if (s1)
+    first_stencil = *s1;
+
+  if (s2)
+    return first_stencil.moved_to_edge (Axis (gh_scm2int (axis)),
+                                       Direction (gh_scm2int (direction)),
+                                       *s2, p, m).smobbed_copy ();
+  else
+    return Stencil().smobbed_copy ();
+}
+
+
+  
+LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge",
           4, 2, 0,  (SCM first, SCM axis, SCM direction,
                      SCM second,
                      SCM padding,
@@ -125,7 +171,6 @@ LY_DEFINE (ly_stencil_combined_at_edge,
   return result.smobbed_copy ();
 }
 
-/*  FIXME: support variable number of arguments.  */
 LY_DEFINE (ly_stencil_add ,
           "ly:stencil-add", 0, 0, 1, (SCM args),
           "Combine stencils. Takes any number of arguments.")
index a983241fc195164f56be0661b338e8b55d0b74f9..2b16efe8b66b1f6a7a54dadc6fdae313912e2add 100644 (file)
@@ -27,6 +27,12 @@ Stencil::smobbed_copy () const
   return s->smobbed_self ();
 }
 
+Offset
+Stencil::origin () const
+{
+  return origin_;
+}
+
 Interval
 Stencil::extent (Axis a) const
 {
@@ -65,6 +71,7 @@ Stencil::translate (Offset o)
                   expr_, SCM_UNDEFINED);
   if (!is_empty ())
     dim_.translate (o);
+  origin_ += o;
 }
   
 void
@@ -73,7 +80,7 @@ Stencil::translate_axis (Real x, Axis a)
   Offset o (0,0);
   o[a] = x;
   translate (o);
-}  
+}
 
 void
 Stencil::add_stencil (Stencil const &s)
@@ -108,29 +115,44 @@ Stencil::align_to (Axis a, Real x)
   translate_axis (-i.linear_combination (x), a);
 }
 
-/*  See scheme Function.  */
-void
-Stencil::add_at_edge (Axis a, Direction d, Stencil const &s, Real padding,
-                      Real minimum)
+/*
+  TODO: unintuitive naming, you would expect *this to be moved.  Kept
+  API for compat with add_at_edge ().
+*/
+Stencil
+Stencil::moved_to_edge (Axis a, Direction d, Stencil const &s, Real padding,
+                       Real minimum) const
 {
   Real my_extent= is_empty () ? 0.0 : dim_[a][d];
   Interval i (s.extent (a));
   Real his_extent;
   if (i.is_empty ())
     {
-      programming_error ("Stencil::add_at_edge: adding empty stencil.");
+      programming_error ("Stencil::move_to_edge: adding empty stencil.");
       his_extent = 0.0;
     }
   else
     his_extent = i[-d];
 
   Real offset = (my_extent -  his_extent) + d * padding;
-  if (minimum > 0 && fabs (offset) <  minimum)
-    offset = sign (offset) * minimum; 
-  
+
   Stencil toadd (s);
-  toadd.translate_axis (offset, a);
-  add_stencil (toadd);
+  toadd.translate_axis (offset,a);
+
+  if (minimum > 0
+      && d *(- origin ()[a] + toadd.origin ()[a]) < minimum)
+    toadd.translate_axis ( -toadd.origin ()[a]
+                          + origin ()[a] + d* minimum, a);
+    
+  return toadd;
+}
+
+/*  See scheme Function.  */
+void
+Stencil::add_at_edge (Axis a, Direction d, Stencil const &s, Real padding,
+                      Real minimum)
+{
+  add_stencil (moved_to_edge (a,d,s,padding, minimum));
 }
 
 /* Hmm... maybe this is not such a good idea ; stuff can be empty,
index 9ea43edbf1f882a86ea7e49285b469a36148f336..6991aa835fcf7bf8693f10932d37bb68431c02ea 100644 (file)
@@ -527,7 +527,7 @@ AncientRemoveEmptyStaffContext = \context {
     tablatureFormat = #fret-number-tablature-format
 
     %%
-    bassFigureFormatFunction = #make-bass-figure-markup
+    bassFigureFormatFunction = #format-bass-figure
     metronomeMarkFormatter = #format-metronome-markup
     graceSettings = #`#(
        (Voice Stem direction 1)
index 8aa8f5dce432ddebc4552c9f30ebd0c82791d747..804198a6c91c3ce7a41e3a45e57522997358279a 100644 (file)
@@ -5,24 +5,9 @@
  "A bass figure, including bracket"
  '())
 
-(define  (recursive-split-at pred? l)
-  (if (null? l)
-      '()
-      (let*
-         ((x (split-at-predicate pred? l)))
-       (set-cdr! x (recursive-split-at pred? (cdr x)))
-       x
-       )))
 
-(define-public (make-bass-figure-markup figures context)
-  
-  (define (no-end-bracket? f1 f2)
-    (eq? (ly:music-property f1 'bracket-stop) '())
-    )
-  (define (no-start-bracket? f1 f2)
-    (eq? (ly:music-property f2 'bracket-start) '())
-    )
 
+(define-public (format-bass-figure figures context grob)
   ;; TODO: support slashed numerals here.
   (define (fig-to-markup fig-music)
     (let*
                                  (alteration->text-accidental-markup acc)))
          fig-markup)
       ))
-  
-  (define (fig-seq-to-markup figs)
-    (let*
-       (
-        (c (make-dir-column-markup (map fig-to-markup figs)))
-        )
-      (if (eq? (ly:music-property (car figs) 'bracket-start) #t)
-         (make-bracket-markup c)
-         c
-         )))
-  
-  (let*
-      (
-       (ends (recursive-split-at no-end-bracket? (reverse figures)))
-       (starts (map (lambda (x) (recursive-split-at no-start-bracket? x)) ends))
-       )
-    (make-dir-column-markup (map fig-seq-to-markup (apply append starts)))
-    ))
 
+  (define (filter-brackets i figs acc)
+    (cond
+     ((null? figs) acc)
+     (else
+      (filter-brackets (1+ i) (cdr figs)
+
+                      (append
+                       (if  (eq? (ly:music-property (car figs) 'bracket-start) #t)
+                            (list i)
+                            '())
+                       (if  (eq? (ly:music-property (car figs) 'bracket-stop) #t)
+                            (list i)
+                            '())
+                       
+                       acc)))))
+
+  (set! (ly:grob-property grob 'text)
+       (make-bracketed-y-column-markup
+        (sort (filter-brackets 0 figures '()) <)
+        (map fig-to-markup figures)
+        )))
index ffa54d5939076750db3e7590f37638702c334c43..736e5bd296b289680c26ba9c8c2e8f15a102bd8c 100644 (file)
@@ -99,7 +99,9 @@ when finding a barcheck.")
 
      (barNumberVisibility ,procedure? "Procedure that takes an int and
 returns whether the corresponding bar number should be printed")
-     (bassFigureFormatFunction ,procedure? "Procedure that produces a markup text. It takes a list of @code{BassFigureEvent}s, and a context.")
+     (bassFigureFormatFunction ,procedure? "Procedure that is called
+to produce the formatting for a @code{BassFigure} grob. It takes a
+list of @code{BassFigureEvent}s, a context, and the grob to format.")
      (beatLength ,ly:moment? "The length of one beat in this time signature.")
      (beatGrouping ,list?
                   "List of beatgroups. Eg. in 5/8 time @code{'(2 3)}.")
index e714adba721e876f26c201caea5d867506aec50c..114cdf5a438bd0a426a0c7429e5d6715164bd41f 100644 (file)
@@ -576,3 +576,92 @@ FIXME: is this working?
  (skipping I), and continues with double letters."
  
    (Text_item::interpret_markup paper props (number->markletter-string num)))
+
+
+
+
+(def-markup-command (bracketed-y-column paper props indices args)
+  (list? markup-list?)
+  "Make a column of the markups in @var{args}, putting brackets around
+the elements marked in @var{indices}, which is a list of numbers."
+
+    (define (sublist l start stop)
+    (take (drop l start)  (- (1+ stop) start)) )
+
+  (define (stencil-list-extent ss axis)
+    (cons
+     (apply min (map (lambda (x) (car (ly:stencil-extent x axis))) ss))
+     (apply max (map (lambda (x) (cdr (ly:stencil-extent x axis))) ss))))
+           
+  (define (stack-stencils stencils bskip last-stencil)
+    (cond
+     ((null? stencils) '())
+     ((not last-stencil)
+      (cons (car stencils)
+           (stack-stencils (cdr stencils) bskip (car stencils))))
+     (else
+      (let*
+         ((orig (car stencils))
+          (handle  (chain-assoc 'direction  props))
+          (dir (if (and (pair? handle) (ly:dir? (cdr handle)))
+                   (cdr handle)
+                   DOWN))
+          (new (ly:stencil-moved-to-edge last-stencil Y dir
+                                         orig
+                                         0.1 bskip))
+          )
+
+       (cons new (stack-stencils (cdr stencils) bskip new))))
+    ))
+
+  (define (make-brackets stencils indices acc)
+    (if (and stencils
+            (pair? indices)
+            (pair? (cdr indices)))
+       (let*
+           ((encl (sublist stencils (car indices) (cadr indices)))
+            (x-ext (stencil-list-extent encl X))
+            (y-ext (stencil-list-extent encl Y))
+            (thick 0.10)
+            (pad 0.35)
+            (protusion (* 2.5 thick))
+            (lb
+             (ly:stencil-translate-axis 
+              (ly:bracket Y y-ext thick protusion)
+              (- (car x-ext) pad) X))
+            (rb (ly:stencil-translate-axis
+                 (ly:bracket Y y-ext thick (- protusion))
+                 (+ (cdr x-ext) pad) X))
+            )
+
+         (make-brackets
+          stencils (cddr indices)
+          (append
+           (list lb rb)
+            acc)))
+       acc))
+
+  (let*
+      ((stencils
+       (map (lambda (x)
+              (interpret-markup
+               paper
+               props
+               x)) args))
+       (leading
+       (cdr (chain-assoc 'baseline-skip props)))
+       (stacked (stack-stencils stencils 1.25 #f))
+       (brackets (make-brackets stacked indices '()))
+       )
+
+    (apply ly:stencil-add
+          (append stacked brackets)
+          )))
+
+
+            
+
+  
+  
+
+     
index db61cee29176c5bebc7d44accca8373f6dc91c84..3cbed697c54277add11e2e21d7082e2a08af6b52 100644 (file)
                                              paper 'linewidth))
                               (font-family . roman))
                             (ly:paper-lookup paper 'font-defaults)))))
-  (interpret-markup paper props
-                   (markup #:fill-line
-                           ;; FIXME: font not found
-                           ;; ("" #:bold (number->string page-number))))))
-                           ("" (number->string page-number))))))
+    (interpret-markup paper props
+                     (markup #:fill-line
+                             ;; FIXME: font not found
+                             ;; ("" #:bold (number->string page-number))))))
+                             ("" (number->string page-number))))))
 
 (define-public (make-footer paper page-number)
   (let ((props (list (append `((linewidth . ,(ly:paper-get-number
index f27fe34a94d4651d400e75fd9e104f0405168ddd..316878f0e5bf3af8112387873172f1bd6e60d2bf 100644 (file)
@@ -435,7 +435,7 @@ the mark when there are no spanners active."
 ;; autochange - fairly related to part combining.
 
 (define-public (make-autochange-music music)
-  (define (generate-split-list event-list acc)
+  (define (generate-split-list change-moment event-list acc)
     (if (null? event-list)
        acc
        (let* ((now-tun (caar event-list))
@@ -449,16 +449,27 @@ the mark when there are no spanners active."
                          #f)))
          ;; tail recursive.
          (if (and pitch (not (= (ly:pitch-steps pitch) 0)))
-             (generate-split-list (cdr event-list)
-                                  (cons (cons now (sign (ly:pitch-steps pitch))) acc))
-             (generate-split-list (cdr event-list) acc)))))
+             (generate-split-list #f
+                                  (cdr event-list)
+                                  (cons (cons
+
+                                         (if change-moment
+                                             change-moment
+                                             now)
+                                         (sign (ly:pitch-steps pitch))) acc))
+             (generate-split-list
+              (if pitch #f now)
+              (cdr event-list) acc)))))
+  
   (set! noticed '())
   (let* ((m (make-music 'AutoChangeMusic))
         (context (ly:run-translator music part-combine-listener))
         (evs (last-pair noticed))
-        (split (reverse! (generate-split-list (if (pair? evs)
-                                                  (reverse! (cdar evs) '()) '())
-                                              '())
+        (split (reverse! (generate-split-list
+                          #f
+                          (if (pair? evs)
+                              (reverse! (cdar evs) '()) '())
+                          '())
                          '())))
     (set! (ly:music-property m 'element) music)
     (set! (ly:music-property m 'split-list) split)