From: Han-Wen Nienhuys Date: Wed, 10 Apr 2002 15:38:40 +0000 (+0000) Subject: '' X-Git-Tag: release/1.5.52~9 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8d8929f220531011b9f503a05737341d4863ed36;p=lilypond.git '' --- diff --git a/ChangeLog b/ChangeLog index 3c3f7d47e6..3df59d362f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-04-10 Han-Wen Nienhuys + + * lily/grob.cc (internal_get_grob_property): also typecheck + property reads. Catches even more undocced properties. Bugfixing + left for the uninspired masses. + + * lily/beam.cc: remove end_after_line_breaking(). + + * lily/grob.cc (calculate_dependencies): remove list support for callbacks. + + * lily/font-size-engraver.cc: only do font-interface. + 2002-04-10 Heikki Junes * lilypond-font-lock.el: Handle notes with cautionary accidentals. diff --git a/lily/beam.cc b/lily/beam.cc index 0e8bf56f34..ea36554c28 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -353,6 +353,7 @@ Beam::after_line_breaking (SCM smob) for (SCM i = callbacks; gh_pair_p (i); i = ly_cdr (i)) gh_call1 (ly_car (i), smob); + set_stem_lengths (me); return SCM_UNSPECIFIED; } @@ -884,16 +885,6 @@ Beam::slope_damping (SCM smob) me->set_grob_property ("positions", ly_interval2scm (pos)); } - return SCM_UNSPECIFIED; -} - -MAKE_SCHEME_CALLBACK (Beam, end_after_line_breaking, 1); -SCM -Beam::end_after_line_breaking (SCM smob) -{ - Grob *me = unsmob_grob (smob); - set_stem_lengths (me); - return SCM_UNSPECIFIED; } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index b37a995b1d..f2d5e10e97 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -150,5 +150,5 @@ Dot_column::add_head (Grob * me, Grob *rh) ADD_INTERFACE (Dot_column, "dot-column-interface", "Interface that groups dots so they form a column", - "stem"); + "direction stem"); diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index 6ca9eea7ca..863bc6bf11 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -43,6 +43,6 @@ Font_size_engraver::acknowledge_grob (Grob_info gi) ENTER_DESCRIPTION(Font_size_engraver, /* descr */ "Puts fontSize into font-relative-size grob property.", /* creats*/ "", -/* acks */ "grob-interface", +/* acks */ "font-interface", /* reads */ "fontSize", /* write */ ""); diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index 283a49fe83..f8ae935983 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -56,8 +56,16 @@ init_iface_funcs () ADD_SCM_INIT_FUNC(giface, init_iface_funcs); void -check_interfaces_for_property (Grob *me, SCM sym) +check_interfaces_for_property (Grob const *me, SCM sym) { + if (sym == ly_symbol2scm ("meta")) + { + /* + otherwise we get in a nasty recursion loop. + */ + return ; + + } SCM ifs = me->get_grob_property ("interfaces"); diff --git a/lily/grob.cc b/lily/grob.cc index ea6fc27b5b..3202e931c3 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -56,6 +56,20 @@ Grob::Grob (SCM basicprops) smobify_self (); + + SCM meta = get_grob_property ("meta"); + if (gh_pair_p (meta)) + { + SCM ifs = scm_assoc (ly_symbol2scm ("interfaces"), meta); + + /* + do it directly to bypass interface checks. + */ + mutable_property_alist_ = gh_cons (gh_cons (ly_symbol2scm ("interfaces"), + gh_cdr (ifs)), + mutable_property_alist_); + } + /* TODO: @@ -94,18 +108,6 @@ Grob::Grob (SCM basicprops) dim_cache_[a].dimension_ = cb; } - SCM meta = get_grob_property ("meta"); - if (gh_pair_p (meta)) - { - SCM ifs = scm_assoc (ly_symbol2scm ("interfaces"), meta); - - /* - do it directly to bypass interface checks. - */ - mutable_property_alist_ = gh_cons (gh_cons (ly_symbol2scm ("interfaces"), - gh_cdr (ifs)), - mutable_property_alist_); - } } Grob::Grob (Grob const&s) @@ -129,6 +131,25 @@ Grob::~Grob () } + +extern void check_interfaces_for_property (Grob const *me, SCM sym); + +void +Grob::internal_set_grob_property (SCM s, SCM v) +{ +#ifndef NDEBUG + if (internal_type_checking_global_b) + { + assert (type_check_assignment (s, v, ly_symbol2scm ("backend-type?"))); + check_interfaces_for_property(this, s); + } +#endif + + + mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v); +} + + SCM Grob::internal_get_grob_property (SCM sym) const { @@ -137,6 +158,15 @@ Grob::internal_get_grob_property (SCM sym) const return ly_cdr (s); s = scm_sloppy_assq (sym, immutable_property_alist_); + +#ifndef NDEBUG + if (internal_type_checking_global_b && gh_pair_p (s)) + { + assert (type_check_assignment (sym, gh_cdr (s), ly_symbol2scm ("backend-type?"))); + check_interfaces_for_property(this, sym); + } +#endif + return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s); } @@ -155,44 +185,6 @@ Grob::remove_grob_property (const char* key) } -#if 0 -/* - Puts the k, v in the immutable_property_alist_, which is convenient for - storing variables that are needed during the breaking process. (eg. - System::rank : int) - */ -void -Grob::set_immutable_grob_property (const char*k, SCM v) -{ - SCM s = ly_symbol2scm (k); - set_immutable_grob_property (s, v); -} - -void -Grob::set_immutable_grob_property (SCM s, SCM v) -{ - immutable_property_alist_ = gh_cons (gh_cons (s,v), mutable_property_alist_); - mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, s); -} -#endif - -extern void check_interfaces_for_property (Grob *me, SCM sym); - -void -Grob::internal_set_grob_property (SCM s, SCM v) -{ -#ifndef NDEBUG - if (internal_type_checking_global_b) - { - assert (type_check_assignment (s, v, ly_symbol2scm ("backend-type?"))); - check_interfaces_for_property(this, s); - } -#endif - - - mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v); -} - MAKE_SCHEME_CALLBACK (Grob,molecule_extent,2); SCM @@ -259,15 +251,11 @@ Grob::calculate_dependencies (int final, int busy, SCM funcname) ->calculate_dependencies (final, busy, funcname); } - // ughugh. - String s = ly_symbol2string (funcname); - SCM proc = get_grob_property (s.ch_C ()); + + SCM proc = internal_get_grob_property (funcname); if (gh_procedure_p (proc)) gh_call1 (proc, this->self_scm ()); - else if (gh_list_p (proc)) - for (SCM i = proc; gh_pair_p (i); i = ly_cdr (i)) - gh_call1 (ly_car (i), this->self_scm ()); - + status_c_= final; } @@ -958,6 +946,6 @@ ADD_INTERFACE (Grob, "grob-interface", "All grobs support this", "X-offset-callbacks Y-offset-callbacks X-extent-callback molecule cause Y-extent-callback molecule-callback extra-offset -staff-symbol interfaces dependencies extra-extent-X causes +staff-symbol interfaces dependencies extra-extent-X causes meta layer before-line-breaking-callback after-line-breaking-callback extra-extent-Y minimum-extent-X minimum-extent-Y transparent"); diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 4f32cfe0e8..dcc7ba1790 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -29,7 +29,6 @@ public: DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM )); DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM )); DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM )); - DECLARE_SCHEME_CALLBACK (end_after_line_breaking, (SCM)); /* position callbacks */ DECLARE_SCHEME_CALLBACK (least_squares, (SCM)); diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 68fe674790..2a86f22ff5 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -768,5 +768,5 @@ gets 2 note heads width (i.e. the space following a note is 1 note head width) A 16th note is followed by 0.5 note head width. The quarter note is followed by 3 NHW, the half by 4 NHW, etc. ", - "spacing-increment shortest-duration-space"); + "grace-space-factor spacing-increment shortest-duration-space"); diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index 8d7a5db7c3..fa18624f99 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -245,4 +245,4 @@ Staff_spacing::get_spacing_params (Grob *me, Real * space, Real * fixed) ADD_INTERFACE (Staff_spacing,"staff-spacing-interface", "", - "left-items right-items"); + "stem-spacing-correction left-items right-items"); diff --git a/lily/stem.cc b/lily/stem.cc index 726f71a2ab..ff8a4c4a99 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -808,5 +808,5 @@ Stem::has_interface (Grob*m) ADD_INTERFACE (Stem,"stem-interface", "A stem", - "thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head heads direction length style no-stem-extend flag-style dir-forced"); + "adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head heads direction length style no-stem-extend flag-style dir-forced"); diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 5f775ddd5c..a237b014d1 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -63,7 +63,7 @@ (thin-kern . 3.0) (hair-thickness . 1.6) (thick-thickness . 6.0) - (meta . ((interfaces . (bar-line-interface font-interface)))) + (meta . ((interfaces . (bar-line-interface break-aligned-interface font-interface)))) )) @@ -113,8 +113,7 @@ ;; TODO: should be in SLT. (thickness . 0.48) ; in staff-space (before-line-breaking-callback . ,Beam::before_line_breaking) - (after-line-breaking-callback . (,Beam::after_line_breaking - ,Beam::end_after_line_breaking)) + (after-line-breaking-callback . ,Beam::after_line_breaking) (neutral-direction . -1) (dir-function . ,beam-dir-majority-median) (beamed-stem-shorten . (1.0 0.5)) @@ -903,7 +902,7 @@ (breakable . #t) (style . C) (font-family . number) - (meta . ((interfaces . (time-signature-interface font-interface)))) + (meta . ((interfaces . (time-signature-interface break-aligned-interface font-interface)))) )) (TupletBracket diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index 81e149a7fe..f1a1c2dbc5 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -72,7 +72,7 @@ In the case of alignment grobs, this should contain only one number.") (grob-property-description 'beam-width number? "width of the tremolo sign.") (grob-property-description 'beamed-lengths list? "list of stem lengths given beam multiplicity .") (grob-property-description 'beamed-minimum-lengths list? "list of minimum stem lengths given beam multiplicity.") -(grob-property-description 'beamed-stem-shorten number? "shorten beamed stems in forced direction.") +(grob-property-description 'beamed-stem-shorten list? "shorten beamed stems in forced direction.") (grob-property-description 'beaming number-pair? "number of beams extending to left and right.") (grob-property-description 'beautiful number? "number that dictates when a slur should be de-uglyfied. It correlates with the enclosed area between noteheads and slurs. A value of 0.1 yields only undisturbed slurs, a value of 5 will tolerate quite high blown slurs.") (grob-property-description 'before-line-breaking-callback procedure? "Procedure taking grob as argument. @@ -228,6 +228,8 @@ and will have no effect. measure. Used in some spacing situations.") (grob-property-description 'measure-count integer? "number of measures for a multimeasure rest.") (grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .") + +(grob-property-description 'meta list? "Alist of meta information of this grob.") (grob-property-description 'minimum-distance number? "minimum distance between notes and rests.") (grob-property-description 'minimum-distances list? "list of rods (ie. (OBJ . DIST) pairs).") (grob-property-description 'minimum-extent-X number-pair? "minimum size in X dimension, measured in staff space.") @@ -249,6 +251,7 @@ FIXME: also pair? (cons LEFT RIGHT) ") (grob-property-description 'molecule-callback procedure? "Function taking grob as argument, returning a Scheme encoded Molecule.") + (grob-property-description 'molecule molecule? "Cached output of the molecule-callback.") (grob-property-description 'new-accidentals list? "list of (pitch, accidental) pairs.") @@ -448,3 +451,4 @@ columns. (grob-property-description 'note-columns pair? "list of NoteColumn grobs.") (grob-property-description 'if-text-padding number? "padding in case texts are there.") +(grob-property-description 'grace-space-factor number? "space grace at this fraction of the increment.")