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-callback.hh"
22 for administration of what was done already
24 enum Score_element_status {
25 ORPHAN=0, // not yet added to pstaff
26 VIRGIN, // added to pstaff
28 PRECALCED, // calcs before spacing done
29 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
30 POSTCALCED, // after spacing calcs done
35 typedef void (Score_element::*Score_element_method_pointer) (void);
42 transparent -- boolean: if true, do not print anything black.
44 dependencies -- list of score-element pointers that indicate who to
47 interfaces -- list of symbols indicating the interfaces supported
50 extra-offset -- pair of reals (a cons) forcing an extra offset
53 glyph -- afm character name to output.
58 The lookup, determined by the font size. Cache this value.
63 properties specific for this element. Destructor will not call
64 scm_unprotect, so as to allow more flexible GC arrangements. The
65 real alist is in (cdr element_property_alist_), to reduce the
66 need for more scm_protect calls.
69 SCM element_property_alist_;
71 Score_element *original_l_;
74 Administration: Where are we?. This is mainly used by Super_element and
75 Score_element::calcalute_dependencies ()
83 Paper_score *pscore_l_;
86 Score_element (Score_element const&);
87 virtual void print () const;
92 SCM get_elt_property (String nm) const;
93 void set_elt_property (String, SCM val);
98 This gets messy because it changes state
104 s->remove_elt_property ("foo")
107 twice may do weird things if Bar::foo has a default set.
110 SCM remove_elt_property (String nm);
112 void Score_element::set_real (String, Real);
113 Real Score_element::get_real (String s) const;
118 Paper_def *paper_l () const;
119 Lookup const *lookup_l () const;
121 void add_processing ();
124 add a dependency. It may be the 0 pointer, in which case, it is ignored.
126 void add_dependency (Score_element*);
127 virtual Line_of_score * line_l () const;
128 bool linked_b () const;
129 VIRTUAL_COPY_CONS(Score_element);
132 Recursively track all dependencies of this Score_element. The
133 status_i_ field is used as a mark-field. It is marked with
134 #busy# during execution of this function, and marked with #final#
137 #funcptr# is the function to call to update this element.
139 void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
141 static SCM handle_broken_smobs (SCM, SCM criterion);
142 void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
144 virtual void do_break_processing ();
145 virtual Score_element *find_broken_piece (Line_of_score*) const;
146 /// generate rods & springs
147 virtual void do_space_processing ();
148 virtual void do_breakable_col_processing ();
150 /// do calculations before determining horizontal spacing
151 virtual void before_line_breaking ();
156 Junk score element. This is protected because this is supposed to
157 be handled by GUILE gc. */
158 virtual ~Score_element ();
160 virtual void output_processing ();
161 static Interval molecule_extent (Dimension_cache const*);
163 /// do printing of derived info.
164 virtual void do_print () const;
165 /// generate the molecule
166 virtual Molecule do_brew_molecule () const;
167 ///executed directly after the item is added to the Paper_score
168 virtual void do_add_processing ();
170 /// do calculations after determining horizontal spacing
171 virtual void after_line_breaking ();
173 static Interval dim_cache_callback (Dimension_cache const*);
175 static SCM ly_set_elt_property (SCM, SCM,SCM);
176 static SCM ly_get_elt_property (SCM, SCM);
178 virtual void handle_broken_dependencies ();
179 virtual void handle_prebroken_dependencies ();
187 Dimension_cache *dim_cache_[NO_AXES];
190 Set this if anyone points to me, or if I point to anyone.
196 char const * name () const;
198 Set empty in direction A.
200 void set_empty (Axis a);
201 bool empty_b (Axis a) const;
202 Interval extent (Axis) const;
205 translate in one direction
208 void translate_axis (Real, Axis);
210 Real relative_coordinate (Score_element const* refp, Axis) const;
212 Find the group-element which has both #this# and #s#
214 Score_element*common_refpoint (Score_element const* s, Axis a) const;
215 Score_element*common_refpoint (Link_array<Score_element> elems, Axis a) const;
218 bool has_offset_callback_b (Offset_cache_callback, Axis)const;
219 void add_offset_callback (Offset_cache_callback, Axis);
221 Set the parent refpoint of THIS to E
223 void set_parent (Score_element* e, Axis);
225 Score_element *parent_l (Axis a) const;
226 void fixup_refpoint ();
229 Score_element * unsmob_element (SCM);
233 #endif // STAFFELEM_HH