]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/stem.hh
release: 0.1.15
[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 (Note_head*n);
79   void add (Rest*);
80
81   DECLARE_MY_RUNTIME_TYPEINFO;
82
83   Real hpos_f() const;
84   
85   int type_i () const;
86
87   void do_print() const;
88   void set_stemend (Real);
89   Direction get_default_dir();
90   int get_center_distance_from_top();
91   int get_center_distance_from_bottom();
92   void set_default_dir();
93   void set_default_stemlen();
94   void set_default_extents();
95   void set_noteheads();
96
97   Real stem_length_f() const;
98   Real stem_end_f() const;
99   Real stem_start_f() const;
100   Real note_delta_f () const;
101
102   bool invisible_b() const;
103     
104   /// heads that the stem encompasses (positions)
105   int max_head_i() const;
106   int min_head_i() const;
107 protected:
108   virtual void do_substitute_dependency (Score_elem*,Score_elem*);
109   virtual void do_pre_processing();
110   virtual Interval do_width() const;
111   Molecule* brew_molecule_p() const;
112 };
113 #endif