2 score-element.hh -- declare Score_element
4 (c) 1996-1999 Han-Wen Nienhuys
11 #include "virtual-methods.hh"
12 #include "lily-guile.hh"
13 #include "lily-proto.hh"
16 typedef void (Score_element::*Score_element_method_pointer) (void);
18 /** Both Spanner and Item are Score_element's. Most Score_element's depend
19 on other Score_element's, eg, Beam needs to know and set direction of
20 Stem. So the Beam has to be calculated *before* Stem. This is
21 accomplished with the dependencies fields of struct Score_element,
22 which are implemented in the Directed_graph_node class: all elements
23 form an acyclic graph.
30 Boolean (true iff defined)
32 break_helper_only -- if defined try to junk this after calcing breakpoints.
34 transparent -- do not calc. output
39 properties specific for this element. Destructor will not call
40 scm_unprotect, so as to allow more flexible GC arrangements. The
41 real alist is in (cdr element_property_alist_), to reduce the
42 need for more scm_protect calls.
45 SCM element_property_alist_;
46 Link_array<Score_element> dependency_arr_;
48 The lookup, determined by the font size. Cache this value.
52 Score_element *original_l_;
55 Administration: Where are we?. This is mainly used by Super_element and
56 Score_element::calcalute_dependencies ()
64 Paper_score *pscore_l_;
67 Score_element (Score_element const&);
68 virtual void print () const;
73 SCM get_elt_property (String nm) const;
74 void set_elt_property (String, SCM val);
75 SCM remove_elt_property (String nm);
77 void Score_element::set_real (String, Real);
78 Real Score_element::get_real (String s) const;
83 Paper_def *paper_l () const;
84 Lookup const *lookup_l () const;
86 void add_processing ();
89 add a dependency. It may be the 0 pointer, in which case, it is ignored.
91 void add_dependency (Score_element*);
92 virtual Line_of_score * line_l () const;
93 bool linked_b () const;
94 VIRTUAL_COPY_CONS(Score_element);
97 Recursively track all dependencies of this Score_element. The
98 status_i_ field is used as a mark-field. It is marked with
99 #busy# during execution of this function, and marked with #final#
102 #funcptr# is the function to call to update this element.
104 void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
106 static SCM handle_broken_smobs (SCM, SCM criterion);
107 void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
110 virtual Score_element *find_broken_piece (Line_of_score*) const;
114 Junk score element. This is protected because this is supposed to
115 be handled by GUILE gc. */
116 virtual ~Score_element ();
118 Score_element* dependency (int) const;
119 int dependency_size () const;
121 virtual void output_processing ();
122 static Interval molecule_extent (Dimension_cache const*);
124 /// do printing of derived info.
125 virtual void do_print () const;
126 /// generate the molecule
127 virtual Molecule* do_brew_molecule_p () const;
128 ///executed directly after the item is added to the Paper_score
129 virtual void do_add_processing ();
130 /// do calculations before determining horizontal spacing
131 virtual void do_pre_processing ();
133 /// generate rods & springs
134 virtual void do_space_processing ();
136 virtual void do_breakable_col_processing ();
137 /// do calculations after determining horizontal spacing
138 virtual void do_post_processing ();
140 virtual void do_break_processing ();
142 virtual Link_array<Score_element> get_extra_dependencies () const;
144 static Interval dim_cache_callback (Dimension_cache const*);
146 virtual void handle_broken_dependencies ();
147 virtual void handle_prebroken_dependencies ();
155 Dimension_cache *dim_cache_[NO_AXES];
158 Set this if anyone points to me, or if I point to anyone.
162 char const * name () const;
164 Set empty in direction A.
166 void set_empty (Axis a);
167 bool empty_b (Axis a) const;
168 void invalidate_cache (Axis);
169 Interval extent (Axis) const;
172 translate in one direction
175 void translate_axis (Real, Axis);
177 Real relative_coordinate (Score_element const* refp, Axis) const;
179 Find the group-element which has both #this# and #s#
181 Score_element*common_refpoint (Score_element const* s, Axis a) const;
182 Score_element*common_refpoint (Link_array<Score_element> elems, Axis a) const;
185 Set the parent refpoint of THIS to E
187 void set_parent (Score_element* e, Axis);
189 Score_element *parent_l (Axis a) const;
190 void fixup_refpoint ();
193 Score_element * unsmob_element (SCM);
197 #endif // STAFFELEM_HH