2 grob.hh -- declare Grob
4 source file of the LilyPond music typesetter
6 (c) 1996--2003 Han-Wen Nienhuys
13 #include "virtual-methods.hh"
14 #include "lily-guile.hh"
15 #include "lily-proto.hh"
17 #include "dimension-cache.hh"
18 #include "grob-interface.hh"
21 for administration of what was done already
24 ORPHAN=0, // not yet added to Paper_score
27 PRECALCED, // calcs before spacing done
28 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
29 POSTCALCED, // after spacing calcs done
32 typedef void (Grob::*Grob_method_pointer) (void);
35 #define get_grob_property(x) internal_get_grob_property(ly_symbol2scm(x))
36 #define set_grob_property(x,y) internal_set_grob_property(ly_symbol2scm(x),y)
43 SCM immutable_property_alist_;
44 SCM mutable_property_alist_;
47 void substitute_mutable_properties(SCM,SCM);
52 Administration: Where are we?. This is mainly used by Super_element and
53 Grob::calcalute_dependencies ()
61 IDEA: make this a global variable. This is the same for all
62 elements, I think it is safe to assume that we will not have
63 scores being formatted multithreadedly.
66 Dimension_cache dim_cache_[NO_AXES];
68 Grob (SCM basic_props);
75 SCM internal_get_grob_property (SCM) const;
76 void internal_set_grob_property (SCM, SCM val);
77 void add_to_list_property (SCM, SCM);
78 void warning (String)const;
79 void programming_error (String)const;
81 void set_elt_pointer (const char*, SCM val);
82 friend class Property_engraver; // UGHUGHUGH.
86 Paper_def *get_paper () const;
89 add a dependency. It may be the 0 pointer, in which case, it is ignored.
91 void add_dependency (Grob*);
92 virtual System * get_system () const;
93 bool linked_b () const;
96 VIRTUAL_COPY_CONS (Grob);
99 Recursively track all dependencies of this Grob. The
100 status_ 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);
109 virtual void do_break_processing ();
110 virtual Grob *find_broken_piece (System*) const;
111 virtual void discretionary_processing ();
112 virtual SCM do_derived_mark () const;
114 Molecule * get_molecule () const;
115 SCM get_uncached_molecule () const;
117 SCM get_property_alist_chain (SCM) const;
121 DECLARE_SCHEME_CALLBACK (preset_extent, (SCM smob, SCM axis));
122 DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
123 DECLARE_SCHEME_CALLBACK (molecule_extent, (SCM smob, SCM axis));
125 static SCM ly_set_grob_property (SCM, SCM,SCM);
126 static SCM ly_get_grob_property (SCM, SCM);
128 bool internal_has_interface (SCM intf);
129 static bool has_interface (Grob*me);
131 virtual void handle_broken_dependencies ();
132 virtual void handle_prebroken_dependencies ();
134 DECLARE_SMOBS (Grob,foo);
138 bool empty_b (Axis a) const;
140 Interval extent (Grob * refpoint, Axis) const;
142 void translate_axis (Real, Axis);
143 Real relative_coordinate (Grob const* refp, Axis) const;
144 Grob*common_refpoint (Grob const* s, Axis a) const;
147 // duh. slim down interface here. (todo)
148 bool has_offset_callback_b (SCM callback, Axis)const;
149 void add_offset_callback (SCM callback, Axis);
150 bool has_extent_callback_b (SCM, Axis)const;
151 void set_extent (SCM , Axis);
152 Real get_offset (Axis a) const;
154 void set_parent (Grob* e, Axis);
156 Grob *get_parent (Axis a) const { return dim_cache_[a].parent_; }
157 DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
160 DECLARE_UNSMOB(Grob,grob);
161 Spanner* unsmob_spanner (SCM );
162 Item* unsmob_item (SCM );
164 Grob*common_refpoint_of_list (SCM elt_list, Grob * , Axis a);
165 Grob*common_refpoint_of_array (Link_array<Grob> const&, Grob * , Axis a);
167 void set_break_subsititution (SCM criterion);
168 SCM substitute_mutable_property_alist (SCM alist);
170 Link_array<Grob> ly_scm2grobs (SCM l);
171 SCM ly_grobs2scm (Link_array<Grob> a);