<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row>
        <after>FixSlursInStaff</after>
        <action>CheckTiesInStaff</action>
        <scheme>;;CheckTiesInStaff
(define CheckTiesInStaff::return #t)
(d-PushPosition)
(d-MoveToBeginning)
(let ((ok #t))	
  (let loop ()
    (if (and (d-IsTied) (Singlenote?))
      (let ((note (d-GetNote)))
				(if (and (d-NextChord) (Singlenote?))
					(let ((nextnote (d-GetNote)))
						(if (equal? note nextnote)
							(if (d-NextChord)
								(loop))
							(begin
								(d-InfoDialog (_ "Tied notes not the same"))
								(set! ok #f))))
					(if (Singlenote?)
						(begin
							(d-InfoDialog "No note to tie to")
							(set! ok #f))))))
		(if (and ok (d-NextChord))
			(loop)))

 (if ok
   (d-PopPosition)
   (let ((position (GetPosition)))
     (set! CheckTiesInStaff::return #f)
     (d-PopPosition)
     (apply d-GoToPosition position))))
     
     
</scheme>
        <label>Check Ties</label>
        <tooltip>Checks for wrongly tied notes in the current voice/staff.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>
