]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
768d07aaa75c311e71c229467b122fe6a115f417
[lilypond.git] / lily / include / beam.hh
1 /*
2   beam.hh -- part of GNU LilyPond
3
4   (c) 1996--2000 Han-Wen Nienhuys
5 */
6
7 #ifndef BEAM_HH
8 #define BEAM_HH
9
10 #include "lily-proto.hh"
11 #include "spanner.hh"
12
13
14 /** a beam connects multiple stems.
15
16   Beam adjusts the stems its owns to make sure that they reach the
17   beam and that point in the correct direction (urg?)
18
19    elt_properties:
20    y-position: real  (position of left edge)
21    height: real  (dy)
22
23    damping: amount of beam slope damping. (int)
24    should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams 
25 */
26 class Beam : public Spanner
27 {
28 public:
29
30   int stem_count () const;
31   Stem* stem (int) const;
32   Stem* stem_top () const;
33   int visible_stem_count () const;
34   Stem* first_visible_stem () const;
35   Stem* last_visible_stem () const;
36
37   Beam ();
38   void add_stem (Stem*);
39   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
40   void set_beaming (Beaming_info_list *);
41   void set_stemlens ();
42   VIRTUAL_COPY_CONS(Score_element);
43
44   int get_multiplicity () const;
45
46 protected:
47  
48   virtual void before_line_breaking ();
49   virtual void after_line_breaking ();
50   virtual Molecule do_brew_molecule () const;
51
52   Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
53 private:
54   Direction get_default_dir () const;
55   void set_stem_directions ();
56   void auto_knees ();
57   bool auto_knee (String gap_str, bool interstaff_b);
58   void set_stem_shorten ();
59   void calc_default_position_and_height (Real* y, Real* dy) const;
60   bool suspect_slope_b (Real y, Real dy) const;
61   Real calc_slope_damping_f (Real dy) const;
62   Real calc_stem_y_f (Stem* s, Real y, Real dy) const;
63   Real check_stem_length_f (Real y, Real dy) const;
64   void set_stem_length (Real y, Real dy);
65   Real quantise_dy_f (Real dy) const;
66   Real quantise_y_f (Real y, Real dy, int quant_dir);
67   int forced_stem_count () const;
68 };
69
70 #endif // BEAM_HH
71