<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row>
        <action>GraceAfter</action>
        <scheme>;;GraceAfter
(if (and (Note?) (d-MoveCursorLeft) (Note?))
    (begin
      (d-MoveCursorRight)
;;there are two notes main note and gracenote, we are on the gracenote-to-be
  (if (d-Directive-chord? "AfterGrace")
      (begin ;;; already is a grace after delete
	(d-DirectiveDelete-chord "AfterGrace")
	(d-ToggleGrace)
	
	(d-MoveCursorLeft)
	;;(display (d-GetNote))
	(d-DirectiveDelete-chord "MainGraceAfter")
	(d-MoveCursorRight)
	)
      (begin;;;make current note a grace note without the \grace output
       (d-ToggleGrace)
       (d-DirectivePut-chord-postfix "AfterGrace" (string-append (d-GetNote) (d-GetNoteDuration)))
       (d-DirectivePut-chord-override "AfterGrace" DENEMO_OVERRIDE_LILYPOND)

       (d-MoveCursorLeft);; now on main note
       (d-DirectivePut-chord-display "MainGraceAfter"  "Grace After" )
       (d-DirectivePut-chord-ty "MainGraceAfter"  -100 )
       (d-DirectivePut-chord-prefix "MainGraceAfter"  "\\afterGrace ")
       (d-DirectivePut-chord-override "MainGraceAfter"  DENEMO_OVERRIDE_AFFIX)	
       (d-DirectivePut-chord-minpixels  "MainGraceAfter" 20)
       (d-MoveCursorRight);; move back onto the grace note
       )))
    (begin
      (d-WarningDialog  "The cursor is not on a potential grace note after a main note or chord\nFirst create the main note, then then follow it with the note that will be the grace note and then invoke this command")))</scheme>
        <label>Grace After (Off/On)</label>
        <tooltip>Print this note as grace note attached to the previous note. Beware! You must repeat this command if you change the note in any way, only the pitch and duration when this command was issued will be printed. Multiple grace notes to follow will need separate start { and end } block directives to group them - this requires extra LilyPond inserts.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>
