]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 1.1.35
[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 class Stem : public Item, public Staff_symbol_referencer {
31   Drul_array<Real> yextent_drul_;
32
33   /**extent of the stem (positions).
34     fractional, since Beam has to adapt them.
35     */
36
37
38   /**
39     geen gedonder, jij gaat onder.
40     -1 stem points down, +1: stem points up
41     */
42   Direction  stem_xdir_;
43
44   Link_array<Note_head> head_l_arr_;
45   Link_array<Rest> rest_l_arr_;
46     
47 public:
48   /// how many abbrev beam don't reach stem?
49   int beam_gap_i_;
50
51   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
52   int flag_i_;
53
54   /** 
55     don't print flag when in beam.
56     our beam, for aligning abbrev flags
57    */
58   Beam* beam_l_;
59
60   Drul_array<int> beams_i_drul_;
61
62   /// maximum number of beams
63   int mult_i_;
64
65   /// direction stem (that's me)
66   Direction dir_;
67
68   /// is direction explicitely specified?
69   bool dir_forced_b_;
70
71   /// direction of the beam
72   Direction beam_dir_;
73   Stem ();
74     
75   /// ensure that this Stem also encompasses the Notehead #n#
76   void add_head (Rhythmic_head*n);
77
78   
79
80   Real hpos_f () const;
81   Real chord_start_f () const;
82   
83   int type_i () const;
84
85   void do_print() const;
86   void set_stemend (Real);
87   Direction get_default_dir() const;
88   Direction get_dir () const;
89
90   int get_center_distance(Direction) const;
91   void set_default_dir();
92   void set_default_stemlen();
93   void set_default_extents();
94   void set_noteheads();
95
96   Real stem_length_f() const;
97   Real stem_end_f() const;
98   Real stem_begin_f() const;
99   Real note_delta_f () const;
100
101   bool invisible_b() const;
102     
103   /// heads that the stem encompasses (positions)
104   Interval_t<int> head_positions() const;
105   virtual ~Stem ();
106 protected:
107   virtual void do_substitute_element_pointer (Score_element*,Score_element*);
108   virtual void do_pre_processing();
109   virtual Interval do_width() const;
110   virtual Molecule* do_brew_molecule_p() const;
111 };
112 #endif