]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' into translation
authorJean-Charles Malahieude <lilyfan@orange.fr>
Sat, 17 Sep 2016 14:05:08 +0000 (16:05 +0200)
committerJean-Charles Malahieude <lilyfan@orange.fr>
Sat, 17 Sep 2016 14:05:08 +0000 (16:05 +0200)
53 files changed:
Documentation/changes.tely
Documentation/contributor/programming-work.itexi
Documentation/extending/scheme-tutorial.itely
Documentation/notation/editorial.itely
Documentation/notation/expressive.itely
Documentation/notation/pitches.itely
Documentation/notation/simultaneous.itely
Documentation/notation/text.itely
Documentation/snippets/new/using-marklines-in-a-frenched-score.ly [new file with mode: 0644]
Documentation/web/news-front.itexi
Documentation/web/news.itexi
VERSION
flower/include/offset.hh
flower/offset.cc
input/regression/remove-layer-symbol.ly [new file with mode: 0644]
input/regression/retrograde.ly [new file with mode: 0644]
input/regression/scheme-text-spanner.ly
input/regression/tablature-micro-tone.ly
lily/arpeggio.cc
lily/beam.cc
lily/bezier.cc
lily/fingering-column.cc
lily/grob.cc
lily/hara-kiri-group-spanner.cc
lily/include/bezier.hh
lily/include/grob.hh
lily/include/slur-engraver.hh
lily/keep-alive-together-engraver.cc
lily/line-interface.cc
lily/lookup.cc
lily/parser.yy
lily/side-position-interface.cc
lily/slur-configuration.cc
lily/slur-engraver.cc
lily/slur-scoring.cc
lily/stencil-integral.cc
lily/stencil-scheme.cc
lily/stencil.cc
lily/tuplet-bracket.cc
ly/Welcome-to-LilyPond-MacOS.ly
ly/Welcome_to_LilyPond.ly
ly/grace-init.ly
ly/music-functions-init.ly
ly/spanners-init.ly
po/lilypond.pot
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/define-music-properties.scm
scm/define-music-types.scm
scm/lily-library.scm
scm/modal-transforms.scm
scm/output-ps.scm
scm/translation-functions.scm

index fb1a77f6331bf83b72dc992a31a1bf3a05c7ecdc..c9315d59da68d24aa633bbc5c0e0fa2c70039d3c 100644 (file)
@@ -61,6 +61,25 @@ which scares away people.
 
 @end ignore
 
+@item
+Slurs and phrasing slurs may now be started from individual notes
+in a chord.  Several simultanous slurs per @code{Voice} need to be
+distinguished by @code{spanner-id} setting.
+
+@item
+The music and grob property @code{spanner-id} for distinguishing
+simultaneous slurs and phrasing slurs has been changed from a
+string to a @q{key}, a non-negative integer or symbol.
+
+@item
+There is a new command @code{\=} for specifying the
+@code{spanner-id} for simultaneous slurs and phrasing slurs.
+@lilypond[verbatim,quote]
+\fixed c' {
+  <c~ f\=1( g\=2( >2 <c e\=1) a\=2) >
+}
+@end lilypond
+
 @item
 Blocks introduced with @code{\header} can be stored in variables
 and used as arguments to music and scheme functions and as the
index 4b0b43dad40dfb5be89b17fe4c7f87e3d5dcdef0..d13b68099c00bee6e6cdf177b4276577a4b06196 100644 (file)
@@ -367,40 +367,35 @@ If you like using font-lock, you can also add this to your
 @end example
 
 
