denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Bookpart scripts


From: Andreas Schneider
Subject: Re: [Denemo-devel] Bookpart scripts
Date: Sat, 14 May 2016 22:18:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0

Thank you. The corresponding piece to close the { from StartBookpart is
EndBookpart (see code below). Do you think those two should be coupled
in some way?

Andreas


;;;EndBookpart
(let ((tag "EndBookpart"))
  (if (d-Directive-movementcontrol? tag)
  (begin
    (disp (string-append "Deleting directive " tag "."))
    (d-DirectiveDelete-movementcontrol tag))
  (begin
    ;; or create it if it doesn't exist
    (disp (string-append "Creating directive " tag "."))
    (d-DirectivePut-movementcontrol-override tag (logior
DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
    (d-DirectivePut-movementcontrol-postfix tag "\n} %end of bookpart\n")
    (d-SetSaved #f))))


Am 14.05.2016 um 21:09 schrieb Richard Shann:
> Here I take out the scheme-escape and the eval-string and this will be
> ok I think (for eval-string to work you would have to have saved the
> string with " " around it, so that guile would evaluate it and get a
> string. That is, what you pass to eval-string should be what you would
> type at a guile prompt to get it to read the data type you want it to
> get, in this case what you would want is for it to read the data and
> evaluate it to result in a string). I think this will be ok (it is on
> Debian, I can check out that Windows is ok with it).
> 
> On its own it is a dangerous command since it doesn't place the } after
> the last movement in the bookpart, so the LilyPond becomes
> un-typesettable. If I understand correctly what you want I think you
> will need to ask for the Movement number where the book part should end
> and then set the } on that (you would need to go to that movement set
> the } in place and then return the cursor to the where you started
> d-PushPosition and d-PopPosition for that).
> 
> Richard
> oh - and I've moved the ))) into the conventional places for a piece of
> Scheme code.
> 
> ;;;StartBookpart
> (let ((tag "StartBookpart")(thetitle ""))
>   (d-DirectivePut-movementcontrol-override tag (logior
> DENEMO_OVERRIDE_GRAPHIC DENEMO_OVERRIDE_TAGEDIT))
>   (disp "checking previous bookpart title ...")
>   (if (d-Directive-movementcontrol? tag)
>     (set! thetitle (d-DirectiveGet-movementcontrol-data tag)))
>   (set! thetitle (d-GetUserInputWithSnippets (_ "Start Bookpart")(_
> "Give chapter title::") thetitle))
>   (if thetitle
>         (begin
>           (set! thetitle (car thetitle))
>           (if (zero? (string-length thetitle)) ;; if empty title string 
> =>delete the directive
>                   (begin
>                     (disp (string-append "Deleting directive " tag "."))
>                     (d-DirectiveDelete-movementcontrol tag)
>                     (d-SetSaved #f))
>                   (begin
>                     (disp thetitle)
>                     (d-DirectivePut-movementcontrol-data tag  thetitle)
>                     (d-DirectivePut-movementcontrol-prefix tag (string-append 
> "\\bookpart { %start of bookpart\n  \\header {\n    title = \\markup { "
>                                       thetitle " }\n  }\n"))
>             (d-SetSaved #f))))
>           (d-InfoDialog "Cancelled")))
> 




reply via email to

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