]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/score-element.hh
release: 1.1.34
[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 #include "protected-scm.hh"
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 : public virtual Graphical_element {
28   Protected_scm element_property_alist_;
29   Link_array<Score_element> dependency_arr_;
30   
31 public:
32   /// delete after linebreak calculation.
33   bool break_helper_only_b_;
34   Paper_score *pscore_l_;    
35   Molecule * output_p_;
36   Score_element ();
37   Score_element (Score_element const&);
38   virtual void print () const;
39
40   SCM get_elt_property (SCM sym);
41   void set_elt_property (SCM sym, SCM val);
42   
43   Paper_def *paper () const;
44   Lookup const *lookup_l () const;
45
46   virtual ~Score_element ();
47   void add_processing ();
48
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   // ugh: no protection. Denk na, Vrij Veilig
64   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
65
66 public:
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   int status_i_;
76
77 protected:
78   Score_element* dependency (int) const;
79   int dependency_size () const;
80   
81   virtual void output_processing ();
82   virtual Interval do_height () const;
83   virtual Interval do_width () const;
84     
85   /// do printing of derived info.
86   virtual void do_print () const;
87   /// generate the molecule    
88   virtual Molecule* do_brew_molecule_p () const;
89   ///executed directly after the item is added to the Paper_score
90   virtual void do_add_processing ();
91   /// do calculations before determining horizontal spacing
92   virtual void do_pre_processing ();
93
94   /// generate rods & springs
95   virtual void do_space_processing ();
96
97   virtual void do_breakable_col_processing ();
98   /// do calculations after determining horizontal spacing
99   virtual void do_post_processing ();
100     
101   virtual void do_substitute_element_pointer (Score_element * , Score_element *);
102   virtual void do_break_processing ();
103   virtual void handle_broken_dependencies ();
104   virtual void handle_prebroken_dependencies ();
105   virtual void handle_prebroken_dependents ();
106   virtual Link_array<Score_element> get_extra_dependencies () const;
107 };
108
109
110 #endif // STAFFELEM_HH
111