-@subheading Indenting with vim
-
-Although emacs indentation is the GNU standard, acceptable
-indentation can usually be accomplished with vim.  Some hints for
-vim are as follows:
-
-A workable .vimrc:
-
-@example
-set cindent
-set smartindent
-set autoindent
-set expandtab
-set softtabstop=2
-set shiftwidth=2
-filetype plugin indent on
-set incsearch
-set ignorecase smartcase
-set hlsearch
-set confirm
-set statusline=%F%m%r%h%w\ %@{&ff@}\ %Y\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ %04l,%04v\ %p%%\ [LEN=%L]
-set laststatus=2
-set number
-" Remove trailing whitespace on write
+@subsubheading Indenting with vim
+
+Although emacs indentation is the GNU standard, correct
+indentation for C++ files can be achieved by using the settings
+recommended in the
+@url{https://gcc.gnu.org/wiki/FormattingCodeForGCC, GNU GCC Wiki}.
+Save the following in @file{~/.vim/after/ftplugin/cpp.vim}:
+
+@example
+setlocal cindent
+setlocal cinoptions=>4,n-2,@{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
+setlocal shiftwidth=2
+setlocal softtabstop=2
+setlocal textwidth=79
+setlocal fo-=ro fo+=cql
+" use spaces instead of tabs
+setlocal expandtab
+" remove trailing whitespace on write
 autocmd BufWritePre * :%s/\s\+$//e
 @end example
 
-With this @file{.vimrc}, files can be reindented automatically by
+With these settings, files can be reindented automatically by
 highlighting the lines to be indented in visual mode (use V to
-enter visual mode) and pressing @code{=}.
+enter visual mode) and pressing @code{=}, or a single line
+correctly indented in normal mode by pressing @code{==}.
 
-A @file{scheme.vim} file will help improve the indentation.  This
-one was suggested by Patrick McCarty.  It should be saved in
-@file{~/.vim/after/syntax/scheme.vim}.
+A @file{scheme.vim} file will help improve the indentation of
+Scheme code.  This one was suggested by Patrick McCarty.  It
+should be saved in @file{~/.vim/after/syntax/scheme.vim}.
 
 @example
 " Additional Guile-specific 'forms'
@@ -417,24 +412,45 @@ syn keyword schemeSyntax define-safe-public define-music-function
 syn keyword schemeSyntax def-grace-function
 
 " All of the above should influence indenting too
-set lw+=define-public,define*-public
-set lw+=define*,lambda*,let-keywords*
-set lw+=defmacro,defmacro*,define-macro
-set lw+=defmacro-public,defmacro*-public
-set lw+=use-modules,define-module
-set lw+=define-method,define-class
-set lw+=define-markup-command,define-markup-list-command
-set lw+=define-safe-public,define-music-function
-set lw+=def-grace-function
+setlocal lw+=define-public,define*-public
+setlocal lw+=define*,lambda*,let-keywords*
+setlocal lw+=defmacro,defmacro*,define-macro
+setlocal lw+=defmacro-public,defmacro*-public
+setlocal lw+=use-modules,define-module
+setlocal lw+=define-method,define-class
+setlocal lw+=define-markup-command,define-markup-list-command
+setlocal lw+=define-safe-public,define-music-function
+setlocal lw+=def-grace-function
 
 " These forms should not influence indenting
-set lw-=if
-set lw-=set!
+setlocal lw-=if
+setlocal lw-=set!
 
 " Try to highlight all ly: procedures
 syn match schemeFunc "ly:[^) ]\+"
 @end example
 
+For documentation work on texinfo files, identify the file
+extensions used as texinfo files in your @file{.vim/filetype.vim}:
+
+@example
+if exists("did_load_filetypes")
+  finish
+endif
+augroup filetypedetect
+  au! BufRead,BufNewFile *.itely setfiletype texinfo
+  au! BufRead,BufNewFile *.itexi setfiletype texinfo
+  au! BufRead,BufNewFile *.tely  setfiletype texinfo
+augroup END
+@end example
+
+and add these settings in @file{.vim/after/ftplugin/texinfo.vim}:
+
+@example
+setlocal expandtab
+setlocal shiftwidth=2
+setlocal textwidth=66
+@end example
 
 @node Naming conventions
 @subsection Naming Conventions
@@ -1742,11 +1758,29 @@ Acknowledge functions are called in the order engravers are
 @code{\consist}-ed (the only exception is if you set
 @code{must-be-last} to @code{#t}).
 
-If useful things are to be done to the acknowledged grobs, this
-should be deferred until all the acknowledging has finished, i.e.,
-store the acknowledged grobs and process the information in a
-@code{process-acknowledged ()} or @code{stop-translation-timestep ()} 
-function.
+There will always be a call to @code{process-acknowledged ()} whenever
+grobs have been created, and @emph{reading} stuff from grobs should be
+delayed until then since other acknowledgers might @emph{write} stuff
+into a grob even after your acknowledger has been called.  So the basic
+workflow is to use the various acknowledgers to @emph{record} the grobs
+you are interested in and @emph{write} stuff into them (or do read/write
+stuff that more or less is accumulative and/or really unrelated to other
+engravers), and then use the @code{process-acknowledged ()} hook for
+processing (including @emph{reading}) the grobs you had recorded.
+
+You can create new grobs in @code{process-acknowledged ()}.  That will lead
+to a new cycle of @code{acknowledger ()} calls followed by a new cycle of
+@code{process-acknowledged ()} calls.
+
+Only when all those cycles are over is @code{stop-translator-timestep ()}
+called, and then creating grobs is no longer an option.  You can still
+@q{process} parts of the grob there (if that means just reading out
+properties and possibly setting context properties based on them) but
+@code{stop-translation-timestep ()} is a cleanup hook, and other engravers
+might have already cleaned up stuff you might have wanted to use.
+Creating grobs in there is not possible since engravers and other code may
+no longer be in a state where they could process them, possibly causing
+a crash.
 
 
 @node Engraver declaration/documentation
index fd0beaa9e19c17ac4e7f62f0ba923dd23fed84e7..5984c4f038c926d962627ef67aafb5b6cf1e886f 100644 (file)
@@ -777,17 +777,28 @@ twentyFour = #(* 2 twelve)
 @end example
 
 @noindent
-which would result in the number 24 being stored in the
-LilyPond (and Scheme) variable @code{twentyFour}.
-
-The usual way to refer to LilyPond variables is to call them using a
-backslash, i.e., @code{\twentyFour} (see @ref{LilyPond Scheme syntax}).
-Since this creates a copy of the value for most of LilyPond's internal
-types, in particular music expressions, music functions don't usually
-create copies of material they change.  For this reason, music
-expressions given with @code{#} should usually not contain material that
-is not either created from scratch or explicitly copied rather than
-directly referenced.
+which would result in the number @emph{24} being stored in the LilyPond
+(and Scheme) variable @code{twentyFour}.
+
+Scheme allows modifying complex expressions in-place and LilyPond makes
+use of this @q{in-place modification} when using music functions.  But
+when music expressions are stored in variables rather than entered
+directly the usual expectation, when passing them to music functions,
+would be that the original value is unmodified.  So when referencing a
+music variable with leading backslash (such as @code{\twentyFour}),
+LilyPond creates a copy of that variable's music value for use in the
+surrounding music expression rather than using the variable's value
+directly.
+
+Therefore, Scheme music expressions written with the @code{#} syntax
+should be used for material that is created @q{from scratch} (or that is
+explicitly copied) rather than being used, instead, to directly
+reference material.
+
+@seealso
+Extending:
+@ref{LilyPond Scheme syntax}.
+
 
 @node Input variables and Scheme
 @subsection Input variables and Scheme
index 73e5ffbecea4376c0928fc5e407b2bd581d87bba..b1fbb8b1c938966009c9674d6aaf75ed133dc19c 100644 (file)
@@ -270,7 +270,7 @@ The following shorthand commands are also available:
 Font size changes are achieved by scaling the design size that is
 closest to the desired size.  The standard font size (for
 @w{@code{font-size = 0}}) depends on the standard staff height.
-For a 20pt staff, a 11pt font is selected.
+For a 20pt staff, an 11pt font is selected.
 
 
 @predefined
index 60f0cc66c0413989d6ca9a6b5f119ed4612dd531..3c249389c28c65c8040d2382f83e84606ad286f2 100644 (file)
@@ -304,7 +304,7 @@ or @notation{decrescendo} mark, it will end at the centre of the note
 that has the next @code{\<} or @code{\>} assigned to it.  The next
 hairpin will then start at the right edge of the same note
 instead of the usual left edge had it been terminated with @code{\!}
-before.
+before.  A hairpin ending on a downbeat will stop at the preceding bar line.
 
 @lilypond[verbatim,quote]
 \relative {
@@ -446,6 +446,8 @@ items such as text scripts, text spanners, and piano pedal marks.
 
 @snippets
 
+@cindex hairpins at bar lines
+
 @lilypondfile[verbatim,quote,texidoc,doctitle]
 {setting-hairpin-behavior-at-bar-lines.ly}
 
@@ -683,7 +685,8 @@ occurences of outer slurs actually indicate phrasing, and phrasing
 slurs may overlap a regular slur, see @ref{Phrasing slurs}.  When
 multiple regular slurs are needed in a single @code{Voice},
 matching slur starts and ends need to be labelled by preceding
-them with @code{\=} followed by an identifying number or string.
+them with @code{\=} followed by an identifying key (a symbol or
+non-negative integer).
 
 @lilypond[verbatim,quote]
 \fixed c' {
index 0699239db55b6e8bdc52a3add4b21dd39d3d926a..bfed32447e5973ffef0423218042c03ef0273269 100644 (file)
@@ -903,9 +903,14 @@ music = \relative { c'8. ees16( fis8. a16 b8.) gis16 f8. d16 }
 @end lilypond
 
 @knownissues
-Manual ties inside @code{\retrograde} will be broken and
-generate warnings.  Some ties can be generated automatically
-by enabling @ref{Automatic note splitting}.
+@code{\retrograde} is a rather simple tool.  Since many events are
+@q{mirrored} rather than exchanged, tweaks and directional
+modifiers for opening spanners need to be added at the matching
+closing spanners: @code{^(} needs to be ended by @code{^)}, every
+@code{\<} or @code{\cresc} needs to be ended by @code{\!} or
+@code{\endcr}, every @code{\>} or @code{\decr} needs to be ended
+by @code{\enddecr}.  Property-changing commands/overrides with a
+lasting effect will likely cause surprises.
 
 @seealso
 Notation Reference:
index fc31736c09cb38e15662f02dbb2765830b97dde2..d9c7fb42d44056798d5ab8ca970a8809d2e8be90 100644 (file)
@@ -559,8 +559,8 @@ upstems, and the even-numbered voices are given downstems:
 >>
 @end lilypond
 
-@warning{Lyrics, spanners (such as slurs, ties, hairpins, etc.) cannot be
-created @q{across} voices.}
+@warning{Lyrics and spanners (such as slurs, ties, hairpins, etc.) cannot
+be created @q{across} voices.}
 
 @subsubsubheading Identical rhythms
 
index 22471b86b312c810b548bfe507144a6fccbb7934..4d1f44a4e4a1cf1fb4df866531f0dedb73815c8c 100644 (file)
@@ -121,7 +121,7 @@ Internals Reference:
 
 @knownissues
 Checking to make sure that text scripts and lyrics are within the
-margins requires additonal calculations. In cases where slightly faster
+margins requires additional calculations. In cases where slightly faster
 performance is desired, use
 
 @example
@@ -505,7 +505,7 @@ Installed Files:
 @file{scm/markup.scm}.
 
 @knownissues
-Syntax errors for markup mode can be confusing.
+Syntax error messages for markup mode can be confusing.
 
 
 @node Selecting font and font size
@@ -543,9 +543,9 @@ Basic font switching is supported in markup mode:
 @funindex \magnify
 
 The font size can be altered, relative to the global staff size, in a
-number of different ways
+number of different ways.
 
-It can be set to predefined size,
+It can be set to predefined size.
 
 @lilypond[quote,verbatim]
 \relative b' {
@@ -555,7 +555,7 @@ It can be set to predefined size,
 }
 @end lilypond
 
-It can be set relative to its previous value,
+It can be set relative to its previous value.
 
 @lilypond[quote,verbatim]
 \relative b' {
@@ -566,7 +566,7 @@ It can be set relative to its previous value,
 @end lilypond
 
 It can be increased or decreased relative to the value set by the
-global staff size,
+global staff size.
 
 @lilypond[quote,verbatim]
 \relative b' {
@@ -577,7 +577,7 @@ global staff size,
 @end lilypond
 
 It can also be set to a fixed point-size, regardless of the global staff
-size,
+size.
 
 @lilypond[quote,verbatim]
 \relative b' {
diff --git a/Documentation/snippets/new/using-marklines-in-a-frenched-score.ly b/Documentation/snippets/new/using-marklines-in-a-frenched-score.ly
new file mode 100644 (file)
index 0000000..0fdefc9
--- /dev/null
@@ -0,0 +1,97 @@
+\version "2.19.48"
+\header {
+  lsrtags = "contexts-and-engravers, staff-notation"
+  texidoc = "
+Using @{MarkLine} contexts (such as in
+@uref{http://lsr.di.unimi.it/LSR/Item?id=1010, LSR1010}) in a
+Frenched score can be problematic if all the staves between two
+@code{MarkLine}s are removed in one system. The
+@code{Keep_alive_together_engraver} can be used within each
+@code{StaffGroup} to keep the @code{MarkLine} alive only as long
+as the other staves in the group stay alive.
+"
+  doctitle = "Using marklines in a Frenched score"
+}
+bars = {
+  \tempo "Allegro" 4=120
+  s1*2
+  \repeat unfold 5 { \mark \default s1*2 }
+  \bar "||"
+  \tempo "Adagio" 4=40
+  s1*2
+  \repeat unfold 8 { \mark \default s1*2 }
+  \bar "|."
+}
+winds = \repeat unfold 120 { c''4 }
+trumpet = { \repeat unfold 8 g'2 R1*16 \repeat unfold 4 g'2 R1*8 }
+trombone = { \repeat unfold 4 c'1 R1*8 d'1 R1*17 }
+strings = \repeat unfold 240 { c''8 }
+
+#(set-global-staff-size 16)
+\paper {
+  systems-per-page = 5
+  ragged-last-bottom = ##f
+}
+
+\layout {
+  indent = 15\mm
+  short-indent = 5\mm
+  \context {
+    \name MarkLine
+    \type Engraver_group
+    \consists Output_property_engraver
+    \consists Axis_group_engraver
+    \consists Mark_engraver
+    \consists Metronome_mark_engraver
+    \override VerticalAxisGroup.remove-empty = ##t
+    \override VerticalAxisGroup.remove-layer = #'any
+    \override VerticalAxisGroup.staff-affinity = #DOWN
+    \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.basic-distance = 1
+    keepAliveInterfaces = #'()
+  }
+  \context {
+    \Staff
+    \override VerticalAxisGroup.remove-empty = ##t
+    \override VerticalAxisGroup.remove-layer = ##f
+  }
+  \context {
+    \StaffGroup
+    \accepts MarkLine
+    \consists Keep_alive_together_engraver
+  }
+  \context {
+    \Score
+    \remove Mark_engraver
+    \remove Metronome_mark_engraver
+  }
+}
+
+\score {
+  <<
+    \new StaffGroup = "winds" \with {
+      instrumentName = "Winds"
+      shortInstrumentName = "Winds"
+    } <<
+      \new MarkLine \bars
+      \new Staff \winds
+    >>
+    \new StaffGroup = "brass" <<
+      \new MarkLine \bars
+      \new Staff = "trumpet" \with {
+        instrumentName = "Trumpet"
+        shortInstrumentName = "Tpt"
+      } \trumpet
+      \new Staff = "trombone" \with {
+        instrumentName = "Trombone"
+        shortInstrumentName = "Tbn"
+      } \trombone
+    >>
+    \new StaffGroup = "strings" \with {
+      instrumentName = "Strings"
+      shortInstrumentName = "Strings"
+    } <<
+      \new MarkLine \bars
+      \new Staff = "strings" { \strings }
+    >>
+  >>
+}
index 69d6fb2dfcae59ead13bdf6e53c186b243d92c35..d9a715518bac1898db74ce6cad20bbf566a486ec 100644 (file)
@@ -9,10 +9,10 @@
 @c used for news about the upcoming release; see CG 10.2
 
 @newsItem
-@subheading LilyPond 2.19.46 released  @emph{July 26, 2016}
+@subheading LilyPond 2.19.48 released  @emph{September 13, 2016}
 
 We are happy to announce the release of LilyPond
-2.19.46.  This release includes a number of enhancements, and contains some
+2.19.48.  This release includes a number of enhancements, and contains some
 work in progress.  You will have access to the very latest features, but
 some may be incomplete, and you may encounter bugs and crashes.  If you
 require a stable version of LilyPond, we recommend using the 2.18
index dfff7af3d01df37e60a400edc4af3e49ce8bbcb4..990d92ceaa87d5f905d15fa7435a245528693fbb 100644 (file)
@@ -26,6 +26,30 @@ NOTE:
   * don't duplicate entries from news-front.itexi
 @end ignore
 
+@newsItem
+@subheading LilyPond 2.19.47 released  @emph{August 31, 2016}
+
+We are happy to announce the release of LilyPond
+2.19.47.  This release includes a number of enhancements, and contains some
+work in progress.  You will have access to the very latest features, but
+some may be incomplete, and you may encounter bugs and crashes.  If you
+require a stable version of LilyPond, we recommend using the 2.18
+version.
+
+@newsEnd
+
+@newsItem
+@subheading LilyPond 2.19.46 released  @emph{July 26, 2016}
+
+We are happy to announce the release of LilyPond
+2.19.46.  This release includes a number of enhancements, and contains some
+work in progress.  You will have access to the very latest features, but
+some may be incomplete, and you may encounter bugs and crashes.  If you
+require a stable version of LilyPond, we recommend using the 2.18
+version.
+
+@newsEnd
+
 @newsItem
 @subheading LilyPond 2.19.45 released  @emph{July 09, 2016}
 
diff --git a/VERSION b/VERSION
index 1b58b2ee855a45a009698abb451e899ab7f43df1..1fc82d22bb84fbe14b7f7e96aa8f4eacd9dce3e7 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=19
-PATCH_LEVEL=47
+PATCH_LEVEL=49
 MY_PATCH_LEVEL=
 VERSION_STABLE=2.18.2
-VERSION_DEVEL=2.19.46
+VERSION_DEVEL=2.19.48
index 8f395398b75e2768d31f476737142502c3a7eedd..a8c5987801069b01790b545b4a12db4c70923bfc 100644 (file)
@@ -111,7 +111,6 @@ public:
   Offset direction () const;
   Offset swapped () const;
 
-  Real arg () const;
   Real angle_degrees () const;
   Real length () const;
   bool is_sane () const;
@@ -124,8 +123,7 @@ IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -);
 IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *);
 
 Offset complex_multiply (Offset, Offset);
-Offset complex_divide (Offset, Offset);
-Offset complex_exp (Offset);
+Offset offset_directed (Real);
 
 inline Offset
 Offset::operator *= (Offset z2)
index 7cb267748190bf372c91a4ae08c122df676144a0..db1654f2d3d517f0ef29b90a3d8750353f0a89d5 100644 (file)
@@ -46,44 +46,67 @@ complex_multiply (Offset z1, Offset z2)
   return z;
 }
 
-Offset
-complex_conjugate (Offset o)
-{
-  o[Y_AXIS] = -o[Y_AXIS];
-  return o;
-}
-
-Offset
-complex_divide (Offset z1, Offset z2)
-{
-  z2 = complex_conjugate (z2);
-  Offset z = complex_multiply (z1, z2);
-  z *= 1 / z2.length ();
-  return z;
-}
-
-Offset
-complex_exp (Offset o)
-{
-  Real s = sin (o[Y_AXIS]);
-  Real c = cos (o[Y_AXIS]);
-
-  Real r = exp (o[X_AXIS]);
-
-  return Offset (r * c, r * s);
-}
-
-Real
-Offset::arg () const
+static inline Real
+atan2d (Real y, Real x)
 {
-  return atan2 (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]);
+  return atan2 (y, x) * (180.0 / M_PI);
 }
 
 Real
 Offset::angle_degrees () const
 {
-  return arg () * 180 / M_PI;
+  Real x = coordinate_a_ [X_AXIS];
+  Real y = coordinate_a_ [Y_AXIS];
+
+  // We keep in the vicinity of multiples of 45 degrees here: this is
+  // where straightforward angles for straightforward angular
+  // relations are most expected.  The factors of 2 employed in the
+  // comparison are not really perfect for that: sqrt(2)+1 would be
+  // the factor giving exact windows of 45 degrees rather than what we
+  // have here.  It's just that 2 is likely to generate nicer code
+  // than 2.4 and the exact handover does not really matter.
+  //
+  // Comparisons here are chosen appropriately to let infinities end
+  // up in their "exact" branch.  As opposed to the normal atan2
+  // function behavior, this makes "competing" infinities result in
+  // NAN angles.
+  if (y < 0.0)
+    {
+      if (2*x < -y)
+        if (-x > -2*y)          // x < 0, y < 0, |x| > |2y|
+          return -180 + atan2d (-y, -x);
+        else if (-2*x >= -y)    // x < 0, y < 0, |y| < |2x| <= |4y|
+          return -135 + atan2d (x - y, -y - x);
+        else                    // y < 0, |y| >= |2x|
+          return -90 + atan2d (x, -y);
+      else if (x <= -2*y)       // x > 0, y < 0, |y| <= |2x| < |4y|
+        return -45 + atan2d (x + y, x - y);
+      // Drop through for y < 0, x > |2y|
+    }
+  else if (y > 0.0)
+    {
+      if (2*x < y)
+        if (-x > 2*y)           // x < 0, y >= 0, |x| > |2y|
+          return 180 - atan2d (y, -x);
+        else if (-2*x >= y)     // x < 0, y >= 0, |y| < |2x| <= |4y|
+          return 135 - atan2d (x + y, y - x);
+        else                    // y >= 0, |y| >= |2x|
+          return 90 - atan2d (x, y);
+      else if (x <= 2*y)        // x >= 0, y >= 0, |y| < |2x| < |4y|
+        return 45 - atan2d (x - y, x + y);
+      // Drop through for y > 0, x > |2y|
+    }
+  else
+    // we return 0 for (0,0).  NAN would be an option but is a
+    // nuisance for getting back to rectangular coordinates.  Strictly
+    // speaking, this argument would be just as valid for (+inf.0,
+    // +inf.0), but then infinities are already an indication of a
+    // problem in LilyPond.
+    return (x < 0.0) ? 180 : 0;
+  return atan2d (y, x);
 }
+
+
 /**
    euclidian vector length / complex modulus
 */
@@ -126,3 +149,39 @@ Offset::swapped () const
 {
   return Offset (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]);
 }
+
+Offset
+offset_directed (Real angle)
+{
+  if (angle <= -360.0 || angle >= 360.0)
+    angle = fmod (angle, 360.0);
+  // Now |angle| < 360.0, and the absolute size is not larger than
+  // before, so we haven't lost precision.
+  if (angle <= -180.0)
+    angle += 360.0;
+  else if (angle > 180.0)
+    angle -= 360.0;
+  // Now -180.0 < angle <= 180.0 and we still haven't lost precision.
+  // We don't work with angles greater than 45 degrees absolute in
+  // order to minimize how rounding errors of M_PI/180 affect the
+  // result.  That way, at least angles that are a multiple of 90
+  // degree deliver the expected results.
+  //
+  // Sign of the sine is chosen to avoid -0.0 in results.  This
+  // version delivers exactly equal magnitude on x/y for odd multiples
+  // of 45 degrees at the cost of losing some less obvious invariants.
+
+  if (angle > 0)
+    if (angle > 90)
+      return Offset (sin ((90 - angle) * M_PI/180.0),
+                     sin ((180 - angle) * M_PI/180.0));
+    else
+      return Offset (sin ((90 - angle) * M_PI/180.0),
+                     sin (angle * M_PI/180.0));
+  else if (angle < -90)
+    return Offset (sin ((90 + angle) * M_PI/180.0),
+                   sin ((-180 - angle) * M_PI/180.0));
+  else
+    return Offset (sin ((90 + angle) * M_PI/180.0),
+                   sin (angle * M_PI/180.0));
+}
diff --git a/input/regression/remove-layer-symbol.ly b/input/regression/remove-layer-symbol.ly
new file mode 100644 (file)
index 0000000..d6fa93d
--- /dev/null
@@ -0,0 +1,65 @@
+\version "2.19.48"
+
+\header {
+  texidoc = "The @code{VerticalAxisGroup.remove-layer} property
+  can be used to keep staves alive with reference to other staves
+  in the @code{Keep_alive_together_engraver} group."
+}
+
+\layout {
+  indent = 40\mm
+  short-indent = 15\mm
+}
+
+\score {
+  <<
+    \new Staff \with {
+      instrumentName = "Continuous"
+      shortInstrumentName = "cont"
+    } { \repeat unfold 104 g'4 \bar "|." }
+    \new StaffGroup \with {
+      \consists Keep_alive_together_engraver
+    } <<
+      \new Staff \with {
+        keepAliveInterfaces = #'()
+        instrumentName = \markup \center-column { "Alive with A or B" }
+        shortInstrumentName = "with A or B"
+        \override VerticalAxisGroup.remove-empty = ##t
+        \override VerticalAxisGroup.remove-first = ##t
+        \override VerticalAxisGroup.remove-layer = #'any
+      } { \repeat unfold 104 c''4 }
+      \new Staff \with {
+        instrumentName = "A"
+        shortInstrumentName = "A"
+        \override VerticalAxisGroup.remove-empty = ##t
+        \override VerticalAxisGroup.remove-first = ##t
+        \override VerticalAxisGroup.remove-layer = ##f
+      } {
+        \repeat unfold 16 c'4
+        R1*4
+        \repeat unfold 16 c'4
+        R1*14
+      }
+      \new Staff \with {
+        keepAliveInterfaces = #'()
+        instrumentName = \markup \center-column { "Alive with A" }
+        shortInstrumentName = "with A"
+        \override VerticalAxisGroup.remove-empty = ##t
+        \override VerticalAxisGroup.remove-first = ##t
+        \override VerticalAxisGroup.remove-layer = #'above
+      } { \repeat unfold 104 c''4 }
+      \new Staff \with {
+        instrumentName = "B"
+        shortInstrumentName = "B"
+        \override VerticalAxisGroup.remove-empty = ##t
+        \override VerticalAxisGroup.remove-first = ##t
+        \override VerticalAxisGroup.remove-layer = ##f
+      } {
+        R1*8
+        \repeat unfold 16 c'4
+        R1*13
+        c'1
+      }
+    >>
+  >>
+}
diff --git a/input/regression/retrograde.ly b/input/regression/retrograde.ly
new file mode 100644 (file)
index 0000000..dd7f7eb
--- /dev/null
@@ -0,0 +1,30 @@
+\version "2.18.0"
+
+\header {
+  texidoc = "@code{\\retrograde} can deal with crescendo and
+  decrescendo as long as they are properly paired with
+  @code{\\endcr}/@code{\\!} and @code{\\enddecr}.  Direction modifiers
+  on slurs like @code{^(} need to be repeated as @code{^)} at the end.
+  Ties and glissandi work mostly (in-chord ties are turned into
+  ordinary per-chord/note ties, however)."
+}
+
+\layout { ragged-right = ##t }
+
+motif =
+\relative {
+  \override TextSpanner.bound-details.left.text = "motif"
+  <c' e>2~\startTextSpan  c16\< d^( e f~ f4:32^)\!\> |
+  <<
+    \context Voice = "voice" {
+      <g~ b>4 g8\glissando f\stopTextSpan\enddecr }
+    \\
+    { c2 }
+  >>
+}
+
+\new Voice = "voice" {
+  \motif
+  \override TextSpanner.bound-details.left.text = "retrograde motif"
+  \retrograde  \motif \bar "|."
+}
index d89a959149739604babe7b16bdd281512247ddc9..d97d215363db1d3f07414365b404e0122d408097 100644 (file)
@@ -68,7 +68,7 @@ in scheme."
      (SchemeTextSpanEvent
       . ((description . "Used to signal where scheme text spanner brackets
 start and stop.")
-         (types . (scheme-text-span-event span-event event))
+         (types . (post-event scheme-text-span-event span-event event))
          ))
      ))
 
index 461dd2f824cbfdeb0d8e8598b895e5ffd00bbb2b..a7f891c048ff65f8a97384c80b8f2caf15c24269 100644 (file)
@@ -8,11 +8,17 @@ in @code{Score}-context.
 @code{FretBoards} will print those micro-tones only if they can be found in the
 chosen settings for @code{stringTunings}, otherwise a warning (surpressed here)
 will be printed and an empty @code{FretBoard} returned.  Which should be the
-case here for the first pitch: @code{gih}"
+case for the last four of the examples pitches.
+Micro-tones assigned to strings work nicely."
 }
 
 #(ly:set-option 'warning-as-error #f)
-#(ly:expect-warning (_ "No string for pitch ~a (given frets ~a)") #{ gih #} '())
+#(for-each
+  (lambda (pitch)
+    (ly:expect-warning (_ "No string for pitch "))
+    (ly:expect-warning (_ "Requested string for pitch requires negative fret"))
+    (ly:expect-warning (_ "Ignoring string request and recalculating.")))
+  (iota 4))
 
 \layout {
   \context {
@@ -24,8 +30,7 @@ case here for the first pitch: @code{gih}"
 custom-tuning = \stringTuning <e, a, d ges beh eeh'>
 
 mus = \relative {
-  gih4
-  eeses'
+  eeses'4
   eeseh
   ees
   eeh
@@ -34,6 +39,10 @@ mus = \relative {
   eis
   eisih
   eisis
+  geseh,,\6
+  geh\6
+  gih\6
+  gisih\6
 }
 
 <<
index 5ba2e59279ec992270fb443d8faaf022ca3eb6b6..95da047a067bd5ced57ba29f53a0a2ee93405bbe 100644 (file)
@@ -215,7 +215,7 @@ Arpeggio::brew_chord_slur (SCM smob)
   Real height_limit = 1.5;
   Real ratio = .33;
   Bezier curve = slur_shape (dy, height_limit, ratio);
-  curve.rotate (M_PI / 2);
+  curve.rotate (90.0);
 
   Stencil mol (Lookup::slur (curve, lt, lt, dash_definition));
   mol.translate_axis (heads[LEFT], Y_AXIS);
index a20530c0f3e0afdbd8adc7aa12a8a8802aa9115c..a50f2904bc0b00e4a497c16c908b13cabf38d96b 100644 (file)
@@ -1280,7 +1280,7 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
 
   Real offset = robust_scm2double (prev_offset, 0.0);
   Interval rest_extent = rest->extent (rest, Y_AXIS);
-  rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS));
+  rest_extent.translate (offset + rest->parent_relative (common_y, Y_AXIS));
 
   Real rest_dim = rest_extent[d];
   Real minimum_distance
index b202d45dd6262f5d52df2590bdc2a93846e68579..eacd4fe6a44e95f224d6a9f4894455198167710a 100644 (file)
@@ -38,9 +38,9 @@ scale (vector<Offset> *array, Real x, Real y)
 }
 
 void
-rotate (vector<Offset> *array, Real phi)
+rotate (vector<Offset> *array, Real deg)
 {
-  Offset rot (complex_exp (Offset (0, phi)));
+  Offset rot (offset_directed (deg));
   for (vsize i = 0; i < array->size (); i++)
     (*array)[i] = complex_multiply (rot, (*array)[i]);
 }
@@ -322,9 +322,9 @@ Bezier::scale (Real x, Real y)
 }
 
 void
-Bezier::rotate (Real phi)
+Bezier::rotate (Real deg)
 {
-  Offset rot (complex_exp (Offset (0, phi)));
+  Offset rot (offset_directed (deg));
   for (int i = 0; i < CONTROL_COUNT; i++)
     control_[i] = complex_multiply (rot, control_[i]);
 }
index c9db28baf93e8bb26ff6810cc28d43770247292e..c069fb7c74c61c8a033c7ec833151c75ffe748a4 100644 (file)
@@ -99,8 +99,7 @@ Fingering_column::do_y_positioning (Grob *me)
         {
           Interval x_ext = fingerings[i]->extent(common[X_AXIS], X_AXIS);
           Interval y_ext = fingerings[i]->extent(fingerings[i], Y_AXIS);
-          Real parent_y = fingerings[i]->get_parent(Y_AXIS)
-                         ->relative_coordinate(common[Y_AXIS], Y_AXIS);
+          Real parent_y = fingerings[i]->parent_relative (common[Y_AXIS], Y_AXIS);
 
           // Checking only between sequential neighbors, seems good enough
           if (!intersection(x_ext, prev_x_ext).is_empty())
index eafa66288efdab93c9ab72bf49a3831c749c24b2..23a1cafae48730885fb7068346750e1f114ec35a 100644 (file)
@@ -338,14 +338,16 @@ Grob::relative_coordinate (Grob const *refp, Axis a) const
 
   /* We catch PARENT_L_ == nil case with this, but we crash if we did
      not ask for the absolute coordinate (ie. REFP == nil.)  */
-  Real off = get_offset (a);
-  if (refp == dim_cache_[a].parent_)
-    return off;
 
-  if (dim_cache_[a].parent_ != NULL)
-    off += dim_cache_[a].parent_->relative_coordinate (refp, a);
+  return get_offset (a) + parent_relative (refp, a);
+}
 
-  return off;
+Real
+Grob::parent_relative (Grob const *refp, Axis a) const
+{
+  if (Grob *p = get_parent (a))
+    return p->relative_coordinate (refp, a);
+  return 0.0;
 }
 
 Real
index 06410786a67fc3e770d4efa56c857b787c0ffed7..76207a5c928abb5dfae0bdb788c063931de21cf2 100644 (file)
@@ -190,9 +190,11 @@ Hara_kiri_group_spanner::add_interesting_item (Grob *me, Grob *n)
 ADD_INTERFACE (Hara_kiri_group_spanner,
                "A group spanner that keeps track of interesting items.  If it"
                " doesn't contain any after line breaking, it removes itself"
-               " and all its children.  Children may be prioritized in layers"
-               " via @code{remove-layer}, in which case only the"
-               " lowest-numbered non-empty layer is retained.",
+               " and all its children.  Greater control can be exercised via"
+               " @code{remove-layer} which can prioritize layers so only the"
+               " lowest-numbered non-empty layer is retained; make the layer"
+               " independent of the group; or make it dependent on any other"
+               " member of the group",
 
                /* properties */
                "items-worth-living "
index 959afc5c4ee32cc2a475d8eadee00eb1cf5ecab5..54acce15fc11b818dbec4801ffbfc3d1fd273dd6 100644 (file)
@@ -62,7 +62,7 @@ public:
 };
 
 void scale (vector<Offset> *array, Real xscale, Real yscale);
-void rotate (vector<Offset> *array, Real phi);
+void rotate (vector<Offset> *array, Real deg);
 void translate (vector<Offset> *array, Offset o);
 
 Bezier slur_shape (Real width, Real height_limit,
index a9408f09a2ac1cbc6beb21a9766526c3d3af5914..5da4dff74ec6107c242754e6c60b2eddefa90848 100644 (file)
@@ -141,6 +141,7 @@ public:
   /* offsets */
   void translate_axis (Real, Axis);
   Real relative_coordinate (Grob const *refp, Axis) const;
+  Real parent_relative (Grob const *refp, Axis) const;
   Real pure_relative_y_coordinate (Grob const *refp, int start, int end);
   Real maybe_pure_coordinate (Grob const *refp, Axis a, bool pure, int start, int end);
 
index 572e7ea02343d2cb2b53538288882ca35e640586..1885625ed91f6d5baca19f3e8f08781f8d35fbf0 100644 (file)
@@ -60,8 +60,8 @@ protected:
   void stop_translation_timestep ();
   void process_music ();
 
-  bool can_create_slur (const string&, vsize, vsize *, Stream_event *);
-  void create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken);
+  bool can_create_slur (SCM, vsize, vsize *, Stream_event *);
+  void create_slur (SCM spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken);
   bool try_to_end (Event_info evi);
 
   virtual void set_melisma (bool);
index 9b1cbe4a23a412b95cb8797e6f7dd8fdc7656704..8931a819c6ff45150ccb229fdec3d06b8c457426 100644 (file)
@@ -22,6 +22,7 @@
 #include "engraver.hh"
 #include "grob.hh"
 #include "grob-array.hh"
+#include "international.hh"
 
 #include "translator.icc"
 
@@ -64,12 +65,44 @@ Keep_alive_together_engraver::finalize ()
         {
           if (i == j)
             continue;
+
+          if (scm_is_symbol (this_layer))
+            {
+              if (scm_is_eq (this_layer, ly_symbol2scm ("any")))
+                {
+                  // layer is kept alive by any other layer
+                  live->add (group_spanners_[j]);
+                  continue;
+                }
+              else if (scm_is_eq (this_layer, ly_symbol2scm ("above")))
+                {
+                  // layer is kept alive by the layer preceding it
+                  if (i == j + 1)
+                    live->add (group_spanners_[j]);
+                  continue;
+                }
+              else if (scm_is_eq (this_layer, ly_symbol2scm ("below")))
+                {
+                  // layer is kept alive by the layer following it
+                  if (i == j - 1)
+                    live->add (group_spanners_[j]);
+                  continue;
+                }
+              else
+                {
+                  group_spanners_[i]->warning (_f ("unknown remove-layer value `%s'",
+                                                   ly_symbol2string (this_layer).c_str ()));
+                  continue;
+                }
+            }
+
           SCM that_layer = group_spanners_[j]->get_property ("remove-layer");
+
           if (scm_is_false (that_layer))
             continue;
           if (!scm_is_integer (this_layer))
             {
-              // Unspecified layers are kept alive by anything else
+              // unset layers are kept alive by all but ignored layers
               live->add (group_spanners_[j]);
               continue;
             }
index f23b58e3084be45de601b5b04f771cf2fb4b3aab..bc0895339fea3c996e08a71891c0090cbea2e96c 100644 (file)
@@ -70,7 +70,7 @@ Line_interface::make_trill_line (Grob *me,
     }
   while (len + elt_len < dz.length ());
 
-  line.rotate (dz.arg (), Offset (LEFT, CENTER));
+  line.rotate (dz.angle_degrees (), Offset (LEFT, CENTER));
   line.translate (from);
 
   return line;
index 3e592516c588bc765cdfe451931bd56da2122e8b..d7b6b8d26e9bc81c5eada2ab7911128c1de26a2d 100644 (file)
@@ -417,9 +417,9 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
       calculate the offset for the two beziers that make the sandwich
       for the slur
   */
-  Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
+  Offset dir = (curve.control_[3] - curve.control_[0]).direction ();
   Bezier back = curve;
-  Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI / 2)) * 0.5;
+  Offset perp = 0.5 * curvethick * Offset (-dir[Y_AXIS], dir[X_AXIS]);
   back.control_[1] += perp;
   back.control_[2] += perp;
 
