]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/spacing-spanner.hh
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[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 #include "grob-interface.hh"
17
18 struct Spacing_options
19 {
20   bool packed_;
21   bool stretch_uniformly_;
22   bool float_nonmusical_columns_;
23   bool float_grace_columns_;
24   Rational global_shortest_;
25   Real increment_;
26   Real shortest_duration_space_;
27
28   Spacing_options();
29   void init_from_grob (Grob *me);
30   Real get_duration_space (Rational d, bool *) const;
31 };
32
33 /*
34   TODO: prune to public interface.
35 */
36 class Spacing_spanner
37 {
38 public:
39   static void generate_pair_spacing (Grob *me,
40                                      Paper_column *l, Paper_column *r,
41                                      Paper_column *nextr,
42                                      Spacing_options const *options);
43   static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
44                                                  Real *fixed, Real *space,
45                                                  Spacing_options const *);
46   static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
47   static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
48   static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
49   static Rational effective_shortest_duration (Grob *me, vector<Grob*> const &all);
50   static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
51   static void prune_loose_columns (Grob *, vector<Grob*> *cols, Spacing_options const *);
52   static void set_explicit_neighbor_columns (vector<Grob*> const &cols);
53   static void set_implicit_neighbor_columns (vector<Grob*> const &cols);
54   static void generate_springs (Grob *me, vector<Grob*> const &cols, Spacing_options const *);
55   static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
56   static vector<Grob*> get_columns (Spanner *me);
57
58   DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
59   DECLARE_SCHEME_CALLBACK (calc_common_shortest_duration, (SCM));
60   DECLARE_GROB_INTERFACE();
61 };
62
63 #endif /* SPACING_SPANNER_HH */