2 beam.hh -- part of GNU LilyPond
4 (c) 1996--2000 Han-Wen Nienhuys
10 #include "lily-proto.hh"
11 #include "lily-guile.hh"
15 /** a beam connects multiple stems.
17 Beam adjusts the stems its owns to make sure that they reach the
18 beam and that point in the correct direction (urg?)
22 y-position -- real (position of left edge)
30 flag-width-function --
32 damping -- amount of beam slope damping. (int)
33 should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
35 default-neutral-direction -- which direction to choose if we're in
36 the middle of the staff
38 thickness -- weight of beams, in staffspace
40 space-function -- function of type multiplicity -> real (in staffspace)
42 beamed-stem-shorten --
46 vertical-position-quant-function --
50 damping -- damping factor (real).
52 outer-stem-length-limit -- catch suspect beam slopes, set slope to zero if
53 outer stem is lengthened more than this (in staffspace)
55 slope-limit -- set slope to zero if slope is running away steeper than this.
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));
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);
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*);