]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 1.1.36
[lilypond.git] / lily / include / stem.hh
1 /*
2   stem.hh -- declare Stem
3
4   (c) 1996--1999 Han-Wen Nienhuys
5 */
6
7 #ifndef STEM_HH
8 #define STEM_HH
9 #include "item.hh"
10 #include "array.hh"
11 #include "moment.hh"
12 #include "molecule.hh"
13 #include "staff-symbol-referencer.hh"
14
15 /**the rule attached to the ball.
16   takes care of:
17
18   \begin{itemize}
19   \item the rule
20   \item the flag
21   \item up/down position.
22   \end{itemize}
23
24   should move beam_{left, right} into Beam
25
26   TODO.
27   
28   Stem size depends on flag.
29
30   elt properties:
31
32   beam_dir: direction of the beam (int)
33
34   dir_force: is direction explicitely specified? (bool)
35
36   */
37 // todo: remove baseclass Staff_symbol_referencer, since stem
38 // can be across a staff.
39 class Stem : public Item, public Staff_symbol_referencer {
40
41   /**extent of the stem (positions).
42     fractional, since Beam has to adapt them.
43     */
44   Drul_array<Real> yextent_drul_;
45
46   /**
47     geen gedonder, jij gaat onder.
48     -1 stem points down, +1: stem points up
49     */
50   Direction  stem_xdir_;
51
52   Link_array<Note_head> head_l_arr_;
53   Link_array<Rest> rest_l_arr_;
54     
55 public:
56   /// how many abbrev beam don't reach stem?
57   int beam_gap_i_;
58
59   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
60   int flag_i_;
61
62   /** 
63     don't print flag when in beam.
64     our beam, for aligning abbrev flags
65    */
66   Beam* beam_l_;
67
68   Drul_array<int> beams_i_drul_;
69
70   /// maximum number of beams
71   int mult_i_;
72
73   /// direction stem (that's me)
74   Direction dir_;
75
76
77   Stem ();
78     
79   /// ensure that this Stem also encompasses the Notehead #n#
80   void add_head (Rhythmic_head*n);
81
82   
83
84   Real hpos_f () const;
85   Real chord_start_f () const;
86   
87   int type_i () const;
88
89   void do_print() const;
90   void set_stemend (Real);
91   Direction get_default_dir() const;
92   Direction get_dir () const;
93
94   int get_center_distance(Direction) const;
95   void set_default_dir();
96   void set_default_stemlen();
97   void set_default_extents();
98   void set_noteheads();
99
100   Real stem_length_f() const;
101   Real stem_end_f() const;
102   Real stem_begin_f() const;
103   Real note_delta_f () const;
104
105   bool invisible_b() const;
106     
107   /// heads that the stem encompasses (positions)
108   Interval_t<int> head_positions() const;
109   virtual ~Stem ();
110 protected:
111   virtual void do_substitute_element_pointer (Score_element*,Score_element*);
112   virtual void do_pre_processing();
113   virtual Interval do_width() const;
114   virtual Molecule* do_brew_molecule_p() const;
115 };
116 #endif