]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stencil-scheme.cc
Merge branch 'master' into translation
[lilypond.git] / lily / stencil-scheme.cc
index 958bcc44c811472b4d3b34a93be2213e02488303..37203f4edaed9cb817809c19ffbe598b2f60efe0 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis",
   Stencil *s = unsmob_stencil (stil);
   LY_ASSERT_SMOB (Stencil, stil, 1);
   LY_ASSERT_TYPE (scm_is_number, amount, 2);
+
   LY_ASSERT_TYPE (is_axis, axis, 3);
 
   Real real_amount = scm_to_double (amount);
@@ -92,17 +93,14 @@ LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?",
 }
 
 LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge",
-           4, 2, 0, (SCM first, SCM axis, SCM direction,
+           4, 1, 0, (SCM first, SCM axis, SCM direction,
                      SCM second,
-                     SCM padding,
-                     SCM minimum),
+                     SCM padding),
            "Construct a stencil by putting @var{second} next to @var{first}."
            "  @var{axis} can be 0 (x-axis) or@tie{}1 (y-axis)."
            "  @var{direction} can be -1 (left or down) or@tie{}1 (right or"
-           "  up).  The stencils are juxtaposed with @var{padding} as extra"
-           " space.  If this puts the reference points closer than"
-           " @var{minimum}, they are moved by the latter amount."
-           "  @var{first} and @var{second} may also be @code{'()} or"
+           " up).  The stencils are juxtaposed with @var{padding} as extra"
+           " space.  @var{first} and @var{second} may also be @code{'()} or"
            " @code{#f}.")
 {
   Stencil *s1 = unsmob_stencil (first);
@@ -122,12 +120,6 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge",
       LY_ASSERT_TYPE (scm_is_number, padding, 5);
       p = scm_to_double (padding);
     }
-  Real m = 0.0;
-  if (minimum != SCM_UNDEFINED)
-    {
-      LY_ASSERT_TYPE (scm_is_number, minimum, 6);
-      m = scm_to_double (minimum);
-    }
 
   if (s1)
     result = *s1;
@@ -147,7 +139,8 @@ LY_DEFINE (ly_stencil_add, "ly:stencil-add",
   SCM_VALIDATE_REST_ARGUMENT (args);
 
   SCM expr = SCM_EOL;
-  SCM *tail = &expr;
+  SCM cs = ly_symbol2scm ("combine-stencil");
+
   Box extent;
   extent.set_empty ();
 
@@ -158,12 +151,18 @@ LY_DEFINE (ly_stencil_add, "ly:stencil-add",
         SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
 
       extent.unite (s->extent_box ());
-      *tail = scm_cons (s->expr (), SCM_EOL);
-      tail = SCM_CDRLOC (*tail);
+      if (scm_is_pair (s->expr ()) && scm_is_eq (cs, s->expr ()))
+        {
+          expr = scm_reverse_x (scm_list_copy (scm_cdr (s->expr ())),
+                                expr);
+        }
+      else
+        expr = scm_cons (s->expr (), expr);
+
       args = scm_cdr (args);
     }
 
-  expr = scm_cons (ly_symbol2scm ("combine-stencil"), expr);
+  expr = scm_cons (cs, scm_reverse_x (expr, SCM_EOL));
   return Stencil (extent, expr).smobbed_copy ();
 }
 
@@ -210,7 +209,7 @@ LY_DEFINE (ly_make_stencil, "ly:make-stencil",
 LY_DEFINE (ly_stencil_aligned_to, "ly:stencil-aligned-to",
            3, 0, 0, (SCM stil, SCM axis, SCM dir),
            "Align @var{stil} using its own extents.  @var{dir} is a number."
-           "  @code{-1} and @code{1} are left and right, respectively."
+           "  @w{@code{-1}} and @code{1} are left and right, respectively."
            "  Other values are interpolated (so @code{0} means the center).")
 {
   LY_ASSERT_SMOB (Stencil, stil, 1);
@@ -297,7 +296,7 @@ LY_DEFINE (ly_bracket, "ly:bracket",
 LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate",
            4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
            "Return a stencil @var{stil} rotated @var{angle} degrees around"
-           " the relative offset (@var{x}, @var{y}). E.g. an offset of"
+           " the relative offset (@var{x}, @var{y}).  E.g., an offset of"
            " (-1, 1) will rotate the stencil around the left upper corner.")
 {
   Stencil *s = unsmob_stencil (stil);