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
50 TEXOUTPUT, // molecule has been output
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_[NO_AXES];
73 Score_elem (Score_elem const&);
74 virtual String TeX_output_str () const ;
75 virtual void print() const;
77 Paper_def *paper() const;
79 virtual ~Score_elem();
81 DECLARE_MY_RUNTIME_TYPEINFO;
83 Interval extent (Axis) const;
84 Interval width() const;
85 Interval height() const;
86 Status status() const;
89 translate the symbol. The symbol does not have to be created yet.
91 void translate (Offset);
93 translate in one direction
96 void translate (Real, Axis);
97 Real relative_coordinate (Axis_group_element*, Axis) const;
98 Offset absolute_offset() const;
99 Real absolute_coordinate (Axis) const;
100 Axis_group_element*common_group (Score_elem const* s, Axis a) const;
102 void add_processing();
104 void pre_processing();
105 void breakable_col_processing();
106 void break_processing();
108 void post_processing();
109 void molecule_processing();
112 Remove all links (dependencies, dependents, Axis_group_elements.
116 void substitute_dependency (Score_elem*,Score_elem*);
117 void remove_dependency (Score_elem*);
119 add a dependency. It may be the 0 pointer, in which case, it is ignored.
121 void add_dependency (Score_elem*);
127 virtual Spanner* spanner() { return 0; }
128 virtual Item * item() { return 0; }
129 virtual Line_of_score * line_l() const;
130 virtual bool linked_b() const;
131 SCORE_ELEM_CLONE(Score_elem);
133 /// no dimension, translation is noop
135 /// do not print anything black
139 virtual Interval do_height() const;
140 virtual Interval do_width() const;
142 /// do printing of derived info.
143 virtual void do_print() const {}
144 /// generate the molecule
145 virtual Molecule* brew_molecule_p() const;
146 ///executed directly after the item is added to the Paper_score
147 virtual void do_add_processing();
148 /// do calculations before determining horizontal spacing
149 virtual void do_pre_processing();
151 virtual void do_breakable_col_processing();
152 /// do calculations after determining horizontal spacing
153 virtual void do_post_processing();
154 virtual String do_TeX_output_str () const;
156 virtual void do_substitute_dependency (Score_elem * , Score_elem *);
157 virtual void do_substitute_dependent (Score_elem *, Score_elem *);
158 virtual void do_break_processing();
159 virtual void handle_broken_dependencies();
160 virtual void handle_prebroken_dependencies();
161 virtual Link_array<Score_elem> get_extra_dependencies() const;
162 virtual void do_unlink();
163 virtual void do_junk_links();
164 String make_TeX_string (Offset) const;
168 #endif // STAFFELEM_HH