From be8b1b187915d3e7cbb867e633aca8c562f79da8 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 27 Sep 2005 10:50:17 +0000 Subject: [PATCH] * lily/include/paper-system.hh (class Paper_system): remove number_ variable. Remove is_title_. Remove break_before_penalty_ * lily/paper-book.cc (systems): use 'number property iso. number_ member. * lily/paper-system-scheme.cc: remove ly:paper-system-break-before-penalty remove ly:paper-system-number. * scm/lily-library.scm (paper-system-title?): new function. * scm/page-layout.scm (ly:optimal-page-breaks): read next-space and next-padding. (optimal-page-breaks): rename from ly:optimal-page-breaks. * lily/paper-system-scheme.cc (LY_DEFINE): new function. * lily/paper-system.cc (internal_get_property): new function. * scm/page-layout.scm (ly:optimal-page-breaks): add support for pagetopspace * lily/paper-system.cc (read_left_bound): new function. Read line-break-system-details from left bound to determine extents. * python/convertrules.py (conv): rule --- ChangeLog | 11 ++++ input/regression/apply-context.ly | 6 +- input/regression/apply-output.ly | 6 +- input/regression/balloon.ly | 4 +- input/regression/cluster-cross-staff.ly | 4 +- input/regression/cluster.ly | 4 +- input/regression/generic-output-property.ly | 6 +- input/regression/music-map.ly | 4 +- input/regression/repeat-unfold-tremolo.ly | 6 +- input/test/add-staccato.ly | 4 +- input/test/add-text-script.ly | 4 +- input/test/ancient-font.ly | 4 +- input/test/bar-number-every-five-reset.ly | 6 +- input/test/move-specific-text.ly | 4 +- input/test/music-box.ly | 6 +- input/test/reverse-music.ly | 4 +- input/test/smart-transpose.ly | 6 +- input/test/unfold-all-repeats.ly | 4 +- lily/include/paper-system.hh | 12 ++-- lily/paper-book.cc | 28 +++++---- lily/paper-system-scheme.cc | 27 --------- lily/paper-system.cc | 67 +++++++++------------ lily/system.cc | 9 ++- python/convertrules.py | 6 +- scm/framework-ps.scm | 12 ++-- scm/lily-library.scm | 5 ++ scm/page-layout.scm | 25 +++++--- scm/safe-lily.scm | 2 - 28 files changed, 139 insertions(+), 147 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c2ccdb47..da4975e517 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2005-09-27 Han-Wen Nienhuys + * lily/include/paper-system.hh (class Paper_system): remove + number_ variable. Remove is_title_. Remove break_before_penalty_ + + * lily/paper-book.cc (systems): use 'number property iso. number_ + member. + + * lily/paper-system-scheme.cc: remove ly:paper-system-break-before-penalty + remove ly:paper-system-number. + + * scm/lily-library.scm (paper-system-title?): new function. + * lily/book.cc (process): bugfix: flip ?: cases. * Documentation/user/changing-defaults.itely (Difficult tweaks): diff --git a/input/regression/apply-context.ly b/input/regression/apply-context.ly index 86c838d999..9eff3c001d 100644 --- a/input/regression/apply-context.ly +++ b/input/regression/apply-context.ly @@ -1,10 +1,10 @@ -\version "2.6.0" +\version "2.7.10" \header { -texidoc = "With @code{\\applycontext}, @code{\\properties} can be modified +texidoc = "With @code{\\applyContext}, @code{\\properties} can be modified procedurally. Applications include: checking bar numbers, smart octavation. @@ -22,7 +22,7 @@ This example prints a bar-number during processing on stdout. %% todo: should put something interesting in the .tex output. - \applycontext + \applyContext #(lambda (tr) (format #t "\nWe were called in barnumber ~a.\n" (ly:context-property tr 'currentBarNumber))) diff --git a/input/regression/apply-output.ly b/input/regression/apply-output.ly index cf99e3dba5..85829a0e88 100644 --- a/input/regression/apply-output.ly +++ b/input/regression/apply-output.ly @@ -1,8 +1,8 @@ -\version "2.6.0" +\version "2.7.10" \header { - texidoc = "The @code{\applyoutput} expression is the most flexible way to + texidoc = "The @code{\applyOutput} expression is the most flexible way to tune properties for individual grobs. Here, the layout of a note head is changed depending on its vertical @@ -38,7 +38,7 @@ position. \stemUp \set autoBeaming = ##f { 8 - \context Voice \applyoutput #mc-squared + \context Voice \applyOutput #mc-squared } diff --git a/input/regression/balloon.ly b/input/regression/balloon.ly index f710b9bc5c..18e0954455 100644 --- a/input/regression/balloon.ly +++ b/input/regression/balloon.ly @@ -3,7 +3,7 @@ texidoc = "With balloon texts, objects in the output can be marked, with lines and explanatory text added." } -\version "2.6.0" +\version "2.7.10" \layout{ raggedright = ##t } @@ -21,7 +21,7 @@ with lines and explanatory text added." %% use predefd function. - \context Voice \applyoutput #(add-balloon-text + \context Voice \applyOutput #(add-balloon-text 'NoteHead "heads, or tails?" '(0 . -3)) diff --git a/input/regression/cluster-cross-staff.ly b/input/regression/cluster-cross-staff.ly index ac491a4bad..9a6adbb76b 100644 --- a/input/regression/cluster-cross-staff.ly +++ b/input/regression/cluster-cross-staff.ly @@ -7,14 +7,14 @@ raggedright= ##t } -\version "2.6.0" +\version "2.7.10" \new PianoStaff << \context Staff = "up" { s1 *2 } \context Staff = "down" << - \applymusic #notes-to-clusters \relative c { 4 \change Staff = up + \applyMusic #notes-to-clusters \relative c { 4 \change Staff = up } { \clef bass s1 * 2 } diff --git a/input/regression/cluster.ly b/input/regression/cluster.ly index 1926b36793..ef805b9f70 100644 --- a/input/regression/cluster.ly +++ b/input/regression/cluster.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc = "Clusters are a device to denote that a complete range of notes is to be played." @@ -15,7 +15,7 @@ fragment = \relative c' { << \new Staff \fragment - \new Staff \applymusic #notes-to-clusters \fragment + \new Staff \applyMusic #notes-to-clusters \fragment >> diff --git a/input/regression/generic-output-property.ly b/input/regression/generic-output-property.ly index 353d8b88ed..5efd751c46 100644 --- a/input/regression/generic-output-property.ly +++ b/input/regression/generic-output-property.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" \header{ texidoc=" @@ -13,13 +13,13 @@ setting the @code{extra-offset} of a grob. \relative c''{ \context Bottom - \applyoutput #(outputproperty-compatibility + \applyOutput #(outputproperty-compatibility (make-type-checker 'note-head-interface) 'extra-offset '(2 . 3)) c2 c \context Score { - \applyoutput #(outputproperty-compatibility (make-type-checker 'mark-interface) 'extra-offset '(-1 . 4)) + \applyOutput #(outputproperty-compatibility (make-type-checker 'mark-interface) 'extra-offset '(-1 . 4)) } \mark A d1 diff --git a/input/regression/music-map.ly b/input/regression/music-map.ly index a3821d8a65..c381b74e0a 100644 --- a/input/regression/music-map.ly +++ b/input/regression/music-map.ly @@ -10,7 +10,7 @@ dynamics are left over. These are put onto the 2nd measure." } -\version "2.6.0" +\version "2.7.10" #(define (notes-to-skip m) "Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips. @@ -35,7 +35,7 @@ foobar = \transpose c c' { c4\>-^ c4-^ c4\!-^ c4-^ } \relative c'' \context Voice { \foobar - << \applymusic #(lambda (x) (music-map notes-to-skip x)) + << pplyMusic #(lambda (x) (music-map notes-to-skip x)) \foobar { d2 d2 } >> } diff --git a/input/regression/repeat-unfold-tremolo.ly b/input/regression/repeat-unfold-tremolo.ly index cd5454e8ea..b1e3d629de 100644 --- a/input/regression/repeat-unfold-tremolo.ly +++ b/input/regression/repeat-unfold-tremolo.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc = "Unfolding tremolo repeats. All fragments fill one @@ -12,12 +12,12 @@ { \time 2/4 - \applymusic #unfold-repeats + \applyMusic #unfold-repeats { \repeat tremolo 4 { c'16 e' } | \repeat tremolo 8 c'16 } | \time 3/4 - \applymusic #unfold-repeats + \applyMusic #unfold-repeats { \repeat tremolo 6 { c'16 e' } | \repeat tremolo 12 c'16 } | \bar "|." diff --git a/input/test/add-staccato.ly b/input/test/add-staccato.ly index bd4b6dcaa4..841569a533 100644 --- a/input/test/add-staccato.ly +++ b/input/test/add-staccato.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" \header { @@ -27,7 +27,7 @@ it is not necessary to use scm constructs (see @code{separate-staccato.ly}). \score { \relative c'' { - a b \applymusic #(lambda (x) (music-map add-staccato x)) { c c } + a b \applyMusic #(lambda (x) (music-map add-staccato x)) { c c } } \layout{ raggedright = ##t } } diff --git a/input/test/add-text-script.ly b/input/test/add-text-script.ly index 4d5f3a2749..fe532957ae 100644 --- a/input/test/add-text-script.ly +++ b/input/test/add-text-script.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc= "@cindex make-music Fingering @@ -28,7 +28,7 @@ create, then write a function that will structure the music for you. m) \score { - \applymusic #(lambda (x) (add-text-script x "6") (display-music x) x ) { c'4-3 } + \applyMusic #(lambda (x) (add-text-script x "6") (display-music x) x ) { c'4-3 } \layout{ raggedright = ##t } } diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index e135a20c5d..e5245d52c3 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" % TODO: split ancient-font into seperate files; possibly in % different locations. \header { @@ -117,7 +117,7 @@ lowerStaff = \context MensuralStaff = "lowerStaff" << % this is broken until further notice -- see refman % \override Staff.StaffSymbol #'line-count = #5 - \context Staff \applyoutput #(outputproperty-compatibility (make-type-checker 'staff-symbol-interface) 'line-count 5) + \context Staff \applyOutput #(outputproperty-compatibility (make-type-checker 'staff-symbol-interface) 'line-count 5) \transpose c c { \set autoBeaming = ##f diff --git a/input/test/bar-number-every-five-reset.ly b/input/test/bar-number-every-five-reset.ly index 5cbd25a279..9fbb860115 100644 --- a/input/test/bar-number-every-five-reset.ly +++ b/input/test/bar-number-every-five-reset.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc = "@cindex Bar Number Every Fifth Reset @@ -7,12 +7,12 @@ not starting from measure zero, you can use a context function, @code{set-bar-number-visibility}, to set automatically @code{barNumberVisibility}, so that the bar numbers appear at regular intervals, starting from the measure in which -@code{set-bar-number-visibility} is set using @code{\applycontext}. +@code{set-bar-number-visibility} is set using @code{\applyContext}. " } -resetBarnum = \context Score \applycontext +resetBarnum = \context Score \applyContext #(set-bar-number-visibility 4) \score { << diff --git a/input/test/move-specific-text.ly b/input/test/move-specific-text.ly index c251f0a672..a82b6bdeee 100644 --- a/input/test/move-specific-text.ly +++ b/input/test/move-specific-text.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" % possible rename to scheme- or something like that. -gp \header { texidoc = "@cindex Scheme Move Text Objects, like text, can be moved around by using some Scheme code. @@ -11,7 +11,7 @@ Objects, like text, can be moved around by using some Scheme code. \score { \relative c''' { \stemUp - \applyoutput #(outputproperty-compatibility (make-text-checker (make-simple-markup "m.d.")) + \applyOutput #(outputproperty-compatibility (make-text-checker (make-simple-markup "m.d.")) 'extra-offset '(-3.5 . -4.5)) a^2^"m.d." } diff --git a/input/test/music-box.ly b/input/test/music-box.ly index d1924e9fb3..47b2cfdd18 100644 --- a/input/test/music-box.ly +++ b/input/test/music-box.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" \include "deutsch.ly" % possible rename to scheme- something. -gp % TODO: ask if it needs to have so many empty bars in the middle. -gp @@ -53,7 +53,7 @@ using Scheme functions to avoid typing work. " } -\version "2.6.0" +\version "2.7.10" pat = \transpose c c' \repeat unfold 2 { << { \context Staff = "up" {r8 e16 f g e f g } } @@ -75,7 +75,7 @@ endc = {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata } \transpose c c' \context PianoStaff << \context Staff = "up" { \clef "G" } \context Staff = "down" { \clef "F" } - { \applymusic #transform { + { \applyMusic #transform { \pat {c e g c' e' } \pat {c d a d' f' } } diff --git a/input/test/reverse-music.ly b/input/test/reverse-music.ly index 6640823353..a0e31643bf 100644 --- a/input/test/reverse-music.ly +++ b/input/test/reverse-music.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" % possible rename to scheme-something. \header { texidoc="@cindex Scheme Reverse Music Symmetric, or palindromical music can be produced, first, by printing @@ -33,7 +33,7 @@ music = \relative c'' { c4 d4( e4 f4 } \score { \context Voice { \music - \applymusic #reverse-music \music + \applyMusic #reverse-music \music } \layout { raggedright = ##t} } diff --git a/input/test/smart-transpose.ly b/input/test/smart-transpose.ly index c164d8fcbf..dec010bd84 100644 --- a/input/test/smart-transpose.ly +++ b/input/test/smart-transpose.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc="@cindex Smart Transpose @@ -69,9 +69,9 @@ music = \relative c' { c4 d e f g a b c } \score { \context Staff { \transpose c ais \music - \applymusic #naturalise \transpose c ais \music + \applyMusic #naturalise \transpose c ais \music \transpose c deses \music - \applymusic #naturalise \transpose c deses \music + \applyMusic #naturalise \transpose c deses \music } \layout { raggedright = ##t} } diff --git a/input/test/unfold-all-repeats.ly b/input/test/unfold-all-repeats.ly index cc7e831b13..153c930f17 100644 --- a/input/test/unfold-all-repeats.ly +++ b/input/test/unfold-all-repeats.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.10" \header { texidoc = "Applying the standard function @code{unfold-repeats} unfolds @@ -18,7 +18,7 @@ mel = \context Staff { \score { { \mel \break - \applymusic #unfold-repeats \mel + \applyMusic #unfold-repeats \mel } } diff --git a/lily/include/paper-system.hh b/lily/include/paper-system.hh index c2640e6548..e35077b9cb 100644 --- a/lily/include/paper-system.hh +++ b/lily/include/paper-system.hh @@ -21,18 +21,18 @@ class Paper_system { DECLARE_SMOBS (Paper_system,); Stencil stencil_; - bool is_title_; - SCM details_; + SCM mutable_property_alist_; + SCM immutable_property_alist_; + + void init_vars (); public: Interval staff_refpoints_; - Real break_before_penalty_; - int number_; - Paper_system (Stencil, bool); - void read_left_bound (Item*); + Paper_system (Stencil, SCM); Stencil to_stencil () const; SCM stencils () const; SCM internal_get_property (SCM sym) const; + void internal_set_property (SCM sym, SCM val); bool is_title () const; Real break_before_penalty () const; Interval staff_refpoints () const; diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 2294a0aef8..fc4da3d89d 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -227,9 +227,10 @@ set_system_penalty (Paper_system *ps, SCM header) if (SCM_VARIABLEP (force) && scm_is_bool (SCM_VARIABLE_REF (force))) { - ps->break_before_penalty_ = to_boolean (SCM_VARIABLE_REF (force)) - ? -10000 - : 10000; + ps->set_property ("penalty", + scm_from_int(to_boolean (SCM_VARIABLE_REF (force)) + ? -10000 + : 10000)); } } } @@ -242,7 +243,9 @@ Paper_book::add_score_title (SCM header) title = score_title (header_); if (!title.is_empty ()) { - Paper_system *ps = new Paper_system (title, true); + // TODO: init properties, from where? + Paper_system *ps = new Paper_system (title, SCM_EOL); + ps->set_property ("is-title", SCM_BOOL_T); systems_ = scm_cons (ps->self_scm (), systems_); ps->unprotect (); set_system_penalty (ps, header); @@ -260,7 +263,8 @@ Paper_book::systems () if (!title.is_empty ()) { - Paper_system *ps = new Paper_system (title, true); + Paper_system *ps = new Paper_system (title, SCM_EOL); + ps->set_property ("is-title", SCM_BOOL_T); set_system_penalty (ps, header_); systems_ = scm_cons (ps->self_scm (), systems_); @@ -317,8 +321,10 @@ Paper_book::systems () SCM t = Text_interface::interpret_markup (paper_->self_scm (), page_properties, scm_car (s)); - // FIXME: title=true? - Paper_system *ps = new Paper_system (*unsmob_stencil (t), true); + + // TODO: init props + Paper_system *ps = new Paper_system (*unsmob_stencil (t), SCM_EOL); + ps->set_property ("is-title", SCM_BOOL_T); systems_ = scm_cons (ps->self_scm (), systems_); ps->unprotect (); @@ -336,12 +342,12 @@ Paper_book::systems () for (SCM s = systems_; s != SCM_EOL; s = scm_cdr (s)) { Paper_system *ps = unsmob_paper_system (scm_car (s)); - ps->number_ = ++i; + ps->set_property ("number", scm_from_int (++i)); if (last - && last->is_title () - && !ps->break_before_penalty_) - ps->break_before_penalty_ = 10000; + && to_boolean (last->get_property ("is-title")) + && !scm_is_number (ps->get_property ("penalty"))) + ps->set_property ("penalty", scm_from_int (10000)); last = ps; } diff --git a/lily/paper-system-scheme.cc b/lily/paper-system-scheme.cc index ee393e0eeb..8f89313e5b 100644 --- a/lily/paper-system-scheme.cc +++ b/lily/paper-system-scheme.cc @@ -19,33 +19,6 @@ LY_DEFINE (ly_paper_system_height, "ly:paper-system-extent", return ly_interval2scm (ps->to_stencil ().extent (ax)); } -LY_DEFINE (ly_paper_system_title_p, "ly:paper-system-title?", - 1, 0, 0, (SCM system), - "Is @var{system} a title system?") -{ - Paper_system *ps = unsmob_paper_system (system); - SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system"); - return SCM_BOOL (ps->is_title ()); -} - -LY_DEFINE (ly_paper_system_number, "ly:paper-system-number", - 1, 0, 0, (SCM system), - "Return the number of @var{system}.") -{ - Paper_system *ps = unsmob_paper_system (system); - SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system"); - return scm_from_int (ps->number_); -} - -LY_DEFINE (ly_paper_system_break_before_penalty, "ly:paper-system-break-before-penalty", - 1, 0, 0, (SCM system), - "Return the score for page break after @var{system}.") -{ - Paper_system *ps = unsmob_paper_system (system); - SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system"); - return scm_from_int (int (ps->break_before_penalty ())); -} - LY_DEFINE (ly_paper_system_stencil, "ly:paper-system-stencil", 1, 0, 0, (SCM system), "Return the height of @var{system}.") diff --git a/lily/paper-system.cc b/lily/paper-system.cc index 87925402d4..a7e95227d0 100644 --- a/lily/paper-system.cc +++ b/lily/paper-system.cc @@ -15,16 +15,17 @@ IMPLEMENT_SMOBS (Paper_system); IMPLEMENT_TYPE_P (Paper_system, "ly:paper-system?"); IMPLEMENT_DEFAULT_EQUAL_P (Paper_system); -Paper_system::Paper_system (Stencil s, bool is_title) +Paper_system::Paper_system (Stencil s, SCM immutable_init) { - is_title_ = is_title; - number_ = 0; - break_before_penalty_ = 0; + mutable_property_alist_ = SCM_EOL; + immutable_property_alist_ = immutable_init; smobify_self (); stencil_ = s; staff_refpoints_ = Interval (0, 0); + init_vars (); } + Paper_system::~Paper_system () { } @@ -33,7 +34,7 @@ SCM Paper_system::mark_smob (SCM smob) { Paper_system *system = (Paper_system *) SCM_CELL_WORD_1 (smob); - scm_gc_mark (system->details_); + scm_gc_mark (system->mutable_property_alist_); return system->stencil_.expr (); } @@ -43,27 +44,12 @@ Paper_system::print_smob (SCM smob, SCM port, scm_print_state*) Paper_system *p = (Paper_system *) SCM_CELL_WORD_1 (smob); scm_puts ("#<", port); scm_puts (classname (p), port); - scm_puts ("n ", port); - scm_puts (to_string (p->number_).to_str0 (), port); - scm_puts (", p ", port); - scm_puts (to_string (p->break_before_penalty_).to_str0 (), port); - if (p->is_title ()) - scm_puts (" t", port); + scm_display (p->mutable_property_alist_, port); + scm_puts (" >", port); return 1; } -bool -Paper_system::is_title () const -{ - return is_title_; -} - -Real -Paper_system::break_before_penalty () const -{ - return break_before_penalty_; -} Stencil Paper_system::to_stencil () const @@ -72,19 +58,10 @@ Paper_system::to_stencil () const } void -Paper_system::read_left_bound (Item *left) +Paper_system::init_vars () { - break_before_penalty_ - = robust_scm2double (left->get_property ("page-penalty"), 0.0); - - details_ - = left->get_property ("line-break-system-details"); - - SCM yext - = scm_assq (ly_symbol2scm ("Y-extent"), details_); - - SCM staff_ext - = scm_assq (ly_symbol2scm ("refpoint-Y-extent"), details_); + SCM yext = get_property ("Y-extent"); + SCM staff_ext = get_property ("refpoint-Y-extent"); if (scm_is_pair (yext) && is_number_pair (scm_cdr (yext))) @@ -105,11 +82,23 @@ Paper_system::read_left_bound (Item *left) SCM Paper_system::internal_get_property (SCM sym) const { - SCM handle = scm_assq (sym, details_); - if (scm_is_pair (handle)) - return scm_cdr (handle); - else - return SCM_EOL; + /* + TODO: type checking + */ + SCM s = scm_sloppy_assq (sym, mutable_property_alist_); + if (s != SCM_BOOL_F) + return scm_cdr (s); + + s = scm_sloppy_assq (sym, immutable_property_alist_); + + + return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s); +} + +void +Paper_system::internal_set_property (SCM sym, SCM val) +{ + mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, sym, val); } /* diff --git a/lily/system.cc b/lily/system.cc index 7df79c196c..1ede4824c5 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -383,9 +383,14 @@ System::get_paper_system () staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS)); } - Paper_system *pl = new Paper_system (sys_stencil, false); + Grob *left_bound = this->get_bound (LEFT); + SCM prop_init = left_bound->get_property ("line-break-system-details"); + Paper_system *pl = new Paper_system (sys_stencil, + prop_init); + pl->staff_refpoints_ = staff_refpoints; - pl->read_left_bound (this->get_bound (LEFT)); + pl->set_property ("penalty", + left_bound->get_property ("page-penalty")); return pl->unprotect (); } diff --git a/python/convertrules.py b/python/convertrules.py index 471a4927b4..f04577e8a4 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2558,9 +2558,9 @@ inside-slur -> avoid-slur''')) def conv (str): - str = re.sub(r'\\applyoutput', '\\applyOutput', str) - str = re.sub(r'\\applycontext', '\\applyContext', str) - str = re.sub(r'\\applymusic', '\\applyMusic', str) + str = re.sub(r'\\applyoutput', r'\\applyOutput', str) + str = re.sub(r'\\applycontext', r'\\applyContext', str) + str = re.sub(r'\\applymusic', r'\\applyMusic', str) str = re.sub(r'ly:grob-suicide', 'ly:grob-suicide!', str) return str diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 031e51998f..125fd8645f 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -498,16 +498,16 @@ (not (ly:get-option 'preview-include-book-title)) (< 1 (length systems)) - (ly:paper-system-title? (list-ref systems 0)) - (ly:paper-system-title? (list-ref systems 1))) + (paper-system-title? (list-ref systems 0)) + (paper-system-title? (list-ref systems 1))) (set! systems (cdr systems))) (for-each (lambda (sys) (if (or - (ly:paper-system-title? sys) + (paper-system-title? sys) (not (pair? to-dump-systems)) - (ly:paper-system-title? (car to-dump-systems))) + (paper-system-title? (car to-dump-systems))) (set! to-dump-systems (cons sys to-dump-systems)))) systems) @@ -527,9 +527,9 @@ (let* ((paper (ly:paper-book-paper book)) (systems (ly:paper-book-systems book)) (scale (ly:output-def-lookup paper 'outputscale)) - (titles (take-while ly:paper-system-title? systems)) + (titles (take-while paper-system-title? systems)) (non-title (find (lambda (x) - (not (ly:paper-system-title? x))) systems)) + (not (paper-system-title? x))) systems)) (dump-me (stack-stencils Y DOWN 0.0 (map ly:paper-system-stencil diff --git a/scm/lily-library.scm b/scm/lily-library.scm index c16acc56f2..3b16305577 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -115,6 +115,11 @@ (ly:score-process score header paper layout base) )) + +(define-public (paper-system-title? ps) + (equal? #t (ly:paper-system-property ps 'is-title) + )) + ;;;;;;;;;;;;;;;; ;; alist (define-public assoc-get ly:assoc-get) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 7dcdd8bd53..3272a2ff3f 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -28,7 +28,10 @@ "\n"))) (define-method (node-system-numbers (node )) - (map ly:paper-system-number (node-lines node))) + (map ly:paper-system-property (node-lines node) 'number)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -130,13 +133,13 @@ create offsets. (let* ((system (car stencil-position)) (stencil (ly:paper-system-stencil system)) (y (cadr stencil-position)) - (is-title (ly:paper-system-title? + (is-title (paper-system-title? (car stencil-position)))) (add-to-page stencil y) (if (and (ly:stencil? system-separator-stencil) last-system - (not (ly:paper-system-title? system)) - (not (ly:paper-system-title? last-system))) + (not (paper-system-title? system)) + (not (paper-system-title? last-system))) (add-to-page system-separator-stencil (average (- last-y @@ -189,7 +192,6 @@ create offsets. "Return pages as a list starting with 1st page. Each page is a list of lines. " - (define MAXPENALTY 1e9) (define paper (ly:paper-book-paper paper-book)) (define scopes (ly:paper-book-scopes paper-book)) @@ -293,10 +295,11 @@ is what have collected so far, and has ascending page numbers." fixed-dist) (interval-start this-system-ext)))) (title1? (and (vector-ref system-vector idx) - (ly:paper-system-title? (vector-ref system-vector idx)))) + (paper-system-title? (vector-ref system-vector idx) + ))) (title2? (and (vector-ref system-vector (1+ idx)) - (ly:paper-system-title? (vector-ref system-vector (1+ idx))))) + (paper-system-title? (vector-ref system-vector (1+ idx))))) (ideal (+ (cond ((and title2? title1?) @@ -384,14 +387,16 @@ CURRENT-BEST is the best result sofar, or #f." satisfied-constraints) 10000)) (positions (cdr vertical-spacing)) + (get-break-penalty (lambda (sys) + (ly:paper-system-property sys 'penalty 0.0))) (user-nobreak-penalties (- (apply + (filter negative? - (map ly:paper-system-break-before-penalty + (map get-break-penalty (cdr current-lines)))))) (user-penalty (+ - (max (ly:paper-system-break-before-penalty (car current-lines)) 0.0) + (max (get-break-penalty (car current-lines)) 0.0) user-nobreak-penalties)) (total-penalty (combine-penalties force user-penalty @@ -457,7 +462,7 @@ DONE." (cdr todo))))) (define (line-number node) - (ly:paper-system-number (car (node-lines node)))) + (ly:paper-system-property (car (node-lines node)) 'number)) (ly:message (_ "Calculating page breaks...")) (set! force-equalization-factor diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 9300f8b248..023b553147 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -100,9 +100,7 @@ ly:layout-def? ly:paper-get-font ly:paper-get-number - ly:paper-system-break-before-penalty ly:paper-system-extent - ly:paper-system-number ly:paper-system-stencil ly:paper-system? ly:output-def-lookup -- 2.39.2