\version "2.18.0"    

tocSection = #(define-music-function (parser location text) (markup?) 
        	(add-toc-item! 'tocSectionMarkup text)) 

%\include "bagpipe.ly"
\include "BP_format.ily"

\book {
  \header {
    title = "Heather Pipes & Drums"
    subtitle = "Grade 2 Band Collection - 2015"
    copyright = \markup {
      \line { 
        "Compiled by John S. McWilliam,"
      	\concat { "(rev. " \today ")" }
      }
    }
    parttagline = "Copied by John S. McWilliam"
  }
  
  \paper {
    oddFooterMarkup = \markup {
      \column {
        \fill-line {
          %% Copyright header field only on book first page.
          \on-the-fly #first-page \fromproperty #'header:copyright
        }
        \fill-line {
          %% Part tagline header field only on each part last page.
          \on-the-fly #part-last-page \fromproperty #'header:parttagline
        }
        \fill-line {
          %% Tagline header field only on book last page.
          \on-the-fly #last-page \fromproperty #'header:tagline
        }
      }
    }
    tocTitleMarkup = \markup {
      \huge 
      \column { 
        \fill-line { \null "Table of Contents" \null } 
        \hspace #1 
      } 
    }     
    tocItemMarkup = \tocItemWithDotsMarkup
    tocSectionMarkup = \markup {
      \large 
      \column { 
        \hspace #1 
        \fill-line { \null \italic \fromproperty #'toc:text \null } 
        \hspace #1 
      }
    }
  }%end paper
  	
  \pageBreak
  \markuplist \table-of-contents
  \pageBreak
  
  
  \bookpart {
    \header {
      title = "March,Strathspey & Reel"
      subtitle = ##f
    }
  	\tocSection \markup { March,Strathspey & Reel }
  	
  	\tocItem \markup { 1. Highland Wedding }
  	\include "Tune1_normal13.ly"
  }
  
  %% need to clear header-fields
  \header {
    title = ##f
    subtitle = ##f
  }
  
  \bookpart {
    \paper {
      ragged-last-bottom = ##f
      ragged-bottom = ##f
    }
    \tocItem \markup { 2. Dora MacLeod }
    \include "Tune1_reduced13.ly"
  }
  
  \bookpart {
    \tocItem \markup { 3. Pretty Marion }
    \include "Tune1_normal13.ly"
%\pageBreak
  }
  
  \bookpart {
    \tocItem \markup { 4. Same Pretty Marion }
    \include "Tune1_normal13.ly"
  }
  
  %% setting new header fields
  \bookpart {
  \header {
    title = "Jigs"
    subtitle = ##f }
  
    \tocSection \markup { Jigs }
    
    \tocItem \markup { 1. Short Jig }
     \include "Tune1_short4.ly"
    \tocItem \markup { 1. Short Other }
     \include "Tune1_short4.ly"

  }
  		
  % More bookparts...
  
} %end book
