Hi Richard,

today, my code from yesterday also worked. I do not understand what
happened.
Your version of the code works perfectly, thank you. I have created a
new menu item under Score > Typesetter. Attached you find the scm and
xml files.

Andreas


Am 02.04.2015 um 10:23 schrieb Richard Shann:
> Hi Andreas,
> 
> It is rather strange - last night I copied and pasted your code and
> tried it and thought I saw it not working like you say. This morning I
> added a line to print out the value of "choice" and of
> (string-append ...) to the console to see what was going on, and it all
> seemed correct and it worked.
> Then I went back and cut and pasted from your email and it was working
> after all.
> Here is your code with the output tidied up and a call to (disp ...)
> which shows you what is going on. The "\n" is scheme syntax for a
> newline, and I have added an if statement to cover the case that the
> user cancels rather than choosing an option.
> 
> 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
> 
> ;ScoreRehearsalMarkFormat
> (let ((tag "ScoreRehearsalMarkFormat")
>         (choice (RadioBoxMenu (cons (_ "alphabetic") "#format-mark-alphabet")
>                 (cons (_ "Numeric") "#format-mark-numbers")
>                 (cons (_ "Boxed alphabetic") "")
>                 (cons (_ "Boxed numeric") "#format-mark-box-numbers")
>                 (cons (_ "Circled alphabetic") "#format-mark-circle-alphabet")
>                 (cons (_ "Circled numeric") "#format-mark-circle-numbers"))))
> 
>       (if choice
>               (begin
>                       (disp "The choice made was " choice " and so the 
> LilyPond syntax will be " (string-append "\n\\set Score.markFormatter = " 
> choice) "\n")
>                       (d-DirectivePut-score-postfix tag (string-append 
> "\n\\set Score.markFormatter = " choice))
>                       (d-DirectivePut-score-override tag 
> DENEMO_OVERRIDE_GRAPHIC)
>                       (d-SetSaved #f))))
> 
> 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
> 
> (disp ...) is a very nice procedure which Nils created, you can put any
> scheme expressions in it and it will print a representation of them on
> the console.
> 
> Let me know that this works for you. I very much welcome useful commands
> - once this is working from the scheme window, think about which menu it
> should go in and which other command it should follow and right click on
> that command and choose "Save Script as New Menu Item" and follow the
> prompts. 
> 
> When finished you will have two files in
> ~/.denemo-1.2.3/actions/menus/ObjectMenu/...
> called ScoreRehearsalMarkFormat.xml and ScoreRehearsalMarkFormat.scm
> which you can send as attachments (avoids the email mangling danger).
> 
> Richard

;ScoreRehearsalMarkFormat
(let ((tag "ScoreRehearsalMarkFormat")
        (choice (RadioBoxMenu (cons (_ "alphabetic") "#format-mark-alphabet")
                (cons (_ "Numeric") "#format-mark-numbers")
                (cons (_ "Boxed alphabetic") "")
                (cons (_ "Boxed numeric") "#format-mark-box-numbers")
                (cons (_ "Circled alphabetic") "#format-mark-circle-alphabet")
                (cons (_ "Circled numeric") "#format-mark-circle-numbers"))))

	(if choice
		(begin
			(disp "The choice made was " choice " and so the LilyPond syntax will be " (string-append "\n\\set Score.markFormatter = " choice) "\n")
			(d-DirectivePut-score-postfix tag (string-append "\n\\set Score.markFormatter = " choice))
			(d-DirectivePut-score-override tag DENEMO_OVERRIDE_GRAPHIC)
			(d-SetSaved #f))))
<?xml version="1.0" encoding="UTF-8"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row type="scheme">
        <action>ScoreRehearsalMarkFormat</action>
        <after>ReduceSystemSpacing</after>
        <_label>(Print) Format of rehearsal marks</_label>
        <_tooltip>Select the format of rehearsal marks (alphabetic, numeric, boxed, etc.)</_tooltip>
      </row>
    </map>
  </merge>
</Denemo>
_______________________________________________
Denemo-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/denemo-devel

Reply via email to