From: hanwen Date: Fri, 21 Oct 2005 13:59:25 +0000 (+0000) Subject: * lily/grob.cc: remove is_empty() X-Git-Tag: release/2.7.16^2~51 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b097ec2db5a3a11ce5a327575a603afecc01d8c5;p=lilypond.git * lily/grob.cc: remove is_empty() * lily/grob-property.cc: remove add_to_list_property(). * lily/grob.cc: remove X-extent-callback / Y-extent-callback. * lily/include/grob.hh (class Grob): remove property_callbacks_ member. Properties of procedure type are assumed to be callbacks. * lily/grob.cc: remove set_extent_callback(), set_extent() and has_extent_callback() * lily/grob.cc (flush_extent_cache): rewrite. * lily/grob.cc (Grob): don't set extent from ctor. (extent): use property callbacks. * lily/grob-property.cc (del_property): new function. --- diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 789b1e45b4..ac452e36b2 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -32,36 +32,6 @@ Grob::get_interfaces () const return interfaces_; } -/* - This special add_thing routine is slightly more efficient than - - set_prop (name, cons (thing, get_prop (name))) - - since it can reuse the handle returned by scm_assq (). -*/ -// JUNKME. -void -Grob::add_to_list_property (SCM sym, SCM thing) -{ - SCM handle - = scm_sloppy_assq (sym, mutable_property_alist_); - - if (handle != SCM_BOOL_F) - scm_set_cdr_x (handle, scm_cons (thing, scm_cdr (handle))); - else - { - /* - There is no mutable prop yet, so create an entry, and put it in front of the - mutable prop list. - */ - handle = scm_sloppy_assq (sym, immutable_property_alist_); - SCM tail = (handle != SCM_BOOL_F) ? scm_cdr (handle) : SCM_EOL; - SCM val = scm_cons (thing, tail); - - mutable_property_alist_ = scm_cons (scm_cons (sym, val), - mutable_property_alist_); - } -} extern void check_interfaces_for_property (Grob const *me, SCM sym); diff --git a/lily/grob.cc b/lily/grob.cc index 380ba92ded..9c2b19ca54 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -359,10 +359,13 @@ Grob::relative_coordinate (Grob const *refp, Axis a) const /* We catch PARENT_L_ == nil case with this, but we crash if we did not ask for the absolute coordinate (ie. REFP == nil.) */ + Real off = get_offset (a); if (refp == dim_cache_[a].parent_) - return get_offset (a); + return off; + + off += dim_cache_[a].parent_->relative_coordinate (refp, a); - return get_offset (a) + dim_cache_[a].parent_->relative_coordinate (refp, a); + return off; } /* Invoke callbacks to get offset relative to parent. */ @@ -387,14 +390,6 @@ Grob::get_offset (Axis a) const return dim_cache_[a].offset_; } -#if 0 -bool -Grob::is_empty (Axis a) const -{ - return !(scm_is_pair (dim_cache_[a].dimension_) - || ly_is_procedure (dim_cache_[a].dimension_callback_)); -} -#endif void Grob::flush_extent_cache (Axis axis) diff --git a/lily/include/grob.hh b/lily/include/grob.hh index 11f5ad0fc9..6c08afeeec 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -42,6 +42,7 @@ protected: void substitute_object_links (SCM, SCM); DECLARE_CLASSNAME(Grob); + Real get_offset (Axis a) const; public: DECLARE_SCHEME_CALLBACK(same_axis_parent_positioning, (SCM, SCM)); DECLARE_SCHEME_CALLBACK(other_axis_parent_positioning, (SCM, SCM)); @@ -77,11 +78,6 @@ public: void internal_set_object (SCM sym, SCM val); SCM try_callback (SCM, SCM); - /* - JUNKME. - */ - void add_to_list_property (SCM, SCM); - void add_to_object_list (SCM sym, SCM thing); SCM get_property_alist_chain (SCM) const; static SCM ly_grob_set_property (SCM, SCM, SCM); @@ -91,11 +87,7 @@ public: void programming_error (String) const; Output_def *get_layout () const; - void add_dependency (Grob *); virtual System *get_system () const; - - void calculate_dependencies (int final, int busy, SCM funcname); - virtual void do_break_processing (); virtual Grob *find_broken_piece (System *) const; virtual void discretionary_processing (); @@ -124,7 +116,6 @@ public: bool has_offset_callback (SCM callback, Axis) const; void add_offset_callback (SCM callback, Axis); void flush_extent_cache (Axis); - Real get_offset (Axis a) const; void set_parent (Grob *e, Axis);