]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
release: 1.3.1
[lilypond.git] / lily / include / beam.hh
1 /*
2   beam.hh -- part of GNU LilyPond
3
4   (c) 1996--1999 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
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
20 elt property:
21
22 damping: amount of beam slope damping. (int)
23
24 should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams 
25
26 slope_quantisation: 'none, 'normal or 'traditional
27
28 */
29 class Beam : public Directional_spanner  {
30 public:
31   /** 
32     The beams should be prevented to conflict with the stafflines, 
33     especially at small slopes.
34     */
35   enum Quantisation { NONE, NORMAL, TRADITIONAL };
36   enum Dir_algorithm { /* DOWN=-1, UP=1, */ MAJORITY=2, MEAN, MEDIAN };
37
38   Link_array<Stem> stems_;
39   /**
40      the slope of the beam in (staffpositions) per (X-dimension, in PT).
41      UGH. standardise this for once and for all.
42    */
43   Real slope_f_;
44
45   /// position of leftmost end of beam  
46   Real left_y_;
47
48
49   /// maximum number of beams (for opening-up of beam-spacing)
50   int multiple_i_;
51
52   Array<Stem_info> sinfo_;
53   
54   Beam();
55   void add_stem (Stem*);
56   Stem_info get_stem_info (Stem*);
57
58   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
59   void set_beaming (Beaming_info_list *);
60   void set_stemlens ();
61   VIRTUAL_COPY_CONS(Score_element);
62
63 protected:
64   virtual Interval do_width () const;    
65   Offset center () const;
66   Direction get_default_dir () const;
67   void set_direction (Direction);
68   void set_steminfo ();
69   bool auto_knee (SCM gap, bool interstaff_b);
70   bool auto_knees ();
71   
72   virtual void do_pre_processing ();
73   virtual void do_post_processing ();
74   virtual void do_substitute_element_pointer (Score_element*, Score_element*);
75   virtual void do_add_processing ();
76   virtual void do_print() const;
77   virtual Molecule*do_brew_molecule_p () const;
78
79   Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
80
81 private:
82   void calculate_slope ();
83   Real check_stemlengths_f (bool set_b);
84   void solve_slope ();
85
86   void quantise_left_y (bool extend_b);
87   void quantise_dy ();
88
89 };
90
91 #endif // BEAM_HH
92