2 break.cc -- implement Break_algorithm
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "paper-column.hh"
10 #include "break-algorithm.hh"
11 #include "paper-def.hh"
13 #include "paper-score.hh"
14 #include "paper-column.hh"
15 #include "cpu-timer.hh"
17 #include "simple-spacer.hh"
18 #include "group-interface.hh"
22 Break_algorithm::find_break_indices () const
24 Link_array
<Grob
> all
= pscore_
->system_
->columns ();
27 for (int i
=0; i
< all
.size (); i
++)
28 if (Item::breakable_b (all
[i
]))
32 while (retval
.size () >2)
40 Break_algorithm::find_breaks () const
42 Link_array
<Grob
> all
= pscore_
->system_
->columns ();
43 Link_array
<Grob
> retval
;
45 for (int i
=0; i
< all
.size (); i
++)
46 if (Item::breakable_b (all
[i
]))
50 while (retval
.size () >2)
58 Break_algorithm::generate_spacing_problem (Link_array
<Grob
> const &curline
,
61 Simple_spacer
* sp
= new Simple_spacer
;
64 this is hardcoded, but this shouldn't happen anyway.
65 used to be get_var ("loose_column_distance");
67 sp
->default_space_
= 1.0;
70 sp
->indent_
= line
[LEFT
];
73 sort out how interfacing this should work;
80 sp
->line_len_
= line
.length ();
82 sp
->add_columns (curline
);
88 Break_algorithm::Break_algorithm ()
95 Break_algorithm::set_pscore (Paper_score
*s
)
98 linewidth_
= s
->paper_
->get_var ("linewidth");
101 Array
<Column_x_positions
>
102 Break_algorithm::solve () const
104 Array
<Column_x_positions
> h
= do_solve ();