]> git.donarmstrong.com Git - lilypond.git/commitdiff
Do not also print intstrument in header on
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 6 Feb 2005 11:35:29 +0000 (11:35 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 6 Feb 2005 11:35:29 +0000 (11:35 +0000)
first page.  Do not print page number on first and only page.

ChangeLog
ly/titling-init.ly
scm/page-layout.scm
scm/titling.scm

index 75a1ac71ca0a80c756f7ce310916a47408bac203..577eb76e8ccbcd31d84e89f7130cd204bae20edc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2005-02-06  Jan Nieuwenhuizen  <janneke@gnu.org>
 
-       * ly/titling-init.ly: Do not print intstrument twice on first
-       page.  Do not print page number on first page.
+       * ly/titling-init.ly: Do not also print intstrument in header on
+       first page.  Do not print page number on first and only page.
 
 2005-02-05  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
index 5b16c8102efdfd23cbc39d56a6f178fd3862f7e4..12801a9060516dae9d49ec64da36834125c99128 100644 (file)
@@ -60,13 +60,14 @@ scoreTitleMarkup = \markup {
     (interpret-markup layout props arg)
     empty-stencil))
 
-%%#(define (multiple-pages layout props arg)
+#(define (not-single-page layout props arg)
+  (if (not (and (= (chain-assoc-get 'page:page-number props -1) 1)
+               (chain-assoc-get 'page:last? props -1)))
+    (interpret-markup layout props arg)
+    empty-stencil))
 
 oddHeaderMarkup = \markup
-%% Do not print page number on fist page.
-%% FIXME: only if multiple pages, do page number
-%% \on-the-fly #multiple-pages
-\on-the-fly #not-first-page
+\on-the-fly #not-single-page
 \fill-line {
   ""
   \on-the-fly #not-first-page \fromproperty #'header:instrument
index dea8df39025fa29aaaab5702b016edf76454b0d9..26020101159590ef0a8796393add5c7c80f98244 100644 (file)
@@ -47,7 +47,7 @@
             (not (ly:stencil-empty? head-stencil)))
        (set! head-stencil
              (ly:stencil-combine-at-edge
-              stencil Y  dir head-stencil
+              stencil Y dir head-stencil
               sep 0.0)))
 
     head-stencil))
               (interval-length (ly:stencil-extent foot Y))
               0))))
     
-                                       ;    (display (list "\n available" available head foot))
+    ;; (display (list "\n available" available head foot))
     available))
 
 (define-public (default-page-make-stencil
-                lines offsets layout scopes number last? )
+                lines offsets layout scopes number last?)
   "Construct a stencil representing the page from LINES.
 
  Offsets is a list of increasing numbers. They must be negated to
 create offsets.
  "