index 159786b93c1dbc13268e72140f1cf7a485996177..83e95491c292f82fb79d4a3439c0947806d86bc5 100644 (file)
@@ -229,7 +229,7 @@ static Music *make_music_with_input (SCM name, Input where);
 SCM check_scheme_arg (Lily_parser *parser, Input loc,
                      SCM arg, SCM args, SCM pred, SCM disp = SCM_UNDEFINED);
 SCM make_music_from_simple (Lily_parser *parser, Input loc, SCM pitch);
-SCM loc_on_music (Lily_parser *parser, Input loc, SCM arg);
+SCM loc_on_copy (Lily_parser *parser, Input loc, SCM arg);
 SCM make_chord_elements (Input loc, SCM pitch, SCM dur, SCM modification_list);
 SCM make_chord_step (SCM step, Rational alter);
 SCM make_simple_markup (SCM a);
@@ -500,8 +500,8 @@ lookup:
        LOOKUP_IDENTIFIER
        | LOOKUP_IDENTIFIER '.' symbol_list_rev
        {
-               $$ = loc_on_music (parser, @$,
-                                  nested_property ($1, scm_reverse_x ($3, SCM_EOL)));
+               $$ = loc_on_copy (parser, @$,
+                                 nested_property ($1, scm_reverse_x ($3, SCM_EOL)));
        }
        ;
 
