From 038d6414e330e7ed7013902e909b2e61908528e3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 16 Jan 2007 11:46:02 +0100 Subject: [PATCH] Fix #236. Always reset middleCPosition. This fixes switching from an non-zero octavation to another non-zero octavation. --- lily/ottava-engraver.cc | 9 ++++++-- scm/define-context-properties.scm | 2 +- scm/music-functions.scm | 37 +++++++++++++++++-------------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index 4dc46d9673..c1afcfed3c 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -61,7 +61,7 @@ Ottava_spanner_engraver::process_music () span_->set_property ("text", ott); SCM c0 (get_property ("middleCPosition")); - SCM oc0 (get_property ("originalCentralCPosition")); + SCM oc0 (get_property ("originalMiddleCPosition")); if (scm_less_p (oc0, c0) == SCM_BOOL_T) span_->set_property ("direction", scm_from_int (DOWN)); } @@ -132,5 +132,10 @@ ADD_ACKNOWLEDGER (Ottava_spanner_engraver, note_column); ADD_TRANSLATOR (Ottava_spanner_engraver, /* doc */ "Create a text spanner when the ottavation property changes..", /* create */ "OttavaBracket", - /* read */ "ottavation", + /* read */ "ottavation " + "originalMiddleCPosition " + "currentMusicalColumn " + + , + /* write */ ""); diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 5debc1d10d..7b990a22b5 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -485,7 +485,7 @@ Valid values are described in @internalsref{bar-line-interface}. ) `((slurMelismaBusy ,boolean? "Signal if a slur is present.") - (originalCentralCPosition + (originalMiddleCPosition ,integer? "Used for temporary overriding middle C in octavation brackets. ") (melismaBusy ,boolean? "Signifies diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 76b8cf2edc..21617676ad 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -415,23 +415,26 @@ i.e. this is not an override" old middleCPosition, add OCTAVATION to middleCPosition, and set OTTAVATION to `8va', or whatever appropriate." (if (number? (ly:context-property context 'middleCPosition)) - (if (= octavation 0) - (let ((where (ly:context-property-where-defined context 'middleCPosition)) - (oc0 (ly:context-property context 'originalCentralCPosition))) - (ly:context-set-property! context 'middleCPosition oc0) - (ly:context-unset-property where 'originalCentralCPosition) - (ly:context-unset-property where 'ottavation)) - (let* ((where (ly:context-property-where-defined context 'middleCPosition)) - (c0 (ly:context-property context 'middleCPosition)) - (new-c0 (+ c0 (* -7 octavation))) - (string (cdr (assoc octavation '((2 . "15ma") - (1 . "8va") - (0 . #f) - (-1 . "8vb") - (-2 . "15mb")))))) - (ly:context-set-property! context 'middleCPosition new-c0) - (ly:context-set-property! context 'originalCentralCPosition c0) - (ly:context-set-property! context 'ottavation string))))) + (begin + (if (number? (ly:context-property context 'originalMiddleCPosition)) + (let ((where (ly:context-property-where-defined context 'middleCPosition))) + + (ly:context-set-property! context 'middleCPosition + (ly:context-property context 'originalMiddleCPosition)) + (ly:context-unset-property where 'originalMiddleCPosition) + (ly:context-unset-property where 'ottavation))) +ot + (let* ((where (ly:context-property-where-defined context 'middleCPosition)) + (c0 (ly:context-property context 'middleCPosition)) + (new-c0 (+ c0 (* -7 octavation))) + (string (cdr (assoc octavation '((2 . "15ma") + (1 . "8va") + (0 . #f) + (-1 . "8vb") + (-2 . "15mb")))))) + (ly:context-set-property! context 'middleCPosition new-c0) + (ly:context-set-property! context 'originalMiddleCPosition c0) + (ly:context-set-property! context 'ottavation string))))) (set! (ly:music-property m 'procedure) ottava-modify) (context-spec-music m 'Staff))) -- 2.39.2