denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Scheme script for score directive


From: Andreas Schneider
Subject: Re: [Denemo-devel] Scheme script for score directive
Date: Wed, 03 Apr 2013 22:36:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

Am 31.03.2013 10:08, schrieb Richard Shann:
> [...] But I think this might be a mistake: if the include file needs
> to be in the same directory as the .denemo file, then it would be
> better to include it literally in the .denemo file so it can't get
> separated.

You're right, it would be better to include the snippet in the .denemo
file. I tried to create a script that inserts user-defined lilypond
commands at the end of a score, displaying an edit field when clicking
on the button:

;;;MarkupAtEnd
(let ((tag "MarkupAtEnd"))
        (d-DirectivePut-scoreheader-override tag DENEMO_OVERRIDE_GRAPHIC)
        (d-DirectivePut-scoreheader-display tag "MarkupAtEnd")
        (if (d-Directive-score? tag)
                (let themarkup (d-DirectiveGet-score-postfix tag))
                (let themarkup (""))
        )
        (set! themarkup (d-GetUserInput (_ "MarkupAtEnd") (_ "Edit markup:")
themarkup))
        (d-DirectivePut-score-postfix tag themarkup)
        (d-DirectivePut-score-override tag DENEMO_OVERRIDE_AFFIX)
        (d-SetSaved #f)
)

I must have misunderstood several things. Is my assumption wrong that
the script is re-executed when the button is pressed? What I intended to
do is: After creating the button (thanks for the hint how to do that)
the script checks whether a score directive with the name is already
present; if yes the default snippet is the current contents, otherwise
it is empty. Then an edit box should show where the user can edit the
snippet. (Here, another type of editor might be better, as the snippet
might be longer.) At last, the score directive is set to the new
snippet. Is there a principle mistake in that? What am I doing wrong?

Andreas


Am 01.04.2013 18:37, schrieb Richard Shann:
> On Sun, 2013-03-31 at 09:52 +0200, Andreas Schneider wrote:
>>
>> I took some time browsing through the commands and some corresponding
>> scripts, particularly looking at the titles, but I couldn't locate the
>> script that creates the button (is it built-in?).
>>
> I just had a look at the details of this, this code puts a directive in
> the scoreheader (with nothing in the LilyPond, ie no prefix or postfix
> fields set) and displays itself as a button (that is what the
> DENEMO_OVERRIDE_GRAPHIC does) with the text from the display field.
> 
> (let ((tag "test"))
>      (d-DirectivePut-scoreheader-override tag DENEMO_OVERRIDE_GRAPHIC)
>      (d-DirectivePut-scoreheader-display tag "something"))
> 
> the tag used, in this case "test", does not match any action (there is
> no command d-test), so clicking on it just gives the advanced edit.
> 
> another example:
> 
> (let ((tag "test"))
>     (d-DirectivePut-movementcontrol-override tag
> DENEMO_OVERRIDE_GRAPHIC)
>      (d-DirectivePut-movementcontrol-display tag "something"))
> 
> this puts the button on the movement titles button bar. If you used a
> real command for the tag, the button would execute that command. For
> example
> (let ((tag "NewScore"))
>     (d-DirectivePut-movementcontrol-override tag DENEMO_OVERRIDE_GRAPHIC)
>      (d-DirectivePut-movementcontrol-display tag "start new"))
> 
> creates a button that runs the NewScore command ...
> 
> HTH
> 
> Richard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]