]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.1
authorfred <fred>
Sun, 24 Mar 2002 19:50:15 +0000 (19:50 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:50:15 +0000 (19:50 +0000)
lily/p-score.cc

index 0e093c9693a55ec6e849ec987ea503aef74c517a..661ccfeaec6ad6454cc4aa610a6737103c93ff47 100644 (file)
 #include "scoreline.hh"
 #include "p-score.hh"
 #include "tex-stream.hh"
-#include "word-wrap.hh"
 #include "p-col.hh"
 
+#include "word-wrap.hh"
+#include "gourlay-breaking.hh"
+
 PScore::PScore(Paper_def*p)
 {
     paper_l_ = p;
@@ -130,6 +132,8 @@ void
 PScore::print() const
 {    
 #ifndef NPRINT
+    if ( !check_debug)
+       return ;
     mtor << "PScore { ";
     paper_l_->print();
     mtor << "\n elements: ";
@@ -203,9 +207,27 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking)
 void
 PScore::calc_breaking()
 {
-    Word_wrap w(*this);
-
-    set_breaking(w.solve());
+    Break_algorithm *algorithm_p;
+    Array<Col_hpositions> sol;
+    bool try_wrap = ! paper_l_->get_var( "castingalgorithm");
+
+    if (!try_wrap) {
+       algorithm_p = new Gourlay_breaking ;
+       algorithm_p->set_pscore(this);
+       sol = algorithm_p->solve();
+       delete algorithm_p;
+       if ( ! sol.size()) { 
+           error ( "Can not solve this casting problem exactly; revert to Word_wrap");
+           try_wrap = true;
+       } 
+    }
+    if  (try_wrap) {
+       algorithm_p = new Word_wrap;    
+       algorithm_p->set_pscore(this);
+       sol = algorithm_p->solve();
+       delete algorithm_p;
+    }
+    set_breaking(sol);
 }
 
 void