From d4fc80020d0a08883160d7dd51d668acb0555bc0 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Fri, 15 Aug 2008 13:25:42 +0000 Subject: [PATCH] Automatic default line breaking --- Sources/VLLilypondWriter.cpp | 22 ++++++++++++++++++---- Sources/VLLilypondWriter.h | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Sources/VLLilypondWriter.cpp b/Sources/VLLilypondWriter.cpp index 2a3ac28..f5df7ba 100644 --- a/Sources/VLLilypondWriter.cpp +++ b/Sources/VLLilypondWriter.cpp @@ -23,6 +23,14 @@ void VLLilypondWriter::Visit(VLSong & song) fSeenEnding = 0; fNumEndings = 0; fLastProp = 0; + fNumPickup = 0; + + fAutomaticLayout = true; + for (int i=0; i 0; - fInPickup = fInPickup && !m && meas.NoChords(); + if (fInPickup = fInPickup && !m && meas.NoChords()) + ++fNumPickup; // // Generate chords @@ -83,11 +92,16 @@ void VLLilypondWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas size_t volta; bool repeat; bool hasBarLine = false; - - if (meas.fBreak == VLMeasure::kNewPage) { + + if (fAutomaticLayout) { + if (m > fNumPickup && !((m-fNumPickup) % 4)) { + fAccum += fIndent+"\\break\n"; + hasBarLine = true; + } + } else if (meas.fBreak & VLMeasure::kNewPage) { fAccum += fIndent+"\\pageBreak\n"; hasBarLine = true; - } else if (meas.fBreak == VLMeasure::kNewSystem) { + } else if (meas.fBreak & VLMeasure::kNewSystem) { fAccum += fIndent+"\\break\n"; hasBarLine = true; } diff --git a/Sources/VLLilypondWriter.h b/Sources/VLLilypondWriter.h index b77703d..c2433e1 100644 --- a/Sources/VLLilypondWriter.h +++ b/Sources/VLLilypondWriter.h @@ -30,6 +30,8 @@ private: VLSong * fSong; bool fUseSharps; bool fInPickup; + bool fAutomaticLayout; + int fNumPickup; size_t fSeenEnding; int fNumEndings; VLNote fPrevNote;