]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 0.1.47
[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     
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
54   /// how many abbrev beam don't reach stem?
55   int beam_gap_i_;
56
57   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
58   int flag_i_;
59
60   /** 
61     don't print flag when in beam.
62     our beam, for aligning abbrev flags
63    */
64   Beam* beam_l_;
65
66   int beams_left_i_;
67   int beams_right_i_;
68
69   Direction dir_;
70     
71   /* *************** */
72   Stem ();
73     
74   /// ensure that this Stem also encompasses the Notehead #n#
75   void add (Rhythmic_head*n);
76
77   DECLARE_MY_RUNTIME_TYPEINFO;
78
79   Real hpos_f () const;
80   Real chord_start_f () const;
81   
82   int type_i () const;
83
84   void do_print() const;
85   void set_stemend (Real);
86   Direction get_default_dir();
87   Direction get_dir ();
88
89   int get_center_distance(Direction);
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_begin_f() const;
98   Real note_delta_f () const;
99
100   bool invisible_b() const;
101     
102   /// heads that the stem encompasses (positions)
103   Interval_t<int> head_positions() 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