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 int x_group_element_i_;
62 int y_group_element_i_;
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();
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* );
104 virtual Spanner* spanner() { return 0; }
105 virtual Horizontal_vertical_group* elem_group() { return 0; }
106 virtual Item * item() { return 0; }
107 virtual Line_of_score * line_l() const;
108 SCORE_ELEM_CLONE(Score_elem);
109 Score_elem* dependency(int) const;
110 Score_elem* dependent(int) const;
111 int dependent_size() const;
112 int dependency_size() const;
114 /// no dimension, translation is noop
116 /// do not print anything black
120 virtual Interval do_height()const;
121 virtual Interval do_width()const;
123 /// do printing of derived info.
124 virtual void do_print() const {}
125 /// generate the molecule
126 virtual Molecule* brew_molecule_p()const;
127 ///executed directly after the item is added to the PScore
128 virtual void do_add_processing();
129 /// do calculations before determining horizontal spacing
130 virtual void do_pre_processing();
132 virtual void do_breakable_col_processing();
133 /// do calculations after determining horizontal spacing
134 virtual void do_post_processing();
136 virtual void do_substitute_dependency(Score_elem * , Score_elem *);
137 virtual void do_substitute_dependent(Score_elem *, Score_elem *);
138 virtual void do_break_processing();
139 virtual void handle_broken_dependencies();
140 virtual void handle_prebroken_dependencies();
147 #endif // STAFFELEM_HH