]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/score-element.hh
release: 1.1.35
[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 #include "lily-guile.hh"
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
29
30 Element Properties:
31
32 Boolean (true iff defined)
33
34  break_helper_only -- if defined try to junk this after calcing breakpoints.
35
36  transparent -- do not calc. output
37
38 */
39 class Score_element : public virtual Graphical_element {
40   Protected_scm element_property_alist_;
41   Link_array<Score_element> dependency_arr_;
42   Lookup * lookup_l_;
43 public:
44   Score_element *original_l_;
45
46   /**
47     Administration: Where are we?. This is mainly used by Super_element and
48     Score_element::calcalute_dependencies ()
49
50     0 means ORPHAN,
51     -1 means deleted
52     
53    */
54   int status_i_;
55
56   Paper_score *pscore_l_;
57   Molecule * output_p_;
58   Score_element ();
59   Score_element (Score_element const&);
60   virtual void print () const;
61
62   /*
63     properties
64    */
65   SCM get_elt_property (SCM sym) const;
66   void set_elt_property (SCM sym, SCM val);
67   SCM remove_elt_property (SCM key);
68
69   /*
70     related classes.
71    */
72   Paper_def *paper_l () const;
73   Lookup const *lookup_l () const;
74
75   virtual ~Score_element ();
76   void add_processing ();
77
78   void substitute_dependency (Score_element*,Score_element*);
79   void remove_dependency (Score_element*);
80   /**
81     add a dependency. It may be the 0 pointer, in which case, it is ignored.
82     */
83   void add_dependency (Score_element*);    
84   virtual Line_of_score * line_l () const;
85   bool linked_b () const;
86   VIRTUAL_COPY_CONS(Score_element);
87  
88   // ugh: no protection. Denk na, Vrij Veilig
89   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
90
91 protected:
92   Score_element* dependency (int) const;
93   int dependency_size () const;
94   
95   virtual void output_processing ();
96   virtual Interval do_height () const;
97   virtual Interval do_width () const;
98     
99   /// do printing of derived info.
100   virtual void do_print () const;
101   /// generate the molecule    
102   virtual Molecule* do_brew_molecule_p () const;
103   ///executed directly after the item is added to the Paper_score
104   virtual void do_add_processing ();
105   /// do calculations before determining horizontal spacing
106   virtual void do_pre_processing ();
107
108   /// generate rods & springs
109   virtual void do_space_processing ();
110
111   virtual void do_breakable_col_processing ();
112   /// do calculations after determining horizontal spacing
113   virtual void do_post_processing ();
114     
115   virtual void do_substitute_element_pointer (Score_element * , Score_element *);
116   virtual void do_break_processing ();
117   virtual void handle_broken_dependencies ();
118   virtual void handle_prebroken_dependencies ();
119   virtual void handle_prebroken_dependents ();
120   virtual Link_array<Score_element> get_extra_dependencies () const;
121
122   static Interval dim_cache_callback (Dimension_cache*);
123 };
124
125
126 #endif // STAFFELEM_HH
127