]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beam.hh
* flower
[lilypond.git] / lily / include / beam.hh
1 /*
2   beam.hh -- part of GNU LilyPond
3
4   source file of the LilyPond music typesetter
5
6   (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   Jan Nieuwenhuizen <janneke@gnu.org>
8 */
9
10 #ifndef BEAM_HH
11 #define BEAM_HH
12
13 #include "lily-proto.hh"
14 #include "lily-guile.hh"
15 #include "stem-info.hh"
16
17 class Beam
18 {
19 public:
20   static int visible_stem_count (Grob *);
21   static Grob *first_visible_stem (Grob *);
22   static Grob *last_visible_stem (Grob *);
23   static bool has_interface (Grob *);
24   DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM axis));
25   Beam (SCM);
26   static void add_stem (Grob *, Grob *);
27   static bool is_knee (Grob *);
28   static void set_beaming (Grob *, Beaming_info_list *);
29   static void set_stemlens (Grob *);
30   static int get_beam_count (Grob *me);
31   static void position_beam (Grob *me);
32   static Real get_beam_translation (Grob *me);
33   static Real get_thickness (Grob *me);
34
35   static void connect_beams (Grob *me);
36   DECLARE_SCHEME_CALLBACK (space_function, (SCM, SCM));
37   DECLARE_SCHEME_CALLBACK (print, (SCM));
38   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
39   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
40
41   /* position callbacks */
42   DECLARE_SCHEME_CALLBACK (least_squares, (SCM));
43   DECLARE_SCHEME_CALLBACK (check_concave, (SCM));
44   DECLARE_SCHEME_CALLBACK (slope_damping, (SCM));
45   DECLARE_SCHEME_CALLBACK (shift_region_to_valid, (SCM));
46   DECLARE_SCHEME_CALLBACK (quanting, (SCM));
47   static Real score_slopes_dy (Real, Real, Real, Real, Real, bool);
48
49   static Real score_stem_lengths (Link_array<Grob> const &stems,
50                                   Array<Stem_info> const &stem_infos,
51                                   Array<Real> const &base_stem_ys,
52                                   Array<Real> const &stem_xs,
53                                   Real xl, Real xr,
54                                   bool knee,
55                                   Real yl, Real yr);
56   static Real score_forbidden_quants (Real, Real,
57                                       Real, Real, Real, Real,
58                                       Drul_array<int>, Direction, Direction);
59
60   static int get_direction_beam_count (Grob *me, Direction d);
61 private:
62   static Direction get_default_dir (Grob *);
63   static void set_stem_directions (Grob *, Direction);
64   static void consider_auto_knees (Grob *);
65   static void set_stem_shorten (Grob *);
66   static Real calc_stem_y (Grob *, Grob *s, Grob **c,
67                            Real, Real,
68                            Drul_array<Real> pos, bool french);
69   static void set_stem_lengths (Grob *);
70   static int forced_stem_count (Grob *);
71 };
72
73 const int REGION_SIZE = 2;
74
75 #ifndef NDEBUG
76 #define DEBUG_QUANTING 1
77 #endif
78
79 #endif /* BEAM_HH */
80