2 grob.hh -- declare Grob
4 (c) 1996-1999--2002 Han-Wen Nienhuys
11 #include "virtual-methods.hh"
12 #include "lily-guile.hh"
13 #include "lily-proto.hh"
15 #include "dimension-cache.hh"
18 for administration of what was done already
21 ORPHAN=0, // not yet added to Paper_score
24 PRECALCED, // calcs before spacing done
25 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
26 POSTCALCED, // after spacing calcs done
29 typedef void (Grob::*Grob_method_pointer) (void);
32 #define get_grob_property(x) internal_get_grob_property(ly_symbol2scm(x))
33 #define set_grob_property(x,y) internal_set_grob_property(ly_symbol2scm(x),y)
40 SCM immutable_property_alist_;
42 // rename me to ``property_alist_''
43 SCM mutable_property_alist_;
48 Administration: Where are we?. This is mainly used by Super_element and
49 Grob::calcalute_dependencies ()
57 IDEA: make this a global variable. This is the same for all
58 elements, I think it is safe to assume that we will not have
59 scores being formatted multithreadedly.
61 Paper_score *pscore_l_;
63 Grob (SCM basic_props);
69 SCM internal_get_grob_property (SCM) const;
70 void internal_set_grob_property (SCM, SCM val);
73 void set_immutable_grob_property (const char * , SCM val);
74 void set_immutable_grob_property (SCM key, SCM val);
77 void warning (String);
79 void set_elt_pointer (const char*, SCM val);
80 friend class Property_engraver; // UGHUGHUGH.
81 SCM remove_grob_property (const char* nm);
86 Paper_def *paper_l () const;
89 add a dependency. It may be the 0 pointer, in which case, it is ignored.
91 void add_dependency (Grob*);
92 virtual Line_of_score * line_l () const;
93 bool linked_b () const;
96 VIRTUAL_COPY_CONS (Grob);
99 Recursively track all dependencies of this Grob. The
100 status_c_ field is used as a mark-field. It is marked with
101 #busy# during execution of this function, and marked with #final#
104 #funcptr# is the function to call to update this element.
106 void calculate_dependencies (int final, int busy, SCM funcname);
107 static SCM handle_broken_grobs(SCM, SCM criterion);
109 virtual void do_break_processing ();
110 virtual Grob *find_broken_piece (Line_of_score*) const;
111 virtual void discretionary_processing ();
112 virtual SCM do_derived_mark ();
114 Molecule * get_molecule () const;
115 SCM get_uncached_molecule () const;
119 DECLARE_SCHEME_CALLBACK (preset_extent, (SCM smob, SCM axis));
120 DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
121 DECLARE_SCHEME_CALLBACK (molecule_extent, (SCM smob, SCM axis));
124 static SCM ly_set_grob_property (SCM, SCM,SCM);
125 static SCM ly_get_grob_property (SCM, SCM);
127 bool has_interface (SCM intf);
128 void set_interface (SCM intf);
130 virtual void handle_broken_dependencies ();
131 virtual void handle_prebroken_dependencies ();
134 DECLARE_SMOBS (Grob,foo);
138 Dimension_cache dim_cache_[NO_AXES];
141 bool empty_b (Axis a) const;
143 Interval extent (Grob * refpoint, Axis) const;
146 translate in one direction
149 void translate_axis (Real, Axis);
152 Find the offset relative to D. If D equals THIS, then it is 0.
153 Otherwise, it recursively defd as
155 OFFSET_ + PARENT_L_->relative_coordinate (D)
157 Real relative_coordinate (Grob const* refp, Axis) const;
159 Find the group-element which has both #this# and #s#
161 Grob*common_refpoint (Grob const* s, Axis a) const;
162 Grob*common_refpoint (SCM elt_list, Axis a) const;
164 // duh. slim down interface here. (todo)
165 bool has_offset_callback_b (SCM callback, Axis)const;
166 void add_offset_callback (SCM callback, Axis);
167 bool has_extent_callback_b (SCM, Axis)const;
168 void set_extent_callback (SCM , Axis);
169 bool has_extent_callback_b (Axis) const;
173 Invoke callbacks to get offset relative to parent.
175 Real get_offset (Axis a) const;
177 Set the parent refpoint of THIS to E
179 void set_parent (Grob* e, Axis);
181 Grob *get_parent (Axis a) const { return dim_cache_[a].parent_l_; }
182 DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
185 DECLARE_UNSMOB(Grob,grob);
186 Spanner* unsmob_spanner (SCM );
187 Item* unsmob_item (SCM );
190 #endif // STAFFELEM_HH