From cc9fc745fc191006f51f2c8988fbc2748e6e141f Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Wed, 2 Feb 2005 22:30:46 +0000
Subject: [PATCH] * Documentation/user/changing-defaults.itely (Page layout):
 add doco about systemSeparatorMarkup.

* scm/page-layout.scm (default-page-make-stencil): add-to-page
function.
(default-page-make-stencil): insert system separators.

* scm/define-markup-commands.scm (hcenter): add
(beam): add.
---
 ChangeLog                                  | 16 +++++++
 Documentation/topdocs/NEWS.texi            |  4 ++
 Documentation/user/changing-defaults.itely | 16 +++++++
 input/regression/system-separator.ly       | 22 ++++++++++
 ly/paper-defaults.ly                       |  3 +-
 ly/titling-init.ly                         |  8 ++++
 scm/define-markup-commands.scm             | 28 +++++++++++-
 scm/lily-library.scm                       |  3 ++
 scm/output-ps.scm                          |  4 +-
 scm/page-layout.scm                        | 51 ++++++++++++++++------
 10 files changed, 135 insertions(+), 20 deletions(-)
 create mode 100644 input/regression/system-separator.ly

diff --git a/ChangeLog b/ChangeLog
index fe37a94b13..f8ca8ec8dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-02-02  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* Documentation/user/changing-defaults.itely (Page layout): add
+	doco about systemSeparatorMarkup.
+
+	* scm/page-layout.scm (default-page-make-stencil): add-to-page
+	function.
+	(default-page-make-stencil): insert system separators.
+
+	* scm/define-markup-commands.scm (hcenter): add
+	(beam): add.
+
+2005-02-01  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* scm/output-ps.scm (ez-ball): reinstate ez notation.
+
 2005-02-01  Jan Nieuwenhuizen  <janneke@gnu.org>
 
 	* lily/main.cc: Spell backend consistently.  Sort options.
diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi
index 04dac3947b..2c19948ea0 100644
--- a/Documentation/topdocs/NEWS.texi
+++ b/Documentation/topdocs/NEWS.texi
@@ -8,6 +8,10 @@
 
 @itemize @bullet
 
+@item
+Separator slashes may be inserted between systems in a score. See
+@file{input/regression/system-separator.ly} for an example. 
+
 @item
 Locations of errors in the input are now calculated more precisely.
 
diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely
index 94686aef34..a0ab14bff6 100644
--- a/Documentation/user/changing-defaults.itely
+++ b/Documentation/user/changing-defaults.itely
@@ -1914,6 +1914,22 @@ title of the next.
 Amount of space between consecutive titles (e.g., the title of the
 book and the title of a piece).
 
+@item systemSeparatorMarkup
+This contains a markup object, which will be inserted between
+systems. This is often used for orchestral scores.
+
+The markup command @code{\slashSeparator} is provided as a sensible
+default,  for example
+
+@lilypond[raggedright]
+\paper {
+  systemSeparatorMarkup = \slashSeparator
+}
+
+\relative { c1 \break c1 }
+@end lilypond
+
+
 @end table
 @end quotation
 
diff --git a/input/regression/system-separator.ly b/input/regression/system-separator.ly
new file mode 100644
index 0000000000..e48f316d36
--- /dev/null
+++ b/input/regression/system-separator.ly
@@ -0,0 +1,22 @@
+\header {
+
+  texidoc = "System separators maybe defined as markups in the
+@code{systemSeparator} field of the bookpaper block. They are centered
+between the boundary staffs of each system. "
+
+}
+
+\paper {
+  systemSeparatorMarkup = \slashSeparator
+
+}
+foobar = \relative { c1 c \break c c  \break c c }
+\book
+{
+  \score {
+     \new GrandStaff <<
+       \new Staff \foobar 
+       \new Staff \foobar 
+     >>
+  }
+}
diff --git a/ly/paper-defaults.ly b/ly/paper-defaults.ly
index e64ef6c8aa..e5d9ee8864 100644
--- a/ly/paper-defaults.ly
+++ b/ly/paper-defaults.ly
@@ -49,7 +49,6 @@
     beforetitlespace = 10 \mm
     betweentitlespace = 2 \mm
 
-
     raggedbottom = ##f
 
     %%
@@ -57,7 +56,7 @@
     %%
     raggedlastbottom= ##t
 
-    %% ugh.  Should use /etc/papersize and set explicitely for
+    %% ugh.  Should use /etc/papersize and set explicitly for
     %% documentation.
     papersizename = "a4"
 
diff --git a/ly/titling-init.ly b/ly/titling-init.ly
index a679ee687d..a41a24c633 100644
--- a/ly/titling-init.ly
+++ b/ly/titling-init.ly
@@ -1,3 +1,11 @@
+
+slashSeparator = \markup {
+    \hcenter
+    \vcenter \combine
+      \beam #2.0 #0.5 #0.48
+      \raise #0.7 \beam #2.0 #0.5 #0.48
+  }
+
 bookTitleMarkup = \markup {
 
   \column {
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index ebfcd540e5..07627ba770 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -332,11 +332,17 @@ of the @code{#'direction} layout property."
     (stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) cmols)))
 
 (def-markup-command (vcenter layout props arg) (markup?)
-  "Align @code{arg} to its center. "
+  "Align @code{arg} to its Y center. "
   (let* ((mol (interpret-markup layout props arg)))
     (ly:stencil-align-to! mol Y CENTER)
     mol))
 
