From 5d4dac8980f796c7e4c97f1a4f19822c0fc4fff7 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 21 Oct 2005 13:54:32 +0000 Subject: [PATCH] * scripts/convert-ly.py (datadir): add prefix switching hack to .py too. * lily/grob-property.cc (del_property): new function. --- ChangeLog | 3 ++ Documentation/topdocs/NEWS.tely | 36 +++++++++++--------- Documentation/user/advanced-notation.itely | 2 +- Documentation/user/basic-notation.itely | 2 +- Documentation/user/changing-defaults.itely | 2 +- Documentation/user/instrument-notation.itely | 2 +- Documentation/user/introduction.itely | 2 +- GNUmakefile.in | 4 +-- VERSION | 2 +- input/regression/balloon.ly | 4 +-- input/regression/lyric-hyphen-retain.ly | 4 +-- input/regression/multi-measure-rest-text.ly | 4 +-- input/regression/spacing-folded-clef2.ly | 6 ++-- input/regression/stencil-hacking.ly | 10 +++--- input/regression/system-extents.ly | 4 +-- lily/cluster.cc | 10 +++--- lily/context-property.cc | 4 ++- lily/grob-property.cc | 7 ++-- lily/grob-scheme.cc | 5 +-- python/convertrules.py | 10 ++++++ scm/define-grob-interfaces.scm | 2 +- scripts/convert-ly.py | 5 ++- 22 files changed, 78 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbf53e7c4c..fe8aebfeeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-21 Han-Wen Nienhuys + * scripts/convert-ly.py (datadir): add prefix switching hack to + .py too. + * input/mutopia/W.A.Mozart/mozart-hrn3-defs.ily (cresc): remove space-function tweak. diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 12250ac0c1..b8fb79aea9 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -45,6 +45,25 @@ This document is also available in @uref{NEWS.pdf,PDF}. @itemize @bullet + +@item +Each grob property can be a procedure. If this is the case, it is +assumed to be a routine that calculates said property. This is a +major internal cleanup, which also provides advanced tweakability for +power users. For example, + +@verbatim +\override Beam #'direction + = #(lambda (grob) + (if (> 4 (ly:grob-array-length (ly:grob-object grob 'stems))) + DOWN + UP)) +@end verbatim + +@noindent +With this code fragment, the direction of a beam is decided to be up +or down, depending on the number of stems in the beam. + @item Support for figured bass has been rewritten. Now it supports continuation lines, slashed figures, and its figures, brackets, and alignments may @@ -61,23 +80,6 @@ tuned separately. This rewrite was sponsored by Trent Johnston and John Mandereau. -@item -For each grob, a subproperty in @code{callbacks} property defines the -procedure which computes it. This is a major internal cleanup, which -also provides advanced tweakability for power users. For example, - -@verbatim -\override Beam #'callbacks #'direction - = #(lambda (grob) - (if (> 4 (ly:grob-array-length (ly:grob-object grob 'stems))) - DOWN - UP)) -@end verbatim - -@noindent -With this code fragment, the direction of a beam is decided to be up -or down, depending on the number of stems in the beam. - @item Subproperties, like the @code{details} field of @code{Slur} and @code{Tie} may now be tuned with @code{\override}. For example, diff --git a/Documentation/user/advanced-notation.itely b/Documentation/user/advanced-notation.itely index 42f34ba89d..922d9aeec0 100644 --- a/Documentation/user/advanced-notation.itely +++ b/Documentation/user/advanced-notation.itely @@ -1524,7 +1524,7 @@ tsMarkup =\markup { } { - \override Staff.TimeSignature #'callbacks #'stencil = #Text_interface::print + \override Staff.TimeSignature #'stencil = #Text_interface::print \override Staff.TimeSignature #'text = #tsMarkup \time 3/2 c'2 \bar ":" c'4 c'4. diff --git a/Documentation/user/basic-notation.itely b/Documentation/user/basic-notation.itely index 7db71430b6..1653738393 100644 --- a/Documentation/user/basic-notation.itely +++ b/Documentation/user/basic-notation.itely @@ -2987,7 +2987,7 @@ Isolated percents can also be printed. This is done by putting a multi measure rest with a different print function, @lilypond[fragment,verbatim] -\override MultiMeasureRest #'callbacks #'stencil +\override MultiMeasureRest #'stencil = #Multi_measure_rest::percent R1 @end lilypond diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 9af5cee059..152a55ba5c 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -1324,7 +1324,7 @@ of the broken tie is translated up. (ly:grob-set-property! grob 'extra-offset '(-2 . 5))))) \relative c'' { - \override Tie #'callbacks #'after-line-breaking = + \override Tie #'after-line-breaking = #my-callback c1 ~ \break c2 ~ c } diff --git a/Documentation/user/instrument-notation.itely b/Documentation/user/instrument-notation.itely index bed34c62f5..4c05f06385 100644 --- a/Documentation/user/instrument-notation.itely +++ b/Documentation/user/instrument-notation.itely @@ -881,7 +881,7 @@ the @code{LyricHyphen} grob. An -- ti -- cons -- ti -- tu -- tion -- nel -- le -- \override LyricHyphen #'minimum-length = #0.7 - \override LyricHyphen #'callbacks #'springs-and-rods = + \override LyricHyphen #'springs-and-rods = #Hyphen_spanner::set_spacing_rods men -- taire -- ment. ouf~! } diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 3d8b8c540e..b0dbe6824a 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -336,7 +336,7 @@ fragment. \set autoBeaming = ##f \time 2/4 4 - \once \override NoteHead #'callbacks #'stencil = #Note_head::brew_ez_stencil + \once \override NoteHead #'stencil = #Note_head::brew_ez_stencil \once \override NoteHead #'style = #'cross diff --git a/GNUmakefile.in b/GNUmakefile.in index 7fef24ff72..574cf4b7b1 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -116,12 +116,12 @@ $(tree-prefix)/lilypond-force link-tree: GNUmakefile mkdir -p $(tree-prefix)/fonts/enc mkdir -p $(tree-prefix)/tex cd $(top-build-dir)/$(outbase)/lib && \ - ln -s ../../../python/$(outconfbase) python + ln -s ../../../../python/$(outconfbase) python cd $(tree-prefix) && \ ln -s $(top-src-dir)/ly ly && \ ln -s ../../../../mf mf && \ ln -s $(top-src-dir)/ps && \ - ln -s ../../../python/$(outconfbase) python && \ + ln -s ../../../../python/$(outconfbase) python && \ ln -s $(top-src-dir)/scm && \ ln -s $(top-src-dir)/scripts scripts cd $(tree-prefix)/dvips && \ diff --git a/VERSION b/VERSION index 38bfbcfef3..7f57d381b8 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=7 -PATCH_LEVEL=13 +PATCH_LEVEL=14 MY_PATCH_LEVEL= diff --git a/input/regression/balloon.ly b/input/regression/balloon.ly index 1f20c4285d..c7f78c45cd 100644 --- a/input/regression/balloon.ly +++ b/input/regression/balloon.ly @@ -12,8 +12,8 @@ with lines and explanatory text added." \relative c' { %% by hand: - \once\override Stem #'callbacks #'stencil = #Balloon_interface::print - \once\override Stem #'balloon-original-callback = #Stem::print + \once\override Stem #'stencil = #Balloon_interface::print + \once\override Stem #'original-stencil = #Stem::print \once\override Stem #'balloon-text = #"I'm a stem" \once\override Stem #'balloon-text-offset = #'(3 . 4) \once\override Stem #'balloon-text-props diff --git a/input/regression/lyric-hyphen-retain.ly b/input/regression/lyric-hyphen-retain.ly index dd3beddf4b..d066169fcc 100644 --- a/input/regression/lyric-hyphen-retain.ly +++ b/input/regression/lyric-hyphen-retain.ly @@ -1,5 +1,5 @@ -\version "2.7.13" +\version "2.7.14" \header { @@ -38,7 +38,7 @@ amount bla -- bla -- bla -- bla -- \override LyricHyphen #'minimum-length = #0.7 - \override LyricHyphen #'callbacks #'springs-and-rods = + \override LyricHyphen #'springs-and-rods = #Hyphen_spanner::set_spacing_rods bla -- bla -- bla -- bla diff --git a/input/regression/multi-measure-rest-text.ly b/input/regression/multi-measure-rest-text.ly index 7d8d54959f..b53496b00c 100644 --- a/input/regression/multi-measure-rest-text.ly +++ b/input/regression/multi-measure-rest-text.ly @@ -1,4 +1,4 @@ -\version "2.7.13" +\version "2.7.14" \header { @@ -22,7 +22,7 @@ measures stretch to accomodate wide texts. R2.^"4" R2.*3_\markup { \roman "a1b2c3" } R2.*10^"inner"^"top"_"inner"_"bot" - \override MultiMeasureRestText #'callbacks #'springs-and-rods + \override MultiMeasureRestText #'springs-and-rods = #Multi_measure_rest::set_text_rods R2.^"very very very very very very long text" diff --git a/input/regression/spacing-folded-clef2.ly b/input/regression/spacing-folded-clef2.ly index 3910763faf..23e6ff2cd7 100644 --- a/input/regression/spacing-folded-clef2.ly +++ b/input/regression/spacing-folded-clef2.ly @@ -1,4 +1,4 @@ -\version "2.7.13" +\version "2.7.14" \header { texidoc = "A clef can be folded below notes in a different staff, if @@ -11,8 +11,8 @@ can show where columns are in the score." \context { \Score - \override NonMusicalPaperColumn #'callbacks #'stencil = #Paper_column::print - \override PaperColumn #'callbacks #'stencil = #Paper_column::print + \override NonMusicalPaperColumn #'stencil = #Paper_column::print + \override PaperColumn #'stencil = #Paper_column::print \override NonMusicalPaperColumn #'font-family = #'roman \override PaperColumn #'font-family = #'roman diff --git a/input/regression/stencil-hacking.ly b/input/regression/stencil-hacking.ly index b5ec1dfa0b..9cdf19d0df 100644 --- a/input/regression/stencil-hacking.ly +++ b/input/regression/stencil-hacking.ly @@ -1,5 +1,5 @@ -\version "2.7.13" +\version "2.7.14" \header { texidoc=" You can write stencil callbacks in Scheme, thus providing custom glyphs for notation elements. A simple example is @@ -37,7 +37,7 @@ GROB. The dimensions of the stencil is not affected. (subject-dim-x (ly:stencil-extent subject 0)) (subject-dim-y (ly:stencil-extent subject 1))) - ; add parens + ;; add parens (set! subject (ly:stencil-combine-at-edge (ly:stencil-combine-at-edge subject 0 1 pclose 0.2) @@ -53,13 +53,13 @@ GROB. The dimensions of the stencil is not affected. \relative c' { c4 e - \override NoteHead #'callbacks #'stencil + \override NoteHead #'stencil = #(parenthesize-callback Note_head::print) g bes - \revert NoteHead #'callbacks % stencil + \revert NoteHead % stencil - \override Beam #'callbacks #'stencil + \override Beam #'stencil = #(parenthesize-callback Beam::print) diff --git a/input/regression/system-extents.ly b/input/regression/system-extents.ly index 35cb091b2b..cbb48a2819 100644 --- a/input/regression/system-extents.ly +++ b/input/regression/system-extents.ly @@ -1,4 +1,4 @@ -\version "2.7.13" +\version "2.7.14" \header { texidoc = "The size of every system is correctly determined; this @@ -10,7 +10,7 @@ \layout { \context { \Score - \override System #'callbacks #'stencil = #box-grob-stencil + \override System #'stencil = #box-grob-stencil } } diff --git a/lily/cluster.cc b/lily/cluster.cc index b089e5cb5a..6eacdf82f7 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -210,13 +210,13 @@ ADD_INTERFACE (Cluster, "cluster-interface", struct Cluster_beacon { public: - DECLARE_SCHEME_CALLBACK (height, (SCM, SCM)); + DECLARE_SCHEME_CALLBACK (height, (SCM)); static bool has_interface (Grob *); }; -MAKE_SCHEME_CALLBACK (Cluster_beacon, height, 2); +MAKE_SCHEME_CALLBACK (Cluster_beacon, height, 1); SCM -Cluster_beacon::height (SCM g, SCM) +Cluster_beacon::height (SCM g) { Grob *me = unsmob_grob (g); Interval v = robust_scm2interval (me->get_property ("positions"), @@ -228,4 +228,6 @@ ADD_INTERFACE (Cluster_beacon, "cluster-beacon-interface", "A place holder for the cluster spanner to determine the vertical " "extents of a cluster spanner at this X position.", - "positions"); + + /* properties */ + "positions "); diff --git a/lily/context-property.cc b/lily/context-property.cc index 4ee9a43002..2fc887300d 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -136,7 +136,9 @@ execute_general_pushpop_property (Context *context, bool ok = true; if (!scm_is_pair (scm_cdr (grob_property_path))) { - ok = type_check_assignment (symbol, new_value, ly_symbol2scm ("backend-type?")); + ok = !ly_is_procedure (new_value) + && type_check_assignment (symbol, new_value, + ly_symbol2scm ("backend-type?")); /* tack onto alist. We can use set_car, since diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 7a21e66111..789b1e45b4 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -88,7 +88,8 @@ Grob::internal_set_property (SCM sym, SCM v) if (do_internal_type_checking_global) { - if (!type_check_assignment (sym, v, ly_symbol2scm ("backend-type?"))) + if (!ly_is_procedure (v) + && !type_check_assignment (sym, v, ly_symbol2scm ("backend-type?"))) abort (); check_interfaces_for_property (this, sym); } @@ -119,7 +120,9 @@ Grob::get_property_data (SCM sym) const if (do_internal_type_checking_global && scm_is_pair (handle)) { - if (!type_check_assignment (sym, scm_cdr (handle), + SCM val = scm_cdr (handle); + if (!ly_is_procedure (val) + && !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"))) abort (); diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index e8911d6a6b..e806689a42 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -38,7 +38,8 @@ LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!", SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); - if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"))) + if (!ly_is_procedure (val) + && !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"))) error ("typecheck failed"); sc->internal_set_property (sym, val); @@ -48,7 +49,7 @@ LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!", LY_DEFINE (ly_grob_property, "ly:grob-property", 2, 0, 0, (SCM grob, SCM sym), "Return the value of a value in grob @var{g} of property @var{sym}. " - "It will return @code{' ()} (end-of-list) " + "It will return @code{'()} (end-of-list) " "if @var{sym} is undefined in @var{g}." "\n\n") { diff --git a/python/convertrules.py b/python/convertrules.py index 92436d5a7d..1423a30e37 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2615,3 +2615,13 @@ def conv (str): conversions.append (((2, 7, 13), conv, '''layout engine refactoring. [FIXME] ''')) + + + +def conv (str): + str = re.sub (r"#'callbacks", '', str) + str = re.sub (r"([XY]-extent)-callback", r'\1', str) + return str + +conversions.append (((2, 7, 14), conv, + '''Remove callbacks property, deprecate XY-extent-callback. ''')) diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index a3d4df37e0..061ea4d83d 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -48,7 +48,7 @@ (ly:add-interface 'ligature-bracket-interface "A bracket indicating a ligature in the original edition" - '(width thickness height ligature-primitive-callback)) + '(width thickness height)) (ly:add-interface diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 2024bd034f..1bb9fbc349 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -22,7 +22,10 @@ if not os.path.isdir (datadir): if os.environ.has_key ('LILYPONDPREFIX'): datadir = os.environ['LILYPONDPREFIX'] while datadir[-1] == os.sep: - datadir= datadir[:-1] + datadir = datadir[:-1] + +if os.path.exists (os.path.join (datadir, 'share/lilypond/@TOPLEVEL_VERSION@/')): + datadir = os.path.join (datadir, 'share/lilypond/@TOPLEVEL_VERSION@/') sys.path.insert (0, os.path.join (datadir, 'python')) -- 2.39.5