]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
patch::: 1.1.20.jcn1: patsje
[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
10 #include "lily-proto.hh"
11 #include "directional-spanner.hh"
12 #include "stem-info.hh"
13 #include "plist.hh"
14
15 /** a beam connects multiple stems.
16
17   Beam adjusts the stems its owns to make sure that they reach the
18   beam and that point in the correct direction */
19 class Beam:  public Directional_spanner {
20 public:
21   /** 
22     The beams should be prevented to conflict with the stafflines, 
23     especially at small slopes.
24     */
25   enum Quantisation { NONE, NORMAL, TRADITIONAL, TEST };
26   enum Dir_algorithm { /* DOWN=-1, UP=1, */ MAJORITY=2, MEAN, MEDIAN };
27
28   Link_array<Stem> stems_;
29   /// the slope of the beam in posns / point (dimension)   
30   Real slope_f_;
31   /// the slope as solved; not quantised or damped
32   Real solved_slope_f_;
33
34   /// position of leftmost end of beam  
35   Real left_y_;
36   /// should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
37   int damping_i_;
38   /// should beam pos / slope be quantised? 0: no, 1: yes, 2: traditional
39   Quantisation quantisation_;
40   /// maximum number of beams (for opening-up of beam-spacing)
41   int multiple_i_;
42
43   /// vertical align distance between staffs
44   Drul_array<Real> vertical_align_drul_;
45
46   Array<Stem_info> sinfo_;
47   
48   Beam();
49   void add_stem (Stem*);
50
51   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
52   void set_stemlens ();
53   VIRTUAL_COPY_CONS(Score_element);
54
55 protected:
56   virtual Interval do_width () const;    
57   Offset center () const;
58   void set_default_dir ();
59   void set_steminfo ();
60   virtual void do_pre_processing ();
61   virtual void do_post_processing ();
62   virtual void do_substitute_dependent (Score_element*, Score_element*);
63
64   virtual void do_print() const;
65
66   virtual void quantise_left_y (bool extend_b);
67   virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
68   virtual void calculate_slope ();
69   virtual Real check_stemlengths_f (bool set_b);
70   virtual void solve_slope ();
71   virtual void quantise_dy ();
72   virtual Molecule*do_brew_molecule_p () const;
73 };
74
75 #endif // BEAM_HH
76