]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/tie-formatting-problem.hh
* lily/tie-formatting-problem.cc (find_optimal_tie_configuration):
[lilypond.git] / lily / include / tie-formatting-problem.hh
1 /*
2   tie-formatting-problem.hh -- declare
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #ifndef TIE_FORMATTING_PROBLEM_HH
11 #define TIE_FORMATTING_PROBLEM_HH
12
13 #include "drul-array.hh"
14 #include "parray.hh"
15 #include "skyline.hh"
16 #include "lily-proto.hh"
17
18 #include <map>
19 #include <set>
20
21 struct Tie_details
22 {
23   Real height_limit_;
24   Real ratio_;
25   Real staff_space_;
26   Real x_gap_;
27   Real between_length_limit_;
28   Grob *staff_symbol_referencer_;
29   
30   Tie_details ();
31   void from_grob (Grob *);
32 };
33
34
35 typedef map< pair<int, int>, Tie_configuration *> Tie_configuration_map;
36
37 class Tie_formatting_problem
38 {
39   Drul_array< Array<Skyline_entry> > chord_outlines_;
40   set<int> dot_positions_;
41   Tie_configuration_map possibilities_;
42
43   Tie_configuration *get_configuration (int position, Direction dir);
44   Tie_configuration *generate_configuration (int position, Direction dir);
45   Real score_configuration (Tie_configuration const&);
46   Real score_aptitude (Tie_configuration const&, int);
47   
48   Grob *x_refpoint_;
49
50   
51 public:
52   Tie_details details_;
53
54 public:
55   Tie_formatting_problem ();
56   ~Tie_formatting_problem ();
57
58   Tie_configuration find_optimal_tie_configuration (int p, Direction d);
59   void from_ties (Link_array<Grob> const &ties);
60   void from_tie (Grob *tie);
61   void from_lv_ties (Link_array<Grob> const &);
62   void set_chord_outline (Link_array<Item>, Direction);
63
64   Interval get_attachment (Real) const;
65   Grob *common_x_refpoint () const;
66 };
67
68 #endif /* TIE_FORMATTING_PROBLEM_HH */