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);
34 Object_key const *key_;
35 SCM immutable_property_alist_;
36 SCM mutable_property_alist_;
40 If this is a property, it accounts for 25% of the property
47 friend SCM ly_grob_properties (SCM);
48 friend SCM ly_grob_basic_properties (SCM);
49 friend void check_interfaces_for_property (Grob const *, SCM);
50 void substitute_object_links (SCM, SCM);
54 Object_key const *get_key () const;
58 /* TODO: junk this member. */
61 Dimension_cache dim_cache_[NO_AXES];
63 Grob (SCM basic_props, Object_key const *);
64 Grob (Grob const &, int copy_count);
66 virtual Grob *clone (int count) const;
67 DECLARE_SCHEME_CALLBACK (stencil_extent, (SCM smob, SCM axis));
73 SCM internal_get_property (SCM) const;
74 SCM internal_get_object (SCM) const;
76 void internal_set_property (SCM sym, SCM val);
77 void internal_set_object (SCM sym, SCM val);
82 void add_to_list_property (SCM, SCM);
83 void add_to_object_list (SCM sym, SCM thing);
85 SCM get_property_alist_chain (SCM) const;
86 static SCM ly_grob_set_property (SCM, SCM, SCM);
87 static SCM ly_grob_property (SCM, SCM);
89 void warning (String) const;
90 void programming_error (String) const;
92 Output_def *get_layout () const;
93 void add_dependency (Grob *);
94 virtual System *get_system () const;
96 void calculate_dependencies (int final, int busy, SCM funcname);
98 virtual void do_break_processing ();
99 virtual Grob *find_broken_piece (System *) const;
100 virtual void discretionary_processing ();
101 virtual void derived_mark () const;
103 Stencil *get_stencil () const;
104 SCM get_uncached_stencil () const;
107 bool is_live () const;
108 bool is_empty (Axis a) const;
110 bool internal_has_interface (SCM intf);
111 static bool has_interface (Grob *me);
113 virtual void handle_broken_dependencies ();
114 virtual void handle_prebroken_dependencies ();
116 Interval extent (Grob *refpoint, Axis) const;
118 void translate_axis (Real, Axis);
119 Real relative_coordinate (Grob const *refp, Axis) const;
120 Grob *common_refpoint (Grob const *s, Axis a) const;
122 // duh. slim down interface here. (todo)
123 bool has_offset_callback (SCM callback, Axis) const;
124 void add_offset_callback (SCM callback, Axis);
125 bool has_extent_callback (SCM, Axis) const;
126 void flush_extent_cache (Axis);
127 void set_extent (SCM, Axis);
128 void set_extent_callback (SCM, Axis);
129 Real get_offset (Axis a) const;
131 void set_parent (Grob *e, Axis);
134 Grob *get_parent (Axis a) const;
135 void fixup_refpoint ();
138 DECLARE_UNSMOB (Grob, grob);
139 Spanner *unsmob_spanner (SCM);
140 Item *unsmob_item (SCM);
142 Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
143 Grob *common_refpoint_of_array (Link_array<Grob> const &, Grob *, Axis a);
145 void set_break_subsititution (SCM criterion);
146 SCM substitute_object_alist (SCM alist, SCM dest);
148 Link_array<Grob> ly_scm2grobs (SCM ell);
149 SCM ly_grobs2scm (Link_array<Grob> a);
151 Interval robust_relative_extent (Grob *, Grob *, Axis);