]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
e4bad88c1caee13781d2ac97578eff4037ad654c
[lilypond.git] / lily / include / beam.hh
1 /*
2   beam.hh -- part of GNU LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef BEAM_HH
8 #define BEAM_HH
9 #include "lily-proto.hh"
10 #include "directional-spanner.hh"
11 #include "plist.hh"
12
13 /** a beam connects multiple stems.
14
15   Beam adjusts the stems its owns to make sure that they reach the
16   beam and that point in the correct direction */
17 class Beam:  public Directional_spanner {
18 public:
19   /** 
20     The beams should be prevented to conflict with the stafflines, 
21     especially at small slopes.
22     */
23   enum Quantisation { NONE, NORMAL, TRADITIONAL, TEST };
24
25   Link_array<Stem> stems_;
26   /// the slope of the beam in posns / point (dimension)   
27   Real slope_f_;
28   /// the slope as solved; not quantised or damped
29   Real solved_slope_f_;
30
31   /// position of leftmost end of beam  
32   Real left_y_;
33   /// should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
34   int damping_i_;
35   /// should beam pos / slope be quantised? 0: no, 1: yes, 2: traditional
36   Quantisation quantisation_;
37   /// maximum number of beams (for opening-up of beam-spacing)
38   int multiple_i_;
39
40
41   DECLARE_MY_RUNTIME_TYPEINFO;
42   Beam();
43   void add (Stem*);
44
45   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
46   void set_stemlens ();
47   SCORE_ELEM_CLONE (Beam);
48
49 protected:
50   virtual Interval do_width () const;    
51   Offset center () const;
52   void set_default_dir ();
53   virtual void do_pre_processing ();
54   virtual void do_post_processing ();
55   virtual void do_substitute_dependent (Score_elem*, Score_elem*);
56
57   virtual void do_print() const;
58
59   virtual void quantise_left_y (bool extend_b);
60   virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
61   virtual void solve_slope ();
62   virtual void quantise_dy ();
63   virtual Molecule*brew_molecule_p () const;
64 };
65
66 #endif // BEAM_HH
67