]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
patch::: 1.3.9.hwn2
[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   Link_array<Note_head> head_l_arr_;
57   Link_array<Rest> rest_l_arr_;
58     
59   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
60   int flag_i_;
61
62   /** 
63     don't print flag when in beam.
64     our beam, for aligning abbrev flags
65    */
66   Beam* beam_l () 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
74   Real hpos_f () const;
75   Real chord_start_f () const;
76   
77   int type_i () const;
78
79   void do_print() const;
80   void set_stemend (Real);
81   Direction get_default_dir() const;
82
83   int get_center_distance(Direction) const;
84
85   void set_default_stemlen();
86   void set_default_extents();
87   void set_noteheads();
88
89   Real stem_length_f() const;
90   Real stem_end_f() const;
91   Real stem_begin_f() const;
92   Real note_delta_f () const;
93
94   bool invisible_b() const;
95     
96   /// heads that the stem encompasses (positions)
97   Interval_t<int> head_positions() const;
98
99 protected:
100   Molecule flag () const;
101   virtual void do_substitute_element_pointer (Score_element*,Score_element*);
102   virtual void do_pre_processing();
103   static Interval dim_callback (Dimension_cache const*);
104   virtual Molecule* do_brew_molecule_p() const;
105
106   void set_spacing_hints () ;
107 };
108 #endif