]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
11bc3d37040ac3b5f568688e31dc36cccada382f
[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 "lily-guile.hh"
12
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 (urg?)
19
20    elt_properties:
21    
22    y-position -- real  (position of left edge)
23
24    height -- real  (dy)
25
26
27    Read-only
28    =========
29    
30    flag-width-function --
31
32    damping -- amount of beam slope damping. (int)
33      should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams 
34
35    default-neutral-direction -- which direction to choose if we're in
36      the middle of the staff
37    
38    thickness -- weight of beams, in staffspace
39
40    space-function -- function of type multiplicity -> real (in staffspace)
41
42    beamed-stem-shorten --
43
44    height-quants --
45
46    vertical-position-quant-function --
47
48    dir-function --
49    
50    damping -- damping factor (real).
51
52    outer-stem-length-limit -- catch suspect beam slopes, set slope to zero if
53      outer stem is lengthened more than this (in staffspace)
54
55    slope-limit -- set slope to zero if slope is running away steeper than this.
56 */
57 class Beam
58 {
59 public:
60   static int visible_stem_count (Score_element*);
61   static  Item* first_visible_stem (Score_element*);
62   static  Item* last_visible_stem (Score_element*);
63   static bool has_interface (Score_element*);
64   static void set_interface (Score_element*);  
65   DECLARE_SCHEME_CALLBACK(rest_collision_callback, (SCM element, SCM axis));
66   Beam (SCM);
67   static void add_stem (Score_element*,Score_element*);
68   static void set_beaming (Score_element*,Beaming_info_list *);
69   static void set_stemlens (Score_element*);
70   static int get_multiplicity (Score_element*me);
71   DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
72   DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
73   DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
74   static Molecule stem_beams (Score_element*,Item *here, Item *next, Item *prev);
75
76 private:
77   static Direction get_default_dir (Score_element*);
78   static  void set_stem_directions (Score_element*);
79   static  void auto_knees (Score_element*);
80   static  bool auto_knee (Score_element*,String gap_str, bool interstaff_b);
81   static void set_stem_shorten (Score_element*);
82   static  void calc_default_position_and_height (Score_element*,Real* y, Real* dy);
83   static  bool suspect_slope_b (Score_element*, Real y, Real dy);
84   static  Real calc_slope_damping_f (Score_element*, Real dy);
85   static  Real calc_stem_y_f (Score_element*, Item* s, Real y, Real dy);
86   static  Real check_stem_length_f (Score_element*, Real y, Real dy);
87   static  void set_stem_length (Score_element*, Real y, Real dy);
88   static   Real quantise_dy_f (Score_element*, Real dy);
89   static  Real quantise_y_f (Score_element*, Real y, Real dy, int quant_dir);
90   static int forced_stem_count (Score_element*);
91 };
92
93 #endif // BEAM_HH
94