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