]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
release: 1.0.1
[lilypond.git] / lily / include / beam.hh
1 /*
2   beam.hh -- part of GNU LilyPond
3
4   (c) 1996--1998 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   enum Dir_algorithm { /* DOWN=-1, UP=1, */ MAJORITY=2, MEAN, MEDIAN };
25
26   Link_array<Stem> stems_;
27   /// the slope of the beam in posns / point (dimension)   
28   Real slope_f_;
29   /// the slope as solved; not quantised or damped
30   Real solved_slope_f_;
31
32   /// position of leftmost end of beam  
33   Real left_y_;
34   /// should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
35   int damping_i_;
36   /// should beam pos / slope be quantised? 0: no, 1: yes, 2: traditional
37   Quantisation quantisation_;
38   /// maximum number of beams (for opening-up of beam-spacing)
39   int multiple_i_;
40
41
42   DECLARE_MY_RUNTIME_TYPEINFO;
43   Beam();
44   void add_stem (Stem*);
45
46   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
47   void set_stemlens ();
48   SCORE_ELEMENT_CLONE (Beam);
49
50 protected:
51   virtual Interval do_width () const;    
52   Offset center () const;
53   void set_default_dir ();
54   virtual void do_pre_processing ();
55   virtual void do_post_processing ();
56   virtual void do_substitute_dependent (Score_element*, Score_element*);
57
58   virtual void do_print() const;
59
60   virtual void quantise_left_y (bool extend_b);
61   virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
62   virtual void solve_slope ();
63   virtual void quantise_dy ();
64   virtual Molecule*brew_molecule_p () const;
65 };
66
67 #endif // BEAM_HH
68