+(def-markup-command (hcenter layout props arg) (markup?)
+  "Align @code{arg} to its X center. "
+  (let* ((mol (interpret-markup layout props arg)))
+    (ly:stencil-align-to! mol X CENTER)
+    mol))
+
 (def-markup-command (right-align layout props arg) (markup?)
   "Align @var{arg} on its right edge. "
   (let* ((m (interpret-markup layout props arg)))
@@ -562,6 +568,26 @@ that.
    (* -0.5 (chain-assoc-get 'baseline-skip props))
    Y))
 
+(def-markup-command (beam layout props width slope thickness) (number? number? number?)
+  "Create a beam with the specified parameters."
+
+  (let*
+      ((y (* slope width))
+       (yext (cons (min 0 y) (max 0 y)))
+       (half (/ thickness 2)))
+       
+    (ly:make-stencil
+     (list 'beam width
+	   slope
+	   thickness
+	   (ly:output-def-lookup layout 'blotdiameter))
+     (cons 0 width)
+     (cons (+ (- half) (car yext))
+	   (+ half (cdr yext))))
+
+    ))
+
+
 (def-markup-command (normal-size-sub layout props arg) (markup?)
   "Set @var{arg} in subscript, in a normal font size."
   (ly:stencil-translate-axis
diff --git a/scm/lily-library.scm b/scm/lily-library.scm
index 195196e732..5d5895a024 100644
--- a/scm/lily-library.scm
+++ b/scm/lily-library.scm
@@ -32,6 +32,9 @@
 (define-public (moment-min a b)
   (if (ly:moment<? a b) a b))
 
+(define-public (average x . lst)
+  (/ (+ x (apply + lst)) (1+ (length lst))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; lily specific variables.
 
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index 19193d4fc7..3b1e91c653 100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -163,9 +163,7 @@
    (ly:numbers->string (list letter-col ball-col))
    ;; FIXME: barf
    " /Helvetica-Bold "
-   " draw_ez_ball")
-  
-  "")
+   " draw_ez_ball"))
 
 ;; FIXME: use draw_round_box
 (define (filledbox breapth width depth height)
diff --git a/scm/page-layout.scm b/scm/page-layout.scm
index ac4283c7a1..f0dbf90324 100644
--- a/scm/page-layout.scm
+++ b/scm/page-layout.scm
@@ -79,7 +79,13 @@
        
        (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
@@ -97,24 +103,41 @@
 			(interval-length (ly:stencil-extent head Y))
 			0.0))
 
-       (line-stencils (map ly:paper-system-stencil lines))
        (height-proc (ly:output-def-lookup layout 'page-music-height))
 
        (page-stencil (ly:make-stencil '()
 				      (cons leftmargin hsize)
 				      (cons (- topmargin) 0)))
-       (was-title #t)
+       (last-system #f)
+       (last-y 0.0)
+       (add-to-page (lambda (stencil y)
+		      (set! page-stencil
+			    (ly:stencil-add page-stencil
+					    (ly:stencil-translate-axis stencil
+					     (- 0 head-height y topmargin) Y)
+					    ))))
        (add-system (lambda (stencil-position)
-		     (set! page-stencil
-			   (ly:stencil-add
-			    (ly:stencil-translate-axis
-			     (car stencil-position)
-			     (- 0
-				head-height
-				(cadr stencil-position)
-				topmargin)
-			     Y)
-			    page-stencil)))))
+		     (let*
+			 ((system (car stencil-position))
+			  (stencil (ly:paper-system-stencil system))
+			  (y (cadr stencil-position))
+			  (is-title (ly:paper-system-title?
+				     (car stencil-position))))
+
+		    
+		       (add-to-page stencil y)
+		       (if (and (ly:stencil? system-separator-stencil)
+				last-system
+				(not (ly:paper-system-title? system))
+				(not (ly:paper-system-title? last-system)))
+			   (add-to-page system-separator-stencil
+					(average (- last-y
+						    (car (ly:paper-system-staff-extents last-system)))
+						 (- y
+						    (cdr (ly:paper-system-staff-extents system))))))
+		       (set! last-system system)
+		       (set! last-y y)
+		       ))))
 
     (if #f
 	(display (list
@@ -123,7 +146,7 @@
     (set! page-stencil (ly:stencil-combine-at-edge
 			page-stencil Y DOWN head 0. 0.))
 
-    (map add-system (zip line-stencils offsets))
+    (map add-system (zip lines offsets))
     (if (ly:stencil? foot)
 	(set! page-stencil
 	      (ly:stencil-add
-- 
2.39.5