From 74ee52246b9a7571a2d697df7aeaf3aa3bd09f45 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 29 Dec 1999 00:55:50 +0100 Subject: [PATCH] patch::: 1.3.18.jcn3 1.3.18.jcn3 =========== * Moved decision for stacking staff spanners {[ from item-creation phase to post_processing (only then we know dimensions/visibility of items) * Separted bar-break-glyph-alist, see input/test/no-span.ly --- CHANGES | 8 ++++++ VERSION | 2 +- input/test/no-span.ly | 23 +++-------------- lily/bar-engraver.cc | 8 +++--- lily/base-span-bar-engraver.cc | 16 +----------- lily/include/base-span-bar-engraver.hh | 2 +- lily/include/span-score-bar-engraver.hh | 1 + lily/span-bar.cc | 25 +++++++++++++++++++ lily/span-score-bar-engraver.cc | 24 +++++++++++++++--- mutopia/J.S.Bach/pa.ly | 20 +++++---------- scm/generic-property.scm | 10 +++++++- scm/lily.scm | 33 ++++++++++++++----------- 12 files changed, 98 insertions(+), 74 deletions(-) diff --git a/CHANGES b/CHANGES index 12163a631b..87eedc5cd2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +1.3.18.jcn3 +=========== + +* Moved decision for stacking staff spanners {[ from item-creation phase +to post_processing (only then we know dimensions/visibility of items) + +* Separted bar-break-glyph-alist, see input/test/no-span.ly + 1.3.18.jcn2 =========== diff --git a/VERSION b/VERSION index 2a45430e42..6ffd469316 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=18 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/no-span.ly b/input/test/no-span.ly index e027434bb6..74c05787ea 100644 --- a/input/test/no-span.ly +++ b/input/test/no-span.ly @@ -1,19 +1,10 @@ -\header { - filename = "pa.ly"; - title = "Wachet auf, ruft uns die Stimme"; - opus = "BWV"; - composer = "Johann Sebastian Bach 1685-1750 "; - enteredby = "JCN"; - copyright = "public domain"; -} - -%% ? +%% why non of this any effect? #(define Span_bar_engraver-visibility #f) #(define Staff_group_bar_engraver-visibility #f) #(define Span_score_bar_engraver-visability #f) +#(assoc-set! bar-break-glyph-alist "bracket" '(nil . nil)) -% these should be two separate scores... \score{ \context Score < \context StaffGroup< @@ -31,18 +22,12 @@ > \paper { textheight = 280.0 \mm; -%{ - \translator { - \OrchestralScoreContext - minVerticalAlign = 4.0*\staffheight; - maxVerticalAlign = 4.0*\staffheight; - } -%} \translator { \StaffGroupContext minVerticalAlign = 4.0*\staffheight; maxVerticalAlign = 4.0*\staffheight; - glyph = "brace"; +% this doesn't work + barType = #"|" } \translator { \PianoStaffContext diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 1dc6c18faf..90178f4666 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -40,7 +40,7 @@ Bar_engraver::create_bar () SCM default_type = get_property ("defaultBarType", 0); if (gh_string_p (default_type)) { - bar_p_->set_elt_property ("glyph", default_type); // gu.h + bar_p_->set_elt_property ("default-glyph", default_type); // gu.h } #if 0 @@ -78,14 +78,14 @@ Bar_engraver::request_bar (String requested_type) return; } - String current = ly_scm2string (bar_p_->get_elt_property ("glyph")); + String current = ly_scm2string (bar_p_->get_elt_property ("default-glyph")); if ((requested_type == "|:" && current== ":|") || (requested_type == ":|" && current == "|:")) requested_type = ":|:"; - bar_p_->set_elt_property ("glyph", + bar_p_->set_elt_property ("default-glyph", ly_str02scm (requested_type.ch_C ())); } @@ -115,7 +115,7 @@ Bar_engraver::do_process_requests() if (which.length_i ()) { create_bar(); - bar_p_->set_elt_property ("glyph", ly_str02scm (which.ch_C ())); + bar_p_->set_elt_property ("default-glyph", ly_str02scm (which.ch_C ())); } if (!bar_p_) diff --git a/lily/base-span-bar-engraver.cc b/lily/base-span-bar-engraver.cc index 9ef6b8fc1a..cc873a5a81 100644 --- a/lily/base-span-bar-engraver.cc +++ b/lily/base-span-bar-engraver.cc @@ -69,24 +69,10 @@ Base_span_bar_engraver::acknowledge_element (Score_element_info i) announce_element (Score_element_info (spanbar_p_,0)); -#if 0 - - // urg, elt-properties are not set until pre_processing (property-engraver) if (!gh_string_p (spanbar_p_->get_elt_property ("glyph")) && !gh_string_p (spanbar_p_->get_elt_property ("default-glyph"))) spanbar_p_-> set_elt_property ("default-glyph", - bar_l_arr_[0]->get_elt_property ("glyph")); -#else - - if (!gh_string_p (spanbar_p_->get_elt_property ("glyph")) - && gh_string_p (spanbar_p_->get_elt_property ("default-glyph"))) - spanbar_p_-> set_elt_property ("glyph", spanbar_p_->get_elt_property ("default-glyph")); - - if (!gh_string_p (spanbar_p_->get_elt_property ("glyph"))) - spanbar_p_-> set_elt_property ("glyph", - bar_l_arr_[0]->get_elt_property ("glyph")); - -#endif + bar_l_arr_[0]->get_elt_property ("default-glyph")); } } } diff --git a/lily/include/base-span-bar-engraver.hh b/lily/include/base-span-bar-engraver.hh index b4caf237d0..9cf40242f6 100644 --- a/lily/include/base-span-bar-engraver.hh +++ b/lily/include/base-span-bar-engraver.hh @@ -23,7 +23,6 @@ class Axis_align_spanner; */ class Base_span_bar_engraver : public Engraver { - Span_bar * spanbar_p_; Array bar_l_arr_; public: @@ -37,6 +36,7 @@ protected: horizontal alignment priority, otherwise, hang the spanbar on the acknowledged bar. */ bool use_priority_b_; + Span_bar * spanbar_p_; virtual void acknowledge_element (Score_element_info); virtual void do_pre_move_processing(); diff --git a/lily/include/span-score-bar-engraver.hh b/lily/include/span-score-bar-engraver.hh index 14cd512a60..9dff3b412c 100644 --- a/lily/include/span-score-bar-engraver.hh +++ b/lily/include/span-score-bar-engraver.hh @@ -37,6 +37,7 @@ public: VIRTUAL_COPY_CONS (Translator); virtual Span_bar * get_span_bar_p () const; + virtual void acknowledge_element (Score_element_info); }; /** diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 951235525f..d116caf288 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -54,6 +54,31 @@ Span_bar::do_post_processing () Interval i(get_spanned_interval ()); translate_axis (i.center (), Y_AXIS); + + /* + {[ stacking shift + ugh + */ + SCM me = get_elt_property ("glyph"); + if (gh_string_p (me) && ly_scm2string (me) == "bracket") + { + SCM e = get_elt_property ("other"); + if (e != SCM_UNDEFINED) + { + assert (SMOB_IS_TYPE_B (Score_element, e)); + Score_element* se = SMOB_TO_TYPE (Score_element, e); + SCM her = se->get_elt_property ("glyph"); +#if 0 + // urg x-extent broken? + if (gh_string_p (her) && ly_scm2string (her) == "brace") + se->translate_axis (-extent (X_AXIS).length (), X_AXIS); +#else + if (gh_string_p (her) && ly_scm2string (her) == "brace" + && !to_boolean (get_elt_property ("transparent"))) + se->translate_axis (-paper_l ()->get_var ("interline"), X_AXIS); +#endif + } + } } void diff --git a/lily/span-score-bar-engraver.cc b/lily/span-score-bar-engraver.cc index cda87205a0..ecccf6e4a9 100644 --- a/lily/span-score-bar-engraver.cc +++ b/lily/span-score-bar-engraver.cc @@ -40,6 +40,19 @@ Piano_bar_engraver::get_span_bar_p () const return s; } +void +Piano_bar_engraver::acknowledge_element (Score_element_info i) +{ + Base_span_bar_engraver::acknowledge_element (i); + + if (Span_bar * b = dynamic_cast (i.elem_l_)) + { + SCM g = b->get_elt_property ("default-glyph"); + if (gh_string_p (g) && (ly_scm2string (g) == "bracket")) + spanbar_p_->set_elt_property ("other", b->self_scm_); + } +} + Span_bar* Staff_group_bar_engraver::get_span_bar_p () const { @@ -53,12 +66,15 @@ void Staff_group_bar_engraver::acknowledge_element (Score_element_info i) { Base_span_bar_engraver::acknowledge_element (i); + + if (!spanbar_p_) + return; + if (Span_bar * b = dynamic_cast (i.elem_l_)) { - SCM gl = b->get_elt_property ("glyph"); - if (gh_string_p (gl) && ly_scm2string (gl) == "brace") - b->translate_axis ( -paper_l ()->get_var ("interline"), - X_AXIS); // ugh + SCM g = b->get_elt_property ("default-glyph"); + if (gh_string_p (g) && (ly_scm2string (g) == "brace")) + spanbar_p_->set_elt_property ("other", b->self_scm_); } } diff --git a/mutopia/J.S.Bach/pa.ly b/mutopia/J.S.Bach/pa.ly index 94132512ba..8967924d08 100644 --- a/mutopia/J.S.Bach/pa.ly +++ b/mutopia/J.S.Bach/pa.ly @@ -226,7 +226,6 @@ pedal = \notes \relative c, { -% these should be two separate scores... \score{ \context Score < \context StaffGroup< @@ -246,26 +245,19 @@ pedal = \notes \relative c, { > \paper { - %textheight = 280.0 \mm; - % landscape: - textheight = 160.0 \mm; - linewidth = 290.0 \mm; -%{ + textheight = 280.0 \mm; + % landscape: -- does not work? ly2dvi -L + %textheight = 160.0 \mm; + %linewidth = 290.0 \mm; \translator { \OrchestralScoreContext minVerticalAlign = 4.0*\staffheight; maxVerticalAlign = 4.0*\staffheight; } -%} \translator { - \StaffGroupContext - minVerticalAlign = 4.0*\staffheight; - maxVerticalAlign = 4.0*\staffheight; - } - \translator { \PianoStaffContext - minVerticalAlign = 2.5*\staffheight; - maxVerticalAlign = 2.5*\staffheight; + minVerticalAlign = 2.5*\staffheight; + maxVerticalAlign = 2.5*\staffheight; } } \midi { diff --git a/scm/generic-property.scm b/scm/generic-property.scm index 498f05bc4a..296f70b8c2 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -62,7 +62,15 @@ (define generic-bar-properties (cons "Staff_bar" (list (list 'barSize number? 'bar-size) - ;(list 'glyph symbol? 'glyph) + (list 'barType symbol? 'glyph) + ) + ) + ) + +(define generic-span-bar-properties + (cons "Span_bar" (list + (list 'barSize number? 'bar-size) + (list 'barType symbol? 'glyph) ) ) ) diff --git a/scm/lily.scm b/scm/lily.scm index 3ab025c5fd..96941d93f8 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -747,22 +747,25 @@ ; ; How should a bar line behave at a break? ; -(define (break-barline glyph dir) - (let ((result (assoc glyph - '((":|:" . (":|" . "|:")) - ("|" . ("|" . "")) - ("|s" . (nil . "|")) - ("|:" . ("|" . "|:")) - ("|." . ("|." . nil)) - (":|" . (":|" . nil)) - ("||" . ("||" . nil)) - (".|." . (".|." . nil)) - ("scorebar" . (nil . "scorepostbreak")) - ("brace" . (nil . "brace")) - ("bracket" . (nil . "bracket")) - ) - ))) +; move this to paper.scm? +; to override, see input/test/no-span.ly +(define bar-break-glyph-alist + '((":|:" . (":|" . "|:")) + ("|" . ("|" . "")) + ("|s" . (nil . "|")) + ("|:" . ("|" . "|:")) + ("|." . ("|." . nil)) + (":|" . (":|" . nil)) + ("||" . ("||" . nil)) + (".|." . (".|." . nil)) + ("scorebar" . (nil . "scorepostbreak")) + ("brace" . (nil . "brace")) + ("bracket" . (nil . "bracket")) + )) + +(define (break-barline glyph dir) + (let ((result (assoc glyph bar-break-glyph-alist))) (if (equal? result #f) (ly-warn (string-append "Unknown bar glyph: `" glyph "'")) (index-cell (cdr result) dir)) -- 2.39.2