]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' into lilypond/translation
authorFrancisco Vila <francisco.vila@hispalinux.es>
Sat, 5 Feb 2011 07:57:55 +0000 (08:57 +0100)
committerFrancisco Vila <francisco.vila@hispalinux.es>
Sat, 5 Feb 2011 07:57:55 +0000 (08:57 +0100)
Conflicts:
scripts/build/create-weblinks-itexi.py

83 files changed:
Documentation/GNUmakefile
Documentation/changes.tely
Documentation/de/notation/percussion.itely
Documentation/es/notation/percussion.itely
Documentation/essay.tely
Documentation/fr/notation/chords.itely
Documentation/notation/ancient.itely
Documentation/notation/percussion.itely
Documentation/pictures/pdf/GNUmakefile
Documentation/snippets/accordion-discant-symbols.ly
Documentation/snippets/adding-bar-lines-to-chordnames-context.ly
Documentation/snippets/adding-drum-parts.ly
Documentation/snippets/adding-indicators-to-staves-which-get-split-after-a-break.ly
Documentation/snippets/ancient-fonts.ly
Documentation/snippets/customizing-fretboard-fret-diagrams.ly
Documentation/snippets/demo-midiinstruments.ly
Documentation/snippets/hiding-the-extender-line-for-text-dynamics.ly
Documentation/snippets/hymn-template.ly
Documentation/snippets/jazz-combo-template.ly
Documentation/snippets/partcombine-and-autobeamoff.ly
Documentation/snippets/piano-template-with-melody-and-lyrics.ly
Documentation/snippets/removing-the-first-empty-line.ly
Documentation/web.texi
GNUmakefile.in
flower/include/interval.hh
input/regression/bar-extent.ly [new file with mode: 0644]
input/regression/drums.ly
input/regression/grid-lines.ly
input/regression/key-signature-space.ly [new file with mode: 0644]
input/regression/lyrics-bar.ly
input/regression/lyrics-melisma-beam.ly
input/regression/mensural-ligatures.ly
input/regression/musicxml/71e-TabStaves.xml
input/regression/no-header.ly [new file with mode: 0644]
input/regression/pdfmark-metadata.ly [new file with mode: 0644]
input/regression/tablature-negative-fret.ly [new file with mode: 0644]
lily/GNUmakefile
lily/bar-line.cc
lily/beam-quanting.cc
lily/beam.cc
lily/book-scheme.cc
lily/include/bar-line.hh
lily/include/beam-scoring-problem.hh [new file with mode: 0644]
lily/include/beam.hh
lily/include/slur-configuration.hh
lily/include/slur-scoring.hh
lily/include/span-bar.hh
lily/lexer.ll
lily/paper-book-scheme.cc
lily/part-combine-iterator.cc
lily/separation-item.cc
lily/slur-configuration.cc
lily/slur-scoring.cc
lily/span-bar.cc
lily/staff-symbol-engraver.cc
ly/GNUmakefile
ly/engraver-init.ly
make/ly-rules.make
make/website.make
ps/GNUmakefile
python/convertrules.py
scm/GNUmakefile
scm/define-context-properties.scm
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/define-markup-commands.scm
scm/define-music-types.scm
scm/display-lily.scm
scm/framework-ps.scm
scm/layout-beam.scm
scm/lily.scm
scm/markup.scm
scm/translation-functions.scm
scripts/auxiliar/build-coverage.sh
scripts/auxiliar/update-with-convert-ly.sh
scripts/build/create-weblinks-itexi.py
stepmake/aclocal.m4
stepmake/stepmake/documentation-vars.make
stepmake/stepmake/install-targets.make
stepmake/stepmake/makedir-vars.make
stepmake/stepmake/texinfo-targets.make
stepmake/stepmake/toplevel-targets.make
tex/GNUmakefile

index e061e629c836bf98e3cb1764c98069d62820746d..d4246294e5d7d2d3ab2c45602bee8cd9ca339324 100644 (file)
@@ -84,7 +84,7 @@ INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
 
 ifeq ($(out),www)
 INFO_IMAGES_DIR = lilypond
-DEST_INFO_IMAGES_SUBDIR = Documentation/
+DEST_INFO_IMAGES_SUBDIR = Documentation
 endif
 
 include $(depth)/make/stepmake.make
index c5ddc51b6314bbe6fbe47f10cc4efe5fc2e4579d..6b08879084d9a379abf2b58731f7602b573b58ea 100644 (file)
@@ -66,6 +66,34 @@ which scares away people.
 
 @end ignore
 
+@item
+Black mensural notation has minimal support.
+
+@item
+Support for obliqua shapes within white mensural ligatures enhanced.
+@lilypond
+\context MensuralStaff
+{
+  \clef "petrucci-c3"
+  \[
+    \override NoteHead #'style = #'semipetrucci
+    c'\maxima
+    \override NoteHead #'style = #'blackpetrucci
+    a\breve
+    \revert NoteHead #'style
+    \override NoteHead #'ligature-flexa = ##t
+    \override NoteHead #'flexa-width = #3
+    g
+    g'
+    \override NoteHead #'flexa-width = #5
+    c'
+    d'
+    \revert NoteHead #'style
+    c'\longa
+  \]
+}
+@end lilypond
+
 @item
 Compound time signatures are now supported by the @code{\compoundMeter} command,
 which can be used instead of @code{\time}:
index b734453ce5d1559a3ea2ee879ba691fcc68c463b..ea51521d584b28c0ce93ec15a669aef39bddf532 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes.
 @end ignore
 
-@c \version "2.13.36"
+@c \version "2.13.48"
 
 @c Translators: Till Paala
 
