[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] Scheme script for score directive
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] Scheme script for score directive |
Date: |
Wed, 03 Apr 2013 22:02:16 +0100 |
I can't test right now, but just looking over your code visually it
looks good except that you have two sorts of directive
d-DirectivePut-scoreheader-xxx
is put inside a \header {} block
while
d-DirectivePut-score-xxx
is not.
(Just working from memory here, not sure of the facts!)
I'll test out the code tomorrow.
Richard
On Wed, 2013-04-03 at 22:36 +0200, Andreas Schneider wrote:
> 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
>
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/denemo-devel