]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 0.1.16
[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   Drul_array<Real> yextent_drul_;
35     
36   /// needed for determining direction/length
37   int staff_size_i_;
38
39   /**extent of the stem (positions).
40     fractional, since Beam has to adapt them.
41     */
42
43
44   /**
45     geen gedonder, jij gaat onder.
46     -1 stem points down, +1: stem points up
47     */
48   Direction  stem_xdir_;
49
50   Link_array<Note_head> head_l_arr_;
51   Link_array<Rest> rest_l_arr_;
52     
53 public:
54   /// abbrev flag? + count
55   int abbrev_flag_i_;
56
57   /// how many abbrev beam don't reach stem?
58   int beam_gap_i_;
59
60   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
61   int flag_i_;
62
63   /** 
64     don't print flag when in beam.
65     our beam, for aligning abbrev flags
66    */
67   Beam* beam_l_;
68
69   int beams_left_i_;
70   int beams_right_i_;
71
72   Direction dir_;
73     
74   /* *************** */
75   Stem ();
76     
77   /// ensure that this Stem also encompasses the Notehead #n#
78   void add (Rhythmic_head*n);
79
80   DECLARE_MY_RUNTIME_TYPEINFO;
81
82   Real hpos_f() const;
83   
84   int type_i () const;
85
86   void do_print() const;
87   void set_stemend (Real);
88   Direction get_default_dir();
89   int get_center_distance_from_top();
90   int get_center_distance_from_bottom();
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_start_f() const;
99   Real note_delta_f () const;
100
101   bool invisible_b() const;
102     
103   /// heads that the stem encompasses (positions)
104   int max_head_i() const;
105   int min_head_i() const;
106 protected:
107   virtual void do_substitute_dependency (Score_elem*,Score_elem*);
108   virtual void do_pre_processing();
109   virtual Interval do_width() const;
110   Molecule* brew_molecule_p() const;
111 };
112 #endif