From: fred Date: Sun, 24 Mar 2002 19:50:15 +0000 (+0000) Subject: lilypond-0.1.1 X-Git-Tag: release/1.5.59~4325 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a9ca0b8656713dab8bbfac407a29d577ae6a5aa4;p=lilypond.git lilypond-0.1.1 --- diff --git a/lily/p-score.cc b/lily/p-score.cc index 0e093c9693..661ccfeaec 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -14,9 +14,11 @@ #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 const &breaking) void PScore::calc_breaking() { - Word_wrap w(*this); - - set_breaking(w.solve()); + Break_algorithm *algorithm_p; + Array 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