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)
18 /** Both Spanner and Item are Score_elem's. Most Score_elem's depend
19 on other Score_elem'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_elem,
22 which are implemented in the Directed_graph_node class: all elements
23 form an acyclic graph.
26 class Score_elem : private Directed_graph_node {
28 /// member: the symbols
29 Molecule *output; // should scrap, and use temp var?
33 This is needed, because #output# may still be
39 for administration of what was done already
42 ORPHAN, // not yet added to pstaff
43 VIRGIN, // added to pstaff
47 PRECALCED, // calcs before spacing done
50 POSTCALCING, // busy calculating. This is used to trap cyclic deps.
51 POSTCALCED, // after spacing calcs done
52 OUTPUT, // molecule has been output
53 DELMARKED, // mark for 'unclean' deletion
54 DELETED, // to catch malloc mistakes.
61 Vertical_group *y_group_l_;
62 Horizontal_group *x_group_l_;
63 Score_elem(Score_elem const&);
64 virtual String TeX_string () const ;
65 virtual void print() const;
67 Paper_def *paper() const;
69 virtual ~Score_elem();
71 DECLARE_MY_RUNTIME_TYPEINFO;
73 Interval width() const;
74 Interval height() const;
75 virtual void translate_x(Real);
76 virtual void translate_y(Real);
77 Status status() const;
80 translate the symbol. The symbol does not have to be created yet.
82 void translate(Offset);
85 void add_processing();
87 void pre_processing();
88 void breakable_col_processing();
89 void break_processing();
91 void post_processing();
92 void molecule_processing();
96 void substitute_dependency(Score_elem*,Score_elem*);
97 void remove_dependency(Score_elem*);
99 add a dependency. It may be the 0 pointer, in which case, it is ignored.
101 void add_dependency(Score_elem* );
102 void copy_dependencies(Score_elem const&);
104 junk the dependency array. Don't do derived stuff.
106 void junk_dependencies();
112 virtual Vertical_group * vertical_group() { return 0; }
113 virtual Horizontal_group * horizontal_group() { return 0; }
115 virtual Spanner* spanner() { return 0; }
116 virtual Horizontal_vertical_group* elem_group() { return 0; }
117 virtual Item * item() { return 0; }
118 virtual Line_of_score * line_l() const;
119 SCORE_ELEM_CLONE(Score_elem);
120 Score_elem* dependency(int) const;
121 Score_elem* dependent(int) const;
122 int dependent_size() const;
123 int dependency_size() const;
125 /// no dimension, translation is noop
127 /// do not print anything black
131 virtual Interval do_height()const;
132 virtual Interval do_width()const;
134 /// do printing of derived info.
135 virtual void do_print() const {}
136 /// generate the molecule
137 virtual Molecule* brew_molecule_p()const;
138 ///executed directly after the item is added to the PScore
139 virtual void do_add_processing();
140 /// do calculations before determining horizontal spacing
141 virtual void do_pre_processing();
143 virtual void do_breakable_col_processing();
144 /// do calculations after determining horizontal spacing
145 virtual void do_post_processing();
147 virtual void do_substitute_dependency(Score_elem * , Score_elem *);
148 virtual void do_substitute_dependent(Score_elem *, Score_elem *);
149 virtual void do_break_processing();
150 virtual void handle_broken_dependencies();
151 virtual void handle_prebroken_dependencies();
158 #endif // STAFFELEM_HH