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"
17 typedef Interval (*Extent_callback)(Score_element *,Axis);
18 typedef Real (*Offset_callback)(Score_element *,Axis);
23 for administration of what was done already
25 enum Score_element_status {
26 ORPHAN=0, // not yet added to pstaff
27 VIRGIN, // added to pstaff
29 PRECALCED, // calcs before spacing done
30 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
31 POSTCALCED, // after spacing calcs done
36 typedef void (Score_element::*Score_element_method_pointer) (void);
43 transparent -- boolean: if true, do not print anything black.
45 dependencies -- list of score-element pointers that indicate who to
48 interfaces -- list of symbols indicating the interfaces supported
51 extra-offset -- pair of reals (a cons) forcing an extra offset
54 glyph -- afm character name to output.
59 The lookup, determined by the font size. Cache this value.
64 SCM immutable_property_alist_;
65 SCM mutable_property_alist_;
66 Score_element *original_l_;
69 Administration: Where are we?. This is mainly used by Super_element and
70 Score_element::calcalute_dependencies ()
75 char const * name () const;
78 IDEA: make this a global variable. This is the same for all
79 elements, I think it is safe to assume that we will not have
80 scores being formatted multithreadedly.
82 Paper_score *pscore_l_;
84 Score_element (SCM basic_props);
85 Score_element (Score_element const&);
90 SCM get_elt_property (const char*) const;
91 SCM get_elt_property (SCM) const;
92 void set_elt_property (const char * , SCM val);
93 void set_immutable_elt_property (const char * , SCM val);
94 void set_immutable_elt_property (SCM key, SCM val);
95 void set_elt_property (SCM , SCM val);
96 void set_elt_pointer (const char*, SCM val);
97 friend class Property_engraver; // UGHUGHUGH.
98 SCM remove_elt_property (const char* nm);
103 Paper_def *paper_l () const;
104 Lookup const *lookup_l () const;
106 void add_processing ();
109 add a dependency. It may be the 0 pointer, in which case, it is ignored.
111 void add_dependency (Score_element*);
112 virtual Line_of_score * line_l () const;
113 bool linked_b () const;
116 VIRTUAL_COPY_CONS(Score_element);
119 Recursively track all dependencies of this Score_element. The
120 status_i_ field is used as a mark-field. It is marked with
121 #busy# during execution of this function, and marked with #final#
124 #funcptr# is the function to call to update this element.
126 void calculate_dependencies (int final, int busy, SCM funcname);
129 static SCM handle_broken_smobs (SCM, SCM criterion);
131 virtual void do_break_processing ();
132 virtual Score_element *find_broken_piece (Line_of_score*) const;
133 virtual void discretionary_processing ();
134 virtual SCM do_derived_mark ();
136 Molecule get_molecule () const;
139 static Interval preset_extent (Score_element *,Axis);
140 static Interval point_dimension_callback (Score_element *,Axis );
141 static Interval molecule_extent (Score_element *,Axis);
144 ///executed directly after the item is added to the Paper_score
145 virtual void do_add_processing ();
146 static Interval dim_cache_callback (Dimension_cache const*);
149 static SCM ly_set_elt_property (SCM, SCM,SCM);
150 static SCM ly_get_elt_property (SCM, SCM);
152 bool has_interface (SCM intf);
153 void set_interface (SCM intf);
156 static SCM brew_molecule (SCM);
157 virtual void handle_broken_dependencies ();
158 virtual void handle_prebroken_dependencies ();
161 DECLARE_SMOBS(Score_element,foo);
165 Dimension_cache dim_cache_[NO_AXES];
168 bool empty_b (Axis a) const;
169 Interval extent (Axis) const;
172 translate in one direction
175 void translate_axis (Real, Axis);
178 Find the offset relative to D. If D equals THIS, then it is 0.
179 Otherwise, it recursively defd as
181 OFFSET_ + PARENT_L_->relative_coordinate (D)
183 Real relative_coordinate (Score_element const* refp, Axis) const;
185 Find the group-element which has both #this# and #s#
187 Score_element*common_refpoint (Score_element const* s, Axis a) const;
188 Score_element*common_refpoint (SCM elt_list, Axis a) const;
190 bool has_offset_callback_b (Offset_callback, Axis)const;
191 void add_offset_callback (Offset_callback, Axis);
192 bool has_extent_callback_b (Extent_callback, Axis)const;
193 void set_extent_callback (Extent_callback , Axis);
196 Invoke callbacks to get offset relative to parent.
198 Real get_offset (Axis a) const;
200 Set the parent refpoint of THIS to E
202 void set_parent (Score_element* e, Axis);
204 Score_element *parent_l (Axis a) const;
205 static SCM fixup_refpoint (SCM);
208 Score_element * unsmob_element (SCM);
210 #endif // STAFFELEM_HH