]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/page-layout.scm
* scm/page-layout.scm (plain-header): add printpagenumber boolean
[lilypond.git] / scm / page-layout.scm
index 6f56886465ea96e04f8f8b519ec00e468b2f4dae..3f9a9baa2ccc4922d7a2aa4edded8a9d38a0e378 100644 (file)
 (define-public (plain-header paper scopes page-number last?)
   "Standard header for a part: page number --outside--  and instrument--centered."
 
-  (let* ((props (page-properties paper) )
-        (pnum (markup #:bold (number->string page-number)))
+  (let* ((props (page-properties paper))
+        (pnum
+         (if (ly:output-def-lookup paper 'printpagenumber)
+             (markup #:bold (number->string page-number))
+             ""
+             ))
         (instr (ly:modules-lookup scopes 'instrument))
+        
         (line (list "" (if (markup? instr) instr "") pnum)))
 
     (if (even? page-number)
   "Construct a stencil representing the page from LINES.  "
   (let*
      ((top-margin  (ly:output-def-lookup paper 'top-margin))
-
+      
       ;; TODO: naming vsize/hsize not analogous to TeX.
       
       (hsize (ly:output-def-lookup paper 'hsize))
       (line-stencils (map ly:paper-system-stencil lines))
       (height-proc (ly:output-def-lookup paper 'page-music-height))
       (music-height (height-proc paper scopes number last?))
+      (ragged (ly:output-def-lookup paper 'raggedbottom))
+      (ragged-last   (ly:output-def-lookup paper 'raggedlastbottom))
+      (ragged-bottom (or (eq? #t ragged)
+                        (and last? (eq? #t ragged-last))))
+
       (spc-left (-  music-height
                   (apply + (map (lambda (x)
                                   (interval-length (ly:stencil-extent x Y)))
                        line-stencils))))
       (stretchable-lines (remove ly:paper-system-title? (cdr lines)))
-      (stretch (if (null? stretchable-lines)
+      (stretch (if (or (null? stretchable-lines)
+                      (> spc-left (/ music-height 2))
+                      ragged-bottom)
                   0.0
                   (/ spc-left (length stretchable-lines))))