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);
79 translate the symbol. The symbol does not have to be created yet.
81 void translate(Offset);
84 void add_processing();
86 void pre_processing();
87 void breakable_col_processing();
88 void break_processing();
90 void post_processing();
91 void molecule_processing();
95 void remove_dependency(Score_elem*);
97 add a dependency. It may be the 0 pointer, in which case, it is ignored.
99 void add_dependency(Score_elem* );
102 virtual Spanner* spanner() { return 0; }
103 virtual Horizontal_vertical_group* elem_group() { return 0; }
104 virtual Item * item() { return 0; }
105 virtual Line_of_score * line_l() const;
106 SCORE_ELEM_CLONE(Score_elem);
109 virtual Interval do_height()const;
110 virtual Interval do_width()const;
112 /// do printing of derived info.
113 virtual void do_print() const {}
114 /// generate the molecule
115 virtual Molecule* brew_molecule_p()const;
116 ///executed directly after the item is added to the PScore
117 virtual void do_add_processing();
118 /// do calculations before determining horizontal spacing
119 virtual void do_pre_processing();
121 virtual void do_breakable_col_processing();
122 /// do calculations after determining horizontal spacing
123 virtual void do_post_processing();
125 virtual void do_substitute_dependency(Score_elem * , Score_elem *);
126 virtual void do_break_processing();
127 virtual void handle_broken_dependencies();
128 virtual void handle_prebroken_dependencies();
130 Score_elem* dependency(int) const;
131 Score_elem* dependent(int) const;
132 int dependent_size() const;
133 int dependency_size() const;
136 /// no dimension, translation is noop
138 /// do not print anything black
143 #endif // STAFFELEM_HH