OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2006--2015 Joe Neeman <joeneeman@gmail.com> | 4 Copyright (C) 2006--2015 Joe Neeman <joeneeman@gmail.com> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 Real spring_length (Line_details const &next_line) const; | 122 Real spring_length (Line_details const &next_line) const; |
123 }; | 123 }; |
124 | 124 |
125 /* | 125 /* |
126 Helper to trace back an optimal path | 126 Helper to trace back an optimal path |
127 */ | 127 */ |
128 struct Constrained_break_node | 128 struct Constrained_break_node |
129 { | 129 { |
130 /* the number of bars in all the systems before this one | 130 /* the number of bars in all the systems before this one |
131 */ | 131 */ |
132 int prev_; | 132 vsize prev_; |
133 | 133 |
134 /* unlike the Gourlay breaker, this is the sum of all demerits up to, | 134 /* unlike the Gourlay breaker, this is the sum of all demerits up to, |
135 * and including, this line */ | 135 * and including, this line */ |
136 Real demerits_; | 136 Real demerits_; |
137 struct Line_details details_; | 137 struct Line_details details_; |
138 | 138 |
139 Constrained_break_node () | 139 Constrained_break_node () |
140 { | 140 { |
141 prev_ = -1; | 141 prev_ = VPOS; |
142 demerits_ = infinity_f; | 142 demerits_ = infinity_f; |
143 } | 143 } |
144 | 144 |
145 void print () const | 145 void print () const |
146 { | 146 { |
147 printf ("prev break %d, demerits %f\n", prev_, demerits_); | 147 printf ("prev break %zu, demerits %f\n", prev_, demerits_); |
148 } | 148 } |
149 }; | 149 }; |
150 | 150 |
151 /* | 151 /* |
152 A dynamic programming solution to breaking scores into lines | 152 A dynamic programming solution to breaking scores into lines |
153 */ | 153 */ |
154 class Constrained_breaking | 154 class Constrained_breaking |
155 { | 155 { |
156 public: | 156 public: |
157 vector<Column_x_positions> solve (vsize start, vsize end, vsize sys_count); | 157 vector<Column_x_positions> solve (vsize start, vsize end, vsize sys_count); |
158 vector<Column_x_positions> best_solution (vsize start, vsize end); | 158 vector<Column_x_positions> best_solution (vsize start, vsize end); |
159 vector<Line_details> line_details (vsize start, vsize end, vsize sys_count); | 159 vector<Line_details> line_details (vsize start, vsize end, vsize sys_count); |
160 | 160 |
161 Constrained_breaking (Paper_score *ps); | 161 Constrained_breaking (Paper_score *ps); |
162 Constrained_breaking (Paper_score *ps, vector<vsize> const &start_col_posns); | 162 Constrained_breaking (Paper_score *ps, vector<vsize> const &start_col_posns); |
163 | 163 |
164 int max_system_count (vsize start, vsize end); | 164 vsize max_system_count (vsize start, vsize end); |
165 int min_system_count (vsize start, vsize end); | 165 vsize min_system_count (vsize start, vsize end); |
166 | 166 |
167 private: | 167 private: |
168 Paper_score *pscore_; | 168 Paper_score *pscore_; |
169 vsize valid_systems_; | 169 vsize valid_systems_; |
170 vsize systems_; | 170 vsize systems_; |
171 bool ragged_right_; | 171 bool ragged_right_; |
172 bool ragged_last_; | 172 bool ragged_last_; |
173 | 173 |
174 Real system_system_min_distance_; | 174 Real system_system_min_distance_; |
175 Real system_system_padding_; | 175 Real system_system_padding_; |
(...skipping 23 matching lines...) Expand all Loading... |
199 | 199 |
200 Column_x_positions space_line (vsize start_col, vsize end_col); | 200 Column_x_positions space_line (vsize start_col, vsize end_col); |
201 vsize prepare_solution (vsize start, vsize end, vsize sys_count); | 201 vsize prepare_solution (vsize start, vsize end, vsize sys_count); |
202 | 202 |
203 Real combine_demerits (Real force, Real prev_force); | 203 Real combine_demerits (Real force, Real prev_force); |
204 | 204 |
205 bool calc_subproblem (vsize start, vsize systems, vsize max_break_index); | 205 bool calc_subproblem (vsize start, vsize systems, vsize max_break_index); |
206 void fill_line_details (Line_details *, vsize, vsize); | 206 void fill_line_details (Line_details *, vsize, vsize); |
207 }; | 207 }; |
208 #endif /* CONSTRAINED_BREAKING_HH */ | 208 #endif /* CONSTRAINED_BREAKING_HH */ |
OLD | NEW |