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