denemo-devel
[Top][All Lists]
Advanced

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

Re: Analysis brackets (with labels) in Denemo


From: Richard Shann
Subject: Re: Analysis brackets (with labels) in Denemo
Date: Fri, 22 Oct 2021 16:20:32 +0100

On Fri, 2021-10-22 at 16:18 +0300, Lib Lists wrote:
> Hi Richard,
> 
> > > 2. (picture Denemo2.png)
> > > I used the your code, the one with
> > >  (d-DirectivePut-standalone-display tag "This will label the
> > > Denemo
> > > Directive")
> > >  (d-DirectivePut-standalone-tx tag 20)
> > >  (d-DirectivePut-standalone-ty tag -20)
> > > and as you can see from the picture it shows four 'Directive'
> > > signs
> > > (sorry I won't know yet how those are called in Denemo). Is this
> > > the
> > > expected behaviour?
> > 
> > Sorry, yes I should have put (d-MoveCursorLeft) after the first
> > command
> > as it creates the Denemo Directive and moves to the right straight
> > away, so that the subsequent commands create new directives instead
> > of
> > editing the old one. There is a wrapper function that does a whole
> > bunch of this for you called (StandAloneDirectiveProto ...) which
> > is
> > used in the script for that InsertStandaloneDirective command I
> > referenced above. But to keep things simple:
> > 
> >  (d-DirectivePut-standalone-display tag "This will label the Denemo
> > Directive")
> >  (d-MoveCursorLeft)
> >  (d-DirectivePut-standalone-tx tag 20)
> >  (d-DirectivePut-standalone-ty tag -20)
> > 
> > would do the trick (the subsequent d-DirectivePut-... are editing
> > so
> > they don't move the cursor right, the cursor always moves right
> > after
> > inserting an object).
> 
> I changed the code and I now get two Directive symbols (see attached
> screenshot), is that correct? 

Sorry I was a bit too terse, here is your code commented

> ;start analysis bracket
> (let ((tag "Analysis"))
>  (d-DirectivePut-standalone-postfix tag "\\startGroup")

this inserts a standalone Denemo Directive object before the cursor
(assuming the cursor is not already on one with that tag) and moves the
cursor right for the next insertion.

>  (d-DirectivePut-standalone-display tag "Start Analysis Bracket
> DOWN")

the cursor is on the note now so this inserts a *second* Denemo
Directive which just displays the label, and moves the cursor right

>  (d-MoveCursorLeft)

this moves the cursor left so it is on that second Denemo Directive, so
now it is ready to be edited
>  (d-DirectivePut-standalone-tx tag 20)
this edits that second one, filling in the tx field, positioning your
label displaced by 20 staff spaces leftwards, it doesn't move the
cursor as it is editing not inserting.

>  (d-DirectivePut-standalone-ty tag -20)
likewise edits for the y position of the label

>  (d-DirectivePut-layout-postfix
> "Analysis" "  \\context {\\Voice  \\consists
> \"Horizontal_bracket_engraver\" }"))

this puts a Denemo Directive into the layout block of the movement (it
doesn't matter where the cursor is as this is not a standalone
directive). You can look in the Movement->Movement Properties Editor
and see that this directive has appeared in the layout directives.

So your code should have been:

;start analysis bracket
(let ((tag "Analysis"))
 (d-DirectivePut-standalone-postfix tag "\\startGroup")
 (d-MoveCursorLeft)
 (d-DirectivePut-standalone-display tag "Start Analysis Bracket DOWN")
 (d-DirectivePut-standalone-tx tag 20)
 (d-DirectivePut-standalone-ty tag -20)
 (d-DirectivePut-layout-postfix
"Analysis" "  \\context {\\Voice  \\consists
\"Horizontal_bracket_engraver\" }"))

where the move left into the editing position is one line earlier.

But you probably don't want such a long label and you perhaps don't
want to alter the default position of the label, so you could write

;start analysis bracket
(let ((tag "Analysis"))
 (d-DirectivePut-standalone-postfix tag "\\startGroup")
 (d-MoveCursorLeft)
 (d-DirectivePut-standalone-display tag "Analysis___")
 (d-DirectivePut-layout-postfix
"Analysis" "  \\context {\\Voice  \\consists
\"Horizontal_bracket_engraver\" }"))

where I've made the label shorter and omitted the tx and ty lines as
they were just examples to play with, the default is usually ok.

HTH

Richard






reply via email to

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