@@ -1992,7 +1992,7 @@ function_arglist_backup:
                                $$ = scm_cons ($$, $3);
                        else
                        {
-                               $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                               $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                                MYBACKUP (SCM_ARG, $4, @4);
                        }
                }
@@ -2003,7 +2003,7 @@ function_arglist_backup:
                {
                        $$ = scm_cons ($4, $3);
                } else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (EVENT_IDENTIFIER, $4, @4);
                }
        }
@@ -2019,7 +2019,7 @@ function_arglist_backup:
                } else if (scm_is_true (scm_call_1 ($2, $4)))
                        $$ = scm_cons ($4, $3);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (PITCH_IDENTIFIER, $4, @4);
                }
        }
@@ -2035,7 +2035,7 @@ function_arglist_backup:
                } else if (scm_is_true (scm_call_1 ($2, $4)))
                        $$ = scm_cons ($4, $3);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (TONICNAME_PITCH, $4, @4);
                }
        }
@@ -2044,7 +2044,7 @@ function_arglist_backup:
                if (scm_is_true (scm_call_1 ($2, $4)))
                        $$ = scm_cons ($4, $3);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (SCM_IDENTIFIER, $4, @4);
                }
        }
@@ -2066,11 +2066,11 @@ function_arglist_backup:
                                          ($2, make_music_from_simple (parser, @4, d))))
                                        MYREPARSE (@4, $2, DURATION_ARG, d);
                                else {
-                                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                                        MYBACKUP (UNSIGNED, $4, @4);
                                }
                        } else {
-                               $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                               $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                                MYBACKUP (UNSIGNED, $4, @4);
                        }
                }
