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;