]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge remote-tracking branch 'origin' into HEAD release/2.15.41-1
authorGraham Percival <graham@percival-music.ca>
Wed, 4 Jul 2012 16:41:03 +0000 (17:41 +0100)
committerGraham Percival <graham@percival-music.ca>
Wed, 4 Jul 2012 16:41:03 +0000 (17:41 +0100)
input/regression/page-headers-and-footers.ly [new file with mode: 0644]
lily/include/lily-guile.hh
lily/lily-guile.cc
ly/titling-init.ly

diff --git a/input/regression/page-headers-and-footers.ly b/input/regression/page-headers-and-footers.ly
new file mode 100644 (file)
index 0000000..ea3c5b8
--- /dev/null
@@ -0,0 +1,45 @@
+\version "2.15.41"
+
+\header {
+
+  texidoc = "Page-headers and -footers.  All headers and footers
+  should be printed on their specified page. "
+
+}
+
+\paper {
+  ragged-last-bottom = ##f
+
+  oddHeaderMarkup = \markup  {
+    \override #'(baseline-skip . 1)
+    \center-column {
+      \box \fill-line { \teeny " " " " }
+      \on-the-fly #first-page "first-page-header-text"
+      \on-the-fly #not-first-page \fromproperty #'page:page-number-string
+      \on-the-fly #(on-page 2) "page-2-header-text"
+      \on-the-fly #last-page "last-page-header-text"
+    }
+  }
+
+  evenHeaderMarkup = \oddHeaderMarkup
+
+  oddFooterMarkup = \markup \fill-line {
+    \override #'(baseline-skip . 0.5)
+    \center-column {
+       \on-the-fly #first-page "first-page-footer-text"
+       \on-the-fly #last-page "last-page-footer-text"
+       \on-the-fly #(on-page 2) "page-2-footer-text"
+       \box \fill-line { \teeny " " " " }
+    }
+  }
+}
+
+#(set-default-paper-size "a6" 'portrait)
+
+\book {
+  \score {
+    \new Staff \relative c' {
+      \repeat unfold 18 { a b c d \break }
+    }
+  }
+}
index 5bcd235e2753f027caf8e9128f28f766b2ba96ee..059e5aa0cc49ba4f1d8bf49a1019f8455758b494 100644 (file)
@@ -97,7 +97,6 @@ SCM ly_hash2alist (SCM tab);
 SCM ly_hash_table_keys (SCM tab);
 
 SCM ly_assoc_prepend_x (SCM alist, SCM key, SCM val);
-inline bool ly_is_fraction (SCM x) { return SCM_FRACTIONP (x) || scm_is_integer (x); }
 
 inline bool ly_is_list (SCM x) { return scm_is_true (scm_list_p (x)); }
 inline bool ly_cheap_is_list (SCM x) { return scm_is_pair (x) || x == SCM_EOL; }
index 7985b35d90e850a9f67152f7a22e4d22e83bbc13..6ddcad079ba749924f0a6d93cd4b56253e48675d 100644 (file)
@@ -580,6 +580,12 @@ robust_scm2vsize (SCM k, vsize o)
 SCM
 ly_rational2scm (Rational r)
 {
+  if (r.is_infinity ())
+    if (r > Rational(0))
+      return scm_inf ();
+    else
+      return scm_difference (scm_inf (), SCM_UNDEFINED);
+
   return scm_divide (scm_from_int64 (r.numerator ()),
                      scm_from_int64 (r.denominator ()));
 }
@@ -587,6 +593,22 @@ ly_rational2scm (Rational r)
 Rational
 ly_scm2rational (SCM r)
 {
+  if (scm_is_true (scm_inf_p (r)))
+    {
+      if (scm_is_true (scm_positive_p (r)))
+       {
+         Rational r;
+         r.set_infinite (1);
+         return r;
+       }
+      else
+       {
+         Rational r;
+         r.set_infinite (-1);
+         return r;
+       }
+    }
+
   return Rational (scm_to_int64 (scm_numerator (r)),
                    scm_to_int64 (scm_denominator (r)));
 }
@@ -594,7 +616,9 @@ ly_scm2rational (SCM r)
 Rational
 robust_scm2rational (SCM n, Rational rat)
 {
-  if (ly_is_fraction (n))
+  if (scm_is_real (n)
+      && (scm_is_true (scm_exact_p (n))
+         || scm_is_true (scm_inf_p (n))))
     return ly_scm2rational (n);
   else
     return rat;
index f6daacddb399cf6bac89b3bcccbb291bab242f82..7b004468a91abdb192be3aa691851ac3e34a82d8 100644 (file)
@@ -101,6 +101,11 @@ book last one."
       (interpret-markup layout props arg)
       empty-stencil))
 
+#(define ((on-page nmbr) layout props arg)
+ (if (= (chain-assoc-get 'page:page-number props -1) nmbr)
+   (interpret-markup layout props arg)
+   empty-stencil))
+
 %% Bookpart first page and last page predicates
 #(define (part-first-page layout props arg)
   (if (= (chain-assoc-get 'page:page-number props -1)