]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/page-breaking.hh
Fix 1203.
[lilypond.git] / lily / include / page-breaking.hh
index 002d7def29ee7e9be8409d77dbb91d9236c83b8b..58c8de0951a93d82b208b15901a01ff0d36081c1 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2006--2009 Joe Neeman <joeneeman@gmail.com>
+  Copyright (C) 2006--2010 Joe Neeman <joeneeman@gmail.com>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -99,6 +99,7 @@ class Page_breaking
 {
 public:
   typedef bool (*Break_predicate) (Grob *);
+  typedef bool (*Prob_break_predicate) (Prob *);
   typedef vector<vsize> Line_division;
   
   /*
@@ -109,7 +110,7 @@ public:
    */
   virtual SCM solve () = 0;
 
-  Page_breaking (Paper_book *pb, Break_predicate);
+  Page_breaking (Paper_book *pb, Break_predicate, Prob_break_predicate);
   virtual ~Page_breaking ();
 
   bool ragged () const;
@@ -127,6 +128,7 @@ public:
   bool too_few_lines (int line_count) const;
   Real min_whitespace_at_top_of_page (Line_details const&) const;
   Real min_whitespace_at_bottom_of_page (Line_details const&) const;
+  int orphan_penalty () const;
 
 protected:
   Paper_book *book_;
@@ -180,6 +182,7 @@ private:
   int max_systems_per_page_;
   int min_systems_per_page_;
   vsize system_count_;
+  int orphan_penalty_;
 
   vector<Line_division> current_configurations_;
   vector<Break_position> current_chunks_;
@@ -187,6 +190,7 @@ private:
   vsize current_end_breakpoint_;
 
   void cache_line_details (vsize configuration_index);
+  void compute_line_heights ();
   void clear_line_details_cache ();
   vsize cached_configuration_index_;
   vector<Line_details> cached_line_details_;
@@ -210,7 +214,7 @@ private:
   Page_spacing_result space_systems_on_2_pages (vsize configuration_index, vsize first_page_num);
   Page_spacing_result finalize_spacing_result (vsize configuration_index, Page_spacing_result);
   void create_system_list ();
-  void find_chunks_and_breaks (Break_predicate);
+  void find_chunks_and_breaks (Break_predicate, Prob_break_predicate);
   SCM make_page (int page_num, bool last) const;
   SCM get_page_configuration (SCM systems, int page_num, bool ragged, bool last);
   SCM draw_page (SCM systems, SCM config, int page_num, bool last);