]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/spacing-spanner.hh
f39ea98bc30726fd2042cd670c1bf9e2f65f5bdb
[lilypond.git] / lily / include / spacing-spanner.hh
1 /*
2   spacing-spanner.hh -- declare Spacing spanner
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef SPACING_SPANNER_HH
10 #define SPACING_SPANNER_HH
11
12 #include "lily-proto.hh"
13 #include "lily-guile.hh"
14 #include "rational.hh"
15 #include "std-vector.hh"
16
17 struct Spacing_options
18 {
19   bool packed_;
20   bool stretch_uniformly_;
21   bool float_nonmusical_columns_;
22   bool float_grace_columns_;
23   Rational global_shortest_;
24   Real increment_;
25   Real shortest_duration_space_;
26
27   Spacing_options();
28   void init_from_grob (Grob *me);
29   Real get_duration_space (Rational d, bool *) const;
30 };
31
32 /*
33   TODO: prune to public interface.
34 */
35 class Spacing_spanner
36 {
37 public:
38   static void generate_pair_spacing (Grob *me,
39                                      Paper_column *l, Paper_column *r,
40                                      Paper_column *nextr,
41                                      Spacing_options const *options);
42   static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
43                                                  Real *fixed, Real *space,
44                                                  Spacing_options const *);
45   static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
46   static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
47   static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
48   static Rational effective_shortest_duration (Grob *me, vector<Grob*> const &all);
49   static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
50   static void prune_loose_columns (Grob *, vector<Grob*> *cols, Spacing_options const *);
51   static void set_explicit_neighbor_columns (vector<Grob*> const &cols);
52   static void set_implicit_neighbor_columns (vector<Grob*> const &cols);
53   static void generate_springs (Grob *me, vector<Grob*> const &cols, Spacing_options const *);
54   static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
55   static vector<Grob*> get_columns (Spanner *me);
56
57   DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
58   DECLARE_SCHEME_CALLBACK (calc_common_shortest_duration, (SCM));
59   static bool has_interface (Grob *);
60 };
61
62 #endif /* SPACING_SPANNER_HH */