]> git.donarmstrong.com Git - lilypond.git/commitdiff
Move \RemoveEmptyStaves to new file for context modifications.
authorNeil Puttock <n.puttock@gmail.com>
Sun, 17 Jul 2011 21:58:19 +0000 (22:58 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Sun, 17 Jul 2011 21:58:19 +0000 (22:58 +0100)
This allows \RemoveEmptyStaves to be invoked outside \layout blocks, i.e.,
directly following a context instantiation:

\new Staff \RemoveEmptyStaves { ... }

or

\new Staff \with { \RemoveEmptyStaves } { ... }

* input/regression/remove-empty-context-mod.ly

  new regtest

* ly/context-mods-init.ly:

  new file for context modification identifiers

* ly/declarations-init.ly:

  include context-mods-init.ly; placed before engraver-init.ly to ensure
  \RemoveEmptyStaves is accessible for deprecated \RemoveEmptyStaffContext
  and analogues

* ly/engraver-init.ly:

  remove \RemoveEmptyStaves declaration

input/regression/remove-empty-context-mod.ly [new file with mode: 0644]
ly/context-mods-init.ly [new file with mode: 0644]
ly/declarations-init.ly
ly/engraver-init.ly

diff --git a/input/regression/remove-empty-context-mod.ly b/input/regression/remove-empty-context-mod.ly
new file mode 100644 (file)
index 0000000..b6cc561
--- /dev/null
@@ -0,0 +1,15 @@
+\version "2.15.6"
+
+\header {
+  texidoc = "@code{\\RemoveEmptyStaves} is defined separately from
+context definitions so it can be used outside of @code{\\layout} blocks."
+}
+
+\paper {
+  ragged-right = ##t
+}
+
+\new Staff \RemoveEmptyStaves {
+  c'1 \break
+  r1
+}
diff --git a/ly/context-mods-init.ly b/ly/context-mods-init.ly
new file mode 100644 (file)
index 0000000..db07600
--- /dev/null
@@ -0,0 +1,29 @@
+%%%% This file is part of LilyPond, the GNU music typesetter.
+%%%%
+%%%% Copyright (C) 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/>.
+
+RemoveEmptyStaves = \with {
+  \remove "Axis_group_engraver"
+  % If RemoveEmptyStaves is called twice, two
+  % Hara_kiri_engravers would be added, which leads to a
+  % warning.
+  % This code makes sure that no previous Hara_kiri_engraver
+  % is left before adding a new one.
+  \remove "Hara_kiri_engraver"
+  \consists "Hara_kiri_engraver"
+  \override VerticalAxisGroup #'remove-empty = ##t
+}
index 268ecaee7eff6de6d34472ced100bbdebb3f3008..8907b789ad674b676cf7af1096bcf9ebf0d2e157 100644 (file)
@@ -122,31 +122,29 @@ repeatTie = #(make-music 'RepeatTieEvent)
 \include "grace-init.ly"
 \include "midi-init.ly"
 \include "paper-defaults-init.ly"
+\include "context-mods-init.ly"
 
 \layout {
-    mm = #(ly:output-def-lookup $defaultpaper 'mm)
-    unit = #(ly:output-def-lookup $defaultpaper 'unit)
+  mm = #(ly:output-def-lookup $defaultpaper 'mm)
+  unit = #(ly:output-def-lookup $defaultpaper 'unit)
 
-    in = #(* 25.4 mm)
-    pt = #(/  in 72.27)
-    cm = #(* 10 mm)
+  in = #(* 25.4 mm)
+  pt = #(/ in 72.27)
+  cm = #(* 10 mm)
 
-    \include "engraver-init.ly"
+  \include "engraver-init.ly"
 
-    #(set-paper-dimension-variables (current-module))
+  #(set-paper-dimension-variables (current-module))
 }
 
 #(set-default-paper-size (ly:get-option 'paper-size))
 partCombineListener = \layout {
-    \context {
-       \Score
-       skipTypesetting = ##t
-       ignoreBarChecks = ##t
-       \alias "Timing"
-    }
+  \context {
+    \Score
+    skipTypesetting = ##t
+    ignoreBarChecks = ##t
+    \alias "Timing"
+  }
 }
 
 setDefaultDurationToQuarter = { c4 }
-
-
-
index d28b8be51b947e1c1391fd37ee7b774be47b8c2c..badb701e08579e8aa7bb4f70ec8b027eaaae0380 100644 (file)
@@ -498,20 +498,6 @@ printing of a single line of lyrics."
   \override VerticalAxisGroup #'nonstaff-nonstaff-spacing #'padding = #0.5
 }
 
-
-RemoveEmptyStaves = \with {
-  \remove "Axis_group_engraver"
-    % If RemoveEmptyStaves is called twice, two
-    % Hara_kiri_engravers would be added, which leads to a
-    % warning.
-    % This code makes sure that no previous Hara_kiri_engraver
-    % is left before adding a new one.
-  \remove "Hara_kiri_engraver"
-  \consists "Hara_kiri_engraver"
-  \override VerticalAxisGroup #'remove-empty = ##t
-}
-
-
 \context {
   \type "Score_engraver"
   \name "Score"
@@ -1052,7 +1038,6 @@ accommodated for typesetting a piece in mensural style."
   printKeyCancellation = ##f
 }
 
-
 %% Keep the old definitions in here for compatibility (they erase previous
 %% settings to the corresponding context!).
 %% For new scores, one should simply insert the \RemoveEmptyStaves settings