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"
19 ORPHAN = 0, // not yet added to Paper_score
21 PRECALCED, // calcs before spacing done
22 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
23 POSTCALCED, // after spacing calcs done
26 typedef void (Grob:: *Grob_method_pointer) (void);
31 DECLARE_SMOBS (Grob, foo);
37 Object_key const *key_;
38 SCM immutable_property_alist_;
39 SCM mutable_property_alist_;
41 SCM property_callbacks_;
44 If this is a property, it accounts for 25% of the property
51 friend SCM ly_grob_properties (SCM);
52 friend SCM ly_grob_basic_properties (SCM);
53 friend void check_interfaces_for_property (Grob const *, SCM);
54 void substitute_object_links (SCM, SCM);
57 DECLARE_CLASSNAME(Grob);
59 DECLARE_SCHEME_CALLBACK(same_axis_parent_positioning, (SCM, SCM));
60 DECLARE_SCHEME_CALLBACK(other_axis_parent_positioning, (SCM, SCM));
62 Object_key const *get_key () const;
66 /* TODO: junk this member. */
69 Dimension_cache dim_cache_[NO_AXES];
71 Grob (SCM basic_props, Object_key const *);
72 Grob (Grob const &, int copy_count);
74 virtual Grob *clone (int count) const;
75 DECLARE_SCHEME_CALLBACK (stencil_extent, (SCM smob, SCM axis));
81 SCM internal_get_property (SCM symbol) const;
82 SCM get_property_data (SCM symbol) const;
83 SCM internal_get_object (SCM symbol) const;
85 void internal_set_property (SCM sym, SCM val);
86 void internal_set_object (SCM sym, SCM val);
88 SCM try_callback (SCM);
92 void add_to_list_property (SCM, SCM);
93 void add_to_object_list (SCM sym, SCM thing);
95 SCM get_property_alist_chain (SCM) const;
96 static SCM ly_grob_set_property (SCM, SCM, SCM);
97 static SCM ly_grob_property (SCM, SCM);
99 void warning (String) const;
100 void programming_error (String) const;
102 Output_def *get_layout () const;
103 void add_dependency (Grob *);
104 virtual System *get_system () const;
106 void calculate_dependencies (int final, int busy, SCM funcname);
108 virtual void do_break_processing ();
109 virtual Grob *find_broken_piece (System *) const;
110 virtual void discretionary_processing ();
111 virtual void derived_mark () const;
113 Stencil *get_stencil () const;
114 SCM get_uncached_stencil () const;
117 bool is_live () const;
118 bool is_empty (Axis a) const;
120 bool internal_has_interface (SCM intf);
121 static bool has_interface (Grob *me);
123 virtual void handle_broken_dependencies ();
124 virtual void handle_prebroken_dependencies ();
126 Interval extent (Grob *refpoint, Axis) const;
128 void translate_axis (Real, Axis);
129 Real relative_coordinate (Grob const *refp, Axis) const;
130 Grob *common_refpoint (Grob const *s, Axis a) const;
132 // duh. slim down interface here. (todo)
133 bool has_offset_callback (SCM callback, Axis) const;
134 void add_offset_callback (SCM callback, Axis);
135 bool has_extent_callback (SCM, Axis) const;
136 void flush_extent_cache (Axis);
137 void set_extent (SCM, Axis);
138 void set_extent_callback (SCM, Axis);
139 Real get_offset (Axis a) const;
141 void set_parent (Grob *e, Axis);
144 Grob *get_parent (Axis a) const;
145 void fixup_refpoint ();
148 DECLARE_UNSMOB (Grob, grob);
149 Spanner *unsmob_spanner (SCM);
150 Item *unsmob_item (SCM);
152 Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
153 Grob *common_refpoint_of_array (Link_array<Grob> const &, Grob *, Axis a);
155 void set_break_subsititution (SCM criterion);
156 SCM substitute_object_alist (SCM alist, SCM dest);
158 Link_array<Grob> ly_scm2grobs (SCM ell);
159 SCM ly_grobs2scm (Link_array<Grob> a);
161 Interval robust_relative_extent (Grob *, Grob *, Axis);