From ff2544f652b9c308aae60dd6eca1aa234d3b3cc2 Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Tue, 17 Aug 2010 16:12:31 +0100 Subject: [PATCH] Fix #544. * input/regression (partial-polymetric.ly): new regtest * lily/parser.yy (command-element): simplify syntax construction for \partial: call single constructor, soft-coded in scheme * scm/ly-syntax-constructor (partial): new syntax-constructor for \partial using descend-to-context to set measurePosition --- input/regression/partial-polymetric.ly | 33 +++++++++++++++++++++++++++++++++ lily/parser.yy | 4 +--- scm/ly-syntax-constructors.scm | 10 ++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 input/regression/partial-polymetric.ly diff --git a/input/regression/partial-polymetric.ly b/input/regression/partial-polymetric.ly new file mode 100644 index 0000000000..e284103b11 --- /dev/null +++ b/input/regression/partial-polymetric.ly @@ -0,0 +1,33 @@ +\version "2.13.31" + +\header { + texidoc = "@code{\partial} works with polymetric staves." +} + +\score { + \relative c' << + \new Staff { + \partial 4 + c4 | + c4 c c c | + } + \new Staff { + \time 3/4 + \partial 2 + c4 c | + c4 c c | + } + >> + \layout { + \context { + \Score + \remove "Timing_translator" + \remove "Default_bar_line_engraver" + } + \context { + \Staff + \consists "Timing_translator" + \consists "Default_bar_line_engraver" + } + } +} diff --git a/lily/parser.yy b/lily/parser.yy index 7fff408f7d..fcde80ea58 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1631,9 +1631,7 @@ command_element: } | PARTIAL duration_length { - Moment m = - unsmob_duration ($2)->get_length (); - $$ = MAKE_SYNTAX ("property-operation", @$, SCM_BOOL_F, ly_symbol2scm ("Timing"), ly_symbol2scm ("PropertySet"), ly_symbol2scm ("measurePosition"), m.smobbed_copy ()); - $$ = MAKE_SYNTAX ("context-specification", @$, ly_symbol2scm ("Score"), SCM_BOOL_F, $$, SCM_EOL, SCM_BOOL_F); + $$ = MAKE_SYNTAX ("partial", @$, $2); } | TIME_T fraction { diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index 98365930fe..decc515361 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -247,3 +247,13 @@ into a @code{MultiMeasureTextEvent}." (begin (set! (ly:music-property ev 'label) label) ch)))) + +(define-ly-syntax-simple (partial dur) + "Make a partial measure." + (let ((mom (ly:moment-sub ZERO-MOMENT (ly:duration-length dur)))) + + ;; We use `descend-to-context' here instead of `context-spec-music' to + ;; ensure \partial still works if the Timing_translator is moved + (descend-to-context + (context-spec-music (make-property-set 'measurePosition mom) 'Timing) + 'Score))) -- 2.11.4.GIT