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