]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/slur-scoring.hh
db03c1e36343e26c757445658ec044b2db89b399
[lilypond.git] / lily / include / slur-scoring.hh
1 /*
2   slur-scoring.hh -- declare Slur_score_parameters
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef SLUR_SCORING_HH
10 #define SLUR_SCORING_HH
11
12 #include "box.hh"
13 #include "std-vector.hh"
14 #include "lily-guile.hh"
15 #include "slur-score-parameters.hh"
16
17 struct Extra_collision_info
18 {
19   Real idx_;
20   Box extents_;
21   Real penalty_;
22   Grob *grob_;
23   SCM type_;
24   
25   Extra_collision_info (Grob *g, Real idx, Interval x, Interval y, Real p);
26   Extra_collision_info ();
27
28 };
29
30 struct Encompass_info
31 {
32   Real x_;
33   Real stem_;
34   Real head_;
35   Encompass_info ()
36   {
37     x_ = 0.0;
38     stem_ = 0.0;
39     head_ = 0.0;
40   }
41   Real get_point (Direction dir) const
42   {
43     Interval y;
44     y.add_point (stem_);
45     y.add_point (head_);
46     return y[dir];
47   }
48 };
49
50 struct Bound_info
51 {
52   Box stem_extent_;
53   Direction stem_dir_;
54   Item *bound_;
55   Grob *note_column_;
56   Grob *slur_head_;
57   Grob *staff_;
58   Grob *stem_;
59   Interval slur_head_x_extent_;
60   Real staff_space_;
61
62   Bound_info ()
63   {
64     stem_ = 0;
65     staff_ = 0;
66     slur_head_ = 0;
67     stem_dir_ = CENTER;
68     note_column_ = 0;
69   }
70 };
71
72 struct Slur_score_state
73 {
74   Spanner *slur_;
75   Grob *common_[NO_AXES];
76   bool valid_;
77   bool edge_has_beams_;
78   bool is_broken_;
79   bool has_same_beam_;
80
81   Real musical_dy_;
82   vector<Grob*> columns_;
83   vector<Encompass_info> encompass_infos_;
84   vector<Extra_collision_info> extra_encompass_infos_;
85
86   Direction dir_;
87   Slur_score_parameters parameters_;
88   Drul_array<Bound_info> extremes_;
89   Drul_array<Offset> base_attachments_;
90   vector<Slur_configuration*> configurations_;
91   Real staff_space_;
92   Real thickness_;
93
94   Slur_score_state ();
95   ~Slur_score_state ();
96
97   Bezier get_best_curve ();
98   void fill (Grob *);
99   void set_next_direction ();
100   
101   vector<Offset> generate_avoid_offsets () const;
102   Drul_array<Bound_info> get_bound_info () const;
103   void generate_curves () const;
104   vector<Slur_configuration*> enumerate_attachments (Drul_array<Real> end_ys) const;
105   Drul_array<Offset> get_base_attachments () const;
106   Drul_array<Real> get_y_attachment_range () const;
107   Encompass_info get_encompass_info (Grob *col) const;
108   vector<Extra_collision_info> get_extra_encompass_infos () const;
109   Real move_away_from_staffline (Real y, Grob *on_staff) const;
110   int get_closest_index (SCM inspect_quants) const;
111
112   Grob *breakable_bound_item (Direction) const;  
113 };
114
115 void set_slur_control_points (Grob *me);
116
117 #endif /* SLUR_SCORING_HH */