X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Finclude%2Fgrob.hh;h=c5413c5e74a206327f547f9cdc0e96ceaa8ca928;hb=75eebcb49e52d296b1da3e1074e0825d2c780db4;hp=b969f7478be82e4dc4fecff9107a8890447efb17;hpb=9106e3bd374198c5457c35181ae1d66b3ec95236;p=lilypond.git diff --git a/lily/include/grob.hh b/lily/include/grob.hh index b969f7478b..c5413c5e74 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -3,7 +3,7 @@ source file of the LilyPond music typesetter - (c) 1996--2005 Han-Wen Nienhuys + (c) 1996--2006 Han-Wen Nienhuys */ #ifndef 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,118 +39,106 @@ protected: lookups. */ SCM interfaces_; - - /* BARF */ + + void substitute_object_links (SCM, SCM); + Real get_offset (Axis a) const; + 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); - friend void check_interfaces_for_property (Grob const *, SCM); - void substitute_object_links (SCM, SCM); - DECLARE_CLASSNAME(Grob); - Real get_offset (Axis a) const; -public: + /* standard callbacks */ DECLARE_SCHEME_CALLBACK(x_parent_positioning, (SCM)); DECLARE_SCHEME_CALLBACK(y_parent_positioning, (SCM)); + DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob)); + DECLARE_SCHEME_CALLBACK (stencil_width, (SCM smob)); - Object_key const *get_key () const; - - Grob *original_; - - /* TODO: junk this member. */ - Paper_score *pscore_; - - Dimension_cache dim_cache_[NO_AXES]; + /* R/O access */ + Output_def *layout () const { return layout_; } + Grob *original () const { return original_; } + SCM interfaces () const { return interfaces_; } + Object_key const *key () const { return key_; } + /* life & death */ Grob (SCM basic_props, Object_key const *); Grob (Grob const &, int copy_count); - virtual Grob *clone (int count) const; - static SCM stencil_extent (Grob*, Axis); - DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob)); - DECLARE_SCHEME_CALLBACK (stencil_width, (SCM smob)); - - + + /* forced death */ + void suicide (); + bool is_live () const; + + /* naming. */ String name () const; - /* - Properties - */ + + /* Properties */ + SCM get_property_alist_chain (SCM) const; SCM internal_get_property (SCM symbol) const; SCM get_property_data (SCM symbol) const; SCM internal_get_object (SCM symbol) const; - void del_property (SCM symbol); void internal_set_property (SCM sym, SCM val); void internal_set_object (SCM sym, SCM val); - SCM try_callback (SCM, SCM); - - SCM get_property_alist_chain (SCM) const; - static SCM ly_grob_set_property (SCM, SCM, SCM); - static SCM ly_grob_property (SCM, SCM); - + /* messages */ void warning (String) const; void programming_error (String) const; - Output_def *get_layout () const; + + /* class hierarchy */ virtual System *get_system () const; virtual void do_break_processing (); virtual Grob *find_broken_piece (System *) const; virtual void discretionary_processing (); virtual void derived_mark () const; + virtual void handle_broken_dependencies (); + virtual void handle_prebroken_dependencies (); + /* printing */ Stencil *get_stencil () const; Stencil get_print_stencil () const; - void suicide (); - bool is_live () const; - + /* interfaces */ bool internal_has_interface (SCM intf); static bool has_interface (Grob *me); - SCM get_interfaces () const; - - virtual void handle_broken_dependencies (); - virtual void handle_prebroken_dependencies (); - - Interval extent (Grob *refpoint, Axis) const; + /* offsets */ void translate_axis (Real, Axis); Real relative_coordinate (Grob const *refp, Axis) const; - Grob *common_refpoint (Grob const *s, Axis a) const; + /* extents */ + Interval extent (Grob *refpoint, Axis) const; void flush_extent_cache (Axis); + /* refpoints */ + Grob *common_refpoint (Grob const *s, Axis a) const; void set_parent (Grob *e, Axis); - - // URG Grob *get_parent (Axis a) const; void fixup_refpoint (); }; +/* smob utilities */ DECLARE_UNSMOB (Grob, grob); Spanner *unsmob_spanner (SCM); Item *unsmob_item (SCM); +/* refpoints */ Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a); Grob *common_refpoint_of_array (Link_array const &, Grob *, Axis a); +System *get_root_system (Grob *me); -void set_break_subsititution (SCM criterion); -SCM substitute_object_alist (SCM alist, SCM dest); - -Link_array ly_scm2grobs (SCM ell); -SCM ly_grobs2scm (Link_array a); - +/* extents */ Interval robust_relative_extent (Grob *, Grob *, Axis); -bool is_callback_chain (SCM s); -SCM callback_chain_extract_procedures (SCM chain_smob); - - -SCM axis_offset_symbol (Axis a); -SCM axis_self_offset_symbol (Axis a); -SCM axis_parent_positioning (Axis a); +/* offset/extent callbacks. */ void add_offset_callback (Grob *g, SCM proc, Axis a); void chain_offset_callback (Grob *g, SCM proc, Axis a); +SCM axis_offset_symbol (Axis a); +SCM axis_parent_positioning (Axis a); #endif /* GROB_HH */