]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/score-element.hh
release: 1.1.18
[lilypond.git] / lily / include / score-element.hh
1 /*
2   score-element.hh -- part of GNU LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef STAFFELEM_HH
8 #define STAFFELEM_HH
9
10 #include "parray.hh"
11 #include "virtual-methods.hh"
12 #include "directed-graph.hh"
13 #include "graphical-element.hh"
14
15
16
17 typedef void (Score_element::*Score_element_method_pointer) (void);
18
19 /** Both Spanner and Item are Score_element's. Most Score_element's depend
20   on other Score_element's, eg, Beam needs to know and set direction of
21   Stem. So the Beam has to be calculated *before* Stem. This is
22   accomplished with the dependencies fields of struct Score_element,
23   which are implemented in the Directed_graph_node class: all elements
24   form an acyclic graph.
25
26   (elem) */
27 class Score_element : private Directed_graph_node, public virtual Graphical_element {
28 public:
29   Paper_score *pscore_l_;    
30   Molecule * output_p_;
31   Score_element ();
32   Score_element (Score_element const&);
33   virtual void print () const;
34     
35   Paper_def *paper () const;
36   Lookup const *lookup_l () const;
37
38   virtual ~Score_element ();
39       
40
41   void add_processing ();
42
43   /**
44     Remove all  links (dependencies, dependents, Axis_group_elements.
45     */
46   void unlink ();
47   void substitute_dependency (Score_element*,Score_element*);
48   void remove_dependency (Score_element*);
49   /**
50     add a dependency. It may be the 0 pointer, in which case, it is ignored.
51     */
52   void add_dependency (Score_element*);    
53
54   virtual Line_of_score * line_l () const;
55   virtual bool linked_b () const;
56   VIRTUAL_COPY_CONS(Score_element);
57  
58   /// do not print anything black
59   bool transparent_b_;
60
61   int size_i_;
62   
63   // ugh: no protection. Denk na, Vrij Veilig
64   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
65
66 protected:
67   /**
68     Administration: Where are we?. This is mainly used by Super_element and
69     Score_element::calcalute_dependencies ()
70
71     0 means ORPHAN,
72     -1 means deleted
73     
74    */
75 public:
76   int status_i_;
77 protected:
78   Score_element* dependency (int) const;
79   Score_element* dependent (int) const;
80   int dependent_size () const;
81   int dependency_size () const;
82   
83   virtual void output_processing ();
84   void junk_links ();
85   virtual Interval do_height () const;
86   virtual Interval do_width () const;
87     
88   /// do printing of derived info.
89   virtual void do_print () const {}
90   /// generate the molecule    
91   virtual Molecule* do_brew_molecule_p () const;
92   ///executed directly after the item is added to the Paper_score
93   virtual void do_add_processing ();
94   /// do calculations before determining horizontal spacing
95   virtual void do_pre_processing ();
96
97   /// generate rods & springs
98   virtual void do_space_processing ();
99
100   virtual void do_breakable_col_processing ();
101   /// do calculations after determining horizontal spacing
102   virtual void do_post_processing ();
103     
104   virtual void do_substitute_dependency (Score_element * , Score_element *);
105   virtual void do_substitute_dependent (Score_element *, Score_element *);
106   virtual void do_break_processing ();
107   virtual void handle_broken_dependencies ();
108   virtual void handle_prebroken_dependencies ();
109   virtual Link_array<Score_element> get_extra_dependencies () const;
110   virtual void do_unlink ();
111   virtual void do_junk_links ();
112   
113 };
114
115
116 #endif // STAFFELEM_HH
117