2 grob.hh -- declare Grob
4 source file of the LilyPond music typesetter
6 (c) 1996--2005 Han-Wen Nienhuys
12 #include "virtual-methods.hh"
13 #include "dimension-cache.hh"
14 #include "grob-interface.hh"
15 #include "object-key.hh"
18 for administration of what was done already
21 ORPHAN = 0, // not yet added to Paper_score
23 PRECALCED, // calcs before spacing done
24 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
25 POSTCALCED, // after spacing calcs done
28 typedef void (Grob::*Grob_method_pointer) (void);
30 // looking at gtk+/pango docstrings .. WIP
34 * @internal_get_property: get property #NAME.
36 * Class structure for #Grob.
41 DECLARE_SMOBS (Grob, foo);
44 Object_key const * key_;
45 SCM immutable_property_alist_;
46 SCM mutable_property_alist_;
50 friend SCM ly_grob_properties (SCM);
51 friend SCM ly_grob_basic_properties (SCM);
53 void substitute_mutable_properties (SCM, SCM);
57 Object_key const *get_key () const;
61 /* TODO: junk this member. */
64 Dimension_cache dim_cache_[NO_AXES];
66 Grob (SCM basic_props, Object_key const *);
67 Grob (Grob const&, int copy_count);
69 virtual Grob *clone (int count) const;
70 DECLARE_SCHEME_CALLBACK (stencil_extent, (SCM smob, SCM axis));
76 SCM internal_get_property (SCM) const;
77 void internal_set_property (SCM, SCM val);
78 void add_to_list_property (SCM, SCM);
80 SCM get_property_alist_chain (SCM) const;
81 static SCM ly_grob_set_property (SCM, SCM, SCM);
82 static SCM ly_grob_property (SCM, SCM);
84 void warning (String) const;
85 void programming_error (String) const;
87 Output_def *get_layout () const;
88 void add_dependency (Grob*);
89 virtual System *get_system () const;
91 void calculate_dependencies (int final, int busy, SCM funcname);
94 virtual void do_break_processing ();
95 virtual Grob *find_broken_piece (System*) const;
96 virtual void discretionary_processing ();
97 virtual SCM do_derived_mark () const;
99 Stencil *get_stencil () const;
100 SCM get_uncached_stencil () const;
103 bool is_live () const;
104 bool is_empty (Axis a) const;
106 bool internal_has_interface (SCM intf);
107 static bool has_interface (Grob *me);
109 virtual void handle_broken_dependencies ();
110 virtual void handle_prebroken_dependencies ();
112 Interval extent (Grob * refpoint, Axis) const;
114 void translate_axis (Real, Axis);
115 Real relative_coordinate (Grob const *refp, Axis) const;
116 Grob *common_refpoint (Grob const *s, Axis a) const;
118 // duh. slim down interface here. (todo)
119 bool has_offset_callback (SCM callback, Axis) const;
120 void add_offset_callback (SCM callback, Axis);
121 bool has_extent_callback (SCM, Axis) const;
122 void set_extent (SCM, Axis);
123 Real get_offset (Axis a) const;
125 void set_parent (Grob* e, Axis);
128 Grob *get_parent (Axis a) const;
129 DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
132 DECLARE_UNSMOB (Grob, grob);
133 Spanner *unsmob_spanner (SCM);
134 Item *unsmob_item (SCM);
136 Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
137 Grob *common_refpoint_of_array (Link_array<Grob> const&, Grob *, Axis a);
139 void set_break_subsititution (SCM criterion);
140 SCM substitute_mutable_property_alist (SCM alist);
142 Link_array<Grob> ly_scm2grobs (SCM ell);
143 SCM ly_grobs2scm (Link_array<Grob> a);
145 Interval robust_relative_extent (Grob*, Grob*, Axis);