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