]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-formatting-problem.cc
3dae389c4d440629d203c908fa7260a8bce59307
[lilypond.git] / lily / dot-formatting-problem.cc
1 /* 
2    dot-formatting-problem.cc -- implement Dot_formatting_problem
3
4
5    file of the GNU LilyPond music typesetter
6    
7    (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
8   
9 */
10
11 #include "dot-formatting-problem.hh"
12 #include "dot-configuration.hh"
13 #include "skyline.hh"
14
15 Dot_formatting_problem::~Dot_formatting_problem()
16 {
17   delete best_;
18 }
19
20 void
21 Dot_formatting_problem::register_configuration (Dot_configuration const &src)
22 {
23   int b = src.badness ();
24   if (b < score_)
25     {
26       delete best_;
27       best_ = new Dot_configuration (src);
28     }
29 }
30
31 Dot_configuration *
32 Dot_formatting_problem::best () const
33 {
34   return best_;
35 }
36
37 Dot_formatting_problem::Dot_formatting_problem (vector<Box> const &boxes,
38                                                 Interval base_x)
39   : head_skyline_ (boxes, 0.0, Y_AXIS, RIGHT)
40 {
41   best_ = 0;
42   head_skyline_.set_minimum_height (base_x[RIGHT]);
43   score_ = 1 << 30;
44 }