@@ -423,7 +423,7 @@ woodstaff = {
   \override Staff.StaffSymbol #'line-positions = #'(-2 3)
 
   % This is necessary; if not entered, the barline would be too short!
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
 }
 
 \new DrumStaff {
@@ -441,7 +441,7 @@ woodstaff = {
 @end lilypond
 
 In diesem Spezialfalls muss die Länge der Taktlinie mit
-@code{\override Staff.BarLine #'bar-size #number} angepasst werden.
+@code{\override Staff.BarLine #'bar-extent #'(von . zu)} angepasst werden.
 Andernfalls wäre sie zu kurz.  Die Position der beiden Linien muss
 auch definiert werden.
 
@@ -452,7 +452,7 @@ Tamburin, notiert mit @code{tamb}:
 
 tambustaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tambourine"
 }
 
@@ -478,7 +478,7 @@ Noten für Tam-Tam (notiert mit @code{tt}):
 
 tamtamstaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tamtam"
 }
 
@@ -502,7 +502,7 @@ Zwei Glocken, notiert mit @code{cb} (Kuhglocke) und @code{rb}
 bellstaff = {
   \override DrumStaff.StaffSymbol #'line-positions = #'(-2 3)
   \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Different Bells"
 }
 
index 4d025119c1f195cc365a5e91667fdaa856fd091d..ec440cce968813f96cdae0b8d2589292c284becc 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.13.36"
+@c \version "2.13.48"
 
 @node Percusión
 @section Percusión
@@ -432,7 +432,7 @@ woodstaff = {
   \override Staff.StaffSymbol #'line-positions = #'(-2 3)
 
   % This is necessary; if not entered, the barline would be too short!
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
 }
 
 \new DrumStaff {
@@ -450,7 +450,7 @@ woodstaff = {
 @end lilypond
 
 Observe que en este caso especial se debe alterar la longitud de la
-línea divisoria con @code{\override Staff.BarLine #'bar-size #number}.
+línea divisoria con @code{\override Staff.BarLine #'bar-extent #'(de . a)}.
 En caso contrario resulta demasiado corta.  También debe definir las
 posiciones de las dos líneas del pentagrama.  Para más información
 sobre estos delicados asuntos, consulte @ref{El símbolo del pentagrama}.
@@ -462,7 +462,7 @@ Una pandereta, escrita mediante @q{tamb} (@emph{tambourine}):
 
 tambustaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tambourine"
 }
 
@@ -489,7 +489,7 @@ Música para gong, introducida con @q{tt} (tam-tam):
 
 tamtamstaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tamtam"
 }
 
@@ -513,7 +513,7 @@ Dos campanas, introducidas con @q{cb} (@emph{cowbell}, cencerro) y
 bellstaff = {
   \override DrumStaff.StaffSymbol #'line-positions = #'(-2 3)
   \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Different Bells"
 }
 
index f934815de55bd835946cb38ab3607cd49ccf8323..bb6d7b9e4f00cf889d93e16b7d1c32cced1b5310 100644 (file)
@@ -26,7 +26,6 @@ Copyright @copyright{} 2002--2011 by the authors.
 @set FDL
 @include macros.itexi
 
-@afourpaper
 @c don't remove this comment.
 @ignore
 @omfcreator Han-Wen Nienhuys, Jan Nieuwenhuizen
index 5827142105b17afcf2bbf785d1aebcba17494ca4..7ecc9e5720aa0e7707150aa5c22ebe93251890f4 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.13.36"
+@c \version "2.13.48"
 
 @c Translators: Valentin Villenave
 @c Translation checkers: Jean-Charles Malahieude, John Mandereau
@@ -280,7 +280,7 @@ s'affichent correctement.
 
 @lilypond[ragged-right,verbatim]
 \new ChordNames \with {
-  \override BarLine #'bar-size = #4
+  \override BarLine #'bar-extent = #'(-2 . 2)
   \consists Bar_engraver
   \consists "Volta_engraver"
 }
index 71ab7bfb0913ee8f1012ec9cf47342cfa0113d85..1d6e871ed9cd8a692e0795e8d3b56a81afdcc60b 100644 (file)
@@ -499,12 +499,14 @@ petrucci style C clefs, for use on different staff lines
 @end lilypond
 
 @item
-petrucci style F clef
+petrucci style F clefs, for use on different staff lines
+(the example shows the 3rd staff line F clef)
 @tab
-@code{petrucci-f}
+@code{petrucci-f3}, @code{petrucci-f4},@*
+@code{petrucci-f5}
 @tab
 @lilypond[fragment,relative=1,notime]
-  \clef "petrucci-f"
+  \clef "petrucci-f3"
   \override NoteHead #'style = #'mensural
   c
 @end lilypond
@@ -631,9 +633,10 @@ Notation Reference:
 @ref{Time signature}.
 
 @knownissues
-Ratios of note durations do not change with the time signature.  For
+Ratios of note durations cannot change with the time signature,
+as those are not constant.  For
 example, the ratio of 1@tie{}breve = 3@tie{}semibreves
-(@emph{tempus perfectum}) must be made by hand, by setting
+(@emph{tempus perfectum}) can be made by hand, by setting
 
 @example
 breveTP = #(ly:make-duration -1 0 3 2)
@@ -658,12 +661,12 @@ For ancient notation, a note head style other than the
 @code{default} style may be chosen.  This is accomplished by setting
 the @code{style} property of the @code{NoteHead} object to
 @code{baroque}, @code{neomensural}, @code{mensural} or
-@code{petrucci}.
+@code{petrucci}, @code{blackpetrucci}, @code{semipetrucci}.
 
 The @code{baroque} style differs from the @code{default} style by:
 
 @itemize
-@item Providing a @code{maxima} notehead, and
+@item Providing a @code{maxima} note head, and
 @item Using a square shape for @code{\breve} note heads.
 @end itemize
 
@@ -676,6 +679,17 @@ and
 @item Centering the stems on the note heads.
 @end itemize
 
+The @code{blackpetrucci} style produces note heads usable in black
+mensural notation or coloratio sections in white mensural notation.
+Because note head style does not influence flag count, in
+this style a semiminima should be notated as @code{a8*2}, not
+@code{a4}, otherwise it will look like a minima.
+The multiplyer can be different if coloratio is used e.g. to notate
+triplets.
+
+Use @code{semipetrucci} style to draw half-colored
+note heads (breves, longas and maximas).
+
 
 The following example demonstrates the @code{petrucci} style:
 
@@ -687,7 +701,12 @@ The following example demonstrates the @code{petrucci} style:
 \autoBeamOff
 \override NoteHead #'style = #'petrucci
 a'\maxima a'\longa a'\breve a'1 a'2 a'4 a'8 a'16 a'
-
+\override NoteHead #'style = #'semipetrucci
+a'\breve*5/6
+\override NoteHead #'style = #'blackpetrucci
+a'8*4/3 a'
+\override NoteHead #'style = #'petrucci
+a'\longa
 @end lilypond
 
 
@@ -789,6 +808,13 @@ Snippets:
 @rlsr{Ancient notation}.
 
 
+@knownissues
+The glyph for the maxima rest in mensural style is actually a perfect
+longa rest; use two (or three) longa rests to print a maxima rest.
+Longa rests are not grouped automatically, so have to be done manually by
+using pitched rests.
+
+
 @node Mensural accidentals and key signatures
 @unnumberedsubsubsec Mensural accidentals and key signatures
 
@@ -910,6 +936,13 @@ that the full musical information of the ligature is known internally.
 This is not only required for correct MIDI output, but also allows for
 automatic transcription of the ligatures.
 
+At certain places two consecutive notes can be represented either as
+two squares or as an oblique parallelogram (flexa shape).  In such
+cases the default is the two squares, but a flexa can be required by
+setting the @code{ligature-flexa} property of the @emph{second} note
+head.  The length of a flexa can be set by the note head property
+@code{flexa-width}.
+
 For example,
 
 @c @example
@@ -928,11 +961,14 @@ For example,
   \transpose c c' {
     \set Score.timing = ##f
     \set Score.defaultBarType = "empty"
-    \override NoteHead #'style = #'neomensural
-    \override Staff.TimeSignature #'style = #'neomensural
+    \override NoteHead #'style = #'petrucci
+    \override Staff.TimeSignature #'style = #'mensural
     \clef "petrucci-g"
     \[ c'\maxima g \]
-    \[ d\longa c\breve f e d \]
+    \[ d\longa
+       \override NoteHead #'ligature-flexa = ##t
+       \once \override NoteHead #'flexa-width = #3.2
+       c\breve f e d \]
     \[ c'\maxima d'\longa \]
     \[ e'1 a g\breve \]
   }
@@ -954,11 +990,14 @@ to the following
 \transpose c c' {
   \set Score.timing = ##f
   \set Score.defaultBarType = "empty"
-  \override NoteHead #'style = #'neomensural
-  \override Staff.TimeSignature #'style = #'neomensural
+  \override NoteHead #'style = #'petrucci
+  \override Staff.TimeSignature #'style = #'mensural
   \clef "petrucci-g"
   \[ c'\maxima g \]
-  \[ d\longa c\breve f e d \]
+  \[ d\longa
+     \override NoteHead #'ligature-flexa = ##t
+     \once \override NoteHead #'flexa-width = #3.2
+     c\breve f e d \]
   \[ c'\maxima d'\longa \]
   \[ e'1 a g\breve \]
 }
@@ -974,7 +1013,7 @@ Notation Reference:
 
 @knownissues
 Horizontal spacing of ligatures is poor.
-
+Accidentals may collide with previous notes.
 
 @node Typesetting Gregorian chant
 @subsection Typesetting Gregorian chant
@@ -2636,7 +2675,7 @@ TBC
 @c Add example of white note heads:
 @c In the french baroque some composers used white note heads in slow pieces,
 @c mainly in 3/2-time.  A quarter looks there like a eighth with a white
-@c notehead.  (Franz-Rudolf Kuhnen)
+@c note head.  (Franz-Rudolf Kuhnen)
 
 @c TODO Add example of this:
 @c I was referring to e.g. notated a8. a16, which should, if I
index 9b4a80974f80a60d3ebee7ea8c5cdb861a02dd44..6e61eebffeb412f7e6318ed5a087cba9e986211f 100644 (file)
@@ -7,7 +7,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.13.36"
+@c \version "2.13.48"
 
 @node Percussion
 @section Percussion
@@ -415,7 +415,7 @@ woodstaff = {
   \override Staff.StaffSymbol #'line-positions = #'(-2 3)
 
   % This is necessary; if not entered, the barline would be too short!
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
 }
 
 \new DrumStaff {
@@ -433,7 +433,7 @@ woodstaff = {
 @end lilypond
 
 Note that in this special case the length of the barline must
-altered with @code{\override Staff.BarLine #'bar-size #number}.
+altered with @code{\override Staff.BarLine #'bar-extent #'(from . to)}.
 Otherwise it would be too short.  And you have also to define the
 positions of the two stafflines.  For more information about these
 delicate things have a look at @ref{Staff symbol}.
@@ -445,7 +445,7 @@ A tambourine, entered with @q{tamb}:
 
 tambustaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tambourine"
 }
 
@@ -471,7 +471,7 @@ Music for Tam-Tam (entered with @q{tt}):
 
 tamtamstaff = {
   \override Staff.StaffSymbol #'line-positions = #'( 0 )
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Tamtam"
 }
 
@@ -494,7 +494,7 @@ Two different bells, entered with @q{cb} (cowbell) and @q{rb} (ridebell)
 bellstaff = {
   \override DrumStaff.StaffSymbol #'line-positions = #'(-2 3)
   \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
-  \override Staff.BarLine #'bar-size = #3
+  \override Staff.BarLine #'bar-extent = #'(-1.5 . 1.5)
   \set DrumStaff.instrumentName = #"Different Bells"
 }
 
index e81f999cc1646c9b87f89b65dd49e24290cb31f7..72ac2bcc88a0dab64600b2501046f4022a2f01b7 100644 (file)
@@ -1,4 +1,4 @@
-depth = ../../../
+depth = ../../..
 
 PDF_FILES = $(call src-wildcard,*.pdf)
 
index a635246f7797517bc927bc9f2637acd74925ce6b..6e7b8a93e6dfa6f552d62314799f15ee6064d058 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "keyboards"
index c282b10a4aa12716c4e91e4d043b323434d8c6cc..de4753e9a94e9a7c933223a213baec6351ae6951 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.12.2"
+\version "2.13.48"
 
 \header {
   lsrtags = "chords"
@@ -33,7 +33,7 @@ To add bar line indications in the @code{ChordNames} context, add the
 } % begin verbatim
 
 \new ChordNames \with {
-  \override BarLine #'bar-size = #4
+  \override BarLine #'bar-extent = #'(-2 . 2)
   \consists "Bar_engraver"
 }
 \chordmode {
index cc6a0b50818b631fc9e1f140be71e45ee29f2f15..67a2fca5542da7b8e8af3afc6704d98efdeef5e5 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.12.2"
+\version "2.13.48"
 
 \header {
   lsrtags = "rhythms, percussion"
@@ -56,7 +56,7 @@ timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb }
     \new DrumStaff \with {
       drumStyleTable = #timbales-style
       \override StaffSymbol #'line-count = #2
-      \override BarLine #'bar-size = #2
+      \override BarLine #'bar-extent = #'(-1 . 1)
     } <<
       \set Staff.instrumentName = #"timbales"
       \timb
index 12aa2438bd6f3163ef6512f553eaf12e815268fd..5e63be0017ad9481bb0129648a85877305b92c21 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "staff-notation, vocal-music"
index 0b7353d8e3d0654e934fa06b7f1efb87beb8004b..f49af685de56913b188e4fe99ccaa0c42e2a0c09 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.12.2"
+\version "2.13.48"
 
 \header {
   lsrtags = "ancient-notation"
@@ -68,7 +68,7 @@ upperStaff = \new VaticanaStaff = "upperStaff" <<
       \override NoteHead #'style = #'vaticana.vupes
       g f
       \override NoteHead #'style = #'vaticana.linea.punctum
-      \once \override Staff.BarLine #'bar-size = #2.0 \bar "|"
+      \once \override Staff.BarLine #'bar-extent = #'(-1 . 1) \bar "|"
       % \break % 3 (8*1)
 
       es d
index ba420d982ffac607793fc67e183844163114f2dd..87425b4d754f7b4ca8c048b77bc8c6c6b29e3f36 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "fretted-strings, tweaks-and-overrides"
index cbfb0069e7c3e02095d167fc9b3ec9ccba7d3958..e5182b49796337d3e2737f1391c0d8ca918a58b7 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "midi"
index 58712c9127360ba570231adcbfe53a7f5e47d65a..503ee71f3745a1a683615870205824db2e6be72f 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "expressive-marks"
index 2924722cc6d9ffe57959b3015061d1740bd544d1..ea7e5ffd40ac9b4a56da94678945f42e1113544e 100644 (file)
@@ -15,6 +15,7 @@ añadir los versos como texto independiente debajo de la música.
 "
 
   doctitlees = "Plantilla para himnos"
+
 %%    Translation of GIT committish: ab9e3136d78bfaf15cc6d77ed1975d252c3fe506
 
   texidocde = "
index a6b60b4a719a52889aa2698ba6544bb7d1a4df10..03be98146bea28e5c08cc7aaa73820893dfa9e08 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "keyboards, percussion, fretted-strings, template"
index 65bf69ba0fd553894b882305ac36193b019de8a3..896dc823de746aa72c235a0b27799b91e0438c4d 100644 (file)
@@ -44,6 +44,7 @@ necesario hacer tres llamadas a @code{\\autoBeamOff}.
 
 "
   doctitlees = "Partcombine y autoBeamOff"
+
 %%   Translation of GIT committish: ab9e3136d78bfaf15cc6d77ed1975d252c3fe506
 
   texidocde = "
@@ -75,6 +76,7 @@ wenn man es mit @code{\\partcombine} verwendet, muss @code{\\autoBeamOff}
 "
 doctitlede = "Partcombine und autoBeamOff"
 
+
 %% Translation of GIT committish: e1a149d0cc60b02e86209387958f4028567dd366
   texidocfr = "
 Le fonction @code{@bs{}autoBeamOff} dans le cadre d'un
index 739547c72094518fa217fa2bc9f217812fb1fdff..4750199cbbca5f398fb876f7b58417322518ff65 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "vocal-music, keyboards, template"
index 662d6f315e14b4c9a3cb24932e4a3d143272f10b..5dcc10e436fcdd9fd6ad2b708d1dfc2bd48561cd 100644 (file)
@@ -1,7 +1,7 @@
 %% Do not edit this file; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.13.46"
+\version "2.13.48"
 
 \header {
   lsrtags = "staff-notation, tweaks-and-overrides, breaks"
index ce4de799ed77f66e0e87470637a99b79b0634004..90d9f79251a326c12c8dba68bdb9cc829ca48e5a 100644 (file)
@@ -23,7 +23,6 @@
 @include macros.itexi
 @include weblinks.itexi
 
-@afourpaper
 
 @c don't remove this comment.
 @ignore
index ca3d09938459cb80cd72e8b851ef6ca8dfbda97d..f8e1d15e7ca6a81516b41bbf3f0e5653c98fa3cd 100644 (file)
@@ -70,8 +70,8 @@ local-clean-ChangeLog:
 
 dist-toplevel-txt-files: top-doc
        -mkdir -p $(distdir)
-       ln $(TOPDOC_TXT_FILES) $(distdir)/
-       ln $(top-src-dir)/stepmake/aclocal.m4 $(distdir)/
+       ln $(TOPDOC_TXT_FILES) $(distdir)
+       ln $(top-src-dir)/stepmake/aclocal.m4 $(distdir)
 
 info:
        $(foreach d, $(INFO_DIRECTORIES),$(MAKE) -C $(d) out=www info && ) true
@@ -101,7 +101,7 @@ ifeq ($(out),www)
 # installed in non-recursing target from TOP-SRC-DIR
 install-WWW:
        -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
-       rsync -rl --exclude='*.signature' $(outdir)/offline-root/ $(DESTDIR)$(webdir)
+       rsync -rl --exclude='*.signature' $(outdir)/offline-root $(DESTDIR)$(webdir)
        $(MAKE) -C Documentation omf-local-install
 
 install-info-WWW:
@@ -210,7 +210,7 @@ $(tree-share-prefix)/mf-link-tree link-mf-tree: $(tree-share-prefix)/lilypond-fo
        rm -f $(tree-share-prefix)/fonts/type1/* &&  \
                cd $(tree-share-prefix)/fonts/otf && \
                ln -s ../../../../../../mf/$(outconfbase)/*.otf .
-       -cd $(tree-share-prefix)/fonts/ && \
+       -cd $(tree-share-prefix)/fonts && \
                ln -s ../../../../../mf/$(outconfbase)/fonts.conf .
        -cd $(tree-share-prefix)/fonts/svg && \
                ln -s ../../../../../../mf/$(outconfbase)/*.svg .
@@ -253,7 +253,7 @@ test:
        @echo
        @echo '        grep sourcefilename `grep -L systems.texi out/lybook-testdb/*/*log|sed s/log/ly/g`'
        @echo
-       $(MAKE) -C input/regression/ out=test local-test
+       $(MAKE) -C input/regression out=test local-test
        $(MAKE) -C input/regression/musicxml out=test local-test
        $(MAKE) -C input/regression/abc2ly out=test local-test
        $(MAKE) -C input/regression/lilypond-book out=test local-test
@@ -264,7 +264,7 @@ test-baseline:
        fi
        $(MAKE)
        $(MAKE) test
-       $(MAKE) out=test -C input/regression/ local-test-baseline
+       $(MAKE) out=test -C input/regression local-test-baseline
        $(MAKE) out=test -C input/regression/musicxml local-test-baseline
        $(MAKE) out=test -C input/regression/abc2ly local-test-baseline
        $(MAKE) out=test -C input/regression/lilypond-book local-test-baseline
@@ -274,7 +274,7 @@ test-baseline:
 local-check: test
        rm -rf $(RESULT_DIR)
        mkdir -p $(RESULT_DIR)
-       $(buildscript-dir)/output-distance --create-images --output-dir $(RESULT_DIR) input/regression/out-test-baseline input/regression/out-test/
+       $(buildscript-dir)/output-distance --create-images --output-dir $(RESULT_DIR) input/regression/out-test-baseline input/regression/out-test
        @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g'
 
 
@@ -286,7 +286,7 @@ test-redo:
        $(MAKE) check
 
 test-clean: test-snippets-clean
-       $(MAKE) -C input/regression/ out=test clean
+       $(MAKE) -C input/regression out=test clean
 
 snippets-clean:
        rm -rf out/lybook-db
index 9c831816c439661856fb240c07d61b4bdad03a96..be7074c242bec76dc2a599e4e9359e6ad9e73556 100644 (file)
@@ -68,6 +68,8 @@ struct Interval_t : public Drul_array<T>
     at (RIGHT) = max (at (RIGHT), p);
   }
   T length () const;
+
+  // Returns RIGHT - LEFT, even if the interval is empty.
   T delta () const;
   void set_empty ();
   void set_full ();
diff --git a/input/regression/bar-extent.ly b/input/regression/bar-extent.ly
new file mode 100644 (file)
index 0000000..825716f
--- /dev/null
@@ -0,0 +1,88 @@
+\header {
+   texidoc = "Bar line extent can be customised and the customised value
+   must be respected when staff symbol is changed temporarily (e.g. to
+   simulate ledger lines of renaissance prints and manuscripts);
+   moreover, span bars should not enter the staves."
+}
+
+
+\version "2.13.48"
+
+ledgerUp =
+{
+  s2
+  \stopStaff
+  \override Staff.StaffSymbol #'line-positions = #'(-4 -2 0 2 4 6)
+  \startStaff
+  s2
+  \noBreak
+  s2
+  \stopStaff
+  \revert Staff.StaffSymbol #'line-positions
+  \startStaff
+  s2
+}
+
+ledgerDown =
+{
+  s2
+  \stopStaff
+  \override Staff.StaffSymbol #'line-positions = #'(-6 -4 -2 0 2 4)
+  \startStaff
+  s1
+  \stopStaff
+  \revert Staff.StaffSymbol #'line-positions
+  \startStaff
+  s2
+}
+
+\new StaffGroup
+<<
+  \new Staff \with
+  {
+    \override BarLine #'bar-extent = #'(-1 . 1.5)
+  }
+  {
+    \ledgerUp \ledgerDown
+    s1*4
+    s1*4
+    \ledgerUp \ledgerDown
+    \ledgerUp \ledgerDown
+    \ledgerUp \ledgerDown
+    \ledgerUp \ledgerDown
+    s1*4
+    s1*4
+  }
+
+  \new Staff \with
+  {
+    \override BarLine #'bar-extent = #'(0 . 0)
+  }
+  {
+    s1*4
+    s1*4
+    \ledgerUp \ledgerDown
+    \ledgerUp \ledgerDown
+    \ledgerDown \ledgerUp
+    s1*4
+    s1*4
+    \ledgerUp \ledgerDown
+    \ledgerUp \ledgerDown
+  }
+
+  \new Staff \with
+  {
+    \override BarLine #'bar-extent = #'(-2 . 0)
+  }
+  {
+    s1*4
+    \ledgerUp \ledgerDown
+    s1*4
+    s1*4
+    s1*4
+    \ledgerUp \ledgerDown
+    \ledgerDown \ledgerUp
+    \ledgerUp \ledgerDown
+    \ledgerDown \ledgerUp
+  }
+>>
index ddc05e4d5ae0e49834c7ca77fabd079e49119c96..1c8ddd690c841c493a86f58cf43124a6e6c00f14 100644 (file)
@@ -7,7 +7,7 @@
 }
 
 
-\version "2.12.0"
+\version "2.13.48"
 
 drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh \repeat "unfold" 5 {hhc8 hho hhc8 hh16 hh} hhc4 r4 r2 }
 drl = \drummode {\repeat "unfold" 3 {bd4 sn8 bd bd4 << bd ss >> } bd8 tommh tommh bd toml toml bd tomfh16 tomfh }
@@ -19,7 +19,7 @@ timb = \drummode { \repeat "unfold" 2 {timh4 ssh timl8 ssh r timh r4 ssh8 timl r
       \new DrumStaff \with {
        drumStyleTable = #timbales-style
        \override StaffSymbol #'line-count = #2
-       \override BarLine #'bar-size = #2
+       \override BarLine #'bar-extent = #'(-1 . 1)
       } <<
        \set Staff.instrumentName = "timbales"
        \timb
index a25c77eb388f998aea515fa685c60b7252130921..b46139abf5841887fec3b6cf44cf8c3c36a3d7cb 100644 (file)
@@ -5,7 +5,7 @@
 staves synchronized with the notes."
 
 }
-\version "2.12.0"
+\version "2.13.48"
 
 skips =
 {
@@ -41,7 +41,7 @@ skips =
     \consists "Grid_point_engraver"
     \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4) 
     gridInterval = #(ly:make-moment 1 8)
-    \override BarLine #'bar-size = #0.05
+    \override BarLine #'bar-extent = #'(-0.025 . 0.025)
   }
   \context {
     \StaffGroup
diff --git a/input/regression/key-signature-space.ly b/input/regression/key-signature-space.ly
new file mode 100644 (file)
index 0000000..ce0d1c3
--- /dev/null
@@ -0,0 +1,19 @@
+\header {
+
+  texidoc = "Key signatures get the required amount of horizontal space."
+
+}
+\version "2.13.47"
+<<
+  \new Staff {
+    \voiceOne
+    \key f\minor
+    f'4 f' f' f'
+    \key b\major
+    e''8 e'' e''4 e''2
+  }
+  \new Staff {
+    R1 \bar "||"
+    R1
+  }
+>>
index f8b7d83575ad9f73d981d43b806c070e2f13638f..a5067687e9770b2b9063799873d606a91c5687c8 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.12.0"
+\version "2.13.48"
 
 \header{
 texidoc="
@@ -22,7 +22,7 @@ lyrics do not collide with barlines.
     \context Lyrics \with {
        \consists "Bar_engraver"
        \consists "Separating_line_group_engraver"
-       \override BarLine #'bar-size = #4 
+       \override BarLine #'bar-extent = #'(-2 . 2)
     } \lyricmode {
          looooooooooooooooooooooooooooooooooong1 syllable
       }
index 008bb69e7b216593cc54799477aa71319fea53e7..811acc80cae0ef82454e3a1898312092e3f39890 100644 (file)
@@ -1,7 +1,8 @@
 \version "2.12.0"
 \header
 {
-  texidoc = "Melismata are triggered by manual beams." 
+  texidoc = "Melismata are triggered by manual beams.  Notes in a
+  melisma take their natural spacing over a long syllable."
 }
 
   \layout { ragged-right = ##t }
@@ -13,9 +14,9 @@
   \new Staff
   \relative c'' {
     \set Staff.autoBeaming = ##f
-    c8 c8[ c8 c8]  c8    }
-  
-  \lyricsto "" \new Lyrics \lyricmode { bla bla bla }
+    g4 d8[ b8 d8 g8]  g4
+  }
+  \lyricsto "" \new Lyrics \lyricmode { bla blaa -- bla }
 >>
 
 
index 787cde444b80026db9ad4f5250a742670991608d..b34c6d1c9cfa5981bfd3c879dcfd647cafc1a700 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.12.0"
+\version "2.13.47"
 
 \header {
   texidoc = "Mensural ligatures show different shapes, depending on the
@@ -27,7 +27,7 @@
   #(set-accidental-style 'forget)
   \textLengthOn
 
-                               % ligaturae binaria
+% ligaturae binaria
 
   \[
     b\breve^\markup { \column { { \bold "ligaturae binaria" } "BL" } }
@@ -81,7 +81,7 @@
 
   \bar "|" \break
 
-                               % ligaturae ternariae, quaternariae, etc. (sicut in Apel[1])
+% ligaturae ternariae, quaternariae, etc. (sicut in Apel[1])
 
   \[
     b\breve^\markup {
 
   \bar "|" \break
 
-                               % examples from "dtv-Atlas zur Musik" [2]
+% examples from "dtv-Atlas zur Musik" [2]
 
   \[
     d'\breve^\markup { \column { { \bold "dtv-Atlas" } "BBL" } }
 
   \bar "|" \break
 
-                               % some ligatures from Ockeghem: Missa De plus en plus
+% some ligatures from Ockeghem: Missa De plus en plus
 
   \[
     c'\maxima^\markup {
     \]
 
   \[
-    b\longa^\markup { "LBBBBB" }
+    \override NoteHead #'style = #'blackpetrucci
+    b\longa^\markup { "LBBBBB." }
     c'\breve
     d'
     g
+    \once \override NoteHead #'ligature-flexa = ##t
     f
-    g
+    \revert NoteHead #'style
+    g\breve.
     \]
 
   \[
     \]
 
   \[
+    \override NoteHead #'style = #'blackpetrucci
     e'1^\markup { "SSB" }
     a
     g\breve
+    \revert NoteHead #'style
     \]
 
   \[
     e'
     \]
 
+  \[
+    \override NoteHead #'style = #'blackpetrucci
+    e'\longa^\markup { "LBB" }
+    f'\breve
+    \revert NoteHead #'style
+    e'
+    \]
+
+  \[
+    \override NoteHead #'style = #'blackpetrucci
+    b\breve^\markup { "BBBBBBL" }
+    g
+    \override NoteHead #'ligature-flexa = ##t
+    \override NoteHead #'flexa-width = #3
+    f
+    f'
+    \override NoteHead #'flexa-width = #5
+    b
+    c'
+    \revert NoteHead #'style
+    % though ligature-flexa is still ##t, this pair must be drawn as recta
+    b\longa
+    \revert NoteHead #'flexa-width
+    \revert NoteHead #'ligature-flexa
+    \]
+
   \bar "|" \break
 
-                               % some from the Requiem
+% some from the Requiem
 
   \[
     a1^\markup { \column { { \bold "Ockeghem: Requiem" } "SSBBBBBBBL" } }
     \]
 
   \bar "|" \break
+}
 
-                               % crazy ligatures
+\context Staff \with
+{
+  \override StaffSymbol #'line-count = #4
+}
+{
+  \clef "petrucci-c5"
+  \set Staff.printKeyCancellation = ##f
+  \cadenzaOn % turn off bar lines
+  #(set-accidental-style 'forget)
+  \textLengthOn
 
   \[
     c\breve^\markup { \column { { \bold "crazy ligatures" } "BBBBB" } }
   \[
     b^\markup { "B.B." }
     a
-    \] % TODO: dots within ligatures must be placed above heads
+    \] % TODO the first dot is too high to avoid a non-existent (ledger) line
 
   \bar "|" \break
 
-                               % invalid ligatures (those commented out are rejected with explanation)
+% invalid ligatures (those commented out are rejected with explanation)
 
-                               %  \[
-                               %    a1^\markup { \column { { \bold "invalid ligatures" } "SS" } }
-                               %    as
-                               %  \]
+%  \[
+%    a1^\markup { \column { { \bold "invalid ligatures" } "SS" } }
+%    as
+%  \]
 
   \[
     a\breve^\markup { "BBB" }
     as
     \]
 
-                               %  \[
-                               %    f\longa^\markup { "LLB" }
-                               %    g
-                               %    f\breve
-                               %  \]
+%  \[
+%    f\longa^\markup { "LLB" }
+%    g
+%    f\breve
+%  \]
 
-                               %  \[
-                               %    f\breve^\markup { "BSLB" }
-                               %    a1
-                               %    g\longa
-                               %    a\breve
-                               %  \]
+%  \[
+%    f\breve^\markup { "BSLB" }
+%    a1
+%    g\longa
+%    a\breve
+%  \]
 }
 
 
 % Litterae:
 %
 % [1] Willi Apel: The Notation of Polyphonic Music. 900-1600.
-% [2] Ulrich Michels: dtv-Altlas zur Musik, 1977.
+% [2] Ulrich Michels: dtv-Atlas zur Musik, 1977.
 %
index e63cf4b88176bea424eda176b9e504ab9464ae8d..79fc6131ee596fc4794be1e5e35755892ae342db 100644 (file)
@@ -4,8 +4,8 @@
 <score-partwise>
   <identification>
     <miscellaneous>
-      <miscellaneous-field name="description">Some tablature staves, with 
-          explicit fingering information and different string tunings given 
+      <miscellaneous-field name="description">Some tablature staves, with
+          explicit fingering information and different string tunings given
           in the MusicXML file.</miscellaneous-field>
     </miscellaneous>
   </identification>
       <note>
         <pitch>
           <step>D</step>
-          <octave>2</octave>
+          <octave>3</octave>
         </pitch>
         <duration>1</duration>
         <voice>1</voice>
         <notations>
           <technical>
             <string>5</string>
-            <fret>-7</fret>
+            <fret>5</fret>
           </technical>
         </notations>
       </note>
diff --git a/input/regression/no-header.ly b/input/regression/no-header.ly
new file mode 100644 (file)
index 0000000..faf2275
--- /dev/null
@@ -0,0 +1,6 @@
+\version "2.12.0"
+
+\markuplines \wordwrap-lines {
+  This regtest does not contain any header and paper blocks. Its purpose is to
+  test whether anything breaks if these blocks are absent.
+}
diff --git a/input/regression/pdfmark-metadata.ly b/input/regression/pdfmark-metadata.ly
new file mode 100644 (file)
index 0000000..16f47eb
--- /dev/null
@@ -0,0 +1,19 @@
+\version "2.13.47"
+
+\header {
+  texidoc = "The PDF backend uses several header fields to store metadata
+in the resulting PDF file. Header fields with the prefix pdf override
+those without the prefix for PDF creation (not for visual display on the page).
+"
+
+  title = \markup { \italic "Title of " \bold \concat {"the" " " \abs-fontsize #27 "piece"} }
+  subtitle = \markup { \concat { "Subtitle" " of" " the" " " \natural "piece" }}
+  composer = \markup { \bold \concat {"The" " " "Genius" " " "Composer"}}
+  pdfcomposer = "Composer used for PDF"
+  arranger = \markup { The Arranger \circle f \draw-circle #3 #0.5  ##t }
+  copyright = "The Copyright"
+  keywords = "pdfmark, metadata, DOCINFO, lilypond"
+}
+\layout { ragged-right= ##t }
+
+\relative c' { g4 }
diff --git a/input/regression/tablature-negative-fret.ly b/input/regression/tablature-negative-fret.ly
new file mode 100644 (file)
index 0000000..4974bdd
--- /dev/null
@@ -0,0 +1,32 @@
+\version "2.13.48"
+
+\header {
+
+  texidoc = "
+Negative fret numbers calculated due to assigning a string number
+can be displayed, ignored, or recalculated.  Here we should have
+all three cases demonstrated.
+"
+
+}
+
+myMusic = \relative c'  {
+  <c\1>1 ^\markup { recalculate }
+  \set TabStaff.handleNegativeFrets = #'include
+  <c\1>1 ^ \markup { include }
+  \set TabStaff.handleNegativeFrets = #'ignore
+  <c\1>1 ^ \markup { ignore }
+}
+
+\score {
+  <<
+    \new Staff {
+      \clef "treble_8"
+      \textLengthOn
+      \myMusic
+    }
+    \new TabStaff {
+      \myMusic
+    }
+  >>
+}
index f3fb922b53f34184794e7d0e0ff84a909db83c03..4056eefb938bf6de297735f2202a6d44f8802be2 100644 (file)
@@ -57,7 +57,7 @@ default:
 
 $(outdir)/libstdc++.a:
        rm -f $@
-       ln -s `$(CXX) -print-file-name=libstdc++.a` $(outdir)/
+       ln -s `$(CXX) -print-file-name=libstdc++.a` $(outdir)
 
 ifeq ($(LINK_GXX_STATICALLY),yes)
 $(outdir)/lilypond: $(outdir)/libstdc++.a
index d2c92be2a48847c309d24c6bf09d048eb68e2e4a..a2d6588726bb823c03075ca65dc35b663ecffaa3 100644 (file)
@@ -31,16 +31,12 @@ MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_extent, 1)
 SCM
 Bar_line::calc_bar_extent (SCM smob)
 {
+  Interval result;
   Grob *me = unsmob_grob (smob);
+  if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me))
+    result = staff->extent (staff, Y_AXIS);
 
-  SCM size = me->get_property ("bar-size");
-
-  if (!scm_is_number (size)
-      || !Staff_symbol_referencer::get_staff_symbol (me))
-    return ly_interval2scm (Interval ());
-
-  Real h = scm_to_double (size);
-  return ly_interval2scm (Interval (-h / 2, h / 2));
+  return ly_interval2scm (result);
 }
 
 Interval
@@ -65,22 +61,24 @@ Bar_line::print (SCM smob)
   Grob *me = unsmob_grob (smob);
 
   SCM s = me->get_property ("glyph-name");
-  SCM barsize = me->get_property ("bar-size");
+  SCM extent = me->get_property ("bar-extent");
 
-  if (scm_is_string (s) && scm_is_number (barsize))
+  if (scm_is_string (s) && is_number_pair (extent))
     {
       string str = ly_scm2string (s);
-      Real sz = robust_scm2double (barsize, 0);
-      if (sz <= 0)
-       return SCM_EOL;
+      Interval ex = ly_scm2interval (extent);
+      if (ex.length () > 0)
+       {
+         Stencil result = compound_barline (me, str, ex, false);
 
-      return compound_barline (me, str, sz, false).smobbed_copy ();
+         return result.smobbed_copy ();
+       }
     }
   return SCM_EOL;
 }
 
 Stencil
-Bar_line::compound_barline (Grob *me, string str, Real h,
+Bar_line::compound_barline (Grob *me, string str, Interval const &extent,
                            bool rounded)
 {
   Real kern = robust_scm2double (me->get_property ("kern"), 1);
@@ -96,8 +94,8 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
   hair *= staffline;
   fatline *= staffline;
 
-  Stencil thin = simple_barline (me, hair, h, rounded);
-  Stencil thick = simple_barline (me, fatline, h, rounded);
+  Stencil thin = simple_barline (me, hair, extent, rounded);
+  Stencil thick = simple_barline (me, fatline, extent, rounded);
   Stencil dot = Font_interface::get_default_font (me)->find_by_name ("dots.dot");
 
   int lines = Staff_symbol_referencer::line_count (me);
@@ -110,14 +108,8 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
   colon.add_stencil (dot);
   colon.translate_axis (-dist / 2, Y_AXIS);
 
+  Real const h = extent.length ();
   Stencil m;
-  Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
-  Real center = 0;
-  if (staff)
-    {
-      Interval staff_extent = staff->extent (staff, Y_AXIS);
-      center = staff_extent.center ();
-    }
 
   if (str == "||:")
     str = "|:";
@@ -127,20 +119,13 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
 
   if (str == "")
     {
-      Stencil empty = Lookup::blank (Box (Interval (0, 0), Interval (-h / 2, h / 2)));
-      empty.translate_axis (center, Y_AXIS);
+      Stencil empty = Lookup::blank (Box (Interval (0, 0), extent));
       return empty;
     }
   else if (str == "|")
-    {
-      thin.translate_axis (center, Y_AXIS);
-      return thin;
-    }
+    return thin;
   else if (str == ".")
-    {
-      thick.translate_axis (center, Y_AXIS);
-      return thick;
-    }
+    return thick;
   else if (str == "|." || (h == 0 && str == ":|"))
     {
       m.add_at_edge (X_AXIS, LEFT, thick, 0);
@@ -254,30 +239,47 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
     }
   else if (str == ":")
     {
-      int c = (Staff_symbol_referencer::line_count (me));
-
-      for (int i = 0; i < c - 1; i++)
+      if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me))
        {
-         Real y = (- (c - 1.0) / 2 + 0.5 + i) * staff_space;
-         Stencil d (dot);
-
-         d.translate_axis (y, Y_AXIS);
-         m.add_stencil (d);
+         Interval staff_extent = staff->extent (staff, Y_AXIS);
+
+         /*
+           assume staff lines are disposed equally at unit space;
+           put a dot into each space within extent (may extend staff_extent).
+
+           staff_extent is an interval of two integers or two half-integers;
+           in the former case dots are to be placed at half-integers,
+           in the latter at integers.
+
+           these integers are not exact due to staff line thickness.
+         */
+         int const pos = int (rint (staff_extent.at (UP) * 2));
+         Real const correction = pos & 1 ? 0.0 : 0.5;
+
+         for (int i = int (rint (extent.at (DOWN) + (0.5 - correction))),
+                e = int (rint (extent.at (UP) + (0.5 - correction)));
+              i < e;
+              ++i)
+           {
+             Stencil d (dot);
+
+             d.translate_axis (i + correction, Y_AXIS);
+             m.add_stencil (d);
+           }
        }
     }
   else if (str == "dashed")
-    m = dashed_bar_line (me, h, hair);
+    m = dashed_bar_line (me, extent, hair);
   else if (str == "'")
-    m = tick_bar_line (me, h, rounded);
+    m = tick_bar_line (me, extent.at (UP), rounded);
 
-  m.translate_axis (center, Y_AXIS);
   return m;
 }
 
 Stencil
 Bar_line::simple_barline (Grob *me,
                          Real w,
-                         Real h,
+                         Interval const &extent,
                          bool rounded)
 {
   Real blot
@@ -285,8 +287,7 @@ Bar_line::simple_barline (Grob *me,
     ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
     : 0.0;
 
-  return Lookup::round_filled_box (Box (Interval (0, w),
-                                       Interval (-h / 2, h / 2)), blot);
+  return Lookup::round_filled_box (Box (Interval (0, w), extent), blot);
 }
 
 Stencil
@@ -301,24 +302,11 @@ Bar_line::tick_bar_line (Grob *me, Real h, bool rounded)
     : 0.0;
 
   return Lookup::round_filled_box (Box (Interval (0, line_thick),
-                                       Interval (h / 2 - th, h / 2 + th)), blot);
-}
-
-MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1);
-SCM
-Bar_line::calc_bar_size (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me))
-    {
-      Interval staff_y = staff->extent (staff, Y_AXIS);
-      return scm_from_double (staff_y.is_empty () ? 0.0 : staff_y.length ());
-    }
-  return scm_from_int (0);
+                                       Interval (h - th, h + th)), blot);
 }
 
 Stencil
-Bar_line::dashed_bar_line (Grob *me, Real h, Real thick)
+Bar_line::dashed_bar_line (Grob *me, Interval const &extent, Real thick)
 {
   Real dash_size
     = 1.0 - robust_scm2double (me->get_property ("gap"), 0.3);
@@ -328,23 +316,30 @@ Bar_line::dashed_bar_line (Grob *me, Real h, Real thick)
     connections.
   */
   Real ss = Staff_symbol_referencer::staff_space (me);
-  int count = Staff_symbol_referencer::line_count (me);
-  Real line_thick = Staff_symbol_referencer::line_thickness (me);
+  Real const h = extent.length ();
+  int dashes = int (rint (h / ss));
 
-  if (fabs (line_thick + (count -1) * ss - h) < 0.1) // ugh.
+  /*
+    there are two concerns:
+    1. one dash plus one space should be one staff space
+    2. the line should begin and end with half a dash
+
+    both can be satisfied, if the extent is (roughly) an integer
+    multiple of staff space.
+  */
+  if (fabs (h / ss - dashes) < 0.1)
     {
       Real blot
        = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
 
-      Real half_space = ss / 2;
+      Real const half_dash = dash_size / 2;
       Stencil bar;
 
-      for (int i = (count - 1); i >= -(count - 1); i -= 2)
+      for (int i = 0; i <= dashes; ++i)
        {
-         Real top_y = min ((i + dash_size) * half_space,
-                           (count - 1) * half_space + line_thick / 2);
-         Real bot_y = max ((i - dash_size) * half_space,
-                           -(count - 1) * half_space - line_thick / 2);
+         Real top_y = extent.at (DOWN)
+           + (i == dashes ? h : (i + half_dash) * ss);
+         Real bot_y = extent.at (DOWN) + (i ? (i - half_dash) * ss : 0.0);
 
          bar.add_stencil (Lookup::round_filled_box (Box (Interval (0, thick),
                                                          Interval (bot_y, top_y)),
@@ -358,7 +353,6 @@ Bar_line::dashed_bar_line (Grob *me, Real h, Real thick)
        We have to scale the dashing so it starts and ends with half a
        dash exactly.
       */
-      int dashes = int (rint (h / ss));
       Real total_dash_size = h / dashes;
       Real factor = (dash_size - thick) / ss;
 
@@ -376,7 +370,7 @@ Bar_line::dashed_bar_line (Grob *me, Real h, Real thick)
       box.add_point (Offset (0, h));
 
       Stencil s (box, at);
-      s.translate (Offset (thick / 2, -h / 2));
+      s.translate (Offset (thick / 2, extent.at (DOWN)));
       return s;
     }
   return Stencil ();
@@ -462,6 +456,5 @@ ADD_INTERFACE (Bar_line,
               "thick-thickness "
               "glyph "
               "glyph-name "
-              "bar-size "
               "bar-extent "
               );
index 2ecf070d4009e5009213f4714307d0ab4b19f3a7..977e5755e0d8dfe38c0777721444642dc2659e73 100644 (file)
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "beam.hh"
+#include "beam-scoring-problem.hh"
 
+#include <queue>  
 #include <algorithm>
 using namespace std;
 
-#include "grob.hh"
 #include "align-interface.hh"
+#include "beam.hh"
+#include "grob.hh"
 #include "international.hh"
+#include "main.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
 #include "warn.hh"
-#include "main.hh"
 
 Real
 get_detail (SCM alist, SCM sym, Real def)
@@ -66,16 +68,47 @@ shrink_extra_weight (Real x, Real fac)
   return fabs (x) * ((x < 0) ? fac : 1.0);
 }
 
-struct Quant_score
+/****************************************************************/
+
+Beam_configuration::Beam_configuration ()
 {
-  Real yl;
-  Real yr;
-  Real demerits;
+  y = Interval (0.0, 0.0);
+  demerits = 0.0;
+  next_scorer_todo = ORIGINAL_DISTANCE;
+}
+
+bool Beam_configuration::done () const
+{
+  return next_scorer_todo >= NUM_SCORERS;
+}
+
+void Beam_configuration::add (Real demerit, const string &reason)
+{
+  demerits += demerit;
 
 #if DEBUG_BEAM_SCORING
-  string score_card_;
+  if (demerit) 
+    score_card_ += to_string (" %s %.2f", reason.c_str (), demerit);
 #endif
-};
+}
+  
+Beam_configuration* Beam_configuration::new_config (Interval start,
+                                                    Interval offset)
+{
+  Beam_configuration* qs = new Beam_configuration;
+  qs->y = Interval (int (start[LEFT]) + offset[LEFT],
+                    int (start[RIGHT]) + offset[RIGHT]);
+
+  // This orders the sequence so we try combinations closest to the
+  // the ideal offset first.
+  Real start_score = abs (offset[RIGHT]) + abs (offset[LEFT]);
+  qs->demerits = start_score / 1000.0;
+  qs->next_scorer_todo = ORIGINAL_DISTANCE + 1;
+  
+  return qs;
+}
+
+/****************************************************************/
 
 /*
   TODO:
@@ -87,17 +120,16 @@ struct Quant_score
   - Add demerits for quants per se, as to forbid a specific quant
   entirely
 */
-
 int
-best_quant_score_idx (vector<Quant_score> const &qscores)
+best_quant_score_idx (vector<Beam_configuration*> const &configs)
 {
   Real best = 1e6;
   int best_idx = -1;
-  for (vsize i = qscores.size (); i--;)
+  for (vsize i = configs.size (); i--;)
     {
-      if (qscores[i].demerits < best)
+      if (configs[i]->demerits < best)
        {
-         best = qscores [i].demerits;
+         best = configs [i]->demerits;
          best_idx = i;
        }
     }
@@ -105,262 +137,252 @@ best_quant_score_idx (vector<Quant_score> const &qscores)
   return best_idx;
 }
 
-MAKE_SCHEME_CALLBACK (Beam, quanting, 2);
-SCM
-Beam::quanting (SCM smob, SCM posns)
-{
-  Grob *me = unsmob_grob (smob);
-
-  Beam_quant_parameters parameters;
-  parameters.fill (me);
-
-  Real yl = scm_to_double (scm_car (posns));
-  Real yr = scm_to_double (scm_cdr (posns));
-
-  /*
-    Calculations are relative to a unit-scaled staff, i.e. the quants are
-    divided by the current staff_space.
-  */
-  Real ss = Staff_symbol_referencer::staff_space (me);
-  Real beam_thickness = Beam::get_beam_thickness (me) / ss;
-  Real slt = Staff_symbol_referencer::line_thickness (me) / ss;
-
-  Real dy_mus = robust_scm2double (me->get_property ("least-squares-dy"), 0);
-  Real straddle = 0.0;
-  Real sit = (beam_thickness - slt) / 2;
-  Real inter = 0.5;
-  Real hang = 1.0 - (beam_thickness - slt) / 2;
-  Real quants [] = {straddle, sit, inter, hang };
-
-  int num_quants = int (sizeof (quants) / sizeof (Real));
-  vector<Real> quantsl;
-  vector<Real> quantsr;
-
-  /*
-    going to REGION_SIZE == 2, yields another 0.6 second with
-    wtk1-fugue2.
-
-    (result indexes between 70 and 575)  ? --hwn.
-
-  */
-
-  /*
-    Do stem computations.  These depend on YL and YR linearly, so we can
-    precompute for every stem 2 factors.
-  */
-  vector<Grob*> stems
-    = extract_grob_array (me, "stems");
-  vector<Stem_info> stem_infos;
-  vector<Real> base_lengths;
-  vector<Real> stem_xposns;
+// This is a temporary hack to see how much we can gain by using a
+// priority queue on the beams to score.
+static int score_count = 0;
+LY_DEFINE (ly_beam_score_count, "ly:beam-score-count", 0, 0, 0,
+          (),
+          "count number of beam scores.") {
+  return scm_from_int (score_count);
+}
 
-  Drul_array<bool> dirs_found (0, 0);
-  Grob *common[2];
+void Beam_scoring_problem::init_stems ()
+{
+  extract_grob_set (beam, "stems", stems);
   for (int a = 2; a--;)
-    common[a] = common_refpoint_of_array (stems, me, Axis (a));
+    common[a] = common_refpoint_of_array (stems, beam, Axis (a));
 
-  Grob *fvs = first_normal_stem (me);
-  Grob *lvs = last_normal_stem (me);
-  Real xl = fvs ? fvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
-  Real xr = fvs ? lvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
-
-  /*
-    We store some info to quickly interpolate.  The stemlength are
-    affine linear in YL and YR. If YL == YR == 0, then we might have
-    stem_y != 0.0, when we're cross staff.
+  Grob *fvs = Beam::first_normal_stem (beam);
+  Grob *lvs = Beam::last_normal_stem (beam);
+    
+  x_span = Interval (fvs ? fvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0,
+                     lvs ? lvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0);
 
-  */
+  Drul_array<bool> dirs_found (0, 0);
   for (vsize i = 0; i < stems.size (); i++)
     {
       Grob *s = stems[i];
-
+      if (!Stem::is_normal_stem (s))
+        continue;
+      
       Stem_info si (Stem::get_stem_info (s));
-      si.scale (1 / ss);
+      si.scale (1 / staff_space);
       stem_infos.push_back (si);
-      dirs_found[stem_infos.back ().dir_] = true;
+      dirs_found[si.dir_] = true;
 
       bool f = to_boolean (s->get_property ("french-beaming"))
-       && s != lvs && s != fvs;
+        && s != lvs && s != fvs;
 
-      if (Stem::is_normal_stem (s))
-       {
-         base_lengths.push_back (calc_stem_y (me, s, common, xl, xr, CENTER, 
-                                              Interval (0, 0), f) / ss);
-       }
-      else
-       {
-         base_lengths.push_back (0);
-       }
-
-      stem_xposns.push_back (s->relative_coordinate (common[X_AXIS], X_AXIS));
+      Real y = Beam::calc_stem_y (beam, s, common, x_span[LEFT], x_span[RIGHT], CENTER, 
+                                  Interval (0, 0), f);
+      base_lengths.push_back (y / staff_space);
+      stem_xpositions.push_back (s->relative_coordinate (common[X_AXIS], X_AXIS));
+    }
+  
+  edge_dirs = Drul_array<Direction> (CENTER, CENTER);
+  if (stem_infos.size ())
+    {
+      edge_dirs = Drul_array<Direction> (stem_infos[0].dir_,
+                                         stem_infos.back().dir_);
     }
-  bool xstaff = Align_interface::has_interface (common[Y_AXIS]);
 
-  Direction ldir = Direction (stem_infos[0].dir_);
-  Direction rdir = Direction (stem_infos.back ().dir_);
-  bool is_knee = dirs_found[LEFT] && dirs_found[RIGHT];
+  is_xstaff = Align_interface::has_interface (common[Y_AXIS]);
+  is_knee = dirs_found[LEFT] && dirs_found[RIGHT];
+  
+  staff_radius = Staff_symbol_referencer::staff_radius (beam);
+  edge_beam_counts =  Drul_array<int>
+    (Stem::beam_multiplicity (stems[0]).length () + 1,
+     Stem::beam_multiplicity (stems.back ()).length () + 1);
+    
+  beam_translation = Beam::get_beam_translation (beam) / staff_space;
+}
+
+Beam_scoring_problem::Beam_scoring_problem (Grob *me, Drul_array<Real> ys)
+{
+  beam = me;
+  unquanted_y = ys;
+    
+  /*
+    Calculations are relative to a unit-scaled staff, i.e. the quants are
+    divided by the current staff_space.
+  */
+  staff_space = Staff_symbol_referencer::staff_space (me);
+  beam_thickness = Beam::get_beam_thickness (me) / staff_space;
+  line_thickness = Staff_symbol_referencer::line_thickness (me) / staff_space;
+
+  // This is the least-squares DY, corrected for concave beams.
+  musical_dy = robust_scm2double (me->get_property ("least-squares-dy"), 0);
 
+  parameters.fill (me);
+  init_stems ();
+}
+
+void
+Beam_scoring_problem::generate_quants (vector<Beam_configuration*> *scores) const
+{
   int region_size = (int) parameters.REGION_SIZE;
 
   /*
     Knees are harder, lets try some more possibilities for knees.
-  */
+  */  
   if (is_knee)
     region_size += 2;
+  
+  Real straddle = 0.0;
+  Real sit = (beam_thickness - line_thickness) / 2;
+  Real inter = 0.5;
+  Real hang = 1.0 - (beam_thickness - line_thickness) / 2;
+  Real base_quants [] = {straddle, sit, inter, hang};
+  int num_base_quants = int (sizeof (base_quants) / sizeof (Real));
 
   /*
     Asymetry ? should run to <= region_size ?
   */
+  vector<Real> unshifted_quants;
   for (int i = -region_size; i < region_size; i++)
-    for (int j = 0; j < num_quants; j++)
+    for (int j = 0; j < num_base_quants; j++)
       {
-       quantsl.push_back (i + quants[j] + int (yl));
-       quantsr.push_back (i + quants[j] + int (yr));
+        unshifted_quants.push_back (i + base_quants[j]);
       }
 
-  vector<Quant_score> qscores;
-
-  for (vsize l = 0; l < quantsl.size (); l++)
-    for (vsize r = 0; r < quantsr.size (); r++)
-      {
-       Quant_score qs;
-       qs.yl = quantsl[l];
-       qs.yr = quantsr[r];
-       qs.demerits = 0.0;
+  for (vsize i = 0; i < unshifted_quants.size (); i++)
+    for (vsize j = 0; j < unshifted_quants.size (); j++)
+      scores->push_back (Beam_configuration::new_config (unquanted_y,
+                                                         Interval (unshifted_quants[i],
+                                                                   unshifted_quants[j])));
+}
 
-       qscores.push_back (qs);
-      }
 
-  /* This is a longish function, but we don't separate this out into
-     neat modular separate subfunctions, as the subfunctions would be
-     called for many values of YL, YR. By precomputing various
-     parameters outside of the loop, we can save a lot of time. */
-  for (vsize i = qscores.size (); i--;)
+void Beam_scoring_problem::one_scorer (Beam_configuration* config) const
+{
+  score_count ++;
+  switch (config->next_scorer_todo) {
+  case SLOPES:
+    score_slopes_dy (config);
+    break;
+  case FORBIDDEN:
+    score_forbidden_quants (config);
+    break;
+  case STEM_LENGTHS:
+    score_stem_lengths (config);
+    break;
+   
+  case NUM_SCORERS:
+  case ORIGINAL_DISTANCE:
+  default:
+    assert (false);
+  }
+  config->next_scorer_todo++;
+}                                  
+
+
+Beam_configuration *
+Beam_scoring_problem::force_score (SCM inspect_quants, const vector<Beam_configuration*> &configs) const
+{
+  Drul_array<Real> ins = ly_scm2interval (inspect_quants);
+  Real mindist = 1e6;
+  Beam_configuration *best = NULL; 
+  for (vsize i = 0; i < configs.size (); i++)
     {
-      Real d = score_slopes_dy (qscores[i].yl, qscores[i].yr,
-                               dy_mus, yr- yl,
-                               xr - xl,
-                               xstaff, &parameters);
-      qscores[i].demerits += d;
-
-#if DEBUG_BEAM_SCORING
-      qscores[i].score_card_ += to_string ("S%.2f", d);
-#endif
+      Real d = fabs (configs[i]->y[LEFT]- ins[LEFT]) + fabs (configs[i]->y[RIGHT] - ins[RIGHT]);
+      if (d < mindist)
+        {
+          best = configs[i];
+          mindist = d;
+        }
     }
+  if (mindist > 1e5)
+    programming_error ("cannot find quant");
 
-  Real rad = Staff_symbol_referencer::staff_radius (me);
-  Drul_array<int> edge_beam_counts
-    (Stem::beam_multiplicity (stems[0]).length () + 1,
-     Stem::beam_multiplicity (stems.back ()).length () + 1);
-
-  Real beam_translation = get_beam_translation (me) / ss;
-
-  Real reasonable_score = (is_knee) ? 200000 : 100;
-  for (vsize i = qscores.size (); i--;)
-    if (qscores[i].demerits < reasonable_score)
-      {
-       Real d = score_forbidden_quants (qscores[i].yl, qscores[i].yr,
-                                        rad, slt, beam_thickness, beam_translation,
-                                        edge_beam_counts, ldir, rdir, &parameters);
-       qscores[i].demerits += d;
-
-#if DEBUG_BEAM_SCORING
-       qscores[i].score_card_ += to_string (" F %.2f", d);
-#endif
-      }
-
-  for (vsize i = qscores.size (); i--;)
-    if (qscores[i].demerits < reasonable_score)
-      {
-       Real d = score_stem_lengths (stems, stem_infos,
-                                    base_lengths, stem_xposns,
-                                    xl, xr,
-                                    is_knee,
-                                    qscores[i].yl, qscores[i].yr, &parameters);
-       qscores[i].demerits += d;
+  return best;
+}
 
-#if DEBUG_BEAM_SCORING
-       qscores[i].score_card_ += to_string (" L %.2f", d);
-#endif
-      }
+Drul_array<Real>
+Beam_scoring_problem::solve () const {
+  vector<Beam_configuration*> configs;
+  generate_quants (&configs);
 
-  int best_idx = best_quant_score_idx (qscores);
+  Beam_configuration *best = NULL;  
 
-#if DEBUG_BEAM_SCORING
-  SCM inspect_quants = me->get_property ("inspect-quants");
-  if (to_boolean (me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring")))
+  SCM inspect_quants = beam->get_property ("inspect-quants");
+  if (to_boolean (beam->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring")))
       && scm_is_pair (inspect_quants))
     {
-      Drul_array<Real> ins = ly_scm2interval (inspect_quants);
-
-      Real mindist = 1e6;
-      for (vsize i = 0; i < qscores.size (); i++)
-       {
-         Real d = fabs (qscores[i].yl- ins[LEFT]) + fabs (qscores[i].yr - ins[RIGHT]);
-         if (d < mindist)
-           {
-             best_idx = i;
-             mindist = d;
-           }
-       }
-      if (mindist > 1e5)
-       programming_error ("cannot find quant");
-    }
-#endif
-
-  Interval final_positions;
-  if (best_idx < 0)
-    {
-      warning (_ ("no feasible beam position"));
-      final_positions = Interval (0, 0);
+      best = force_score (inspect_quants, configs);
     }
   else
     {
-      final_positions = Drul_array<Real> (qscores[best_idx].yl,
-                                         qscores[best_idx].yr);
+      std::priority_queue<Beam_configuration*, std::vector<Beam_configuration*>,
+                          Beam_configuration_less> queue;
+      for (vsize i = 0; i < configs.size(); i++)
+        queue.push(configs[i]);
+
+
+      /*
+        TODO
+
+        It would be neat if we generated new configurations on the
+        fly, depending on the best complete score so far, eg.
+
+        if (best->done()) {
+          if (best->demerits < sqrt(queue.size())
+            break;
+          while (best->demerits > sqrt(queue.size()) {
+            generate and insert new configuration
+          }
+        }
+
+        that would allow us to do away with region_size altogether.
+      */
+      while (true) {
+        best = queue.top ();
+        if (best->done ())
+          break;
+
+        queue.pop ();
+        one_scorer (best);
+        queue.push (best);
+      }
     }
-  
+
+  Interval final_positions = best->y;
+
 #if DEBUG_BEAM_SCORING
-  if (best_idx >= 0
-      && to_boolean (me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring"))))
+  if (to_boolean (beam->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring"))))
     {
-      qscores[best_idx].score_card_ += to_string ("i%d", best_idx);
-
       // debug quanting
-      me->set_property ("quant-score",
-                       ly_string2scm (qscores[best_idx].score_card_));
+      int completed = 0;
+      for (vsize i = 0; i < configs.size (); i++)
+        {
+          if (configs[i]->done ())
+            completed++;
+        }
+
+      string card = best->score_card_ + to_string (" c%d/%d", completed, configs.size());
+      beam->set_property ("quant-score", ly_string2scm (card));
     }
 #endif
 
-  return ly_interval2scm (final_positions);
+  junk_pointers (configs);
+  return final_positions;
 }
 
-Real
-Beam::score_stem_lengths (vector<Grob*> const &stems,
-                         vector<Stem_info> const &stem_infos,
-                         vector<Real> const &base_stem_ys,
-                         vector<Real> const &stem_xs,
-                         Real xl, Real xr,
-                         bool knee,
-                         Real yl, Real yr,
-
-                         Beam_quant_parameters const *parameters)
+void
+Beam_scoring_problem::score_stem_lengths (Beam_configuration* config) const
 {
-  Real limit_penalty = parameters->STEM_LENGTH_LIMIT_PENALTY;
+  Real limit_penalty = parameters.STEM_LENGTH_LIMIT_PENALTY;
   Drul_array<Real> score (0, 0);
   Drul_array<int> count (0, 0);
 
-  for (vsize i = 0; i < stems.size (); i++)
+  for (vsize i = 0; i < stem_xpositions.size (); i++)
     {
-      Grob *s = stems[i];
-      if (!Stem::is_normal_stem (s))
-       continue;
-
-      Real x = stem_xs[i];
-      Real dx = xr - xl;
-      Real beam_y = dx ? yr * (x - xl) / dx + yl * (xr - x) / dx : (yr + yl) / 2;
-      Real current_y = beam_y + base_stem_ys[i];
-      Real length_pen = parameters->STEM_LENGTH_DEMERIT_FACTOR;
+      Real x = stem_xpositions[i];
+      Real dx = x_span.delta ();
+      Real beam_y = dx
+        ? config->y[RIGHT] * (x - x_span[LEFT]) / dx + config->y[LEFT] * (x_span[RIGHT] - x) / dx
+        : (config->y[RIGHT] + config->y[LEFT]) / 2;
+      Real current_y = beam_y + base_lengths[i];
+      Real length_pen = parameters.STEM_LENGTH_DEMERIT_FACTOR;
 
       Stem_info info = stem_infos[i];
       Direction d = info.dir_;
@@ -373,33 +395,29 @@ Beam::score_stem_lengths (vector<Grob*> const &stems,
       /* We introduce a power, to make the scoring strictly
          convex. Otherwise a symmetric knee beam (up/down/up/down)
          does not have an optimum in the middle. */
-      if (knee)
+      if (is_knee)
        ideal_score = pow (ideal_score, 1.1);
 
       score[d] += length_pen * ideal_score;
-
       count[d]++;
     }
 
+  /* Divide by number of stems, to make the measure scale-free. */
   Direction d = DOWN;
   do
     score[d] /= max (count[d], 1);
   while (flip (&d) != DOWN);
 
-  return score[LEFT] + score[RIGHT];
+  config->add (score[LEFT] + score[RIGHT], "L");
 }
 
-Real
-Beam::score_slopes_dy (Real yl, Real yr,
-                      Real dy_mus, Real dy_damp,
-                      Real dx,
-                      bool xstaff,
-
-                      Beam_quant_parameters const *parameters)
+void
+Beam_scoring_problem::score_slopes_dy (Beam_configuration *config) const
 {
-  Real dy = yr - yl;
+  Real dy = config->y.delta ();
+  Real damped_dy = unquanted_y.delta();
   Real dem = 0.0;
-
+  
   /*
     DAMPING_DIRECTION_PENALTY is a very harsh measure, while for
     complex beaming patterns, horizontal is often a good choice.
@@ -407,34 +425,34 @@ Beam::score_slopes_dy (Real yl, Real yr,
     TODO: find a way to incorporate the complexity of the beam in this
     penalty.
   */
-  if (sign (dy_damp) != sign (dy))
+  if (sign (damped_dy) != sign (dy))
     {
       if (!dy)
        {
-         if (fabs (dy_damp / dx) > parameters->ROUND_TO_ZERO_SLOPE)
-           dem += parameters->DAMPING_DIRECTION_PENALTY;
+         if (fabs (damped_dy / x_span.delta ()) > parameters.ROUND_TO_ZERO_SLOPE)
+           dem += parameters.DAMPING_DIRECTION_PENALTY;
          else
-           dem += parameters->HINT_DIRECTION_PENALTY;
+           dem += parameters.HINT_DIRECTION_PENALTY;
        }
       else
-       dem += parameters->DAMPING_DIRECTION_PENALTY;
+       dem += parameters.DAMPING_DIRECTION_PENALTY;
     }
   
-  dem += parameters->MUSICAL_DIRECTION_FACTOR
-    * max (0.0, (fabs (dy) - fabs (dy_mus)));
+  dem += parameters.MUSICAL_DIRECTION_FACTOR
+    * max (0.0, (fabs (dy) - fabs (musical_dy)));
 
-  Real slope_penalty = parameters->IDEAL_SLOPE_FACTOR;
+  Real slope_penalty = parameters.IDEAL_SLOPE_FACTOR;
 
   /* Xstaff beams tend to use extreme slopes to get short stems. We
      put in a penalty here. */
-  if (xstaff)
+  if (is_xstaff)
     slope_penalty *= 10;
 
   /* Huh, why would a too steep beam be better than a too flat one ? */
-  dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy), 1.5)
+  dem += shrink_extra_weight (fabs (damped_dy) - fabs (dy), 1.5)
     * slope_penalty;
 
-  return dem;
+  config->add (dem, "S");
 }
 
 static Real
@@ -448,31 +466,23 @@ my_modf (Real x)
   because for 32nd and 64th beams the forbidden quants are relatively
   more important than stem lengths.
 */
-Real
-Beam::score_forbidden_quants (Real yl, Real yr,
-                             Real radius,
-                             Real slt,
-                             Real beam_thickness, Real beam_translation,
-                             Drul_array<int> beam_counts,
-                             Direction ldir, Direction rdir,
-
-                             Beam_quant_parameters const *parameters)
+void
+Beam_scoring_problem::score_forbidden_quants (Beam_configuration *config) const
 {
-  Real dy = yr - yl;
-  Drul_array<Real> y (yl, yr);
-  Drul_array<Direction> dirs (ldir, rdir);
+  Real dy = config->y.delta ();
 
-  Real extra_demerit = parameters->SECONDARY_BEAM_DEMERIT / (max (beam_counts[LEFT], beam_counts[RIGHT]));
+  Real extra_demerit = parameters.SECONDARY_BEAM_DEMERIT /
+    max (edge_beam_counts[LEFT], edge_beam_counts[RIGHT]);
 
   Direction d = LEFT;
   Real dem = 0.0;
-  Real eps = parameters->BEAM_EPS;
+  Real eps = parameters.BEAM_EPS;
 
   do
     {
-      for (int j = 1; j <= beam_counts[d]; j++)
+      for (int j = 1; j <= edge_beam_counts[d]; j++)
        {
-         Direction stem_dir = dirs[d];
+         Direction stem_dir = edge_dirs[d];
 
          /*
            The 2.2 factor is to provide a little leniency for
@@ -480,15 +490,15 @@ Beam::score_forbidden_quants (Real yl, Real yr,
            will be in the gap of the (2, sit) quant, leading to a
            false demerit.
          */
-         Real gap1 = y[d] - stem_dir * ((j - 1) * beam_translation + beam_thickness / 2 - slt / 2.2);
-         Real gap2 = y[d] - stem_dir * (j * beam_translation - beam_thickness / 2 + slt / 2.2);
+         Real gap1 = config->y[d] - stem_dir * ((j - 1) * beam_translation + beam_thickness / 2 - line_thickness / 2.2);
+         Real gap2 = config->y[d] - stem_dir * (j * beam_translation - beam_thickness / 2 + line_thickness / 2.2);
 
          Interval gap;
          gap.add_point (gap1);
          gap.add_point (gap2);
 
-         for (Real k = -radius;
-              k <= radius + eps; k += 1.0)
+         for (Real k = -staff_radius;
+              k <= staff_radius + eps; k += 1.0)
            if (gap.contains (k))
              {
                Real dist = min (fabs (gap[UP] - k), fabs (gap[DOWN] - k));
@@ -506,43 +516,45 @@ Beam::score_forbidden_quants (Real yl, Real yr,
     }
   while ((flip (&d)) != LEFT);
 
-  if (max (beam_counts[LEFT], beam_counts[RIGHT]) >= 2)
+  if (max (edge_beam_counts[LEFT], edge_beam_counts[RIGHT]) >= 2)
     {
       Real straddle = 0.0;
-      Real sit = (beam_thickness - slt) / 2;
+      Real sit = (beam_thickness - line_thickness) / 2;
       Real inter = 0.5;
-      Real hang = 1.0 - (beam_thickness - slt) / 2;
+      Real hang = 1.0 - (beam_thickness - line_thickness) / 2;
 
       Direction d = LEFT;
       do
        {
-         if (beam_counts[d] >= 2
-             && fabs (y[d] - dirs[d] * beam_translation) < radius + inter)
+         if (edge_beam_counts[d] >= 2
+             && fabs (config->y[d] - edge_dirs[d] * beam_translation) < staff_radius + inter)
            {
-             if (dirs[d] == UP && dy <= eps
-                 && fabs (my_modf (y[d]) - sit) < eps)
+              // TODO up/down symmetry.
+             if (edge_dirs[d] == UP && dy <= eps
+                 && fabs (my_modf (config->y[d]) - sit) < eps)
                dem += extra_demerit;
 
-             if (dirs[d] == DOWN && dy >= eps
-                 && fabs (my_modf (y[d]) - hang) < eps)
+             if (edge_dirs[d] == DOWN && dy >= eps
+                 && fabs (my_modf (config->y[d]) - hang) < eps)
                dem += extra_demerit;
            }
 
-         if (beam_counts[d] >= 3
-             && fabs (y[d] - 2 * dirs[d] * beam_translation) < radius + inter)
+         if (edge_beam_counts[d] >= 3
+             && fabs (config->y[d] - 2 * edge_dirs[d] * beam_translation) < staff_radius + inter)
            {
-             if (dirs[d] == UP && dy <= eps
-                 && fabs (my_modf (y[d]) - straddle) < eps)
+              // TODO up/down symmetry.
+             if (edge_dirs[d] == UP && dy <= eps
+                 && fabs (my_modf (config->y[d]) - straddle) < eps)
                dem += extra_demerit;
 
-             if (dirs[d] == DOWN && dy >= eps
-                 && fabs (my_modf (y[d]) - straddle) < eps)
+             if (edge_dirs[d] == DOWN && dy >= eps
+                 && fabs (my_modf (config->y[d]) - straddle) < eps)
                dem += extra_demerit;
            }
        }
       while (flip (&d) != LEFT);
     }
 
-  return dem;
+  config->add (dem, "F");
 }
 
index 3197c7d29fb425572f2d2fac88ad4a7801238e46..d31e570186dca277a527ea687262d1abe45dced1 100644 (file)
 
 #include "beam.hh"
 
+#include "beam-scoring-problem.hh"
 #include "beaming-pattern.hh"
 #include "directional-element-interface.hh"
-#include "main.hh"
+#include "grob-array.hh"
 #include "international.hh"
 #include "interval-set.hh"
 #include "item.hh"
 #include "least-squares.hh"
 #include "lookup.hh"
+#include "main.hh"
 #include "misc.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
@@ -52,7 +54,6 @@
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
 #include "warn.hh"
-#include "grob-array.hh"
 
 #if DEBUG_BEAM_SCORING
 #include "text-interface.hh" // debug output.
@@ -1144,7 +1145,6 @@ Beam::slope_damping (SCM smob, SCM posns)
   if (normal_stem_count (me) <= 1)
     return posns;
 
-
   SCM s = me->get_property ("damping");
   Real damping = scm_to_double (s);
   Real concaveness = robust_scm2double (me->get_property ("concaveness"), 0.0);
@@ -1186,6 +1186,21 @@ Beam::slope_damping (SCM smob, SCM posns)
   return ly_interval2scm (pos);
 }
 
+
+MAKE_SCHEME_CALLBACK (Beam, quanting, 2);
+SCM
+Beam::quanting (SCM smob, SCM posns)
+{
+  Grob *me = unsmob_grob (smob);
+  Drul_array<Real> ys(0, 0);
+  ys = robust_scm2drul (posns, ys);
+  Beam_scoring_problem problem (me, ys);
+
+  ys = problem.solve ();
+  return ly_interval2scm (ys);
+}
+
+
 /*
   Report slice containing the numbers that are both in (car BEAMING)
   and (cdr BEAMING)
index 55529de79c9839f2b67f5a40faa6157b4f1f04e9..339e2c282930e6c2c892c7c54f776844af354f35 100644 (file)
@@ -148,6 +148,15 @@ LY_DEFINE (ly_book_paper, "ly:book-paper",
   return b->paper_ ? b->paper_->self_scm () : SCM_BOOL_F;
 }
 
+LY_DEFINE (ly_book_header, "ly:book-header",
+          1, 0, 0, (SCM book),
+          "Return header in @var{book}.")
+{
+  LY_ASSERT_SMOB (Book, book, 1);
+  Book *b = unsmob_book (book);
+  return b->header_ ? b->header_ : SCM_BOOL_F;
+}
+
 LY_DEFINE (ly_book_scores, "ly:book-scores",
           1, 0, 0, (SCM book),
           "Return scores in @var{book}.")
index 1a895724f3f63692f96d28603b6fd86ee72e5262..442fe27770759131ac37c392b769dde4607537d3 100644 (file)
@@ -28,15 +28,16 @@ class Bar_line
 public:
   DECLARE_GROB_INTERFACE();
 
-  static Stencil dashed_bar_line (Grob *me, Real h, Real thick);
+  static Stencil dashed_bar_line (Grob *me, Interval const &extent, Real thick);
   static Stencil tick_bar_line (Grob *me, Real h, bool rounded);
-  static Stencil compound_barline (Grob *, string, Real height, bool rounded);
-  static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
+  static Stencil compound_barline (Grob *, string, Interval const &extent,
+                                  bool rounded);
+  static Stencil simple_barline (Grob *, Real wid, Interval const &extent,
+                                bool rounded);
   static Interval bar_y_extent (Grob *, Grob *);
   static bool non_empty_barline (Grob *me);
 
   DECLARE_SCHEME_CALLBACK (calc_bar_extent, (SCM));
-  DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_anchor, (SCM));
 };
diff --git a/lily/include/beam-scoring-problem.hh b/lily/include/beam-scoring-problem.hh
new file mode 100644 (file)
index 0000000..755fb38
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+  This file is part of LilyPond, the GNU music typesetter.
+
+  Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Jan Nieuwenhuizen <janneke@gnu.org>
+
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BEAM_SCORING_PROBLEM_HH
+#define BEAM_SCORING_PROBLEM_HH
+
+#include "interval.hh"
+#include "lily-proto.hh" 
+#include "lily-guile.hh" 
+#include "std-vector.hh" 
+#include "stem-info.hh" 
+#include "main.hh"  //  DEBUG_BEAM_SCORING
+
+enum Scorers {
+  // Should be ordered by increasing expensiveness.
+  ORIGINAL_DISTANCE,
+  SLOPES,
+  FORBIDDEN,
+  STEM_LENGTHS,
+  NUM_SCORERS,
+};
+
+struct Beam_configuration
+{
+  Interval y;
+  Real demerits;
+#if DEBUG_BEAM_SCORING
+  string score_card_;
+#endif
+
+  int next_scorer_todo;
+
+  Beam_configuration ();
+  bool done () const;
+  void add (Real demerit, const string &reason);
+  static Beam_configuration* new_config(Interval start,
+                                        Interval offset);
+};
+
+// Comparator for a queue of Beam_configuration*.
+class Beam_configuration_less
+{
+public:
+  bool operator() (Beam_configuration* const& l, Beam_configuration* const& r)
+  {
+    // Invert
+    return l->demerits > r->demerits;
+  }
+};
+
+
+struct Beam_quant_parameters
+{
+  Real SECONDARY_BEAM_DEMERIT;
+  Real STEM_LENGTH_DEMERIT_FACTOR;
+  Real REGION_SIZE;
+
+  /*
+    threshold to combat rounding errors.
+  */
+  Real BEAM_EPS;
+
+  // possibly ridiculous, but too short stems just won't do
+  Real STEM_LENGTH_LIMIT_PENALTY;
+  Real DAMPING_DIRECTION_PENALTY;
+  Real MUSICAL_DIRECTION_FACTOR;
+  Real HINT_DIRECTION_PENALTY;
+  Real IDEAL_SLOPE_FACTOR;
+  Real ROUND_TO_ZERO_SLOPE;
+
+  void fill (Grob *him);
+};
+
+
+
+/*
+  Parameters for a single beam.  Precomputed to save time in
+  scoring individual configurations.
+
+  TODO - use trailing _ on data members.
+  */
+class Beam_scoring_problem
+{
+public:
+  Beam_scoring_problem (Grob *me, Drul_array<Real> ys);
+  Drul_array<Real> solve() const;
+
+private:
+  Grob *beam;
+
+  Interval unquanted_y;
+  
+  Real staff_space;
+  Real beam_thickness;
+  Real line_thickness;
+  Real musical_dy;
+
+  Interval x_span;
+  
+  vector<Stem_info> stem_infos;
+
+  /*
+    Do stem computations.  These depend on YL and YR linearly, so we can
+    precompute for every stem 2 factors.
+
+    We store some info to quickly interpolate.  The stemlengths are
+    affine linear in YL and YR. If YL == YR == 0, then we might have
+    stem_y != 0.0, when we're cross staff.
+  */
+  vector<Real> base_lengths;
+  vector<Real> stem_xpositions;
+  
+  Grob *common[2];
+  bool is_xstaff;
+  bool is_knee;
+
+  Beam_quant_parameters parameters;
+
+  Real staff_radius;
+  Drul_array<int> edge_beam_counts;
+  Drul_array<Direction> edge_dirs;
+  Real beam_translation;
+
+  void init_stems ();
+
+  void one_scorer (Beam_configuration* config) const;
+  Beam_configuration *force_score (SCM inspect_quants,
+                                   const vector<Beam_configuration*> &configs) const;
+
+  // Scoring functions:
+  void score_forbidden_quants (Beam_configuration *config) const;
+  void score_slopes_dy (Beam_configuration *config) const;
+  void score_stem_lengths (Beam_configuration* config) const;
+  void generate_quants(vector<Beam_configuration*>* scores) const;
+};
+
+#endif /* BEAM_SCORING_PROBLEM_HH */
index 1fbb74f981952d6533b40d3616a96960cfbdb798..52be4c444777b98de3d30999fb7fed7d5c6556b7 100644 (file)
 #include "lily-proto.hh"
 #include "stem-info.hh"
 
-/*
-  TODO: move quanting in separate file.
-*/
-struct Beam_quant_parameters
-{
-  Real SECONDARY_BEAM_DEMERIT;
-  Real STEM_LENGTH_DEMERIT_FACTOR;
-  Real REGION_SIZE;
-
-  /*
-    threshold to combat rounding errors.
-  */
-  Real BEAM_EPS;
-
-  // possibly ridiculous, but too short stems just won't do
-  Real STEM_LENGTH_LIMIT_PENALTY;
-  Real DAMPING_DIRECTION_PENALTY;
-  Real MUSICAL_DIRECTION_FACTOR;
-  Real HINT_DIRECTION_PENALTY;
-  Real IDEAL_SLOPE_FACTOR;
-  Real ROUND_TO_ZERO_SLOPE;
-
-  void fill (Grob *him);
-};
-
 struct Beam_segment
 {
   int vertical_count_;
@@ -70,7 +45,6 @@ struct Beam_stem_segment
   bool gapped_;
   Direction dir_;
   int max_connect_;
-  
 };
 
 
@@ -112,30 +86,19 @@ public:
   DECLARE_SCHEME_CALLBACK (slope_damping, (SCM, SCM));
   DECLARE_SCHEME_CALLBACK (quanting, (SCM, SCM));
   
-static Real score_slopes_dy (Real, Real, Real, Real, Real, bool, Beam_quant_parameters const *);
-
-  static Real score_stem_lengths (vector<Grob*> const &stems,
-                                 vector<Stem_info> const &stem_infos,
-                                 vector<Real> const &base_stem_ys,
-                                 vector<Real> const &stem_xs,
-                                 Real xl, Real xr,
-                                 bool knee,
-                                 Real yl, Real yr, Beam_quant_parameters const *);
-  static Real score_forbidden_quants (Real, Real,
-                                     Real, Real, Real, Real,
-                                     Drul_array<int>, Direction, Direction,
-                                     Beam_quant_parameters const *);
-
   static int get_direction_beam_count (Grob *me, Direction d);
+
 private:
+  friend class Beam_scoring_problem;
+  
   static Direction get_default_dir (Grob *);
   static void set_stem_directions (Grob *, Direction);
   static void consider_auto_knees (Grob *);
   static void set_stem_shorten (Grob *);
+  static int forced_stem_count (Grob *);
   static Real calc_stem_y (Grob *, Grob *s, Grob **c,
                           Real, Real, Direction,
                           Drul_array<Real> pos, bool french);
-  static int forced_stem_count (Grob *);
 };
 
 
index 992472f22a23f4c2d46472346d1c5e28c1eb0b09..a4d78f99c912b913fe6cf9449869f3ab085d036c 100644 (file)
 #include "lily-proto.hh"
 #include "std-vector.hh"
 
-
-enum Configuration_tag
-  {
-    SLUR_STEM = 0x01,
-    SLUR_HEAD = 0x02,
-    SLUR_FREE = 0x04,
-    SLUR_FREE_HEAD = 0x08,
-    SLUR_FREE_STEM = 0x10,
-    SLUR_STEM_TIP = 0x10,
-  };
-
 class Slur_configuration
 {
   Real score_;
@@ -44,9 +33,20 @@ public:
   Drul_array<Offset> attachment_;
   Bezier curve_;
   Real height_;
-  unsigned tags_;
   int index_;
 
+  enum Slur_scorers
+  {
+    INITIAL_SCORE,
+    SLOPE,
+    EDGES,
+    EXTRA_ENCOMPASS,
+    ENCOMPASS,
+    NUM_SCORERS,
+  };
+
+  int next_scorer_todo;
+  
   Slur_configuration ();
 
   Real score () const { return score_; }
@@ -55,12 +55,28 @@ public:
   
   void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
                       vector<Offset> const &);
-  void calculate_score (Slur_score_state const &);
+  void run_next_scorer (Slur_score_state const &);
+  bool done () const;
+  static Slur_configuration *new_config (Drul_array<Offset> const &offs, int idx);
+
 protected:
   void score_extra_encompass (Slur_score_state const &);
   void score_slopes (Slur_score_state const &);
   void score_edges (Slur_score_state const &);
   void score_encompass (Slur_score_state const &);
+
+  friend class Slur_configuration_less;
+};
+
+// Comparator for a queue of Beam_configuration*.
+class Slur_configuration_less
+{
+public:
+  bool operator () (Slur_configuration* const& l, Slur_configuration* const& r)
+  {
+    // Invert
+    return l->score_ > r->score_;
+  }
 };
 
 #endif /* SLUR_CONFIGURATION_HH */
index 88083fa8ccd0e3071a1522f0fc340d4417289b1f..866b216942f5dc831995567de7484e1a7581d09d 100644 (file)
@@ -35,7 +35,6 @@ struct Extra_collision_info
   
   Extra_collision_info (Grob *g, Real idx, Interval x, Interval y, Real p);
   Extra_collision_info ();
-
 };
 
 struct Encompass_info
@@ -105,7 +104,8 @@ struct Slur_score_state
   Slur_score_state ();
   ~Slur_score_state ();
 
-  Bezier get_best_curve ();
+  Slur_configuration *get_forced_configuration (Interval ys) const;
+  Slur_configuration *get_best_curve () const;
   void fill (Grob *);
   Direction slur_direction () const;
   
@@ -118,7 +118,6 @@ struct Slur_score_state
   Encompass_info get_encompass_info (Grob *col) const;
   vector<Extra_collision_info> get_extra_encompass_infos () const;
   Real move_away_from_staffline (Real y, Grob *on_staff) const;
-  int get_closest_index (SCM inspect_quants) const;
 
   Grob *breakable_bound_item (Direction) const;  
 };
index d869d878eacc28bb0e0f0707b3e842b3a16db171..7ebedb4d46238d0555f7b1906c4c8d4da35cdb44 100644 (file)
@@ -37,7 +37,6 @@ public:
   static void add_bar (Grob *, Grob *);
   static void evaluate_glyph (Grob *);
   DECLARE_SCHEME_CALLBACK (width, (SCM smob));
-  DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
index 52fc8799e914c194c284f76ff1c2196ece5b9f61..882418242d9d4ce8577ee81069a22d8ef75f5675 100644 (file)
@@ -198,13 +198,13 @@ BOM_UTF8  \357\273\277
   "%{" {
        yy_push_state (longcomment);
   }
-  %[^{\n\r].*[\n\r]    {
+  %[^{\n\r][^\n\r]*[\n\r]      {
   }
   %[^{\n\r]    { // backup rule
   }
   %[\n\r]      {
   }
-  %[^{\n\r].*  {
+  %[^{\n\r][^\n\r]*    {
   }
   {WHITE}+     {
 
index a821597be0c978dffc8e08434d68c923a00f7c3e..915844453025ece1d1883a41db0a4cbb73c72baa 100644 (file)
@@ -72,3 +72,13 @@ LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper",
   Paper_book *pbook = unsmob_paper_book (pb);
   return pbook->paper_->self_scm ();
 }
+
+LY_DEFINE (ly_paper_book_header, "ly:paper-book-header",
+          1, 0, 0, (SCM pb),
+          "Return the header definition (@code{\\header})"
+          " in @code{Paper_book} object @var{pb}.")
+{
+  LY_ASSERT_SMOB (Paper_book, pb, 1);
+  Paper_book *pbook = unsmob_paper_book (pb);
+  return pbook->header_;
+}
index 0c664e38fbcb613642537d856be14e3e571b2e30..adbc2beb32d18f1e01848c3400d79939eaacc9df 100644 (file)
@@ -135,6 +135,9 @@ Part_combine_iterator::Part_combine_iterator ()
   split_list_ = SCM_EOL;
   state_ = APART;
   playing_state_ = APART;
+
+  busy_ = false;
+  notice_busy_ = false;
 }
 
 void
index 5df19544eb520efde47b5bec60bd753b844c93ec..013e457034bea442ae397211d431178888f0357c 100644 (file)
@@ -80,7 +80,8 @@ Skyline
 Separation_item::conditional_skyline (Grob *me, Grob *left)
 {
   vector<Box> bs = boxes (me, left);
-  return Skyline (bs, 0.0, Y_AXIS, LEFT);
+  Real horizon_padding = robust_scm2double (me->get_property ("skyline-vertical-padding"), 0.0);
+  return Skyline (bs, horizon_padding, Y_AXIS, LEFT);
 }
 
 
@@ -90,8 +91,8 @@ Separation_item::calc_skylines (SCM smob)
 {
   Item *me = unsmob_item (smob);
   vector<Box> bs = boxes (me, 0);
-  /* todo: the horizon_padding is somewhat arbitrary */
-  return Skyline_pair (bs, 0.0, Y_AXIS).smobbed_copy ();
+  Real horizon_padding = robust_scm2double (me->get_property ("skyline-vertical-padding"), 0.0);
+  return Skyline_pair (bs, horizon_padding, Y_AXIS).smobbed_copy ();
 }
 
 /* if left is non-NULL, get the boxes corresponding to the
@@ -189,4 +190,5 @@ ADD_INTERFACE (Separation_item,
               "elements "
               "padding "
               "horizontal-skylines "
+              "skyline-vertical-padding "
               );
index 630fd523d8e7020132e5bbc96697e96abcb8aff5..1285a3bb5d2357f66f3ef61918c036c455439b1c 100644 (file)
@@ -177,12 +177,10 @@ Slur_configuration::generate_curve (Slur_score_state const &state,
 
 Slur_configuration::Slur_configuration ()
 {
-  tags_ = 0x0;
   score_ = 0.0;
   index_ = -1;
 };
 
-
 void
 Slur_configuration::add_score (Real s, string desc)
 {
@@ -413,6 +411,7 @@ Slur_configuration::score_edges (Slur_score_state const &state)
       Real demerit = factor * dy;
       if (state.extremes_[d].stem_
          && state.extremes_[d].stem_dir_ == state.dir_
+          // TODO - Stem::get_beaming() should be precomputed.
          && !Stem::get_beaming (state.extremes_[d].stem_, -d))
        demerit /= 5;
 
@@ -467,11 +466,51 @@ Slur_configuration ::score_slopes (Slur_score_state const &state)
   add_score (demerit, "slope");
 }
 
+
+// This is a temporary hack to see how much we can gain by using a
+// priority queue on the beams to score.
+static int score_count = 0;
+LY_DEFINE (ly_slur_score_count, "ly:slur-score-count", 0, 0, 0,
+          (),
+          "count number of slur scores.") {
+  return scm_from_int (score_count);
+}
+
 void
-Slur_configuration::calculate_score (Slur_score_state const &state)
+Slur_configuration::run_next_scorer (Slur_score_state const &state)
+{
+  switch (next_scorer_todo) {
+  case EXTRA_ENCOMPASS:
+    score_extra_encompass (state);
+    break;
+  case SLOPE:
+    score_slopes (state);
+    break;
+  case EDGES:
+    score_edges (state);
+    break;
+  case ENCOMPASS:
+    score_encompass (state);
+    break;
+  default:
+    assert (false);
+  }
+  next_scorer_todo++;
+  score_count++;
+}
+
+bool
+Slur_configuration::done () const
+{
+  return next_scorer_todo >= NUM_SCORERS;
+}
+
+Slur_configuration *
+Slur_configuration::new_config (Drul_array<Offset> const &offs, int idx)
 {
-  score_extra_encompass (state);
-  score_slopes (state);
-  score_edges (state);
-  score_encompass (state);
+  Slur_configuration *conf = new Slur_configuration;
+  conf->attachment_ = offs;
+  conf->index_ = idx;
+  conf->next_scorer_todo = INITIAL_SCORE + 1;
+  return conf;
 }
index 62eeed5837d15f21342bd01229bc22fe289ab9c7..551d4b4524e0e1946d11e74fe9aa7f00463b567a 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "slur-scoring.hh"
 
+#include <queue>
+
 #include "accidental-interface.hh"
 #include "beam.hh"
 #include "directional-element-interface.hh"
@@ -303,17 +305,31 @@ Slur::calc_control_points (SCM smob)
   state.generate_curves ();
 
   SCM end_ys = me->get_property ("positions");
-  Bezier best;
-
+  SCM inspect_quants = me->get_property ("inspect-quants");
+  if (is_number_pair (inspect_quants))
+    end_ys = inspect_quants;
+  
+  Slur_configuration *best = NULL;
   if (is_number_pair (end_ys))
-    best = state.configurations_[state.get_closest_index (end_ys)]->curve_;
+    best = state.get_forced_configuration (ly_scm2interval(end_ys));
   else
     best = state.get_best_curve ();
 
+#if DEBUG_SLUR_SCORING
+  bool debug_slurs = to_boolean (me->layout ()
+                                ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
+  if (debug_slurs)
+    {
+      string total = best->card ();
+      total += to_string (" TOTAL=%.2f idx=%d", best->score (), best->index_); 
+      me->set_property ("quant-score", ly_string2scm (total));
+    }
+#endif
+  
   SCM controls = SCM_EOL;
   for (int i = 4; i--;)
     {
-      Offset o = best.control_[i]
+      Offset o = best->curve_.control_[i]
        - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXIS),
                  me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS));
       controls = scm_cons (ly_offset2scm (o), controls);
@@ -322,72 +338,52 @@ Slur::calc_control_points (SCM smob)
   return controls;
 }
 
-Bezier
-Slur_score_state::get_best_curve ()
+Slur_configuration*
+Slur_score_state::get_forced_configuration (Interval ys) const
 {
-  int opt_idx = -1;
-  Real opt = 1e6;
-
-#if DEBUG_SLUR_SCORING
-  bool debug_slurs = to_boolean (slur_->layout ()
-                                ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
-  SCM inspect_quants = slur_->get_property ("inspect-quants");
-  SCM inspect_index = slur_->get_property ("inspect-index");
-  if (debug_slurs
-      && scm_is_integer (inspect_index))
-    {
-      opt_idx = scm_to_int (inspect_index);
-      configurations_[opt_idx]->calculate_score (*this);
-      opt = configurations_[opt_idx]->score ();
-    }
-  else if (debug_slurs
-          && scm_is_pair (inspect_quants))
-    {
-      opt_idx = get_closest_index (inspect_quants);
-      configurations_[opt_idx]->calculate_score (*this);
-      opt = configurations_[opt_idx]->score ();
-    }
-  else
-#endif
+  Slur_configuration *best = NULL;
+  Real mindist = 1e6;
+  for (vsize i = 0; i < configurations_.size (); i++)
     {
-      for (vsize i = 0; i < configurations_.size (); i++)
-       configurations_[i]->calculate_score (*this);
-      for (vsize i = 0; i < configurations_.size (); i++)
+      Real d = fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ys[LEFT])
+       + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ys[RIGHT]);
+      if (d < mindist)
        {
-         if (configurations_[i]->score () < opt)
-           {
-             opt = configurations_[i]->score ();
-             opt_idx = i;
-           }
+         best = configurations_[i];
+         mindist = d;
        }
     }
 
-#if DEBUG_SLUR_SCORING
-  if (debug_slurs)
-    {
-      string total;
-      if (opt_idx >= 0)
-       {
-         total = configurations_[opt_idx]->card ();
-         total += to_string (" TOTAL=%.2f idx=%d", configurations_[opt_idx]->score (), opt_idx); 
-       }
-      else
-       {
-         total = "no sol?";
-       }
+  while (!best->done ())
+    best->run_next_scorer (*this);
   
-      slur_->set_property ("quant-score",
-                          ly_string2scm (total));
-    }
-#endif
+  if (mindist > 1e5)
+    programming_error ("cannot find quant");
 
-  if (opt_idx < 0)
-    {
-      opt_idx = 0;
-      programming_error ("No optimal slur found. Guessing 0.");
-    }
-  
-  return configurations_[opt_idx]->curve_;
+  return best;
+}
+
+
+Slur_configuration *
+Slur_score_state::get_best_curve () const
+{
+  std::priority_queue<Slur_configuration*, std::vector<Slur_configuration*>,
+                      Slur_configuration_less> queue;
+  for (vsize i = 0; i < configurations_.size (); i++)
+    queue.push (configurations_[i]);
+
+  Slur_configuration *best = NULL;
+  while (true) {
+    best = queue.top ();
+    if (best->done ())
+      break;
+    
+    queue.pop ();
+    best->run_next_scorer (*this);
+    queue.push (best);
+  }
+
+  return best;
 }
 
 Grob *
@@ -407,28 +403,6 @@ Slur_score_state::breakable_bound_item (Direction d) const
   return 0;
 }
 
-int
-Slur_score_state::get_closest_index (SCM inspect_quants) const
-{
-  Drul_array<Real> ins = ly_scm2interval (inspect_quants);
-
-  int opt_idx = -1;
-  Real mindist = 1e6;
-  for (vsize i = 0; i < configurations_.size (); i++)
-    {
-      Real d = fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ins[LEFT])
-       + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ins[RIGHT]);
-      if (d < mindist)
-       {
-         opt_idx = i;
-         mindist = d;
-       }
-    }
-  if (mindist > 1e5)
-    programming_error ("cannot find quant");
-  return opt_idx;
-}
-
 /*
   TODO: should analyse encompasses to determine sensible region, and
   should limit slopes available.
@@ -668,7 +642,6 @@ Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
       os[RIGHT] = base_attachments_[RIGHT];
       for (int j = 0; dir_ * os[RIGHT][Y_AXIS] <= dir_ * end_ys[RIGHT]; j++)
        {
-         Slur_configuration s;
          Direction d = LEFT;
          Drul_array<bool> attach_to_stem (false, false);
          do
@@ -729,10 +702,7 @@ Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
            }
          while (flip (&d) != LEFT);
 
-         s.attachment_ = os;
-         s.index_ = scores.size ();
-
-         scores.push_back (new Slur_configuration (s));
+         scores.push_back (Slur_configuration::new_config (os, scores.size ()));
 
          os[RIGHT][Y_AXIS] += dir_ * staff_space_ / 2;
        }
index 638823651f0f890772f75142f0d23b29ab558423..00e22fb0855e016d3f1750369a26e64634fc5df9 100644 (file)
@@ -28,6 +28,8 @@
 #include "bar-line.hh"
 #include "grob.hh"
 #include "pointer-group-interface.hh"
+#include "staff-symbol-referencer.hh"
+
 
 void
 Span_bar::add_bar (Grob *me, Grob *b)
@@ -74,6 +76,8 @@ Span_bar::print (SCM smobbed_me)
     {
       Grob *bar = elements[i];
       Interval ext = Bar_line::bar_y_extent (bar, refp);
+      if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (bar))
+       ext.unite (staff->extent (refp, Y_AXIS));
       if (ext.is_empty ())
        continue;
 
@@ -105,9 +109,8 @@ Span_bar::print (SCM smobbed_me)
            {
              Stencil interbar = Bar_line::compound_barline (model_bar,
                                                             glyph_string,
-                                                            l.length (),
+                                                            l,
                                                             false);
-             interbar.translate_axis (l.center (), Y_AXIS);
              span_bar.add_stencil (interbar);
            }
        }
@@ -134,7 +137,8 @@ Span_bar::width (SCM smob)
   /*
     urg.
   */
-  Stencil m = Bar_line::compound_barline (me, gl, 40 PT, false);
+  Stencil m =
+    Bar_line::compound_barline (me, gl, Interval (-20 PT, 20 PT), false);
 
   return ly_interval2scm (m.extent (X_AXIS));
 }
@@ -221,21 +225,6 @@ Span_bar::get_spanned_interval (Grob *me)
   return ly_scm2interval (Axis_group_interface::generic_group_extent (me, Y_AXIS));
 }
 
-MAKE_SCHEME_CALLBACK (Span_bar, calc_bar_size, 1);
-SCM
-Span_bar::calc_bar_size (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  Interval iv (get_spanned_interval (me));
-  if (iv.is_empty ())
-    {
-      /* This happens if the bars are hara-kiried from under us. */
-      me->suicide ();
-      return scm_from_double (-1);
-    }
-  return scm_from_double (iv.length ());
-}
-
 ADD_INTERFACE (Span_bar,
               "A bar line that is spanned between other barlines.  This"
               " interface is used for bar lines that connect different"
index e5d981b04e28230e39a392b266d9aceb9284b49f..55e118245f2c793ac5b2ff92e995595e639d586e 100644 (file)
@@ -50,7 +50,11 @@ protected:
 
 Staff_symbol_engraver::~Staff_symbol_engraver ()
 {
-  assert (!span_);
+  if (span_)
+    {
+      // Somehow finalize() was not called?
+      programming_error ("Have a pending spanner in destructor.");
+    }
 }
 
 Staff_symbol_engraver::Staff_symbol_engraver ()
index fd82839f736e8ba93b9b0d320bc965979fde1084..afdbac3478924d42a9d04b9edda0211b52667c44 100644 (file)
@@ -3,7 +3,7 @@ depth = ..
 INI_FILES = $(LY_FILES)
 EXTRA_DIST_FILES = $(SCM_FILES)
 
-INSTALLATION_DIR=$(local_lilypond_datadir)/ly/
+INSTALLATION_DIR=$(local_lilypond_datadir)/ly
 INSTALLATION_FILES=$(INI_FILES)
 
 STEPMAKE_TEMPLATES=install
index 7de70d37329398ff5715045b1ce7fa4ef3f03c55..ab7dafe48ee3a77b5437236494419f88cb63824b 100644 (file)
@@ -16,7 +16,7 @@
 %%%% You should have received a copy of the GNU General Public License
 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-\version "2.13.42"
+\version "2.13.48"
 
 \context {
   \name "Global"
@@ -45,6 +45,7 @@
   shortInstrumentName = #'()
 
   predefinedDiagramTable = #default-fret-table
+  handleNegativeFrets = #'recalculate
 }
 
 \context {
@@ -163,7 +164,7 @@ contained staves are not connected vertically."
   \name RhythmicStaff
   \alias "Staff"
 
-  \override BarLine #'bar-size = #4
+  \override BarLine #'bar-extent = #'(-2 . 2)
   \override VoltaBracket #'staff-padding = #3
   \override StaffSymbol #'line-count = #1
 
@@ -446,7 +447,7 @@ printing of a single line of lyrics."
 
   %% make sure that barlines aren't collapsed, when
   %% Bar_engraver is there.
-  \override BarLine #'bar-size = #0.1
+  \override BarLine #'bar-extent = #'(-0.05 . 0.05)
 
 }
 
@@ -864,6 +865,8 @@ contexts and handles the line spacing, the tablature clef etc. properly."
   %% Special "TAB" clef
   clefGlyph = #"clefs.tab"
   clefPosition = #0
+  %% Change string if note results in negative fret number
+  handleNegativeFrets = #'recalculate
 }
 
 \context {
index 19b00f05b222ed41653b2f40fd7345e91c30b296..0df0643ee3158ec5ad2c0a685d752942ea30d18e 100644 (file)
@@ -2,7 +2,7 @@
 
 # TODO: fix hardcoded out/ ?
 LYS_OUTPUT_OPTION= --lily-output-dir $(LYS_OUTPUT_DIR)
-LYS_OUTPUT_DIR=$(top-build-dir)/out/lybook-db/
+LYS_OUTPUT_DIR=$(top-build-dir)/out/lybook-db
 LILYPOND_BOOK_FLAGS += $(LYS_OUTPUT_OPTION)
 $(outdir)/%.latex: %.doc $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
        LILYPOND_VERSION=$(TOPLEVEL_VERSION) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BOOK_PROCESS) $(LILYPOND_BOOK_LILYPOND_FLAGS)' --output=$(outdir) $(LILYPOND_BOOK_FLAGS) $<
index beaff7c8217f555e2ef12ec15829a4d88b71054c..7d6ed7cb84f1d6e107e6514d7526b2f27362ec50 100644 (file)
@@ -16,18 +16,18 @@ ifeq ($(WEBSITE_ONLY_BUILD),1)
   top-htaccess=$(trusted-dir)/lilypond.org.htaccess
   dir-htaccess=$(trusted-dir)/website-dir.htaccess
   TEXI2HTML_PROGRAM=$(HOME)/usr/bin/texi2html
-  EXAMPLES=$(HOME)/lilypond/media/ly-examples/
+  EXAMPLES=$(HOME)/lilypond/media/ly-examples
   PICTURES=$(HOME)/lilypond/media/pictures
 else
   ### for normal git
-  script-dir=$(top-src-dir)/scripts/build/
+  script-dir=$(top-src-dir)/scripts/build
   texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
   top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
   dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
   include $(config_make)
   # I assume this is run from top-build-dir
-  EXAMPLES=Documentation/web/ly-examples/out-www/
-  PICTURES=Documentation/pictures/out-www/
+  EXAMPLES=Documentation/web/ly-examples/out-www
+  PICTURES=Documentation/pictures/out-www
 endif
 
 
@@ -48,7 +48,7 @@ MASS_LINK=python $(script-dir)/mass-link.py
 WEB_POST=python $(script-dir)/website_post.py
 WEB_BIBS=python $(script-dir)/bib2texi.py
 
-SERVER_FILES=$(top-src-dir)/Documentation/web/server/
+SERVER_FILES=$(top-src-dir)/Documentation/web/server
 
 # don't include web
 MANUALS=$(wildcard $(top-src-dir)/Documentation/*.tely)
@@ -65,7 +65,7 @@ website-version:
 website-xrefs: website-version
        for l in '' $(WEB_LANGS); do \
                $(EXTRACT_TEXI_FILENAMES) \
-                       -I $(top-src-dir)/Documentation/ \
+                       -I $(top-src-dir)/Documentation \
                        -I $(top-src-dir)/Documentation/"$$l" \
                        -I $(OUT) -o $(OUT) --split=node \
                        $(top-src-dir)/Documentation/"$$l"/web.texi ;\
@@ -75,20 +75,20 @@ website-xrefs: website-version
                        d=`basename "$$b" .tely`; \
                        if [ -e "$$n" ] ; then \
                                $(EXTRACT_TEXI_FILENAMES) \
-                               -I $(top-src-dir)/Documentation/ \
+                               -I $(top-src-dir)/Documentation \
                                -I $(top-src-dir)/Documentation/"$$l" \
-                               -I $(top-src-dir)/Documentation/"$$l"/"$$d"/ \
+                               -I $(top-src-dir)/Documentation/"$$l"/"$$d" \
                                -I $(OUT) -o $(OUT) "$$n" ; \
                        fi ; \
                done; \
        done;
 
 website-bibs: website-version
-       BSTINPUTS=$(top-src-dir)/Documentation/web/ \
+       BSTINPUTS=$(top-src-dir)/Documentation/web \
                $(WEB_BIBS) -s web \
                -o $(OUT)/others-did.itexi \
                $(top-src-dir)/Documentation/web/others-did.bib
-       BSTINPUTS=$(top-src-dir)/Documentation/web/ \
+       BSTINPUTS=$(top-src-dir)/Documentation/web \
                $(WEB_BIBS) -s web \
                -o $(OUT)/we-wrote.itexi \
                $(top-src-dir)/Documentation/web/we-wrote.bib
@@ -103,7 +103,7 @@ website-texinfo: website-version website-xrefs website-bibs
                $(TEXI2HTML) --prefix=index \
                        --split=section \
                        --I=$(top-src-dir)/Documentation/"$$l" \
-                       --I=$(top-src-dir)/Documentation/ \
+                       --I=$(top-src-dir)/Documentation \
                        --I=$(OUT) \
                        $$langopt \
                        --init-file=$(texi2html-init-file) \
@@ -115,11 +115,11 @@ website-texinfo: website-version website-xrefs website-bibs
 
 
 website-css:
-       cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website/
+       cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website
 
 website-pictures:
-       mkdir -p $(OUT)/website/pictures/
-       cp $(PICTURES)/* $(OUT)/website/pictures/
+       mkdir -p $(OUT)/website/pictures
+       cp $(PICTURES)/* $(OUT)/website/pictures
        ln -sf website/pictures $(OUT)/pictures
 
 website-examples:
@@ -127,11 +127,11 @@ website-examples:
        cp $(EXAMPLES)/* $(OUT)/website/ly-examples
 
 web-post:
-       $(WEB_POST) $(OUT)/website/
+       $(WEB_POST) $(OUT)/website
 
 website: website-texinfo website-css website-pictures website-examples web-post
-       cp $(SERVER_FILES)/favicon.ico $(OUT)/website/
-       cp $(SERVER_FILES)/robots.txt $(OUT)/website/
+       cp $(SERVER_FILES)/favicon.ico $(OUT)/website
+       cp $(SERVER_FILES)/robots.txt $(OUT)/website
        cp $(top-htaccess) $(OUT)/.htaccess
        cp $(dir-htaccess) $(OUT)/website/.htaccess
 
index 8967ca4a2d5feb55780009fede1a706ce7e74366..4bdc92c75e584159dcc43910360abced062efc11 100644 (file)
@@ -5,7 +5,7 @@ PS_FILES = $(call src-wildcard,*.ps)
 STEPMAKE_TEMPLATES=install
 EXTRA_DIST_FILES = $(PS_FILES)
 
-INSTALLATION_DIR=$(local_lilypond_datadir)/ps/
+INSTALLATION_DIR=$(local_lilypond_datadir)/ps
 INSTALLATION_FILES=$(PS_FILES)
 
 include $(depth)/make/stepmake.make
index c3cbc2133809dcb2b10d658f2461a1bdcda28208..b1e21616e8ecf82a209a5cb85a8b71e0b73a29d7 100644 (file)
@@ -3181,6 +3181,18 @@ def conv(str):
 
     return str
 
+@rule ((2, 13, 48),
+       _ ("Replace bar-size with bar-extent."))
+
+def conv(str):
+    def size_as_extent (matchobj):
+        half = "%g" % (float (matchobj.group (1)) / 2)
+        return "bar-extent = #'(-" + half + " . " + half + ")"
+
+    str = re.sub (r"bar-size\s*=\s*#([0-9\.]+)", size_as_extent, str)
+
+    return str
+
 # Guidelines to write rules (please keep this at the end of this file)
 #
 # - keep at most one rule per version; if several conversions should be done,
index d3f055f77f9bfa8c6fea9bb4699c9be8ab0b133f..0c1965293a84324ed5aa0d44148cf5c668e7c519 100644 (file)
@@ -2,7 +2,7 @@
 
 depth = ..
 
-INSTALLATION_DIR=$(local_lilypond_datadir)/scm/
+INSTALLATION_DIR=$(local_lilypond_datadir)/scm
 INSTALLATION_FILES=$(SCM_FILES)
 
 XGETTEXT_FLAGS = --language=Scheme
index 2b1a62e7b46df8548ffeb583ce2a85aca5233c23..5853474179985733fa8675e8c309f4b5fab7847d 100644 (file)
@@ -261,6 +261,11 @@ frets in tablature.")
 @code{GridPoint}s.")
 
 
+     (handleNegativeFrets ,symbol? "How the automatic fret calculator
+should handle calculated negative frets.  Values include @code{'ignore},
+to leave them out of the diagram completely, @code{'include}, to include
+them as calculated, and @code{'recalculate}, to ignore the specified
+string and find a string where they will fit with a positive fret number.")
      (harmonicAccidentals ,boolean? "If set, harmonic notes in chords
 get accidentals.")
      (harmonicDots ,boolean? "If set, harmonic notes in dotted chords get
index 41f5386b45f84dda9549e71e20580f117cce396a..e92bf9ce345a908bec29d023681330e0ef446b2f 100644 (file)
@@ -75,7 +75,6 @@ grobs, this should contain only one number.")
 ;;
 ;; b
 ;;
-     (bar-size ,ly:dimension? "The size of a bar line.")
      (base-shortest-duration ,ly:moment? "Spacing is based on the
 shortest notes in a piece.  Normally, pieces are spaced as if notes at
 least as short as this are present.")
@@ -722,6 +721,11 @@ vertical distance between two staves, it is possible to have a
 configuration which would result in a tight interleaving of grobs from
 the top staff and the bottom staff.  The larger this parameter is, the
 farther apart the staves are placed in such a configuration.")
+     (skyline-vertical-padding ,number? "The amount by which the left
+and right skylines of a column are padded vertically, beyond the
+@code{Y-extent}s and @code{extra-spacing-height}s of the constituent
+grobs in the column.  Increase this to prevent interleaving of grobs
+from adjacent columns.")
      (slash-negative-kern ,number? "The space to remove between
 slashes in percent repeat glyphs.  Larger values bring the two
 elements closer together.")
index 5b234627439fb10a2f7ef3940712d059ebeb8380..59f756e8a0ccb709b0db7f39230f5a9d4c1550a0 100644 (file)
      . (
        (allow-span-bar . #t)
        (bar-extent . ,ly:bar-line::calc-bar-extent)
-       (bar-size .  ,ly:bar-line::calc-bar-size)
        (break-align-anchor . ,ly:bar-line::calc-anchor)
        (break-align-symbol . staff-bar)
        (break-visibility . ,bar-line::calc-break-visibility)
        (font-family . sans)
        (font-size . 1.5)
        (stencil . ,ly:text-interface::print)
+       (extra-spacing-height . (0.2 . -0.2))
        (word-space . 0.0)
        (meta . ((class . Item)
                 (interfaces . (chord-name-interface
                        (next-note . (extra-space . 0.5))
                        (right-edge . (extra-space . 0.5))))
        (stencil . ,ly:clef::print)
-       (extra-spacing-height . (-0.5 . 0.5))
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
                 (interfaces . (break-aligned-interface
                        (next-note . (extra-space . 0.5))
                        (right-edge . (extra-space . 0.5))))
        (stencil . ,ly:clef::print)
-       (extra-spacing-height . (-0.5 . 0.5))
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
                 (interfaces . (break-aligned-interface
                        (next-note . (extra-space . 0.5))
                        (right-edge . (extra-space . 0.5))))
        (stencil . ,ly:clef::print)
-       (extra-spacing-height . (-0.5 . 0.5))
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
                 (interfaces . (break-aligned-interface
        (after-line-breaking . ,ly:chord-name::after-line-breaking)
        (fret-diagram-details . ((finger-code . below-string)))
        (stencil . ,fret-board::calc-stencil)
+       (extra-spacing-height . (0.2 . -0.2))
        (meta . ((class . Item)
                 (interfaces . (chord-name-interface
                                font-interface
        (break-align-symbol . left-edge)
        (break-visibility . ,center-invisible)
        (non-musical . #t)
+       (extra-spacing-height . (+inf.0 . -inf.0))
        (space-alist . (
                        (ambitus . (extra-space . 2.0))
                        (breathing-sign . (minimum-space . 0.0))
     (LyricText
      . (
        (extra-spacing-width . (0.0 . 0.0))
+       ;; Recede in height for purposes of note spacing,
+       ;; so notes in melismata can be freely spaced above lyrics
+       (extra-spacing-height . (0.2 . -0.2))
        (font-series . medium)
        (font-size . 1.0)
        (self-alignment-X . ,CENTER)
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
        (full-measure-extra-space . 1.0)
        (horizontal-skylines . ,ly:separation-item::calc-skylines)
+       (skyline-vertical-padding . 0.15)
        ;;                    (stencil . ,ly:paper-column::print)
 
        (line-break-permission . allow)
      . (
        (axes . (,X ,Y))
        (horizontal-skylines . ,ly:separation-item::calc-skylines)
+       (skyline-vertical-padding . 0.15)
        (X-extent . ,ly:axis-group-interface::width)
        (Y-extent . ,ly:axis-group-interface::height)
        (meta . ((class . Item)
        (duration-log . ,note-head::calc-duration-log)
        (extra-spacing-height . ,ly:note-head::include-ledger-line-height)
        (glyph-name . ,note-head::calc-glyph-name)
-        (ligature-flexa . #f)
+       (ligature-flexa . #f)
        (stem-attachment . ,ly:note-head::calc-stem-attachment)
        (stencil . ,ly:note-head::print)
        (X-offset . ,ly:note-head::stem-x-shift)
      . (
        (allow-span-bar . #t)
        (bar-extent . ,ly:axis-group-interface::height)
-       (bar-size . ,ly:span-bar::calc-bar-size)
        (before-line-breaking . ,ly:span-bar::before-line-breaking)
        (break-align-symbol . staff-bar)
        (cross-staff . #t)
    ly:note-head::print
    ly:dots::print
    ly:clef::print
+   ly:key-signature-interface::print
    ly:percent-repeat-item-interface::beat-slash
    ly:text-interface::print
    ly:script-interface::print
index 7a96dfa869592b9ec9f3434c6cae5d58fbe4829c..5dbc5d2f5254b61bd4e3bd4c42b4143807501812 100644 (file)
@@ -2379,6 +2379,32 @@ normal text font, no matter what font was used earlier.
 ;; symbols.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(define-markup-command (musicglyph layout props glyph-name)
+  (string?)
+  #:category music
+  "@var{glyph-name} is converted to a musical symbol; for example,
+@code{\\musicglyph #\"accidentals.natural\"} selects the natural sign from
+the music font.  See @ruser{The Feta font} for a complete listing of
+the possible glyphs.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\musicglyph #\"f\"
+  \\musicglyph #\"rests.2\"
+  \\musicglyph #\"clefs.G_change\"
+}
+@end lilypond"
+  (let* ((font (ly:paper-get-font layout
+                                 (cons '((font-encoding . fetaMusic)
+                                         (font-name . #f))
+
+                                                props)))
+        (glyph (ly:font-get-glyph font glyph-name)))
+    (if (null? (ly:stencil-expr glyph))
+       (ly:warning (_ "Cannot find glyph ~a") glyph-name))
+
+    glyph))
+
 (define-markup-command (doublesharp layout props)
   ()
   #:category music
@@ -2546,33 +2572,6 @@ Use the filled head if @var{filled} is specified.
                                     props))
      name)))
 
-(define-markup-command (musicglyph layout props glyph-name)
-  (string?)
-  #:category music
-  "@var{glyph-name} is converted to a musical symbol; for example,
-@code{\\musicglyph #\"accidentals.natural\"} selects the natural sign from
-the music font.  See @ruser{The Feta font} for a complete listing of
-the possible glyphs.
-
-@lilypond[verbatim,quote]
-\\markup {
-  \\musicglyph #\"f\"
-  \\musicglyph #\"rests.2\"
-  \\musicglyph #\"clefs.G_change\"
-}
-@end lilypond"
-  (let* ((font (ly:paper-get-font layout
-                                 (cons '((font-encoding . fetaMusic)
-                                         (font-name . #f))
-
-                                                props)))
-        (glyph (ly:font-get-glyph font glyph-name)))
-    (if (null? (ly:stencil-expr glyph))
-       (ly:warning (_ "Cannot find glyph ~a") glyph-name))
-
-    glyph))
-
-
 (define-markup-command (lookup layout props glyph-name)
   (string?)
   #:category other
index 2205c43e5a1526cadd47fbc42b7b2e727c153200..a349934c238e0896bab665206db71919fd5a7e65 100644 (file)
@@ -696,7 +696,7 @@ Syntax: @code{\\\\}")
 (set! music-descriptions
       (sort music-descriptions alist<?))
 
-(define-public music-name-to-property-table (make-vector 59 '()))
+(define-public music-name-to-property-table (make-hash-table 59))
 
 ;; init hash table,
 ;; transport description to an object property.
index 51b13eb25941f21356691c0a48a59c459e185365..fa87f1c7f919618ee1128cada9a490a88b05ee08 100644 (file)
@@ -28,9 +28,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-13)
   #:use-module (srfi srfi-39)
-  #:use-module (lily)
-  #:use-syntax (srfi srfi-39)
-  #:use-syntax (ice-9 optargs))
+  #:use-module (lily))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -289,11 +287,13 @@ inside body."
 ;;;
 
 (define (make-music-type-predicate . music-types)
-  (define ((make-music-type-predicate-aux mtypes) expr)
-    (if (null? mtypes)
-       #f
-       (or (eqv? (car mtypes) (ly:music-property expr 'name))
-           ((make-music-type-predicate-aux (cdr mtypes)) expr))))
-  (make-music-type-predicate-aux music-types))
+  (define make-music-type-predicate-aux
+    (lambda (mtypes)
+      (lambda (expr)
+       (if (null? mtypes)
+           #f
+           (or (eqv? (car mtypes) (ly:music-property expr 'name))
+               ((make-music-type-predicate-aux (cdr mtypes)) expr))))))
+      (make-music-type-predicate-aux music-types))
 
 (load "define-music-display-methods.scm")
\ No newline at end of file
index 18038a61af164ce7963bbf7624859a9214f4dcdd..032f0c5de1f263beae33126e2ce1edd09b3b9233 100644 (file)
           (pfas (map font-loader font-names)))
       pfas))
 
+
   (display "%%BeginProlog\n" port)
   (format
    port
   (display "%%EndProlog\n" port)
   (display "%%BeginSetup\ninit-lilypond-parameters\n%%EndSetup\n\n" port))
 
+;;; Create DOCINFO pdfmark containing metadata
+;;; header fields with pdf prefix override those without the prefix
+(define (handle-metadata header port)
+  (define (metadata-lookup-output overridevar fallbackvar field)
+    (let* ((overrideval (ly:modules-lookup (list header) overridevar))
+          (fallbackval (ly:modules-lookup (list header) fallbackvar))
+          (val (if overrideval overrideval fallbackval)))
+      (if val
+         (format port "/~a (~a)\n" field (markup->string val)))))
+  (display "[ " port)
+  (metadata-lookup-output 'pdfcomposer 'composer "Author")
+  (format port "/Creator (LilyPond ~a)\n" (lilypond-version))
+  (metadata-lookup-output 'pdftitle 'title "Title")
+  (metadata-lookup-output 'pdfsubject 'subject "Subject")
+  (metadata-lookup-output 'pdfkeywords 'keywords "Keywords")
+  (metadata-lookup-output 'pdfmodDate 'modDate "ModDate")
+  (metadata-lookup-output 'pdfsubtitle 'subtitle "Subtitle")
+  (metadata-lookup-output 'pdfcomposer 'composer "Composer")
+  (metadata-lookup-output 'pdfarranger 'arranger "Arranger")
+  (metadata-lookup-output 'pdfpoet 'poet "Poet")
+  (metadata-lookup-output 'pdfcopyright 'copyright "Copyright")
+  (display "/DOCINFO pdfmark\n\n" port))
+
+
 (define-public (output-framework basename book scopes fields)
   (let* ((filename (format "~a.ps" basename))
         (outputter (ly:make-paper-outputter
                     (open-file filename "wb")
                     'ps))
         (paper (ly:paper-book-paper book))
+        (header (ly:paper-book-header book))
         (systems (ly:paper-book-systems book))
         (page-stencils (map page-stencil (ly:paper-book-pages book)))
         (landscape? (eq? (ly:output-def-lookup paper 'landscape) #t))
     ;; don't do BeginDefaults PageMedia: A4
     ;; not necessary and wrong
     (write-preamble paper #t port)
+    (if (module? header)
+       (handle-metadata header port))
     (for-each
      (lambda (page)
        (set! page-number (1+ page-number))
index 5d5d190c2d01ca769622d45f4f832c11b68569c8..4ef49e975989978bfdeeb1af595aa567f76fc06f 100644 (file)
@@ -15,7 +15,9 @@
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-(define ((check-beam-quant posl posr) beam posns)
+(define check-beam-quant
+  (lambda (posl posr)
+    (lambda (beam posns)
   "Check whether BEAM has POSL and POSR quants.  POSL are (POSITION
 . QUANT) pairs, where QUANT is -1 (hang), 0 (center), 1 (sit) or -2/ 2 (inter) 
 
                      want-l want-r posns)
          (set! (ly:grob-property beam 'annotation)
                (format "(~S,~S)" want-l want-r))))
-    posns
-    ))
+    posns))))
 
-
-(define ((check-beam-slope-sign comparison) beam posns)
+(define check-beam-slope-sign
+  (lambda (comparison)
+    (lambda (beam posns)
   "Check whether the slope of BEAM is correct wrt. COMPARISON."
   (let* ((slope-sign (- (cdr posns) (car posns)))
         (correct (comparison slope-sign 0)))
@@ -54,7 +56,7 @@
          (set! (ly:grob-property beam 'annotation)
                (format "~S 0" (procedure-name comparison))))
        (set! (ly:grob-property beam 'annotation) ""))
-    posns))
+    posns))))
 
 
 (define-public (check-quant-callbacks l r)
index 7384d56f9e4b7750da6d3d9162ba562a748e9564..08e656105873400de70aae5280f8768c3ceb1cac 100644 (file)
@@ -409,12 +409,15 @@ LilyPond safe mode.  The syntax is the same as `define*-public'."
     "define-music-properties.scm"
     "time-signature-settings.scm"
     "auto-beam.scm"
-    "chord-name.scm"
     "bezier-tools.scm"
     "parser-ly-from-scheme.scm"
     "ly-syntax-constructors.scm"
 
     "define-context-properties.scm"
+    ;; guile 1.9 wants markups defined before referenced
+    "define-markup-commands.scm"
+
+    "chord-name.scm"
     "translation-functions.scm"
     "script.scm"
     "midi.scm"
@@ -431,7 +434,6 @@ LilyPond safe mode.  The syntax is the same as `define*-public'."
     "define-woodwind-diagrams.scm"
     "display-woodwind-diagrams.scm"
     "predefined-fretboards.scm"
-    "define-markup-commands.scm"
     "define-grob-properties.scm"
     "define-grobs.scm"
     "define-grob-interfaces.scm"
index 108751e22f590156d607365d69c0a44f0e9e6def..6bd9fd6236c687950ff450b09ee2184badda92e8 100644 (file)
@@ -544,3 +544,63 @@ Uncovered - cheap-markup? is used."
           (car stencils))
       (ly:make-stencil '() '(0 . 0) '(0 . 0))))
 
+
+;;; convert a full markup object to an approximate pure string representation
+
+(define-public (markup->string m)
+  ;; markup commands with one markup argument, formatting ignored
+  (define markups-first-argument '(list
+    bold-markup box-markup caps-markup dynamic-markup finger-markup
+    fontCaps-markup huge-markup italic-markup large-markup larger-markup
+    medium-markup normal-size-sub-markup normal-size-super-markup
+    normal-text-markup normalsize-markup number-markup roman-markup
+    sans-markup simple-markup small-markup smallCaps-markup smaller-markup
+    sub-markup super-markup teeny-markup text-markup tiny-markup
+    typewriter-markup underline-markup upright-markup bracket-markup
+    circle-markup hbracket-markup parenthesize-markup rounded-box-markup
+
+    center-align-markup center-column-markup column-markup dir-column-markup
+    fill-line-markup justify-markup justify-string-markup left-align-markup
+    left-column-markup line-markup right-align-markup right-column-markup
+    vcenter-markup wordwrap-markup wordwrap-string-markup ))
+
+  ;; markup commands with markup as second argument, first argument
+  ;; specifies some formatting and is ignored
+  (define markups-second-argument '(list
+    abs-fontsize-markup fontsize-markup magnify-markup lower-markup
+    pad-around-markup pad-markup-markup pad-x-markup raise-markup
+    halign-markup hcenter-in-markup rotate-markup translate-markup
+    translate-scaled-markup with-url-markup scale-markup ))
+
+  ;; helper functions to handle string cons like string lists
+  (define (markup-cons->string-cons c)
+    (if (not (pair? c)) (markup->string c)
+      (cons (markup->string (car c)) (markup-cons->string-cons (cdr c)))))
+  (define (string-cons-join c)
+    (if (not (pair? c)) c
+        (string-join (list (car c) (string-cons-join (cdr c))) "")))
+
+  (cond
+    ((string? m) m)
+    ((null? m) "")
+
+    ;; handle \concat (string-join without spaces)
+    ((and (pair? m) (equal? (car m) concat-markup))
+        (string-cons-join (markup-cons->string-cons (cadr m))) )
+
+    ;; markup functions with the markup as first arg
+    ((member (car m) (primitive-eval markups-first-argument))
+        (markup->string (cadr m)))
+
+    ;; markup functions with markup as second arg
+    ((member (car m) (primitive-eval markups-second-argument))
+        (markup->string (cddr m)))
+
+    ;; ignore all other markup functions
+    ((markup-function? (car m)) "")
+
+    ;; handle markup lists
+    ((list? m)
+        (string-join (map markup->string m) " "))
+
+    (else "ERROR, unable to extract string from markup")))
index f6f24734e47425afbfd002276279c1d372adb5f0..5a22e72a89b1cdbba2a4e24cfe9ee9232a11c55c 100644 (file)
@@ -258,6 +258,162 @@ dot placement entries."
     (length (filter (lambda (x) (not (null? x)))
                     art-list)))
 
+  (define (determine-frets-and-strings
+           notes
+           defined-strings
+           defined-fingers
+           minimum-fret
+           maximum-stretch
+           tuning)
+
+    (define (calc-fret pitch string tuning)
+      (- (ly:pitch-semitones pitch) (ly:pitch-semitones (list-ref tuning (1- string)))))
+
+    (define (note-pitch a)
+      (ly:event-property a 'pitch))
+
+    (define (note-pitch>? a b)
+      (ly:pitch<? (note-pitch b)
+                 (note-pitch a)))
+
+    (define (note-finger ev)
+      (let* ((articulations (ly:event-property ev 'articulations))
+            (finger-found #f))
+
+       (map (lambda (art)
+              (let* ((num (ly:event-property art 'digit)))
+
+                (if (and (eq? 'fingering-event (ly:event-property art 'class))
+                         (number? num)
+                         (> num 0))
+                  (set! finger-found num))))
+            articulations)
+
+       finger-found))
+
+    (define (string-number event)
+      (let ((num (ly:event-property event 'string-number)))
+       (if (number? num)
+         num
+         #f)))
+
+    (define (delete-free-string string)
+      (if (number? string)
+       (set! free-strings
+         (delete string free-strings))))
+
+    (define free-strings '())
+    (define unassigned-notes '())
+    (define specified-frets '())
+
+    (define (close-enough fret)
+      (if (null? specified-frets)
+       #t
+       (reduce
+         (lambda (x y)
+           (and x y))
+         #t
+         (map (lambda (specced-fret)
+                (or (eq? 0 specced-fret)
+                    (>= maximum-stretch (abs (- fret specced-fret)))))
+              specified-frets))))
+
+    (define (string-qualifies string pitch)
+      (let* ((fret (calc-fret pitch string tuning)))
+       (and (>= fret minimum-fret)
+            (close-enough fret))))
+
+    (define (open-string string pitch)
+      (let* ((fret (calc-fret pitch string tuning)))
+       (eq? fret 0)))
+
+    (define string-fret-fingering-tuples '())
+
+    (define (set-fret note string)
+      (let ((this-fret (calc-fret (ly:event-property note 'pitch)
+                                 string
+                                 tuning)))
+       (if (< this-fret 0)
+         (ly:warning (_ "Negative fret for pitch ~a on string ~a")
+                     (note-pitch note) string))
+       (set! string-fret-fingering-tuples
+         (cons (list string
+                     this-fret
+                     (note-finger note))
+               string-fret-fingering-tuples))
+       (delete-free-string string)
+       (set! specified-frets (cons this-fret specified-frets))))
+
+    (define (pad-list target template)
+      (while (< (length target) (length template))
+            (set! target (if (null? target)
+                           '(())
+                           (append target '(()))))))
+
+    ;;; body of determine-frets-and-strings
+    (set! free-strings (map 1+ (iota (length tuning))))
+
+    ;; get defined-strings same length as notes
+    (pad-list defined-strings notes)
+
+    ;; get defined-fingers same length as notes
+    (pad-list defined-fingers notes)
+
+    ;; handle notes with strings assigned and fingering of 0
+    (for-each
+      (lambda (note string finger)
+       (let ((digit (if (null? finger)
+                      #f
+                      finger)))
+         (if (and (null? string)
+                  (not (eq? digit 0)))
+           (set! unassigned-notes (cons note unassigned-notes))
+           (if (eq? digit 0)
+             (let ((fit-string
+                     (find (lambda (string)
+                             (open-string string (note-pitch note)))
+                           free-strings)))
+               (if fit-string
+                 (begin
+                   (delete-free-string fit-string)
+                   (set-fret note fit-string))
+                 (begin
+                   (ly:warning (_ "No open string for pitch ~a")
+                               (note-pitch note))
+                   (set! unassigned-notes (cons note unassigned-notes)))))
+             (let ((this-fret (calc-fret (note-pitch note) string tuning))
+                   (handle-negative
+                     (ly:context-property context
+                                          'handleNegativeFrets
+                                          'recalculate)))
+               (cond ((or (>= this-fret 0)
+                          (eq? handle-negative 'include))
+                      (begin
+                        (delete-free-string string)
+                        (set-fret note string)))
+                     ((eq? handle-negative 'recalculate)
+                      (begin
+                        (ly:warning (_ "Requested string for pitch requires negative fret: string ~a pitch ~a") string (note-pitch note))
+                        (ly:warning (_ "Ignoring string request."))
+                        (set! unassigned-notes (cons note unassigned-notes))))))))))
+      notes defined-strings defined-fingers)
+
+    ;; handle notes without strings assigned
+    (for-each
+      (lambda (note)
+       (let ((fit-string
+               (find (lambda (string)
+                       (string-qualifies string (note-pitch note)))
+                     free-strings)))
+         (if fit-string
+           (set-fret note fit-string)
+           (ly:warning (_ "No string for pitch ~a (given frets ~a)")
+                       (note-pitch note)
+                       specified-frets))))
+      (sort unassigned-notes note-pitch>?))
+
+    string-fret-fingering-tuples) ;; end of determine-frets-and-strings
+
   (define (get-predefined-fretboard predefined-fret-table tuning pitches)
     "Search through @var{predefined-fret-table} looking for a predefined
 fretboard with a key of @var{(tuning . pitches)}.  The search will check
@@ -271,6 +427,8 @@ chords.  Returns a placement-list."
            (cdr hash-handle)  ; return table entry
            '())))
 
+
+
     ;; body of get-predefined-fretboard
     (let ((test-fretboard (get-fretboard (cons tuning pitches))))
       (if (not (null? test-fretboard))
@@ -332,149 +490,6 @@ chords.  Returns a placement-list."
              (create-fretboard context grob predefined-fretboard)))))
 
 
-(define (determine-frets-and-strings
-          notes
-          defined-strings
-          defined-fingers
-          minimum-fret
-          maximum-stretch
-          tuning)
-
-  (define (calc-fret pitch string tuning)
-    (- (ly:pitch-semitones pitch) (ly:pitch-semitones (list-ref tuning (1- string)))))
-
-  (define (note-pitch a)
-    (ly:event-property a 'pitch))
-
-  (define (note-pitch>? a b)
-    (ly:pitch<? (note-pitch b)
-               (note-pitch a)))
-
-  (define (note-finger ev)
-    (let* ((articulations (ly:event-property ev 'articulations))
-          (finger-found #f))
-
-      (map (lambda (art)
-            (let* ((num (ly:event-property art 'digit)))
-
-              (if (and (eq? 'fingering-event (ly:event-property art 'class))
-                       (number? num)
-                        (> num 0))
-                  (set! finger-found num))))
-          articulations)
-
-      finger-found))
-
-  (define (string-number event)
-    (let ((num (ly:event-property event 'string-number)))
-      (if (number? num)
-          num
-          #f)))
-
-  (define (delete-free-string string)
-    (if (number? string)
-       (set! free-strings
-             (delete string free-strings))))
-
-  (define free-strings '())
-  (define unassigned-notes '())
-  (define specified-frets '())
-
-  (define (close-enough fret)
-    (if (null? specified-frets)
-        #t
-        (reduce
-          (lambda (x y)
-            (and x y))
-          #t
-          (map (lambda (specced-fret)
-                 (or (eq? 0 specced-fret)
-                     (>= maximum-stretch (abs (- fret specced-fret)))))
-               specified-frets))))
-
-  (define (string-qualifies string pitch)
-    (let* ((fret (calc-fret pitch string tuning)))
-      (and (>= fret minimum-fret)
-          (close-enough fret))))
-
-  (define (open-string string pitch)
-    (let* ((fret (calc-fret pitch string tuning)))
-      (eq? fret 0)))
-
-  (define string-fret-fingering-tuples '())
-
-  (define (set-fret note string)
-    (let ((this-fret (calc-fret (ly:event-property note 'pitch)
-                                string
-                                tuning)))
-       (if (< this-fret 0)
-           (ly:warning (_ "Negative fret for pitch ~a on string ~a")
-                                       (note-pitch note) string))
-       (set! string-fret-fingering-tuples
-             (cons (list string
-                         this-fret
-                         (note-finger note))
-                   string-fret-fingering-tuples))
-       (delete-free-string string)
-       (set! specified-frets (cons this-fret specified-frets))))
-
-  (define (pad-list target template)
-    (while (< (length target) (length template))
-           (set! target (if (null? target)
-                            '(())
-                            (append target '(()))))))
-
-  ;;; body of determine-frets-and-strings
-  (set! free-strings (map 1+ (iota (length tuning))))
-
-  ;; get defined-strings same length as notes
-  (pad-list defined-strings notes)
-
-  ;; get defined-fingers same length as notes
-  (pad-list defined-fingers notes)
-
-  ;; handle notes with strings assigned and fingering of 0
-  (for-each
-    (lambda (note string finger)
-      (let ((digit (if (null? finger)
-                       #f
-                       finger)))
-        (if (and (null? string)
-                 (not (eq? digit 0)))
-            (set! unassigned-notes (cons note unassigned-notes))
-            (if (eq? digit 0)
-                (let ((fit-string
-                      (find (lambda (string)
-                              (open-string string (note-pitch note)))
-                            free-strings)))
-                  (if fit-string
-                      (begin
-                        (delete-free-string fit-string)
-                        (set-fret note fit-string))
-                      (begin
-                        (ly:warning (_ "No open string for pitch ~a")
-                                       (note-pitch note))
-                        (set! unassigned-notes (cons note unassigned-notes)))))
-                (begin
-                  (delete-free-string string)
-                  (set-fret note string))))))
-    notes defined-strings defined-fingers)
-
-  ;; handle notes without strings assigned
-  (for-each
-   (lambda (note)
-     (let ((fit-string
-            (find (lambda (string)
-                    (string-qualifies string (note-pitch note)))
-                  free-strings)))
-        (if fit-string
-            (set-fret note fit-string)
-            (ly:warning (_ "No string for pitch ~a (given frets ~a)")
-                           (note-pitch note)
-                           specified-frets))))
-   (sort unassigned-notes note-pitch>?))
-
-   string-fret-fingering-tuples)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; tablature
index f61ff649dca336346a0863bf24c67d4a128bb741..d774bee3fdee601350f379418db61543fc69e19b 100755 (executable)
@@ -18,7 +18,7 @@ else
   find -name '*.gcda' -exec rm  '{}' ';'
 fi
 
-mkdir -p scripts/out-cov/
+mkdir -p scripts/out-cov
 touch scripts/out-cov/midi2ly scripts/out-cov/midi2ly.1
 make conf=cov -j2 &&  \
   make conf=cov test-clean OUT_TEST=testcov LILYPOND_JOBS= && \
@@ -42,11 +42,11 @@ mv $depth/input/regression/out-testcov/*.scm.cov .
 ln $depth/ly/*.ly .
 ln $depth/lily/out-cov/*[ch] .
 mkdir include
-ln $depth/lily/include/* include/
-ln $depth/flower/include/* include/
+ln $depth/lily/include/* include
+ln $depth/flower/include/* include
 for a in *[cl] *.yy
 do
-   gcov -o $depth/lily/out-cov/  -p $a > $a.gcov-summary
+   gcov -o $depth/lily/out-cov  -p $a > $a.gcov-summary
 done 
 
 $depth/scripts/auxiliar/coverage.py --uncovered *.cc > uncovered.txt
index 6063c21ee411336402bd3f2d8a0b8fbeffe847a1..9bb48614d728816cab105f5595855d2df9b5036e 100755 (executable)
@@ -20,8 +20,10 @@ make
 cd $TOP_SRC_DIR
 
 ### update manuals
-find Documentation/ -path 'Documentation/snippets' -prune \
-  -o -name '*.itely' | xargs $BUILD_DIR/out/bin/convert-ly -e -d
+find Documentation/ -path 'Documentation/snippets' -prune -o \
+  -name '*.itely' | xargs $BUILD_DIR/out/bin/convert-ly -e -d
 
 ### update .ly files
-find . -name '*.ly' | xargs $BUILD_DIR/out/bin/convert-ly -e -d
+# don't look in . otherwise it'll find stuff in build/ !
+find Documentation/ input/ ly/ \
+  -name '*.ly' | xargs $BUILD_DIR/out/bin/convert-ly -e -d
index 5b38c0c96be770cc051e4dc644d3e1491d41e0d5..c2f4554bbd2774670a5c5737007c05ce26f0f03e 100644 (file)
@@ -124,7 +124,6 @@ translations = {
         'Internals': 'Belső működés',
         'Contributor': 'Közreműködés',
 
-# keep the spaces!
         ' (split HTML)': ' (HTML oldalak)',
         ' (big HTML)': ' (egy nagy HTML oldal)',
 
index 9cb66d73ac389d417015888e26c113565653f570..c06224717b002f795b4ef184a37f48931c1b15f9 100644 (file)
@@ -426,7 +426,7 @@ EOF
 
        
        cat <<EOF > GNUmakefile
-depth = ./
+depth = .
 include config\$(if \$(conf),-\$(conf),).make
 include \$(configure-srcdir)/GNUmakefile.in
 EOF
index 4c572c214a4e452cec7118e46d65ac370efab610..b22da2e9f50706118954ef800ca1e2526d079f47 100644 (file)
@@ -1,4 +1,4 @@
-at-dir = $(doc-dir)/
+at-dir = $(doc-dir)
 at-ext = .in
 
 EXTRA_DIST_FILES += $(call src-wildcard,*.ihtml)
index 89c4129f1d687a9696be973816471d6232adb0c5..1344a2f52407801724be203f9195c7647be8a210 100644 (file)
@@ -10,7 +10,7 @@ local-install-files: $(INSTALLATION_FILES)
        $(INSTALLPY) -m 644 $(addprefix $(src-dir)/,$(INSTALLATION_FILES)) $(DESTDIR)$(INSTALLATION_DIR)/
        $(foreach suff, $(INSTALLATION_SUFFIXES),  \
                ($(INSTALLPY) -d $(DESTDIR)$(INSTALLATION_DIR$(suff)) || true) && \
-               $(INSTALLPY) -m 644  $(addprefix $(src-dir)/, $(INSTALLATION_FILES$(suff))) $(DESTDIR)$(INSTALLATION_DIR$(suff))/ )
+               $(INSTALLPY) -m 644  $(addprefix $(src-dir), $(INSTALLATION_FILES$(suff))) $(DESTDIR)$(INSTALLATION_DIR$(suff))/ )
        $(POST_INSTALL)
 
 local-uninstall: local-uninstall-outfiles local-uninstall-files
index 7a78a593448218afe8e630ed424606d83c7023e8..ac5d1b6e8735d2981af0b4ea4d6b9cc32561245c 100644 (file)
@@ -12,7 +12,7 @@ EXTRA_DIST_FILES += $(MAKE_FILES)
 # these two outdir FILES are distributed, since they make sense to have
 # without running configure and make.
 
-at-dir = $(doc-dir)/
+at-dir = $(doc-dir)
 at-ext = .in
 
 
index df3fe8347ea143aa287625a27335bc8a8fe46f61..487ee97e491998257c5f4f108770064b18f93b05 100644 (file)
@@ -43,7 +43,7 @@ install-info-images:
 # remove $(infodir)/$(INFO_IMAGES_DIR) in case it is a symlink
        -rm -f $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
        $(INSTALL) -d $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
-       rsync -r --include '[0-9a-f][0-9a-f]' --include '*.png' --exclude '*' $(outdir)/ $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)/
+       rsync -r --include '[0-9a-f][0-9a-f]' --include '*.png' --exclude '*' $(outdir)/ $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
 
 uninstall-info-images:
        rm -f $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR) || rm -rf $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
index 2ee7be573f69bdf10c33ae97d182ed82d8dd246d..d2748a97a3280e2e16ea575485ba9b2c40b2fe11 100644 (file)
@@ -52,7 +52,7 @@ dist:
        chmod -R a+r $(distdir)
        chmod  a+x `find $(distdir) -type d -print`
        (cd ./$(depth)/$(outdir); $(TAR) -cf -  --owner=0 --group=0 $(DIST_NAME) | gzip -9 > $(DIST_NAME).tar.gz)
-       rm -rf $(distdir)/
+       rm -rf $(distdir)
 
 local-help:
        @echo "  config          rerun configure"
index 64e2653bd9d227b0095c7f36e67df576d22317d9..51a54a43aa8f9a4b67e00f2cc862097aabb44f32 100644 (file)
@@ -5,7 +5,7 @@ TEX_FILES = $(filter-out $(TEXINFO_FILES),$(call src-wildcard,*.tex))
 EXTRA_DIST_FILES = $(TEX_FILES) $(TEXINFO_FILES)
 STEPMAKE_TEMPLATES = install install-out
 
-INSTALLATION_DIR = $(local_lilypond_datadir)/tex/
+INSTALLATION_DIR = $(local_lilypond_datadir)/tex
 INSTALLATION_FILES = $(TEX_FILES)
 
 include $(depth)/make/stepmake.make