]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/simple-spacer.hh
* The grand 2005-2006 replace.
[lilypond.git] / lily / include / simple-spacer.hh
1 /*
2   simple-spacer.hh -- declare Simple_spacer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1999--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef SIMPLE_SPACER_HH
10 #define SIMPLE_SPACER_HH
11
12 #include "parray.hh"
13 #include "lily-proto.hh"
14 #include "smobs.hh"
15
16 struct Spring_description
17 {
18   Real ideal_;
19   Real inverse_hooke_;
20   bool is_active_;
21   Real block_force_;
22
23   Real length (Real force) const;
24   Spring_description ();
25
26   bool is_sane () const;
27 };
28
29 class Simple_spacer
30 {
31 public:
32   Array<Spring_description> springs_;
33   Real force_;
34   Real indent_;
35   Real line_len_;
36   Real default_space_;
37   int active_count_;
38
39   Simple_spacer ();
40
41   void my_solve_linelen ();
42   void my_solve_natural_len ();
43   Real active_springs_stiffness () const;
44   Real range_stiffness (int, int) const;
45   void add_rod (int l, int r, Real dist);
46   void add_spring (Real, Real);
47   Real range_ideal_len (int l, int r) const;
48   Real active_blocking_force ()const;
49   Real configuration_length ()const;
50   void set_active_states ();
51   bool is_active () const;
52
53   DECLARE_SIMPLE_SMOBS (Simple_spacer,);
54 };
55
56 struct Simple_spacer_wrapper
57 {
58   Simple_spacer *spacer_;
59   Link_array<Grob> spaced_cols_;
60   Link_array<Grob> loose_cols_;
61
62   Simple_spacer_wrapper ();
63   void add_columns (Link_array<Grob> const &);
64   void solve (Column_x_positions *, bool);
65   ~Simple_spacer_wrapper ();
66 private:
67   Simple_spacer_wrapper (Simple_spacer_wrapper const &);
68 };
69
70 #endif /* SIMPLE_SPACER_HH */
71