-  (let* ((topmargin  (ly:output-def-lookup layout 'topmargin))
+  (let* ((topmargin (ly:output-def-lookup layout 'topmargin))
        
        ;; TODO: naming vsize/hsize not analogous to TeX.
        
-       (vsize (ly:output-def-lookup layout 'vsize))
-       (hsize (ly:output-def-lookup layout 'hsize))
-
-       (system-separator-markup (ly:output-def-lookup layout 'systemSeparatorMarkup))
-       (system-separator-stencil (if (markup? system-separator-markup)
-                                    (interpret-markup layout
-                                                      (page-properties layout)
-                                                      system-separator-markup)
-                                    #f))
-       (lmargin (ly:output-def-lookup layout 'leftmargin))
-       (leftmargin (if lmargin
+        (vsize (ly:output-def-lookup layout 'vsize))
+        (hsize (ly:output-def-lookup layout 'hsize))
+
+        (system-separator-markup (ly:output-def-lookup layout 'systemSeparatorMarkup))
+        (system-separator-stencil (if (markup? system-separator-markup)
+                                      (interpret-markup layout
+                                                        (page-properties layout)
+                                                        system-separator-markup)
+                                      #f))
+        (lmargin (ly:output-def-lookup layout 'leftmargin))
+        (leftmargin (if lmargin
                       lmargin
                       (/ (- hsize
                             (ly:output-def-lookup layout 'linewidth)) 2)))
@@ -118,8 +118,7 @@ create offsets.
                      (set! page-stencil
                            (ly:stencil-add page-stencil
                                            (ly:stencil-translate-axis stencil
-                                            (- 0 head-height y topmargin) Y)
-                                           ))))
+                                            (- 0 head-height y topmargin) Y)))))
        (add-system (lambda (stencil-position)
                     (let*
                         ((system (car stencil-position))
@@ -128,7 +127,6 @@ create offsets.
                          (is-title (ly:paper-system-title?
                                     (car stencil-position))))
 
-                   
                       (add-to-page stencil y)
                       (if (and (ly:stencil? system-separator-stencil)
                                last-system
@@ -140,8 +138,7 @@ create offsets.
                                                 (- y
                                                    (cdr (ly:paper-system-staff-extents system))))))
                       (set! last-system system)
-                      (set! last-y y)
-                      ))))
+                      (set! last-y y)))))
 
     (if #f
        (display (list
@@ -163,19 +160,16 @@ create offsets.
 
     (ly:stencil-translate page-stencil (cons leftmargin 0))))
 
-
-
-
 ;;; optimal page breaking
 
 ;;; This is not optimal page breaking, this is optimal distribution of
 ;;; lines over pages; line breaks are a given.
 
-                                       ; TODO:
-                                       ;
-                                       ; - density scoring
-                                       ; - separate function for word-wrap style breaking?
-                                       ; - raggedbottom? raggedlastbottom? 
+;; TODO:
+;;
+;; - density scoring
+;; - separate function for word-wrap style breaking?
+;; - raggedbottom? raggedlastbottom? 
 
 (define-public (ly:optimal-page-breaks
                lines paper-book)
@@ -203,12 +197,12 @@ is what have collected so far, and has ascending page numbers."
        done))
 
   (define (combine-penalties force user best-paths)
-    (let* ((prev-force  (if (null? best-paths)
-                         0.0
-                         (node-force  (car best-paths))))
-        (prev-penalty (if (null? best-paths)
+    (let* ((prev-force (if (null? best-paths)
                           0.0
-                          (node-penalty (car best-paths))))
+                          (node-force (car best-paths))))
+          (prev-penalty (if (null? best-paths)
+                            0.0
+                            (node-penalty (car best-paths))))
         (inter-system-space (ly:output-def-lookup paper 'betweensystemspace))
         (force-equalization-factor 0.3)
         (relative-force (/ force inter-system-space))
@@ -222,21 +216,18 @@ is what have collected so far, and has ascending page numbers."
 
   (define (space-systems page-height lines ragged?)
     (let* ((inter-system-space
-         (ly:output-def-lookup paper 'betweensystemspace))
-        (system-vector (list->vector
-                        (append lines
-                                (if (= (length lines) 1)
-                                    '(#f)
-                                    '()))))
-
+           (ly:output-def-lookup paper 'betweensystemspace))
+          (system-vector (list->vector
+                          (append lines
+                                  (if (= (length lines) 1)
+                                      '(#f)
+                                      '()))))
         (staff-extents
          (list->vector
-          (append  (map
-                    ly:paper-system-staff-extents
-                    lines)
-                   (if (= (length lines) 1)
-                       '((0 .  0))
-                       '()))))
+          (append (map ly:paper-system-staff-extents lines)
+                  (if (= (length lines) 1)
+                      '((0 . 0))
+                      '()))))
         (real-extents
          (list->vector
           (append
@@ -249,7 +240,7 @@ is what have collected so far, and has ascending page numbers."
         (topskip (interval-end (vector-ref real-extents 0)))
         (space-left (- page-height
                        (apply + (map interval-length (vector->list real-extents)))))
-        
+
         (space (- page-height
                   topskip
                   (-  (interval-start (vector-ref real-extents (1- no-systems))))))
@@ -259,7 +250,7 @@ is what have collected so far, and has ascending page numbers."
          (lambda (idx)
            (let* ((this-system-ext (vector-ref staff-extents idx))
                 (next-system-ext (vector-ref staff-extents (1+ idx)))
-                (fixed (max 0  (- (+ (interval-end next-system-ext)
+                (fixed (max 0 (- (+ (interval-end next-system-ext)
                                      fixed-dist)
                                   (interval-start this-system-ext))))
                 (title1? (and (vector-ref system-vector idx)
@@ -361,15 +352,15 @@ CURRENT-BEST is the best result sofar, or #f."
                            force user-penalty
                           best-paths))
 
-          
+
            (better? (or
                      (not current-best)
                      (< total-penalty (node-penalty current-best))))
            (new-best (if better?
                         (make <optimally-broken-page-node>
-                          #:prev  (if (null? best-paths)
-                                      #f
-                                      (car best-paths))
+                          #:prev (if (null? best-paths)
+                                     #f
+                                     (car best-paths))
                           #:lines current-lines
                           #:pageno this-page-num
                           #:force force
@@ -401,7 +392,6 @@ CURRENT-BEST is the best result sofar, or #f."
           (walk-paths (cdr done-lines) (cdr best-paths)
                       (cons (car done-lines) current-lines)
                       last? new-best)
-         
          new-best)))
 
   (define (walk-lines done best-paths todo)
@@ -415,7 +405,7 @@ DONE."
               (last? (null? (cdr todo)))
               (next (walk-paths done best-paths (list this-line) last? #f)))
 
-                                       ;         (display "\n***************")
+         ;; (display "\n***************")
          (walk-lines (cons this-line done)
                      (cons next best-paths)
                      (cdr todo)))))
@@ -433,10 +423,8 @@ DONE."
                   "\nsystems " (map node-lines break-nodes)
                   "\npenalties " (map node-penalty break-nodes)
                   "\nconfigs " (map node-configuration break-nodes))))
-
-    
-                                       ; create stencils.
     
+    ;; create stencils.
     (map (lambda (node)
           ((ly:output-def-lookup paper 'page-make-stencil)
            (node-lines node)
@@ -446,5 +434,3 @@ DONE."
            (node-page-number node)
            (eq? node best-break-node)))
         break-nodes)))
-
-
index 9fa0c4f74db6533362c88d1721e67f7e80204634..5efd9ce0dd83821b6c9b6dd387cbef8f1f98b834 100644 (file)
@@ -24,7 +24,7 @@ page:last?, page:page-number-string and page:page-number
 
   (define (interpret-in-page-env potential-markup)
     (if (markup? potential-markup)
-       (let* ((alists  (map ly:module->alist scopes))
+       (let* ((alists (map ly:module->alist scopes))
               (prefixed-alists
                (map (lambda (alist)
                       (map (lambda (entry)
@@ -46,14 +46,14 @@ page:last?, page:page-number-string and page:page-number
                 (cons 'page:last? last?)
                 (cons 'page:page-number-string
                       (number->string page-number))
-                (cons 'page:page-number  page-number)))
+                (cons 'page:page-number page-number)))
               (props (append
                       (list pgnum-alist)
                       prefixed-alists
                       (page-properties layout))))
 
          (interpret-markup layout props potential-markup))
-       
+
        empty-stencil))
 
   (interpret-in-page-env
@@ -72,7 +72,7 @@ PROPS argument will include variables set in SCOPES (prefixed with
     (let ((x (ly:modules-lookup scopes sym)))
       (if (markup? x) x #f)))
 
-  (let* ((alists  (map ly:module->alist scopes))
+  (let* ((alists (map ly:module->alist scopes))
         (prefixed-alist
          (map (lambda (alist)
                 (map (lambda (entry)