2 score-element.hh -- declare Score_element
4 (c) 1996-1999--2000 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
20 enum Score_element_status {
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
31 typedef void (Score_element::*Score_element_method_pointer) (void);
38 transparent -- boolean: if true, do not print anything black.
40 dependencies -- list of score-element pointers that indicate who to
43 interfaces -- list of symbols indicating the interfaces supported
46 extra-offset -- pair of reals (a cons) forcing an extra offset
49 glyph -- afm character name to output.
54 The lookup, determined by the font size. Cache this value.
59 SCM immutable_property_alist_;
60 SCM mutable_property_alist_;
61 Score_element *original_l_;
64 Administration: Where are we?. This is mainly used by Super_element and
65 Score_element::calcalute_dependencies ()
73 IDEA: make this a global variable. This is the same for all
74 elements, I think it is safe to assume that we will not have
75 scores being formatted multithreadedly.
77 Paper_score *pscore_l_;
79 Score_element (SCM basic_props);
80 Score_element (Score_element const&);
85 SCM get_elt_property (const char*) const;
86 SCM get_elt_property (SCM) const;
87 void set_elt_property (const char * , SCM val);
88 void set_immutable_elt_property (const char * , SCM val);
89 void set_immutable_elt_property (SCM key, SCM val);
90 void set_elt_property (SCM , SCM val);
91 void set_elt_pointer (const char*, SCM val);
92 friend class Property_engraver; // UGHUGHUGH.
93 SCM remove_elt_property (const char* nm);
98 Paper_def *paper_l () const;
99 Lookup const *lookup_l () const;
102 add a dependency. It may be the 0 pointer, in which case, it is ignored.
104 void add_dependency (Score_element*);
105 virtual Line_of_score * line_l () const;
106 bool linked_b () const;
109 VIRTUAL_COPY_CONS(Score_element);
112 Recursively track all dependencies of this Score_element. The
113 status_i_ field is used as a mark-field. It is marked with
114 #busy# during execution of this function, and marked with #final#
117 #funcptr# is the function to call to update this element.
119 void calculate_dependencies (int final, int busy, SCM funcname);
120 static SCM handle_broken_smobs (SCM, SCM criterion);
122 virtual void do_break_processing ();
123 virtual Score_element *find_broken_piece (Line_of_score*) const;
124 virtual void discretionary_processing ();
125 virtual SCM do_derived_mark ();
127 Molecule get_molecule () const;
130 DECLARE_SCHEME_CALLBACK(preset_extent, (SCM smob, SCM axis));
131 DECLARE_SCHEME_CALLBACK(point_dimension_callback, (SCM smob, SCM axis));
132 DECLARE_SCHEME_CALLBACK(molecule_extent, (SCM smob, SCM axis));
135 static SCM ly_set_elt_property (SCM, SCM,SCM);
136 static SCM ly_get_elt_property (SCM, SCM);
138 bool has_interface (SCM intf);
139 void set_interface (SCM intf);
142 DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
143 virtual void handle_broken_dependencies ();
144 virtual void handle_prebroken_dependencies ();
147 DECLARE_SMOBS(Score_element,foo);
151 Dimension_cache dim_cache_[NO_AXES];
154 bool empty_b (Axis a) const;
156 Interval extent (Score_element * refpoint, Axis) const;
159 translate in one direction
162 void translate_axis (Real, Axis);
165 Find the offset relative to D. If D equals THIS, then it is 0.
166 Otherwise, it recursively defd as
168 OFFSET_ + PARENT_L_->relative_coordinate (D)
170 Real relative_coordinate (Score_element const* refp, Axis) const;
172 Find the group-element which has both #this# and #s#
174 Score_element*common_refpoint (Score_element const* s, Axis a) const;
175 Score_element*common_refpoint (SCM elt_list, Axis a) const;
177 // duh. slim down interface here. (todo)
178 bool has_offset_callback_b (SCM callback, Axis)const;
179 void add_offset_callback (SCM callback, Axis);
180 bool has_extent_callback_b (SCM, Axis)const;
181 void set_extent_callback (SCM , Axis);
182 bool has_extent_callback_b (Axis) const;
186 Invoke callbacks to get offset relative to parent.
188 Real get_offset (Axis a) const;
190 Set the parent refpoint of THIS to E
192 void set_parent (Score_element* e, Axis);
194 Score_element *parent_l (Axis a) const;
195 DECLARE_SCHEME_CALLBACK(fixup_refpoint, (SCM));
198 Score_element * unsmob_element (SCM);
200 #endif // STAFFELEM_HH