<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row>
        <after>InsertWholeMeasureRest</after>
        <action>MultiMeasureRests</action>
        <scheme>;;MultiMeasureRests
  (let ((tag #f))
    (define count 0)
    (if (d-Directive-chord? "WholeMeasureRest")
    (begin
      (set! count 1)
      (d-DirectiveDelete-chord "WholeMeasureRest")
      (d-DirectivePut-chord-minpixels "MultiMeasureRests" 50)
      (d-DirectivePut-chord-graphic "MultiMeasureRests"  "MultiMeasureRests")
      (d-DirectivePut-chord-gy "MultiMeasureRests"  -5)
      (d-PushPosition)
      (let loop ()
	(if (d-NextChord)
	    (begin	    
	      (if (d-Directive-chord? "WholeMeasureRest")
		  (begin
		    (set! count (1+ count))
		    (d-DeleteObject)
		    (d-Directive-standalone "WholeMeasureRest")
		    (d-DirectivePut-standalone-graphic "WholeMeasureRest" "BracketedWholeMeasureRest")
		    (d-DirectivePut-standalone-postfix "WholeMeasureRest" "%{ grouped rest %}")
		    (d-DirectivePut-standalone-override "WholeMeasureRest" DENEMO_OVERRIDE_LILYPOND)
		    (d-DirectivePut-standalone-display "WholeMeasureRest" "grouped\nas mm rest")
		    (d-DirectivePut-standalone-tx "WholeMeasureRest" 25)
		    (d-DirectivePut-standalone-ty "WholeMeasureRest" -25)
		    (loop))))))
      (d-PopPosition)
      (if (d-Directive-chord? "MultiMeasureRests")
	  (begin
	    (d-SetDurationInTicks (* 1536 (GetPrevailingTimeSig #t) count))
	    (d-DirectivePut-chord-display "MultiMeasureRests" (string-append "Rest " (number-&gt;string count)))
	    (d-DirectivePut-chord-ty "MultiMeasureRests" -20)  
	    (d-DirectivePut-chord-postfix "MultiMeasureRests" (string-append "\\set Score.skipBars = ##t R1*" (d-InsertTimeSig "query=timesigname") "*" (number-&gt;string count)))
	    (d-DirectivePut-chord-override "MultiMeasureRests" DENEMO_OVERRIDE_LILYPOND)
	    )))))
    (d-SetSaved #f)	 

</scheme>
        <label>Multi-Measure Rests</label>
        <tooltip>Creates a multi-measure rest from the whole measure rests after the cursor. You must create the whole measure rests first.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>
