]> git.donarmstrong.com Git - lilypond.git/blob - hdr/staffelem.hh
partial: 0.0.24.jcn
[lilypond.git] / hdr / staffelem.hh
1 /*
2   staffelem.hh -- part of LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef STAFFELEM_HH
8 #define STAFFELEM_HH
9 #include "varray.hh"
10 #include "proto.hh"
11 #include "offset.hh"
12 #include "molecule.hh"
13
14 struct Staff_elem {
15     enum Status {
16         ORPHAN,                 // not yet added to pstaff
17         VIRGIN,                 // added to pstaff
18         PRECALCED,              // calcs before spacing done
19         POSTCALCED,             // after spacing calcs done
20         OUTPUT,                 // molecule has been output
21     } status;
22     bool calc_children;
23     Array<Staff_elem*> dependencies;
24     
25     ///  the pstaff it is in
26     PStaff *pstaff_l_;
27
28     /****************/
29     Staff_elem(Staff_elem const&);
30     String TeXstring () const ;
31     virtual void print() const;
32     virtual Interval width() const;
33     virtual Interval height() const;
34     Paperdef *paper() const;
35     virtual ~Staff_elem();
36     Staff_elem();
37     
38     void translate(Offset);
39     void add_processing();
40     void pre_processing();
41     void post_processing();
42     void molecule_processing();
43     
44 protected:
45     /// generate the molecule    
46     virtual Molecule* brew_molecule()const=0;
47     ///executed directly after the item is added to the PScore
48     virtual void do_add_processing();
49     /// do calculations before determining horizontal spacing
50     virtual void do_pre_processing();
51
52     /// do calculations after determining horizontal spacing
53     virtual void do_post_processing();
54
55 private:
56     /// member: the symbols
57     Molecule *output;           // should scrap, and use temp var?
58
59     /// 
60     Offset offset_;
61     /**
62       This is  needed, because #output# may still be
63       NULL.
64       */
65 };
66 /** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend
67   on other Staff_elem's, eg, Beam needs to know and set direction of
68   Stem. So the Beam has to be calculated *before* Stem. This is
69   accomplished with the dependencies field of struct Staff_elem.
70
71   */
72 #endif // STAFFELEM_HH
73