@@ -2082,7 +2082,7 @@ function_arglist_backup:
                        $$ = $3;
                        MYREPARSE (@4, $2, REAL, $4);
                } else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (REAL, $4, @4);
                }
        }
@@ -2092,7 +2092,7 @@ function_arglist_backup:
                {
                        $$ = scm_cons ($4, $3);
                } else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (NUMBER_IDENTIFIER, $4, @4);
                }
        }
@@ -2109,7 +2109,7 @@ function_arglist_backup:
                        if (scm_is_true (scm_call_1 ($2, $$)))
                                $$ = scm_cons ($$, $3);
                        else {
-                               $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                               $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                                MYBACKUP (UNSIGNED, $5, @5);
                                parser->lexer_->push_extra_token (@4, '-');
                        }
@@ -2122,7 +2122,7 @@ function_arglist_backup:
                        MYREPARSE (@5, $2, REAL, n);
                        $$ = $3;
                } else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (REAL, n, @5);
                }
        }
@@ -2132,7 +2132,7 @@ function_arglist_backup:
                if (scm_is_true (scm_call_1 ($2, n))) {
                        $$ = scm_cons (n, $3);
                } else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (NUMBER_IDENTIFIER, n, @5);
                }
        }
@@ -2146,7 +2146,7 @@ function_arglist_backup:
                          ($2, make_music_from_simple (parser, @4, $4))))
                        MYREPARSE (@4, $2, DURATION_ARG, $4);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (DURATION_IDENTIFIER, $4, @4);
                }
        }
@@ -2161,7 +2161,7 @@ function_arglist_backup:
                        else
                                $$ = scm_cons (res, $3);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (SCM_IDENTIFIER, $4, @4);
                }
        }
@@ -2176,7 +2176,7 @@ function_arglist_backup:
                        else
                                $$ = scm_cons (res, $3);
                else {
-                       $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+                       $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
                        MYBACKUP (STRING, $4, @4);
                }
        }
@@ -2215,7 +2215,7 @@ function_arglist:
        function_arglist_nonbackup
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup DEFAULT
        {
-               $$ = scm_cons (loc_on_music (parser, @4, $1), $3);
+               $$ = scm_cons (loc_on_copy (parser, @4, $1), $3);
        }
        ;
 
@@ -2223,7 +2223,7 @@ function_arglist_skip_nonbackup:
        function_arglist_nonbackup
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup
        {
-               $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+               $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
        }
        ;
 
@@ -2483,7 +2483,7 @@ function_arglist_optional:
        function_arglist_backup
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_backup DEFAULT
        {
-               $$ = scm_cons (loc_on_music (parser, @4, $1), $3);
+               $$ = scm_cons (loc_on_copy (parser, @4, $1), $3);
        }
        | function_arglist_skip_backup BACKUP
        ;
@@ -2492,7 +2492,7 @@ function_arglist_skip_backup:
        function_arglist_backup
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_backup
        {
-               $$ = scm_cons (loc_on_music (parser, @3, $1), $3);
+               $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
        }
        ;
 
@@ -4146,7 +4146,7 @@ SCM check_scheme_arg (Lily_parser *parser, Input loc,
        return args;
 }
 
-SCM loc_on_music (Lily_parser *parser, Input loc, SCM arg)
+SCM loc_on_copy (Lily_parser *parser, Input loc, SCM arg)
 {
        if (Music *m = unsmob<Music> (arg))
        {
@@ -4154,6 +4154,34 @@ SCM loc_on_music (Lily_parser *parser, Input loc, SCM arg)
                m->set_spot (parser->lexer_->override_input (loc));
                return m->unprotect ();
        }
+       if (Book *b = unsmob<Book> (arg))
+       {
+               b = b->clone ();
+               b->origin ()->set_spot (parser->lexer_->override_input (loc));
+               return b->unprotect ();
+       }
+       if (Context_def *cd = unsmob<Context_def> (arg))
+       {
+               cd = cd->clone ();
+               cd->origin ()->set_spot (parser->lexer_->override_input (loc));
+               return cd->unprotect ();
+       }
+       if (Output_def *od = unsmob<Output_def> (arg))
+       {
+               od = od->clone ();
+               od->input_origin_ = parser->lexer_->override_input (loc);
+               return od->unprotect ();
+       }
+       if (Score *s = unsmob<Score> (arg))
+       {
+               s = s->clone ();
+               s->origin ()->set_spot (parser->lexer_->override_input (loc));
+               return s->unprotect ();
+       }
+       if (Context_mod *cm = unsmob<Context_mod> (arg))
+       {
+               return cm->smobbed_copy ();
+       }
        return arg;
 }
 
index 16e2929a6699001fd029f7e43548097ec62031c6..52551e8b5286452342d4eae53dbc1f9396efef36 100644 (file)
@@ -220,7 +220,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i
       // skyline will likely be of infinite width anyway
       // and we don't want to prematurely trigger H spacing
       Real xc = a == X_AXIS || (pure && dynamic_cast<Spanner *> (me))
-                ? me->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS)
+                ? me->parent_relative (common[X_AXIS], X_AXIS)
                 : me->relative_coordinate (common[X_AXIS], X_AXIS);
       // same here, for X_AXIS spacing, if it's happening, it should only be
       // before line breaking.  because there is no thing as "pure" x spacing,
@@ -274,7 +274,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i
            if (unsmob<Skyline_pair> (sp))
              {
                Real xc = pure && dynamic_cast<Spanner *> (e)
-                         ? e->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS)
+                         ? e->parent_relative (common[X_AXIS], X_AXIS)
                          : e->relative_coordinate (common[X_AXIS], X_AXIS);
                // same logic as above
                // we assume horizontal spacing is always pure
index dc453a97294fc130b3ec49378d21bdaec3924893..9eb4ef83bd03c74581d9da08b5664c1a062c9c54 100644 (file)
@@ -90,7 +90,7 @@ fit_factor (Offset dz_unit, Offset dz_perp, Real close_to_edge_length,
   Real fit_factor = 0.0;
   Offset x0 = curve.control_[0];
   curve.translate (-x0);
-  curve.rotate (-dz_unit.arg ());
+  curve.rotate (-dz_unit.angle_degrees ());
   curve.scale (1, d);
 
   Interval curve_xext;
index 1a06ca6422cd65a045e61ec9e692cbacde4b15d5..80ceb5f431fdf700dddc2000b95044ac9ff3f023 100644 (file)
@@ -189,14 +189,14 @@ Slur_engraver::finalize ()
 }
 
 void
-Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken)
+Slur_engraver::create_slur (SCM spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken)
 {
   Grob *ccc = left_broken
     ? unsmob<Grob> (get_property ("currentCommandColumn"))
     : 0; // efficiency
   SCM cause = evi.slur_ ? evi.slur_->self_scm () : g_cause->self_scm ();
   Spanner *slur = make_spanner (grob_symbol (), cause);
-  slur->set_property ("spanner-id", ly_string2scm (spanner_id));
+  slur->set_property ("spanner-id", spanner_id);
   if (dir)
     set_grob_direction (slur, dir);
   if (left_broken)
@@ -209,7 +209,7 @@ Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_ca
   {
     set_grob_direction (slur, DOWN);
     slur = make_spanner (grob_symbol (), cause);
-    slur->set_property ("spanner-id", ly_string2scm (spanner_id));
+    slur->set_property ("spanner-id", spanner_id);
     set_grob_direction (slur, UP);
     if (left_broken)
       slur->set_bound (LEFT, ccc);
@@ -221,7 +221,7 @@ Slur_engraver::create_slur (const string &spanner_id, Event_info evi, Grob *g_ca
 }
 
 bool
-Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_idx, Stream_event *ev)
+Slur_engraver::can_create_slur (SCM id, vsize old_slurs, vsize *event_idx, Stream_event *ev)
 {
   for (vsize j = slurs_.size (); j--;)
     {
@@ -229,7 +229,7 @@ Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_
       Direction updown = to_dir (ev->get_property ("direction"));
 
       // Check if we already have a slur with the same spanner-id.
-      if (id == robust_scm2string (slur->get_property ("spanner-id"), ""))
+      if (ly_is_equal (id, slur->get_property ("spanner-id")))
         {
           if (j < old_slurs)
             {
@@ -280,13 +280,13 @@ Slur_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_
 bool
 Slur_engraver::try_to_end (Event_info evi)
 {
-  string id = robust_scm2string (evi.slur_->get_property ("spanner-id"), "");
+  SCM id = evi.slur_->get_property ("spanner-id");
 
   // Find the slurs that are ended with this event (by checking the spanner-id)
   bool ended = false;
   for (vsize j = slurs_.size (); j--;)
     {
-      if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), ""))
+      if (ly_is_equal (id, slurs_[j]->get_property ("spanner-id")))
         {
           ended = true;
           end_slurs_.push_back (slurs_[j]);
@@ -305,16 +305,14 @@ Slur_engraver::process_music ()
 {
   for (vsize i = 0; i < stop_events_.size (); i++)
     {
-      string id = robust_scm2string
-        (stop_events_[i].slur_->get_property ("spanner-id"), "");
+      SCM id = stop_events_[i].slur_->get_property ("spanner-id");
       bool ended = try_to_end (stop_events_[i]);
       if (ended)
         {
           // Ignore redundant stop events for this id
           for (vsize j = stop_events_.size (); --j > i;)
             {
-              if (id == robust_scm2string
-                  (stop_events_[j].slur_->get_property ("spanner-id"), ""))
+              if (ly_is_equal (id, stop_events_[j].slur_->get_property ("spanner-id")))
                 stop_events_.erase (stop_events_.begin () + j);
             }
         }
@@ -326,7 +324,7 @@ Slur_engraver::process_music ()
   for (vsize i = start_events_.size (); i--;)
     {
       Stream_event *ev = start_events_[i].slur_;
-      string id = robust_scm2string (ev->get_property ("spanner-id"), "");
+      SCM id = ev->get_property ("spanner-id");
       Direction updown = to_dir (ev->get_property ("direction"));
 
       if (can_create_slur (id, old_slurs, &i, ev))
index 2d4865e19095aa0f4e983b83ad002e6d90d022db..a3dad6fb5e9785888b05b119ac5320b24c0b36b0 100644 (file)
@@ -740,7 +740,7 @@ Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
                 }
             }
 
-          dz = os[RIGHT] - os[LEFT];
+          dz = (os[RIGHT] - os[LEFT]).direction ();
           for (LEFT_and_RIGHT (d))
             {
               if (extremes_[d].slur_head_
@@ -752,7 +752,7 @@ Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
                      TODO: parameter */
                   os[d][X_AXIS]
                   -= dir_ * extremes_[d].slur_head_x_extent_.length ()
-                     * sin (dz.arg ()) / 3;
+                    * dz[Y_AXIS] / 3;
                 }
             }
 
index 747217c847024b993b307555edcca46c85b025d1..ee12c53f3668a951fbf4160b86f30fcf5e74f047 100644 (file)
@@ -260,6 +260,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   expr = scm_cdr (expr);
   Real y_rad = robust_scm2double (scm_car (expr), 0.0);
   expr = scm_cdr (expr);
+  Offset rad (x_rad, y_rad);
   Real start = robust_scm2double (scm_car (expr), 0.0);
   expr = scm_cdr (expr);
   Real end = robust_scm2double (scm_car (expr), 0.0);
@@ -270,12 +271,10 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   expr = scm_cdr (expr);
   bool fill = to_boolean (scm_car (expr));
   //////////////////////
-  start = M_PI * start / 180;
-  end = M_PI * end / 180;
   if (end == start)
-    end += (2 * M_PI);
-  Offset sp (cos (start) * x_rad, sin (start) * y_rad);
-  Offset ep (cos (end) * x_rad, sin (end) * y_rad);
+    end += 360;
+  Offset sp (offset_directed (start).scale (rad));
+  Offset ep (offset_directed (end).scale (rad));
   //////////////////////
   Drul_array<vector<Offset> > points;
   int quantization = max (1, (int) (((x_rad * trans.xx) + (y_rad * trans.yy)) * M_PI / QUANTIZATION_UNIT));
@@ -284,7 +283,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
       for (vsize i = 0; i < 1 + (vsize) quantization; i++)
         {
           Real ang = linear_map (start, end, 0, quantization, i);
-          Offset pt (cos (ang) * x_rad, sin (ang) * y_rad);
+          Offset pt (offset_directed (ang).scale (rad));
           Offset inter = pt + d * get_normal ((th/2) * pt.direction ());
           pango_matrix_transform_point (&trans, &inter[X_AXIS], &inter[Y_AXIS]);
           points[d].push_back (inter);
@@ -316,7 +315,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   if (th > 0.0)
     {
       // beg line cap
-      Offset pt (cos (start) * x_rad, sin (start) * y_rad);
+      Offset pt (offset_directed (start).scale (rad));
       create_path_cap (boxes,
                        buildings,
                        trans,
@@ -325,7 +324,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
                        -get_normal (pt));
 
       // end line cap
-      pt = Offset (cos (end) * x_rad, sin (end) * y_rad);
+      pt = offset_directed (end).scale (rad);
       create_path_cap (boxes,
                        buildings,
                        trans,
index c8d87439d67452e497049886b7cd25bf55cfa194..5c43189e0bc713305d51245cee254b97021300d0 100644 (file)
 #include "font-metric.hh"
 #include "libc-extension.hh"
 #include "lookup.hh"
+#include "offset.hh"
 #include "stencil.hh"
 
+/*
+ * A few general helpers in degrees
+ */
+
+LY_DEFINE (ly_angle, "ly:angle",
+           1, 1, 0, (SCM x, SCM y),
+           "Calculates angle in degrees of given vector.  With one argument,"
+           " @var{x} is a number pair indicating the vector.  With two"
+           " arguments, @var{x} and @var{y} specify the respective coordinates.")
+{
+  Offset off;
+  if (SCM_UNBNDP (y)) {
+    LY_ASSERT_TYPE (is_number_pair, x, 1);
+    off = ly_scm2offset (x);
+  } else {
+    LY_ASSERT_TYPE (scm_is_number, x, 1);
+    LY_ASSERT_TYPE (scm_is_number, y, 2);
+    off = Offset (scm_to_double (x), scm_to_double (y));
+  }
+  return scm_from_double (off.angle_degrees ());
+}
+
+LY_DEFINE (ly_length, "ly:length",
+           1, 1, 0, (SCM x, SCM y),
+           "Calculates magnitude of given vector.  With one argument,"
+           " @var{x} is a number pair indicating the vector.  With two"
+           " arguments, @var{x} and @var{y} specify the respective coordinates.")
+{
+  Offset off;
+  if (SCM_UNBNDP (y)) {
+    LY_ASSERT_TYPE (is_number_pair, x, 1);
+    off = ly_scm2offset (x);
+  } else {
+    LY_ASSERT_TYPE (scm_is_number, x, 1);
+    LY_ASSERT_TYPE (scm_is_number, y, 2);
+    off = Offset (scm_to_double (x), scm_to_double (y));
+  }
+  return scm_from_double (off.length ());
+}
+
+LY_DEFINE (ly_directed, "ly:directed",
+           1, 1, 0, (SCM direction, SCM magnitude),
+           "Calculates an @code{(x . y)} pair with optional @var{magnitude}"
+           " (defaulting to @code{1.0}) and @var{direction} specified either"
+           " as an angle in degrees or a coordinate pair giving the direction. "
+           " If @var{magnitude} is a pair, the respective coordinates are"
+           " scaled independently, useful for ellipse drawings.")
+{
+  Offset res;
+  if (scm_is_pair (direction))
+    {
+      LY_ASSERT_TYPE (is_number_pair, direction, 1);
+      res = ly_scm2offset (direction).direction ();
+    }
+  else
+    {
+      LY_ASSERT_TYPE (scm_is_number, direction, 1);
+      res = offset_directed (scm_to_double (direction));
+    }
+  if (SCM_UNBNDP (magnitude))
+    return ly_offset2scm (res);
+  if (scm_is_pair (magnitude))
+    {
+      LY_ASSERT_TYPE (is_number_pair, magnitude, 2);
+      return ly_offset2scm (res.scale (ly_scm2offset (magnitude)));
+    }
+  LY_ASSERT_TYPE (scm_is_number, magnitude, 2);
+  return ly_offset2scm (scm_to_double (magnitude) * res);
+}
+
+
 /*
   TODO: naming add/combine.
 */
index 0cf49296f0b460f444eaad29b7941b2ab99d248e..5e568c98dbd8efb38dd963f15a8313a242759b0d 100644 (file)
@@ -80,7 +80,7 @@ Stencil::extent_box () const
 void
 Stencil::rotate (Real a, Offset off)
 {
-  rotate_degrees (a * 180 / M_PI, off);
+  rotate_degrees (a, off);
 }
 
 /*
@@ -121,7 +121,7 @@ Stencil::rotate_degrees_absolute (Real a, Offset absolute_off)
   pts.push_back (Offset (shifted_box.x ().at (RIGHT), shifted_box.y ().at (UP)));
   pts.push_back (Offset (shifted_box.x ().at (LEFT), shifted_box.y ().at (UP)));
 
-  const Offset rot = complex_exp (Offset (0, a * M_PI / 180.0));
+  const Offset rot (offset_directed (a));
   dim_.set_empty ();
   for (vsize i = 0; i < pts.size (); i++)
     dim_.add_point (pts[i] * rot + absolute_off);
index 17e1194de80762822da92ed5e7d8767bc6a8a7d0..340b017723753e5431ecce6379129f65ad212caf 100644 (file)
@@ -540,7 +540,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
           if (Grob *beam = Stem::get_beam (stems[side]))
             (void) beam->get_property ("quantized-positions");
           poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])]
-                       + stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+                       + stems[side]->parent_relative (commony, Y_AXIS);
         }
 
       *dy = poss[RIGHT] - poss[LEFT];
index 657b9b1f507fc4ccdca638fba5f1ab290311f160..6424d756e5df23de2536f1474577d27864071615 100644 (file)
@@ -23,7 +23,7 @@ That's it.  For more information, visit http://lilypond.org .
 
 %}
 
-\version "2.19.46"  % necessary for upgrading to future LilyPond versions.
+\version "2.19.48"  % necessary for upgrading to future LilyPond versions.
 
 \header{
   title = "A scale in LilyPond"
index 9f950733bd01327316e36dca3b72ccf997f15f18..77503b4ff8c65bae67b8afb428767a2cd4803179 100644 (file)
@@ -32,7 +32,7 @@ Good luck with LilyPond!  Happy engraving.
 
 %}
 
-\version "2.19.46"  % necessary for upgrading to future LilyPond versions.
+\version "2.19.48"  % necessary for upgrading to future LilyPond versions.
 
 \header{
   title = "A scale in LilyPond"
index 6fe32f49fbaf513055c94b2fa103d6cf368a23e5..a46111e4d91a2a62d36c6595b7a9e88da3047738 100644 (file)
@@ -1,7 +1,7 @@
 \version "2.17.6"
 
-startGraceSlur = #(make-music 'SlurEvent 'span-direction START 'spanner-id "grace")
-stopGraceSlur = #(make-music 'SlurEvent 'span-direction STOP 'spanner-id "grace")
+startGraceSlur = #(make-music 'SlurEvent 'span-direction START 'spanner-id 'grace)
+stopGraceSlur = #(make-music 'SlurEvent 'span-direction STOP 'spanner-id 'grace)
 
 
 startGraceMusic =  {
index ee9fdb8c2064b604e8123b0032bdd730f41d5f99..76c2ec64b882f079ec9fbf441076cfc30a305631 100644 (file)
@@ -1551,7 +1551,12 @@ retrograde =
 #(define-music-function (music)
     (ly:music?)
     (_i "Return @var{music} in reverse order.")
-    (retrograde-music music))
+    (retrograde-music
+     (expand-repeat-notes!
+      (expand-repeat-chords!
+       (cons 'rhythmic-event
+             (ly:parser-lookup '$chord-repeat-events))
+       music))))
 
 revertTimeSignatureSettings =
 #(define-music-function
index 756a55579e377935ab3b7242db358a54eb499576..8d8a69444f8815af37d8080a75fdcf6a9a34688c 100644 (file)
@@ -1,18 +1,15 @@
 \version "2.19.29"
 
 "\\=" =
-#(define-event-function (id event) (number-or-string? ly:event?)
+#(define-event-function (id event) (key? ly:event?)
   (_i "This sets the @code{spanner-id} property of the following
-@var{event} to the given @var{id} (numbers will be converted to a
-string).  This can be used to tell LilyPond how to connect overlapping
+@var{event} to the given @var{id} (non-negative integer or symbol).
+This can be used to tell LilyPond how to connect overlapping
 or parallel slurs or phrasing slurs within a single @code{Voice}.
 @lilypond[quote,verbatim]
 \\fixed c' { c\\=1( d\\=2( e\\=1) f\\=2) }
 @end lilypond\n")
-  (set! (ly:music-property event 'spanner-id)
-       (if (number? id)
-           (number->string id)
-           id))
+  (set! (ly:music-property event 'spanner-id) id)
   event)
 
 startGroup = #(make-span-event 'NoteGroupingEvent START)
index 7bd1d9a0ebe654202c77f2d5af5384cce9e3f67b..c51faefffdb8b0127e163f3302a60c1b704a8411 100644 (file)
@@ -6,10 +6,10 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: lilypond 2.19.46\n"
+"Project-Id-Version: lilypond 2.19.48\n"
 "Report-Msgid-Bugs-To: http://post.gmane.org/post.php?group=gmane.comp.gnu."
 "lilypond.bugs\n"
-"POT-Creation-Date: 2016-07-24 11:09+0100\n"
+"POT-Creation-Date: 2016-09-13 11:07+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -917,7 +917,7 @@ msgstr ""
 msgid "Encountered unprocessed marker %s\n"
 msgstr ""
 
-#: abc2ly.py:1389 convert-ly.py:85 lilypond-book.py:122 midi2ly.py:1046
+#: abc2ly.py:1389 convert-ly.py:85 lilypond-book.py:122 midi2ly.py:1052
 #, python-format
 msgid "%s [OPTION]... FILE"
 msgstr ""
@@ -930,16 +930,16 @@ msgid ""
 msgstr ""
 
 #: abc2ly.py:1398 convert-ly.py:92 etf2ly.py:1208 lilypond-book.py:231
-#: midi2ly.py:1097 musicxml2ly.py:2766 main.cc:184
+#: midi2ly.py:1103 musicxml2ly.py:2766 main.cc:184
 msgid "show version number and exit"
 msgstr ""
 
 #: abc2ly.py:1401 convert-ly.py:96 etf2ly.py:1204 lilypond-book.py:140
-#: midi2ly.py:1064 musicxml2ly.py:2747 main.cc:163
+#: midi2ly.py:1070 musicxml2ly.py:2747 main.cc:163
 msgid "show this help and exit"
 msgstr ""
 
-#: abc2ly.py:1404 etf2ly.py:1209 midi2ly.py:1073
+#: abc2ly.py:1404 etf2ly.py:1209 midi2ly.py:1079
 msgid "write output to FILE"
 msgstr ""
 
@@ -960,7 +960,7 @@ msgstr ""
 #. or if there is a LilyPond users list or forum in your language
 #. "Report bugs in English via %s or in YOUR_LANG via URI"
 #: abc2ly.py:1416 convert-ly.py:157 etf2ly.py:1218 lilypond-book.py:258
-#: midi2ly.py:1109 musicxml2ly.py:2909 main.cc:318
+#: midi2ly.py:1115 musicxml2ly.py:2909 main.cc:318
 #, c-format, python-format
 msgid "Report bugs via %s"
 msgstr ""
@@ -1042,7 +1042,7 @@ msgstr ""
 msgid "make a numbered backup [default: filename.ext~]"
 msgstr ""
 
-#: convert-ly.py:152 etf2ly.py:1212 lilypond-book.py:234 midi2ly.py:1098
+#: convert-ly.py:152 etf2ly.py:1212 lilypond-book.py:234 midi2ly.py:1104
 #: main.cc:186
 msgid "show warranty and copyright"
 msgstr ""
@@ -1101,7 +1101,7 @@ msgid ""
 "file.\n"
 msgstr ""
 
-#: etf2ly.py:1210 midi2ly.py:1069 midi2ly.py:1074 musicxml2ly.py:2859
+#: etf2ly.py:1210 midi2ly.py:1075 midi2ly.py:1080 musicxml2ly.py:2859
 #: main.cc:169 main.cc:181
 msgid "FILE"
 msgstr ""
@@ -1208,7 +1208,7 @@ msgstr ""
 msgid "write snippet output files with the same base name as their source file"
 msgstr ""
 
-#: lilypond-book.py:223 midi2ly.py:1092 musicxml2ly.py:2772
+#: lilypond-book.py:223 midi2ly.py:1098 musicxml2ly.py:2772
 msgid "be verbose"
 msgstr ""
 
@@ -1310,7 +1310,7 @@ msgstr ""
 msgid "warning: "
 msgstr ""
 
-#: midi2ly.py:92 midi2ly.py:1126
+#: midi2ly.py:92 midi2ly.py:1132
 msgid "error: "
 msgstr ""
 
@@ -1318,85 +1318,85 @@ msgstr ""
 msgid "Exiting... "
 msgstr ""
 
-#: midi2ly.py:834
+#: midi2ly.py:840
 msgid "found more than 5 voices on a staff, expect bad output"
 msgstr ""
 
-#: midi2ly.py:1034
+#: midi2ly.py:1040
 #, python-format
 msgid "%s output to `%s'..."
 msgstr ""
 
-#: midi2ly.py:1047
+#: midi2ly.py:1053
 #, python-format
 msgid "Convert %s to LilyPond input.\n"
 msgstr ""
 
-#: midi2ly.py:1052
+#: midi2ly.py:1058
 msgid "print absolute pitches"
 msgstr ""
 
-#: midi2ly.py:1054 midi2ly.py:1082
+#: midi2ly.py:1060 midi2ly.py:1088
 msgid "DUR"
 msgstr ""
 
-#: midi2ly.py:1055
+#: midi2ly.py:1061
 msgid "quantise note durations on DUR"
 msgstr ""
 
-#: midi2ly.py:1058
+#: midi2ly.py:1064
 msgid "debug printing"
 msgstr ""
 
-#: midi2ly.py:1061
+#: midi2ly.py:1067
 msgid "print explicit durations"
 msgstr ""
 
-#: midi2ly.py:1066
+#: midi2ly.py:1072
 msgid "prepend FILE to output"
 msgstr ""
 
-#: midi2ly.py:1070
+#: midi2ly.py:1076
 msgid "set key: ALT=+sharps|-flats; MINOR=1"
 msgstr ""
 
-#: midi2ly.py:1071
+#: midi2ly.py:1077
 msgid "ALT[:MINOR]"
 msgstr ""
 
-#: midi2ly.py:1076
+#: midi2ly.py:1082
 msgid "preview of first 4 bars"
 msgstr ""
 
-#: midi2ly.py:1080
+#: midi2ly.py:1086
 msgid "suppress progress messages and warnings about excess voices"
 msgstr ""
 
-#: midi2ly.py:1081
+#: midi2ly.py:1087
 msgid "quantise note starts on DUR"
 msgstr ""
 
-#: midi2ly.py:1085
+#: midi2ly.py:1091
 msgid "use s instead of r for rests"
 msgstr ""
 
-#: midi2ly.py:1087
+#: midi2ly.py:1093
 msgid "DUR*NUM/DEN"
 msgstr ""
 
-#: midi2ly.py:1090
+#: midi2ly.py:1096
 msgid "allow tuplet durations DUR*NUM/DEN"
 msgstr ""
 
-#: midi2ly.py:1100
+#: midi2ly.py:1106
 msgid "treat every text as a lyric"
 msgstr ""
 
-#: midi2ly.py:1103
+#: midi2ly.py:1109
 msgid "Examples"
 msgstr ""
 
-#: midi2ly.py:1127
+#: midi2ly.py:1133
 msgid "no files specified on command line."
 msgstr ""
 
@@ -2046,7 +2046,7 @@ msgstr ""
 msgid "failed redirecting stderr to `%s'"
 msgstr ""
 
-#: general-scheme.cc:482 output-ps.scm:48
+#: general-scheme.cc:482
 msgid "Found infinity or nan in output.  Substituting 0.0"
 msgstr ""
 
@@ -2107,7 +2107,7 @@ msgstr ""
 msgid "%d: %s"
 msgstr ""
 
-#: grob.cc:487
+#: grob.cc:489
 #, c-format
 msgid "ignored infinite %s-offset"
 msgstr ""
@@ -2150,6 +2150,11 @@ msgstr ""
 msgid "position unknown"
 msgstr ""
 
+#: keep-alive-together-engraver.cc:93
+#, c-format
+msgid "unknown remove-layer value `%s'"
+msgstr ""
+
 #: key-engraver.cc:197
 msgid "Incomplete keyAlterationOrder for key signature"
 msgstr ""
@@ -2544,17 +2549,17 @@ msgstr ""
 msgid "unexpected case fall-through"
 msgstr ""
 
-#: midi-control-function-performer.cc:107 staff-performer.cc:159
+#: midi-cc-announcer.cc:99
 #, c-format
 msgid "ignoring out-of-range value change for MIDI property `%s'"
 msgstr ""
 
-#: midi-item.cc:92
+#: midi-item.cc:91
 #, c-format
 msgid "no such MIDI instrument: `%s'"
 msgstr ""
 
-#: midi-item.cc:178
+#: midi-item.cc:177
 msgid "Time signature with more than 255 beats.  Truncating"
 msgstr ""
 
@@ -3087,7 +3092,7 @@ msgstr ""
 msgid "%s without a cause"
 msgstr ""
 
-#: slur-engraver.cc:322
+#: slur-engraver.cc:320
 #, c-format
 msgid "cannot end %s"
 msgstr ""
@@ -3102,11 +3107,11 @@ msgstr ""
 msgid "expected to read %d characters, got %d"
 msgstr ""
 
-#: staff-performer.cc:306
+#: staff-performer.cc:273
 msgid "MIDI channel wrapped around"
 msgstr ""
 
-#: staff-performer.cc:307
+#: staff-performer.cc:274
 msgid "remapping modulo 16"
 msgstr ""
 
@@ -3594,17 +3599,17 @@ msgstr ""
 msgid "not a valid duration string: ~a - ignoring"
 msgstr ""
 
-#: define-music-types.scm:798
+#: define-music-types.scm:796
 #, scheme-format
 msgid "symbol expected: ~S"
 msgstr ""
 
-#: define-music-types.scm:801
+#: define-music-types.scm:799
 #, scheme-format
 msgid "cannot find music object: ~S"
 msgstr ""
 
-#: define-music-types.scm:821
+#: define-music-types.scm:819
 #, scheme-format
 msgid "bad make-music argument: ~S"
 msgstr ""
@@ -3779,19 +3784,19 @@ msgstr ""
 msgid "Music unsuitable for output-def"
 msgstr ""
 
-#: lily-library.scm:920
+#: lily-library.scm:914
 msgid ""
 "Find the index between @var{start} and @var{end} (an integer)\n"
 "which produces the closest match to @var{target-val} if\n"
 "applied to function @var{getter}."
 msgstr ""
 
-#: lily-library.scm:1014
+#: lily-library.scm:1008
 #, scheme-format
 msgid "unknown unit: ~S"
 msgstr ""
 
-#: lily-library.scm:1039
+#: lily-library.scm:1033
 #, scheme-format
 msgid "no \\version statement found, please add~afor future compatibility"
 msgstr ""
@@ -3901,6 +3906,10 @@ msgstr ""
 msgid "negative replication count; ignoring"
 msgstr ""
 
+#: modal-transforms.scm:289
+msgid "Dangling tie in \\retrograde"
+msgstr ""
+
 #: music-functions.scm:319
 #, scheme-format
 msgid "invalid tremolo repeat count: ~a"
@@ -3976,12 +3985,12 @@ msgstr ""
 msgid "conflicting tag group ~a"
 msgstr ""
 
-#: output-ps.scm:290 output-svg.scm:539
+#: output-ps.scm:271 output-svg.scm:539
 #, scheme-format
 msgid "unknown line-cap-style: ~S"
 msgstr ""
 
-#: output-ps.scm:295 output-svg.scm:545
+#: output-ps.scm:276 output-svg.scm:545
 #, scheme-format
 msgid "unknown line-join-style: ~S"
 msgstr ""
@@ -4069,25 +4078,25 @@ msgstr ""
 msgid "No open string for pitch ~a"
 msgstr ""
 
-#: translation-functions.scm:442 translation-functions.scm:454
+#: translation-functions.scm:450 translation-functions.scm:462
 #, scheme-format
 msgid "Requested string for pitch requires negative fret: string ~a pitch ~a"
 msgstr ""
 
-#: translation-functions.scm:445
+#: translation-functions.scm:453
 msgid "Ignoring string request and recalculating."
 msgstr ""
 
-#: translation-functions.scm:457
+#: translation-functions.scm:465
 msgid "Ignoring note in tablature."
 msgstr ""
 
-#: translation-functions.scm:482
+#: translation-functions.scm:490
 #, scheme-format
 msgid "No string for pitch ~a (given frets ~a)"
 msgstr ""
 
-#: translation-functions.scm:598
+#: translation-functions.scm:606
 #, scheme-format
 msgid ""
 "No label for fret ~a (on string ~a);\n"
index cb9103a6fcda899fe88d459af846f724e5e01e92..d55ab4c8c788449af838d45b2afd55b9b1e8247c 100644 (file)
@@ -809,12 +809,16 @@ number, the quicker the slur attains its @code{height-limit}.")
 interesting items.")
      (remove-first ,boolean? "Remove the first staff of an orchestral
 score?")
-     (remove-layer ,integer? "The @code{Keep_alive_together_engraver}
-removes all @code{VerticalAxisGroup} grobs with a @code{remove-layer}
-larger than the smallest retained @code{remove-layer}.  Set to
-@code{#f} to make a layer invisible to the
-@code{Keep_alive_together_engraver}, set to @code{'()} to have it not
-participate in the layering decisions.")
+     (remove-layer ,key? "When set as a positive integer, the
+@code{Keep_alive_together_engraver} removes all
+@code{VerticalAxisGroup} grobs with a @code{remove-layer} larger than
+the smallest retained @code{remove-layer}. Set to @code{#f} to make a
+layer independent of the @code{Keep_alive_together_engraver}. Set to
+@code{'()}, the layer does not participate in the layering decisions.
+The property can also be set as a symbol for common behaviors:
+@code{#'any} to keep the layer alive with any other layer in the
+group; @code{#'above} or @code{#'below} to keep the layer alive with
+the context immediately before or after it, respectively.")
      (replacement-alist ,list? "Alist of strings.
 The key is a string of the pattern to be replaced.  The value is a
 string of what should be displayed.  Useful for ligatures.")
@@ -992,7 +996,7 @@ override:
 \\override MultiMeasureRest
   #'spacing-pair = #'(staff-bar . staff-bar)
 @end example")
-     (spanner-id ,string? "An identifier to distinguish concurrent spanners.")
+     (spanner-id ,key? "An identifier to distinguish concurrent spanners.")
      (springs-and-rods ,boolean? "Dummy variable for triggering
 spacing routines.")
      (stacking-dir ,ly:dir? "Stack objects in which direction?")
index f525edd69a4040cb5acbec48b052ac006e96da34..6ca25b586e69ce735effaf5bd61a2f941270a794 100644 (file)
         (height-limit . 2.0)
         (minimum-length . 1.5)
         (ratio . 0.333)
-        (spanner-id . "")
         (springs-and-rods . ,ly:spanner::set-spacing-rods)
         (stencil . ,ly:slur::print)
         (thickness . 1.1)
         (line-thickness . 0.8)
         (minimum-length . 1.5)
         (ratio . 0.25)
-        (spanner-id . "")
         (springs-and-rods . ,ly:spanner::set-spacing-rods)
         (stencil . ,ly:slur::print)
         (thickness . 1.2)
index 4df3f933405fd4a1be7ea953eae62912a295bcb5..f8c567d1fa09d50958744e22e18166b8c1ec67d5 100644 (file)
@@ -183,7 +183,7 @@ If zero, signals a beat containing varying durations.")
 Options are @code{'text} and @code{'hairpin}.")
      (span-text ,markup? "The displayed text for dynamic text
 spanners (e.g., cresc.)")
-     (spanner-id ,string? "Identifier to distinguish concurrent spanners.")
+     (spanner-id ,key? "Identifier to distinguish concurrent spanners.")
      (start-callback ,procedure? "Function to compute the negative length
 of starting grace notes.  This property can only be defined as initializer
 in @file{scm/@/define-music-types.scm}.")
index e0190eda5516c419eb6763affa58e968b082ae20..348bcd0e87228669e281cf379f5fc10332ac6396 100644 (file)
@@ -438,7 +438,6 @@ goes down).")
      . ((description . "Start or end phrasing slur.
 
 Syntax: @var{note}@code{\\(} and @var{note}@code{\\)}")
-        (spanner-id . "")
         (types . (post-event span-event event phrasing-slur-event))
         ))
 
@@ -570,7 +569,6 @@ Syntax: @code{\\skip} @var{duration}")
      . ((description . "Start or end slur.
 
 Syntax: @var{note}@code{(} and @var{note}@code{)}")
-        (spanner-id . "")
         (types . (post-event span-event event slur-event))
         ))
 
index 574b85437eb251b12c02e6e3f24f6bdbecd3173e..bbbe3cc53acebcd12ad2406cf9fde2a50b07a8e1 100644 (file)
@@ -776,14 +776,8 @@ right (@var{dir}=+1)."
 
 (define-public (polar->rectangular radius angle-in-degrees)
   "Return polar coordinates (@var{radius}, @var{angle-in-degrees})
-as rectangular coordinates @ode{(x-length . y-length)}."
-
-  (let ((complex (make-polar
-                  radius
-                  (degrees->radians angle-in-degrees))))
-    (cons
-     (real-part complex)
-     (imag-part complex))))
+as rectangular coordinates @code{(x-length . y-length)}."
+  (ly:directed angle-in-degrees radius))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; string
index 98e9ac3021750bd510e9e9b276944820ab730fd4..f9e26ed360235d316a5a467fab1c9d19483d3f3f 100644 (file)
@@ -185,32 +185,110 @@ Typically used to construct a scale for input to
 
 (define-public (retrograde-music music)
   "Returns @var{music} in retrograde (reversed) order."
-  ;; Copied from LSR #105 and renamed.
   ;; Included here to allow this module to provide a complete set of
   ;; common formal operations on motives, i.e transposition,
   ;; inversion and retrograding.
 
-  (let* ((elements (ly:music-property music 'elements))
-         (arts (ly:music-property music 'articulations))
-         (reversed (reverse elements))
-         (element (ly:music-property music 'element))
-         (span-dir (ly:music-property music 'span-direction)))
-
-    (ly:music-set-property! music 'elements reversed)
-
-    (for-each retrograde-music arts)
-
-    (if (ly:music? element)
-        (ly:music-set-property!
-         music 'element
-         (retrograde-music element)))
-
-    (if (ly:dir? span-dir)
-        (ly:music-set-property! music 'span-direction (- span-dir)))
-
-    (for-each retrograde-music reversed)
-
-    music))
+  (define (reverse-span! m)
+    ;; invert direction of two-sided spanners
+    (let ((spd (ly:music-property m 'span-direction)))
+      (if (ly:dir? spd)
+          (begin
+            (set! (ly:music-property m 'span-direction) (- spd))
+            (case (ly:music-property m 'name)
+              ((CrescendoEvent)
+               (make-music 'DecrescendoEvent m))
+              ((DecrescendoEvent)
+               (make-music 'CrescendoEvent m))
+              (else m)))
+          m)))
+
+  ;; carryover is a possible list of tie events, the loop returns any
+  ;; such trailing list from the given expression
+  (define (loop m carryover)
+    (define (filter-ties! m carryover field)
+      (let ((vals (ly:music-property m field)))
+        (if (pair? vals)
+            (call-with-values
+                (lambda ()
+                  (partition! (music-type-predicate
+                               '(tie-event glissando-event)) vals))
+              (lambda (ties no-ties)
+                (set! (ly:music-property m field)
+                      (append! (map! reverse-span! no-ties) carryover))
+                ties))
+            (begin
+              (if (pair? carryover)
+                  (set! (ly:music-property m field) carryover))
+              '()))))
+
+    ;; The reversal will let some prefatory material stay in front of
+    ;; the following element.  Most prominently single
+    ;; overrides/reverts/sets/unsets and applyContext.  This does not
+    ;; change the position of a clef (which will generally be useless
+    ;; after retrograding) but it does not jumble the clef change
+    ;; command internals.  Also, stuff like \once\override stays at
+    ;; the affected element.
+
+    (define (prefatory? m)
+      (or ((music-type-predicate
+            '(apply-context apply-output-event layout-instruction-event)) m)
+          (and
+           (music-is-of-type? m 'music-wrapper-music)
+           (prefatory? (ly:music-property m 'element)))))
+
+    (define (musiclistreverse lst)
+      (let loop ((lst lst) (res '()) (zeros '()))
+        (cond ((null? lst) (reverse! zeros res))
+              ((prefatory? (car lst))
+               (loop (cdr lst) res (cons (car lst) zeros)))
+              (else
+               (loop (cdr lst) (reverse! zeros (cons (car lst) res)) '())))))
+
+    (cond ((music-is-of-type? m 'event-chord)
+           (let* ((chord-ties
+                   (append!
+                    (filter-ties! m carryover 'elements)
+                    ;; articulations on an event-chord do not occur
+                    ;; "naturally" but are supported when user-generated
+                    ;; elsewhere, so we treat them properly
+                    (filter-ties! m '() 'articulations)))
+                  ;; in-chord ties are converted to per-chord ties.
+                  ;; This is less than optimal but pretty much the
+                  ;; best we can hope to achieve with this approach.
+                  (element-ties
+                   (append-map!
+                    (lambda (m) (filter-ties! m '() 'articulations))
+                    (ly:music-property m 'elements))))
+             (append! chord-ties element-ties)))
+
+          ((music-is-of-type? m 'rhythmic-event)
+           (filter-ties! m carryover 'articulations))
+
+          ;; The following is hardly correct but tieing inside of
+          ;; <<...>> is really beyond our pay grade.
+          ((music-is-of-type? m 'simultaneous-music)
+           (append-map! (lambda (m) (loop m (ly:music-deep-copy carryover)))
+                        (ly:music-property m 'elements)))
+          (else
+           (let ((elt (ly:music-property m 'element))
+                 (elts (ly:music-property m 'elements)))
+             (let ((res
+                    (fold loop
+                          (if (ly:music? elt) (loop elt carryover) carryover)
+                          elts)))
+               (if (ly:music? elt)
+                   (set! (ly:music-property m 'element)
+                         (reverse-span! elt)))
+               (if (pair? elts)
+                   (set! (ly:music-property m 'elements)
+                         (map! reverse-span! (musiclistreverse elts))))
+               (append! res (filter-ties! m '() 'articulations)))))))
+  (let ((dangling (loop music '())))
+    (for-each
+     (lambda (t) (ly:music-warning t (_ "Dangling tie in \\retrograde")))
+     dangling))
+  music)
 
 (define-public (pitch-invert around to music)
   "If @var{music} is a single pitch, inverts it about @var{around}
index 70b13848e4aa6ad898bac04f79d33c80dfdaf838..6d3ab63c2fcf30dd78370cd7cb97e9b458abbe0e 100644 (file)
              (scm framework-ps)
              (lily))
 
-;;; helper functions, not part of output interface
-;;;
-
-
-;; ice-9 format uses a lot of memory
-;; using simple-format almost halves lilypond cell usage
-
-(define (str4 num)
-  (if (or (nan? num) (inf? num))
-      (begin
-        (ly:warning (_ "Found infinity or nan in output.  Substituting 0.0"))
-        (if (ly:get-option 'strict-infinity-checking)
-            (exit 1))
-        "0.0")
-      (ly:number->string num)))
-
-(define (number-pair->string4 numpair)
-  (ly:format "~4l" numpair))
-
 ;;;
 ;;; Lily output interface, PostScript implementation --- cleanup and docme
 ;;;
index 22f8648c31e8c0dcaacdad9a4894c6ef057bd0fc..0ed0deff0a24817edc4f53b42fb902313f0e75bc 100644 (file)
@@ -427,13 +427,21 @@ the current tuning?"
                          (ly:warning (_ "No open string for pitch ~a")
                                      pitch)))
                    ;; here we handle assigned strings
-                   (let ((this-fret
-                          (calc-fret pitch string tuning))
-                         (handle-negative
-                          (ly:context-property context
-                                               'handleNegativeFrets
-                                               'recalculate)))
-                     (cond ((or (and (>= this-fret 0) (integer? this-fret))
+                   (let* ((this-fret
+                           (calc-fret pitch string tuning))
+                          (possible-fret?
+                           (and (>= this-fret 0)
+                                (if (and
+                                      (ly:context-property
+                                        context 'supportNonIntegerFret #f)
+                                      (null? rest))
+                                    (integer? (truncate this-fret))
+                                    (integer? this-fret))))
+                          (handle-negative
+                           (ly:context-property context
+                                                'handleNegativeFrets
+                                                'recalculate)))
+                     (cond ((or possible-fret?
                                 (eq? handle-negative 'include))
                             (set-fret! pitch-entry string finger))
                            ((eq? handle-negative 'recalculate)