From: Han-Wen Nienhuys Date: Wed, 2 Nov 2005 15:38:11 +0000 (+0000) Subject: * lily/main.cc (LY_DEFINE): add gmane address. X-Git-Tag: release/2.7.15~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=75c339f75315f38e85d137c8ea0693fbc4cc4028;p=lilypond.git * lily/main.cc (LY_DEFINE): add gmane address. * lily/beam.cc: remove calc_positions() * lily/include/grob.hh (class Grob): move pscore, dim_cache_, original_ in private scope. (class Grob): drop pscore_ pointer, change to output_def pointer. (class Grob): cleanup class definition. * ly/spanners-init.ly (assertBeamQuant): use make-simple-closure. --- diff --git a/ChangeLog b/ChangeLog index afef6167b1..3c5e3926e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-11-02 Han-Wen Nienhuys + * lily/main.cc (LY_DEFINE): add gmane address. + + * lily/beam.cc: remove calc_positions() + * lily/include/grob.hh (class Grob): move pscore, dim_cache_, original_ in private scope. (class Grob): drop pscore_ pointer, change to output_def pointer. diff --git a/input/regression/beam-concave.ly b/input/regression/beam-concave.ly index 2cd8fcbd89..077dd2bcc9 100644 --- a/input/regression/beam-concave.ly +++ b/input/regression/beam-concave.ly @@ -2,20 +2,20 @@ \version "2.7.13" \header{ -texidoc = "Fully concave beams should be horizontal. Informally spoken, + texidoc = "Fully concave beams should be horizontal. Informally spoken, concave refers to the shape of the notes that are opposite a beam. If an up-beam has high notes on its center stems, then we call it concave. + If a beam is fails a test, the desired slope is printed next to it. - If a beam is fails a test, the desired slope is printed -next to it." +" } resetMeasure = \set Score.measurePosition = #(ly:make-moment 0 1) -% examples from +%% examples from Ross. rossFourBeams =\relative c'' { \time 2/4 c8[ e b c] @@ -31,7 +31,7 @@ rossFourBeams =\relative c'' { f,,[ b a g] f[g g e] a[ d, b' g] - } +} rossThreeBeams = \relative c'' { \time 6/8 e[ a, c] f[ d g] @@ -47,8 +47,7 @@ rossThreeBeams = \relative c'' { rossBeams = \relative c'' { \rossFourBeams \rossThreeBeams - } - +} \layout{ raggedright = ##t @@ -59,8 +58,12 @@ rossBeams = \relative c'' { #(define (<> x y) (not (= x y))) - \new Voice { - \override Beam #'position-callbacks = #(check-slope-callbacks =) - \rossBeams - - } +\new Voice { + \override Beam #'positions = #(ly:make-simple-closure + (ly:make-simple-closure + (append + (list chain-grob-member-functions `(,cons 0 0)) + (check-slope-callbacks =)))) + \rossBeams + +} diff --git a/input/regression/beam-default-lengths.ly b/input/regression/beam-default-lengths.ly index 4321247b25..e066c1b609 100644 --- a/input/regression/beam-default-lengths.ly +++ b/input/regression/beam-default-lengths.ly @@ -3,14 +3,20 @@ \version "2.7.13" \header{ - texidoc="Beamed stems have standard lengths if possible. Quantization is switched off in this example." - } + texidoc="Beamed stems have standard lengths if possible. Quantization is switched off in this example." +} \relative c'{ - \override Beam #'position-callbacks = - #`(,Beam::least_squares - ,Beam::check_concave - ,Beam::slope_damping) + \override Beam #'position = + #(ly:make-simple-closure + (ly:make-simple-closure + (list chain-grob-member-functions + `(,cons 0 0) + Beam::calc_least_squares_positions + Beam::slope_damping + Beam::shift_region_to_valid + Beam::set_stem_lengths + ))) f4 f8[ f] f16[ f] f32[ f] f64[ f] f128[ f] } diff --git a/input/regression/beam-shortened-lengths.ly b/input/regression/beam-shortened-lengths.ly index 775c0feed2..9705fbf643 100644 --- a/input/regression/beam-shortened-lengths.ly +++ b/input/regression/beam-shortened-lengths.ly @@ -2,16 +2,23 @@ \version "2.7.13" \header{ - texidoc="Beams in unnatural direction, have shortened stems, but do not look too short." - } + texidoc="Beams in unnatural direction, have shortened stems, but do not look too short." +} \layout{ raggedright = ##t } \relative c'{ - \override Beam #'position-callbacks = - #`(,Beam::least_squares - ,Beam::check_concave - ,Beam::slope_damping) + \override Beam #'positions = + #(ly:make-simple-closure + (ly:make-simple-closure + (list chain-grob-member-functions + `(,cons 0 0) + Beam::calc_least_squares_positions + Beam::slope_damping + Beam::shift_region_to_valid + Beam::set_stem_lengths + ))) + \stemUp f'4 f8[ f] f16[ f] f32[ f] f64[ f] f128[ f] } diff --git a/lily/beam.cc b/lily/beam.cc index 6ad45126d7..71a0933a18 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -723,26 +723,6 @@ Beam::set_stem_shorten (Grob *me) me->set_property ("shorten", scm_from_double (shorten)); } -MAKE_SCHEME_CALLBACK (Beam, calc_positions, 1); -SCM -Beam::calc_positions (SCM smob) -{ - Grob *me = unsmob_grob (smob); - if (!me->is_live ()) - return SCM_EOL; - - (void) me->get_property ("direction"); - - SCM posns = scm_cons (SCM_BOOL_F, SCM_BOOL_F); - me->set_property ("positions", posns); - - SCM callbacks = me->get_property ("position-callbacks"); - for (SCM i = callbacks; scm_is_pair (i); i = scm_cdr (i)) - scm_call_1 (scm_car (i), me->self_scm ()); - - return SCM_UNSPECIFIED; -} - void diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 59a3cd68f2..168a120f41 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -191,3 +191,10 @@ Grob::is_live () const { return immutable_property_alist_ != SCM_EOL; } + + +bool +Grob::internal_has_interface (SCM k) +{ + return scm_c_memq (k, interfaces_) != SCM_BOOL_F; +} diff --git a/lily/grob.cc b/lily/grob.cc index abad363e6c..514eb57b03 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -31,31 +31,6 @@ -MAKE_SCHEME_CALLBACK(Grob, y_parent_positioning, 1); -SCM -Grob::y_parent_positioning (SCM smob) -{ - Grob *me = unsmob_grob (smob); - Grob *par = me->get_parent (Y_AXIS); - if (par) - (void) par->get_property ("positioning-done"); - - return scm_from_double (0.0); -} - - -MAKE_SCHEME_CALLBACK(Grob, x_parent_positioning, 1); -SCM -Grob::x_parent_positioning (SCM smob) -{ - Grob *me = unsmob_grob (smob); - - Grob *par = me->get_parent (X_AXIS); - if (par) - (void) par->get_property ("positioning-done"); - - return scm_from_double (0.0); -} Grob * Grob::clone (int count) const @@ -63,14 +38,6 @@ Grob::clone (int count) const return new Grob (*this, count); } -/* TODO: - -- remove dynamic_cast and put this code into respective -subclass. */ - -#define HASH_SIZE 3 -#define INFINITY_MSG "Infinity or NaN encountered" - Grob::Grob (SCM basicprops, Object_key const *key) { @@ -127,46 +94,9 @@ Grob::Grob (Grob const &s, int copy_index) Grob::~Grob () { } - - -static SCM -grob_stencil_extent (Grob *me, Axis a) -{ - Stencil *m = me->get_stencil (); - Interval e; - if (m) - e = m->extent (a); - return ly_interval2scm (e); -} - - -MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1); -SCM -Grob::stencil_height (SCM smob) -{ - Grob *me = unsmob_grob (smob); - return grob_stencil_extent (me, Y_AXIS); -} - -MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1); -SCM -Grob::stencil_width (SCM smob) -{ - Grob *me = unsmob_grob (smob); - return grob_stencil_extent (me, X_AXIS); -} - - -Interval -robust_relative_extent (Grob *me, Grob *refpoint, Axis a) -{ - Interval ext = me->extent (refpoint, a); - if (ext.is_empty ()) - ext.add_point (me->relative_coordinate (refpoint, a)); - - return ext; -} - +/**************************************************************** + STENCILS +****************************************************************/ Stencil * Grob::get_stencil () const @@ -216,14 +146,19 @@ Grob::get_print_stencil () const return retval; } -/* +/**************************************************************** VIRTUAL STUBS -*/ +****************************************************************/ void Grob::do_break_processing () { } +void +Grob::discretionary_processing () +{ +} + System * Grob::get_system () const { @@ -300,13 +235,16 @@ Grob::find_broken_piece (System *) const return 0; } -/* Translate in one direction. */ +/**************************************************************** + OFFSETS +****************************************************************/ + void Grob::translate_axis (Real y, Axis a) { if (isinf (y) || isnan (y)) { - programming_error (_ (INFINITY_MSG)); + programming_error (_ ("Infinity or NaN encountered")); return ; } @@ -360,6 +298,11 @@ Grob::get_offset (Axis a) const return *me->dim_cache_[a].offset_; } + +/**************************************************************** + extents +****************************************************************/ + void Grob::flush_extent_cache (Axis axis) { @@ -416,6 +359,10 @@ Grob::extent (Grob *refp, Axis a) const return real_ext; } +/**************************************************************** + REFPOINTS +****************************************************************/ + /* Find the group-element which has both #this# and #s# */ Grob * Grob::common_refpoint (Grob const *s, Axis a) const @@ -431,50 +378,18 @@ Grob::common_refpoint (Grob const *s, Axis a) const return 0; } -Grob * -common_refpoint_of_list (SCM elist, Grob *common, Axis a) +void +Grob::set_parent (Grob *g, Axis a) { - for (; scm_is_pair (elist); elist = scm_cdr (elist)) - if (Grob *s = unsmob_grob (scm_car (elist))) - { - if (common) - common = common->common_refpoint (s, a); - else - common = s; - } - - return common; + dim_cache_[a].parent_ = g; } Grob * -common_refpoint_of_array (Link_array const &arr, Grob *common, Axis a) -{ - for (int i = arr.size (); i--;) - if (Grob *s = arr[i]) - { - if (common) - common = common->common_refpoint (s, a); - else - common = s; - } - - return common; -} - -String -Grob::name () const +Grob::get_parent (Axis a) const { - SCM meta = get_property ("meta"); - SCM nm = scm_assq (ly_symbol2scm ("name"), meta); - nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL; - return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name (); + return dim_cache_[a].parent_; } -void -Grob::set_parent (Grob *g, Axis a) -{ - dim_cache_[a].parent_ = g; -} void Grob::fixup_refpoint () @@ -510,6 +425,10 @@ Grob::fixup_refpoint () } } + +/**************************************************************** + MESSAGES +****************************************************************/ void Grob::warning (String s) const { @@ -523,6 +442,16 @@ Grob::warning (String s) const ::warning (s); } + +String +Grob::name () const +{ + SCM meta = get_property ("meta"); + SCM nm = scm_assq (ly_symbol2scm ("name"), meta); + nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL; + return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name (); +} + void Grob::programming_error (String s) const { @@ -537,22 +466,6 @@ Grob::programming_error (String s) const else ::message (s); } -void -Grob::discretionary_processing () -{ -} - -bool -Grob::internal_has_interface (SCM k) -{ - return scm_c_memq (k, interfaces_) != SCM_BOOL_F; -} - -Grob * -Grob::get_parent (Axis a) const -{ - return dim_cache_[a].parent_; -} ADD_INTERFACE (Grob, "grob-interface", @@ -615,3 +528,107 @@ ADD_INTERFACE (Grob, "grob-interface", "transparent " ); + + + + +/**************************************************************** + CALLBACKS +****************************************************************/ + + +static SCM +grob_stencil_extent (Grob *me, Axis a) +{ + Stencil *m = me->get_stencil (); + Interval e; + if (m) + e = m->extent (a); + return ly_interval2scm (e); +} + + +MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1); +SCM +Grob::stencil_height (SCM smob) +{ + Grob *me = unsmob_grob (smob); + return grob_stencil_extent (me, Y_AXIS); +} + +MAKE_SCHEME_CALLBACK(Grob, y_parent_positioning, 1); +SCM +Grob::y_parent_positioning (SCM smob) +{ + Grob *me = unsmob_grob (smob); + Grob *par = me->get_parent (Y_AXIS); + if (par) + (void) par->get_property ("positioning-done"); + + return scm_from_double (0.0); +} + + +MAKE_SCHEME_CALLBACK(Grob, x_parent_positioning, 1); +SCM +Grob::x_parent_positioning (SCM smob) +{ + Grob *me = unsmob_grob (smob); + + Grob *par = me->get_parent (X_AXIS); + if (par) + (void) par->get_property ("positioning-done"); + + return scm_from_double (0.0); +} + +MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1); +SCM +Grob::stencil_width (SCM smob) +{ + Grob *me = unsmob_grob (smob); + return grob_stencil_extent (me, X_AXIS); +} + + + +Grob * +common_refpoint_of_list (SCM elist, Grob *common, Axis a) +{ + for (; scm_is_pair (elist); elist = scm_cdr (elist)) + if (Grob *s = unsmob_grob (scm_car (elist))) + { + if (common) + common = common->common_refpoint (s, a); + else + common = s; + } + + return common; +} + +Grob * +common_refpoint_of_array (Link_array const &arr, Grob *common, Axis a) +{ + for (int i = arr.size (); i--;) + if (Grob *s = arr[i]) + { + if (common) + common = common->common_refpoint (s, a); + else + common = s; + } + + return common; +} + +Interval +robust_relative_extent (Grob *me, Grob *refpoint, Axis a) +{ + Interval ext = me->extent (refpoint, a); + if (ext.is_empty ()) + ext.add_point (me->relative_coordinate (refpoint, a)); + + return ext; +} + diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index 66de466019..07daf85638 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -14,21 +14,15 @@ #include "dimension-cache-callback.hh" #include "lily-guile.hh" -/** - Adminstration of offset dimension info. +/* + XY offset/refpoint/extent structure. */ class Dimension_cache { - /** - The offset wrt. to the center of #parent_# - */ Interval *extent_; Real *offset_; - - /** - What to call to find extent. Nil means empty. - */ Grob *parent_; + friend class Grob; Dimension_cache (Dimension_cache const &); diff --git a/lily/include/grob.hh b/lily/include/grob.hh index 46f1ff473a..2ba37797c0 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -14,16 +14,22 @@ #include "grob-interface.hh" #include "object-key.hh" -typedef void (Grob:: *Grob_method_pointer) (void); - class Grob { private: DECLARE_SMOBS (Grob, foo); + DECLARE_CLASSNAME(Grob); + void init (); protected: + /* data */ + Dimension_cache dim_cache_[NO_AXES]; + Output_def *layout_; + Grob *original_; Object_key const *key_; + + /* SCM data */ SCM immutable_property_alist_; SCM mutable_property_alist_; SCM object_alist_; @@ -33,22 +39,19 @@ protected: lookups. */ SCM interfaces_; - - /* BARF */ - friend class Spanner; - friend SCM ly_grob_properties (SCM); - friend SCM ly_grob_basic_properties (SCM); + void substitute_object_links (SCM, SCM); - - DECLARE_CLASSNAME(Grob); Real get_offset (Axis a) const; - - Output_def *layout_; - Dimension_cache dim_cache_[NO_AXES]; - Grob *original_; - SCM try_callback (SCM, SCM); public: + + /* friends */ + friend class Spanner; + friend class System; + friend SCM ly_grob_properties (SCM); + friend SCM ly_grob_basic_properties (SCM); + + /* standard callbacks */ DECLARE_SCHEME_CALLBACK(x_parent_positioning, (SCM)); DECLARE_SCHEME_CALLBACK(y_parent_positioning, (SCM)); DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob)); @@ -118,6 +121,7 @@ public: void fixup_refpoint (); }; +/* smob utilities */ DECLARE_UNSMOB (Grob, grob); Spanner *unsmob_spanner (SCM); Item *unsmob_item (SCM); diff --git a/lily/include/self-alignment-interface.hh b/lily/include/self-alignment-interface.hh index bd1f1096c4..aa64f590c7 100644 --- a/lily/include/self-alignment-interface.hh +++ b/lily/include/self-alignment-interface.hh @@ -16,7 +16,7 @@ struct Self_alignment_interface static bool has_interface (Grob *); static SCM aligned_on_self (Grob *me, Axis a); - static SCM centered_on_parent (Grob *me, Axis a); + static SCM centered_on_object (Grob *me, Axis a); static SCM aligned_on_parent (Grob *me, Axis a); static void set_center_parent (Grob *me, Axis a); static void set_align_self (Grob *me, Axis a); @@ -26,6 +26,7 @@ struct Self_alignment_interface DECLARE_SCHEME_CALLBACK (centered_on_x_parent, (SCM element)); DECLARE_SCHEME_CALLBACK (centered_on_y_parent, (SCM element)); + DECLARE_SCHEME_CALLBACK (x_centered_on_y_parent, (SCM element)); DECLARE_SCHEME_CALLBACK (aligned_on_x_parent, (SCM element)); DECLARE_SCHEME_CALLBACK (aligned_on_y_parent, (SCM element)); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 0f35e8aab9..d527c07afe 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -23,6 +23,8 @@ #include "source.hh" #include "warn.hh" +#include "ly-smobs.icc" + Lily_parser::Lily_parser (Sources *sources) { lexer_ = 0; @@ -55,11 +57,6 @@ Lily_parser::~Lily_parser () { } -#include "ly-smobs.icc" - -IMPLEMENT_SMOBS (Lily_parser); -IMPLEMENT_TYPE_P (Lily_parser, "ly:lily-parser?"); -IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser); SCM Lily_parser::mark_smob (SCM s) @@ -179,10 +176,19 @@ Lily_parser::parser_error (Input const &i, String s) error_level_ = 1; } -/****************************************************************/ + + +IMPLEMENT_SMOBS (Lily_parser); +IMPLEMENT_TYPE_P (Lily_parser, "ly:lily-parser?"); +IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser); + + +/**************************************************************** + OUTPUT-DEF + ****************************************************************/ Output_def * -layout (Lily_parser *parser) +get_layout (Lily_parser *parser) { SCM id = parser->lexer_->lookup_identifier ("$defaultlayout"); Output_def *layout = unsmob_output_def (id); diff --git a/lily/main.cc b/lily/main.cc index f3b8689d9b..e924777a22 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -245,7 +245,10 @@ LY_DEFINE (ly_usage, "ly:usage", printf ("\n"); printf (Long_option_init::table_string (options_static).to_str0 ()); printf ("\n"); - printf (_f ("Report bugs to %s.", "bug-lilypond@gnu.org").to_str0 ()); + printf (_f ("Report bugs to %s or via %s", + "bug-lilypond@gnu.org" + "http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs" + ).to_str0 ()); printf ("\n"); printf ("\n"); return SCM_UNSPECIFIED; diff --git a/lily/paper-score.cc b/lily/paper-score.cc index f9718cbc67..80d18104a8 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -25,7 +25,6 @@ Paper_score::Paper_score (Output_def *layout) { layout_ = layout; system_ = 0; - pscore_ = 0; systems_ = SCM_EOL; paper_systems_ = SCM_EOL; } @@ -41,8 +40,6 @@ Paper_score::derived_mark () const { if (layout_) scm_gc_mark (layout_->self_scm ()); - if (pscore_) - scm_gc_mark (pscore_->self_scm ()); scm_gc_mark (systems_); scm_gc_mark (paper_systems_); } @@ -55,7 +52,7 @@ Paper_score::typeset_system (System *system) systems_ = scm_cons (system->self_scm (), systems_); system->pscore_ = this; - system->layout_ = pscore_->layout_; + system->layout_ = layout_; system->unprotect (); } diff --git a/lily/self-aligment-interface.cc b/lily/self-aligment-interface.cc index 17ec37b91f..a9970b393c 100644 --- a/lily/self-aligment-interface.cc +++ b/lily/self-aligment-interface.cc @@ -43,12 +43,18 @@ Self_alignment_interface::aligned_on_self (Grob *me, Axis a) +SCM +Self_alignment_interface::centered_on_object (Grob *him, Axis a) +{ + return scm_from_double (robust_relative_extent (him, him, a).center ()); +} + MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_x_parent, 1); SCM Self_alignment_interface::centered_on_x_parent (SCM smob) { - return centered_on_parent (unsmob_grob (smob), X_AXIS); + return centered_on_object (unsmob_grob (smob)->get_parent (X_AXIS), X_AXIS); } @@ -56,16 +62,15 @@ MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_y_parent, 1); SCM Self_alignment_interface::centered_on_y_parent (SCM smob) { - return centered_on_parent (unsmob_grob (smob), Y_AXIS); + return centered_on_object (unsmob_grob (smob)->get_parent (Y_AXIS), Y_AXIS); } + +MAKE_SCHEME_CALLBACK (Self_alignment_interface, x_centered_on_y_parent, 1); SCM -Self_alignment_interface::centered_on_parent (Grob *me, Axis a) +Self_alignment_interface::x_centered_on_y_parent (SCM smob) { - Grob *him = me->get_parent (a); - Interval he = him->extent (him, a); - - return scm_from_double (he.is_empty () ? 0.0 : he.center ()); + return centered_on_object (unsmob_grob (smob)->get_parent (Y_AXIS), X_AXIS); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_x_parent,1); diff --git a/lily/spanner.cc b/lily/spanner.cc index 2c49aacad7..e8d194182b 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -80,7 +80,8 @@ Spanner::do_break_processing () } else { - Link_array break_points = pscore_->root_system ()->broken_col_range (left, right); + System *root = get_root_system (this); + Link_array break_points = root->broken_col_range (left, right); break_points.insert (left, 0); break_points.push (right); diff --git a/lily/system.cc b/lily/system.cc index 10a4e9505b..e7291e7337 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -20,7 +20,6 @@ #include "all-font-metrics.hh" #include "spacing-interface.hh" #include "staff-symbol-referencer.hh" -#include "paper-book.hh" #include "paper-system.hh" #include "tweak-registration.hh" #include "grob-array.hh" @@ -30,6 +29,7 @@ System::System (System const &src, int count) : Spanner (src, count) { all_elements_ = 0; + pscore_ = 0; rank_ = 0; init_elements (); } @@ -75,11 +75,11 @@ System::spanner_count () const void System::typeset_grob (Grob *elem) { - if (elem->pscore_) + if (elem->layout_) programming_error ("adding element twice"); else { - elem->layout_ = pscore_->layout_; + elem->layout_ = pscore_->layout (); all_elements_->add (elem); elem->unprotect (); } @@ -462,8 +462,9 @@ System * get_root_system (Grob *me) { Grob *system_grob = me; - while (system->get_parent (Y_AXIS)) - system = system->get_parent (Y_AXIS); + + while (system_grob->get_parent (Y_AXIS)) + system_grob = system_grob->get_parent (Y_AXIS); return dynamic_cast (system_grob); } @@ -471,4 +472,9 @@ get_root_system (Grob *me) ADD_INTERFACE (System, "system-interface", "This is the toplevel object: each object in a score " "ultimately has a System object as its X and Y parent. ", - "all-elements spaceable-staves columns") + + /* properties */ + "all-elements " + "spaceable-staves " + "columns" + ) diff --git a/lily/tweak-registration.cc b/lily/tweak-registration.cc index 4b5f244832..3de59650ce 100644 --- a/lily/tweak-registration.cc +++ b/lily/tweak-registration.cc @@ -54,7 +54,7 @@ Tweak_registry::insert_tweak_from_file (SCM tweak) void Tweak_registry::insert_grob_tweak (Grob *g, SCM tweak) { - Object_key const *key = g->get_key (); + Object_key const *key = g->key (); if (tweaks_.find (key) == tweaks_.end ()) tweaks_[key] = SCM_EOL; @@ -64,14 +64,14 @@ Tweak_registry::insert_grob_tweak (Grob *g, SCM tweak) void Tweak_registry::replace_grob_tweak (Grob *g, SCM tweak) { - Object_key const *key = g->get_key (); + Object_key const *key = g->key (); tweaks_[key] = scm_cons (tweak, SCM_EOL); } SCM Tweak_registry::get_tweaks (Grob *g) { - Object_key const *key = g->get_key (); + Object_key const *key = g->key (); if (tweaks_.find (key) == tweaks_.end ()) return SCM_EOL; return tweaks_[key]; diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 61c033c6bb..798f46641d 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -250,6 +250,30 @@ barNumberCheck = cbn n)))))) + +% for regression testing purposes. +assertBeamQuant = +#(def-music-function (parser location l r) (pair? pair?) + (make-grob-property-override 'Beam 'positions + (ly:make-simple-closure + (ly:make-simple-closure + (append + (list chain-grob-member-functions `(,cons 0 0)) + (check-quant-callbacks l r)))))) + +% for regression testing purposes. +assertBeamSlope = +#(def-music-function (parser location comp) (procedure?) + (make-grob-property-override 'Beam 'positions + (ly:make-simple-closure + (ly:make-simple-closure + (append + (list chain-grob-member-functions `(,cons 0 0)) + (check-slope-callbacks comp)))))) + + + + %{ TODO: diff --git a/ly/spanners-init.ly b/ly/spanners-init.ly index 59765d075e..d8a3390c77 100644 --- a/ly/spanners-init.ly +++ b/ly/spanners-init.ly @@ -91,26 +91,3 @@ sostenutoUp = #(make-span-event 'SostenutoEvent STOP) %crescpoco = \set crescendoText = "cresc. poco a poco" %decresc = \set crescendoText = "decr." %dim = \set crescendoText = "dim." - - -% for regression testing purposes. -assertBeamQuant = -#(def-music-function (parser location l r) (pair? pair?) - (make-grob-property-override 'Beam 'positions - (ly:make-simple-closure - (ly:make-simple-closure - (append - (list chain-grob-member-functions `(,cons 0 0)) - (check-quant-callbacks l r)))))) - -% for regression testing purposes. -assertBeamSlope = -#(def-music-function (parser location comp) (procedure?) - (make-grob-property-override 'Beam 'positions - (ly:make-simple-closure - (ly:make-simple-closure - (append - (list chain-grob-member-functions `(,cons 0 0)) - (check-slope-callbacks comp)))))) - - diff --git a/python/convertrules.py b/python/convertrules.py index fb80ba1b33..7453a495b3 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2641,6 +2641,8 @@ conversions.append (((2, 7, 14), conv, def conv (str): if re.search ('[XY]-offset-callbacks', str): error_file.write (NOT_SMART % "[XY]-offset-callbacks") + if re.search ('position-callbacks', str): + error_file.write (NOT_SMART % "position-callbacks") return str conversions.append (((2, 7, 15), conv, diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 0c5e765c6f..afbd73bf7e 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -696,8 +696,9 @@ (stencil . ,Grid_line_interface::print) (self-alignment-X . ,CENTER) - (X-offset . (ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_x_parent)) - ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))))) + (X-offset . ,(ly:make-simple-closure + `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_x_parent)) + ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))))) (layer . 0) (meta . ((class . Item) (interfaces . (self-alignment-interface @@ -996,8 +997,9 @@ . ( (springs-and-rods . ,Multi_measure_rest::set_spacing_rods) (stencil . ,Text_interface::print) - (self-X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::y_aligned_on_self)) - ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent))))) + (X-offset . ,(ly:make-simple-closure + `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)) + ,(ly:make-simple-closure (list Self_alignment_interface::x_centered_on_y_parent))))) (Y-offset . ,Side_position_interface::y_aligned_side) (self-alignment-X . 0) (direction . 1) @@ -1012,12 +1014,12 @@ text-interface)))) )) - (MultiMeasureRestText . ( (stencil . ,Text_interface::print) - (X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent)) - ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))))) + (X-offset . ,(ly:make-simple-closure + `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::x_centered_on_y_parent)) + ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))))) (Y-offset . ,Side_position_interface::y_aligned_side) (self-alignment-X . 0) @@ -1204,7 +1206,7 @@ (PercentRepeatCounter . ( (stencil . ,Text_interface::print) - (X-offset . `(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent)) + (X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent)) ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))))) (Y-offset . ,Side_position_interface::y_aligned_side) (self-alignment-X . 0) diff --git a/scm/layout-beam.scm b/scm/layout-beam.scm index 051cc5f2af..9c55dbd9e3 100644 --- a/scm/layout-beam.scm +++ b/scm/layout-beam.scm @@ -35,6 +35,7 @@ posns )) + (define ((check-beam-slope-sign comparison) beam posns) "Check whether the slope of BEAM is correct wrt. COMPARISON." (let* ((slope-sign (- (cdr posns) (car posns))) @@ -61,7 +62,6 @@ )) - (define-public (check-slope-callbacks comparison) (list Beam::calc_least_squares_positions Beam::slope_damping