]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
12380ae48babc6c3a614a274f9a6fb326977e014
[lilypond.git] / lily / include / stem.hh
1 /*
2   stem.hh -- declare Stem
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef STEM_HH
8 #define STEM_HH
9 #include "item.hh"
10 #include "varray.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   Molecule abbrev_mol () const;
33     
34   Real stem_bottom_f_, stem_top_f_;
35     
36     
37   /// needed for determining direction/length
38   int staff_size_i_;
39
40   /**extent of the stem (positions).
41     fractional, since Beam has to adapt them.
42     */
43
44
45   /**
46     geen gedonder, jij gaat onder.
47     -1 stem points down, +1: stem points up
48     */
49   Real stem_xoffset_f_;
50   /**
51     store the wholes (for vapourware tremolo)
52     */
53   Link_array<Note_head> whole_l_arr_;
54   Link_array<Note_head> head_l_arr_;
55   Link_array<Note_head> rest_l_arr_;
56     
57 public:
58   /// abbrev flag? + count
59   int abbrev_flag_i_;
60
61   /// flagtype? 4 none, 8 8th flag, 0 = beam.
62   int flag_i_;
63
64   /** 
65     don't print flag when in beam.
66     our beam, for aligning abbrev flags
67    */
68   Beam* beam_l_;
69
70   int beams_left_i_;
71   int beams_right_i_;
72
73   Direction dir_;
74     
75   /* *************** */
76   Stem ();
77     
78   /// ensure that this Stem also encompasses the Notehead #n#
79   void add (Note_head*n);
80
81   DECLARE_MY_RUNTIME_TYPEINFO;
82
83   Real hpos_f() const;
84     
85   void do_print() const;
86   void set_stemend (Real);
87   Direction get_default_dir();
88   int get_center_distance_from_top();
89   int get_center_distance_from_bottom();
90   void set_default_dir();
91   void set_default_stemlen();
92   void set_default_extents();
93   void set_noteheads();
94
95   Real stem_length_f() const;
96   Real stem_end_f() const;
97   Real stem_start_f() const;
98
99   bool invisible_b() const;
100     
101   /// heads that the stem encompasses (positions)
102   int max_head_i() const;
103   int min_head_i() const;
104 protected:
105   virtual void do_substitute_dependency (Score_elem*,Score_elem*);
106   virtual void do_pre_processing();
107   virtual Interval do_width() const;
108   Molecule* brew_molecule_p() const;
109 };
110 #endif