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