]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 1.3.10
[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 #include "directional-element.hh"
15
16 /**the rule attached to the ball.
17   takes care of:
18
19   \begin{itemize}
20   \item the rule
21   \item the flag
22   \item up/down position.
23   \end{itemize}
24
25   should move beam_{left, right} into Beam
26
27   TODO.
28   
29   Stem size depends on flag.
30
31   elt properties:
32
33   beam_dir: direction of the beam (int)
34
35   dir_force: is direction explicitely specified? (bool)
36
37   /// how many abbrev beam don't reach stem?
38   int beam_gap_i_;
39
40
41   
42   */
43 // todo: remove baseclass Staff_symbol_referencer, since stem
44 // can be across a staff.
45 class Stem : public Item, public Staff_symbol_referencer,
46              public Directional_element
47 {
48
49   /**extent of the stem (positions).
50     fractional, since Beam has to adapt them.
51     */
52   Drul_array<Real> yextent_drul_;
53
54 public:
55
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 () const;
65   Note_head * first_head () const;
66
67   Drul_array<int> beams_i_drul_;
68   Stem ();
69     
70   /// ensure that this Stem also encompasses the Notehead #n#
71   void add_head (Rhythmic_head*n);
72
73   Real hpos_f () const;
74   Real chord_start_f () const;
75   
76   int type_i () const;
77
78   void do_print() const;
79   void set_stemend (Real);
80   Direction get_default_dir() const;
81
82   int get_center_distance(Direction) const;
83
84   void set_default_stemlen();
85   void set_default_extents();
86   void set_noteheads();
87
88   Real stem_length_f() const;
89   Real stem_end_f() const;
90   Real stem_begin_f() const;
91   Real note_delta_f () const;
92
93   bool invisible_b() const;
94     
95   /// heads that the stem encompasses (positions)
96   Interval_t<int> head_positions() const;
97
98 protected:
99   Molecule flag () const;
100
101   virtual void do_pre_processing();
102   static Interval dim_callback (Dimension_cache const*);
103   virtual Molecule* do_brew_molecule_p() const;
104
105   void set_spacing_hints () ;
106 };
107 #endif