]> git.donarmstrong.com Git - lilypond.git/blob - ly/context-mods-init.ly
Web-ja: update introduction
[lilypond.git] / ly / context-mods-init.ly
1 %%%% This file is part of LilyPond, the GNU music typesetter.
2 %%%%
3 %%%% Copyright (C) 2011--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 %%%%                    Jan Nieuwenhuizen <janneke@gnu.org>
5 %%%%
6 %%%% LilyPond is free software: you can redistribute it and/or modify
7 %%%% it under the terms of the GNU General Public License as published by
8 %%%% the Free Software Foundation, either version 3 of the License, or
9 %%%% (at your option) any later version.
10 %%%%
11 %%%% LilyPond is distributed in the hope that it will be useful,
12 %%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
13 %%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 %%%% GNU General Public License for more details.
15 %%%%
16 %%%% You should have received a copy of the GNU General Public License
17 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18
19 \version "2.17.6"
20
21 RemoveEmptyStaves = \with {
22   \override VerticalAxisGroup.remove-empty = ##t
23   \description "Remove staves which are considered to be empty according
24 to the list of interfaces set by @code{keepAliveInterfaces}."
25 }
26
27 RemoveAllEmptyStaves = \with {
28   \override VerticalAxisGroup.remove-empty = ##t
29   \override VerticalAxisGroup.remove-first = ##t
30   \description "Remove staves which are considered to be empty according
31 to the list of interfaces set by @code{keepAliveInterfaces}, including those
32 in the first system."
33 }
34
35 inherit-acceptability =
36 #(define-void-function (to from)
37    (symbol? symbol?)
38    (_i "When used in an output definition, will modify all context
39 definitions such that context @var{to} is accepted as a child by all
40 contexts that also accept @var{from}.")
41    (let* ((module (current-module))
42           (cmod (ly:make-context-mod)))
43      (ly:add-context-mod cmod (list 'accepts to))
44      (if (output-module? module)
45          (module-map
46           (lambda (_sym var)
47             (if (variable-bound? var)
48                 (let ((cdef (variable-ref var)))
49                   (if (ly:context-def? cdef)
50                       (let ((accepts (ly:context-def-lookup cdef 'accepts)))
51                         (if (and (memq from accepts)
52                                  (not (memq to accepts)))
53                             (variable-set! var
54                                            (ly:context-def-modify cdef cmod))))))))
55           module)
56          (ly:parser-error (_ "Not in an output definition")))))