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"
16 #include "grob-interface.hh"
19 for administration of what was done already
22 ORPHAN=0, // not yet added to Paper_score
25 PRECALCED, // calcs before spacing done
26 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
27 POSTCALCED, // after spacing calcs done
30 typedef void (Grob::*Grob_method_pointer) (void);
33 #define get_grob_property(x) internal_get_grob_property(ly_symbol2scm(x))
34 #define set_grob_property(x,y) internal_set_grob_property(ly_symbol2scm(x),y)
41 SCM immutable_property_alist_;
42 SCM mutable_property_alist_;
44 void substitute_mutable_properties(SCM,SCM);
49 Administration: Where are we?. This is mainly used by Super_element and
50 Grob::calcalute_dependencies ()
58 IDEA: make this a global variable. This is the same for all
59 elements, I think it is safe to assume that we will not have
60 scores being formatted multithreadedly.
63 Dimension_cache dim_cache_[NO_AXES];
65 Grob (SCM basic_props);
72 SCM internal_get_grob_property (SCM) const;
73 void internal_set_grob_property (SCM, SCM val);
74 void add_to_list_property (SCM, SCM);
75 void warning (String)const;
76 void programming_error (String)const;
78 void set_elt_pointer (const char*, SCM val);
79 friend class Property_engraver; // UGHUGHUGH.
80 SCM remove_grob_property (const char* nm);
85 Paper_def *get_paper () const;
88 add a dependency. It may be the 0 pointer, in which case, it is ignored.
90 void add_dependency (Grob*);
91 virtual System * get_system () const;
92 bool linked_b () const;
95 VIRTUAL_COPY_CONS (Grob);
98 Recursively track all dependencies of this Grob. The
99 status_ field is used as a mark-field. It is marked with
100 #busy# during execution of this function, and marked with #final#
103 #funcptr# is the function to call to update this element.
105 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 SCM do_derived_mark ();
113 Molecule * get_molecule () const;
114 SCM get_uncached_molecule () const;
116 SCM get_property_alist_chain (SCM) const;
120 DECLARE_SCHEME_CALLBACK (preset_extent, (SCM smob, SCM axis));
121 DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
122 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 internal_has_interface (SCM intf);
128 static bool has_interface (Grob*me);
130 virtual void handle_broken_dependencies ();
131 virtual void handle_prebroken_dependencies ();
133 DECLARE_SMOBS (Grob,foo);
137 bool empty_b (Axis a) const;
139 Interval extent (Grob * refpoint, Axis) const;
141 void translate_axis (Real, Axis);
142 Real relative_coordinate (Grob const* refp, Axis) const;
143 Grob*common_refpoint (Grob const* s, Axis a) const;
146 // duh. slim down interface here. (todo)
147 bool has_offset_callback_b (SCM callback, Axis)const;
148 void add_offset_callback (SCM callback, Axis);
149 bool has_extent_callback_b (SCM, Axis)const;
150 void set_extent (SCM , Axis);
151 Real get_offset (Axis a) const;
153 void set_parent (Grob* e, Axis);
155 Grob *get_parent (Axis a) const { return dim_cache_[a].parent_; }
156 DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
159 DECLARE_UNSMOB(Grob,grob);
160 Spanner* unsmob_spanner (SCM );
161 Item* unsmob_item (SCM );
163 Grob*common_refpoint_of_list (SCM elt_list, Grob * , Axis a);
164 Grob*common_refpoint_of_array (Link_array<Grob> const&, Grob * , Axis a);
166 void set_break_subsititution (SCM criterion);
167 SCM substitute_mutable_property_alist (SCM alist);
169 Link_array<Grob> ly_scm2grobs (SCM l);
170 SCM ly_grobs2scm (Link_array<Grob> a);
172 #endif // STAFFELEM_HH