2 score-elem.hh -- part of GNU LilyPond
4 (c) 1996,97 Han-Wen Nienhuys
11 #include "lily-proto.hh"
13 #include "virtual-methods.hh"
14 #include "directed-graph.hh"
16 #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem)
20 /** Both Spanner and Item are Score_elem's. Most Score_elem's depend
21 on other Score_elem's, eg, Beam needs to know and set direction of
22 Stem. So the Beam has to be calculated *before* Stem. This is
23 accomplished with the dependencies fields of struct Score_elem,
24 which are implemented in the Directed_graph_node class: all elements
25 form an acyclic graph.
28 class Score_elem : private Directed_graph_node {
30 /// member: the symbols
31 Molecule *output; // should scrap, and use temp var?
36 for administration of what was done already
39 ORPHAN, // not yet added to pstaff
40 VIRGIN, // added to pstaff
44 PRECALCED, // calcs before spacing done
47 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
48 POSTCALCED, // after spacing calcs done
49 OUTPUT, // molecule has been output
50 DELMARKED, // mark for 'unclean' deletion
51 DELETED, // to catch malloc mistakes.
56 Score_elem* dependency (int) const;
57 Score_elem* dependent (int) const;
58 int dependent_size() const;
59 int dependency_size() const;
62 This is needed, because #output# may still be
70 Paper_score *pscore_l_;
71 Axis_group_element * axis_group_l_a_[2];
73 Score_elem (Score_elem const&);
74 virtual String TeX_string() const ;
75 String TeX_string_without_offset (Offset)const;
76 virtual void print() const;
78 Paper_def *paper() const;
80 virtual ~Score_elem();
82 DECLARE_MY_RUNTIME_TYPEINFO;
84 Interval extent (Axis)const;
85 Interval width() const;
86 Interval height() const;
87 Status status() const;
90 translate the symbol. The symbol does not have to be created yet.
92 void translate (Offset);
94 translate in one direction
97 void translate (Real, Axis);
98 Real relative_coordinate (Axis_group_element*, Axis)const;
99 Offset absolute_offset()const;
100 Real absolute_coordinate (Axis)const;
101 Axis_group_element*common_group (Score_elem const* s, Axis a)const;
103 void add_processing();
105 void pre_processing();
106 void breakable_col_processing();
107 void break_processing();
109 void post_processing();
110 void molecule_processing();
113 Remove all links (dependencies, dependents, Axis_group_elements.
117 void substitute_dependency (Score_elem*,Score_elem*);
118 void remove_dependency (Score_elem*);
120 add a dependency. It may be the 0 pointer, in which case, it is ignored.
122 void add_dependency (Score_elem*);
123 void copy_dependencies (Score_elem const&);
125 junk the dependency array. Don't do derived stuff.
127 void junk_dependencies();
134 virtual Spanner* spanner() { return 0; }
135 virtual Item * item() { return 0; }
136 virtual Line_of_score * line_l() const;
137 SCORE_ELEM_CLONE(Score_elem);
139 /// no dimension, translation is noop
141 /// do not print anything black
145 virtual Interval do_height()const;
146 virtual Interval do_width()const;
148 /// do printing of derived info.
149 virtual void do_print() const {}
150 /// generate the molecule
151 virtual Molecule* brew_molecule_p()const;
152 ///executed directly after the item is added to the Paper_score
153 virtual void do_add_processing();
154 /// do calculations before determining horizontal spacing
155 virtual void do_pre_processing();
157 virtual void do_breakable_col_processing();
158 /// do calculations after determining horizontal spacing
159 virtual void do_post_processing();
161 virtual void do_substitute_dependency (Score_elem * , Score_elem *);
162 virtual void do_substitute_dependent (Score_elem *, Score_elem *);
163 virtual void do_break_processing();
164 virtual void handle_broken_dependencies();
165 virtual void handle_prebroken_dependencies();
166 virtual Link_array<Score_elem> get_extra_dependencies()const;
167 virtual void do_unlink();
171 #endif // STAFFELEM_HH