]> git.donarmstrong.com Git - lilypond.git/blob - lily/break-algorithm.cc
*** empty log message ***
[lilypond.git] / lily / break-algorithm.cc
1 /*
2   break.cc -- implement Break_algorithm
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "break-algorithm.hh"
10 #include "paper-column.hh"
11 #include "output-def.hh"
12 #include "system.hh"
13 #include "paper-score.hh"
14 #include "paper-column.hh"
15 #include "cpu-timer.hh"
16 #include "simple-spacer.hh"
17
18 vector<Grob*>
19 Break_algorithm::find_breaks () const
20 {
21   vector<Grob*> all = pscore_->root_system ()->columns ();
22   vector<Grob*> retval;
23
24   for (vsize i = 0; i < all.size (); i++)
25     if (Item::is_breakable (all[i]))
26       retval.push_back (all[i]);
27
28
29   return retval;
30 }
31
32 Simple_spacer_wrapper *
33 Break_algorithm::generate_spacing_problem (vector<Grob*> const &curline,
34                                            Interval line) const
35 {
36   Simple_spacer_wrapper *spw = new Simple_spacer_wrapper;
37   Simple_spacer *sp = spw->spacer_;
38
39   /*
40     this is hardcoded, but this shouldn't happen anyway.
41     used to be get_dimension (ly_symbol2scm ("loose_column_distance"));
42   */
43   sp->default_space_ = 1.0;
44   sp->indent_ = line[LEFT];
45
46   /*
47     sort out how interfacing this should work;
48   */
49   if (line.is_empty ())
50     sp->line_len_ = -1;
51   else
52     sp->line_len_ = line.length ();
53
54   spw->add_columns (curline);
55   return spw;
56 }
57
58 Break_algorithm::Break_algorithm ()
59 {
60   pscore_ = 0;
61   linewidth_ = 0;
62 }
63
64 void
65 Break_algorithm::set_pscore (Paper_score *s)
66 {
67   pscore_ = s;
68   linewidth_ = s->layout ()->get_dimension (ly_symbol2scm ("line-width"));
69 }
70
71 vector<Column_x_positions>
72 Break_algorithm::solve () 
73 {
74   vector<Column_x_positions> h;
75   return h;
76 }
77
78 Break_algorithm::~Break_algorithm ()
79 {
80 }