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