denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] Editing DenemoDirectives.


From: Richard Shann
Subject: [Denemo-devel] Editing DenemoDirectives.
Date: Mon, 16 Feb 2009 11:37:26 +0000

Once a script has generated a DenemoDirective it will often be useful to
allow the user to edit it. The classic example is applying LilyPond
tweaks to avoid collisions between notation elements, when LilyPond
fails to do so.
To achieve this editablilty I propose to create a directory
actions/editscripts where script writers can place scripts containing
editing functions; for the action <name> the file <name>.scm will be
available (so for example the action D.C.Alfine would have editing
functions in the file actions/editscripts/D.C.Alfine.scm
To support editing, I propose a new function Edit->Edit Directive
which searches at the current object for a directive (letting the user
choose if there are several) and then calling the editing script
appropriate to the directive (derived from the tag of the directive). I
propose that the default mouse action for right-click on a directive
would invoke this function.

The editing scripts themselves will be able to exploit a new scheme
procedure
(d-popup-menu "item1\0item2\0...")
which will pop up a menu with menu items labelled item1, item2 etc (e.g.
Tweak Position, Tweak Padding...)
and return the chosen item or none.

An editing script will call this function and the apply the appropriate
edit to the directive. Such an editing script can be very simple in the
case where only one sort of edit is catered for. But if, for example, it
is desired to allow both the position and the padding of an item to be
edited then the script would require more care in its construction: this
is because DenemoDirectives have a single prefix and a single postfix
string, so the script will have to edit a string, avoiding disturbing
settings put there by other types of edit. 
However, I think this can be achieved fairly easily without resorting to
tagged lists of prefixes etc.
For example a position tweak might look like this:

\once \override TextScript #'extra-offset = #'( -4.0 . 0.0 )

which could be tweaked by a function called thus:

(tweak "\\once \\override TextScript #'extra-offset = #'( " m " . " n
" )")

where m and n were the new, tweaked values to replace -4.0 and 0.0 in
the original. The function tweak would not be too tricky to write, and
as long as editing scripts took care to describe the whole string being
tweaked there should be no problem of different types of edit
interfering with each other.
The general purpose function being used here should have its definition
placed in a script /actions/editscripts/init-edits.scm which the system
will guarantee is executed when denemo starts. Many commands will simply
call general purpose edits from the definitions in init-edits (and as
usual there can be a custom version under .denemo/actions/editscripts).
For example all the text markings (Allegro, Andante, D.C.Alfine ...) can
use the same routine. I was tempted to propose that we exploit the menu
hierarchy to allow them to inherit editing methods from a general text
marking, but the menu system was not set up for that.

In the first implementation we can stick to single types of edits.

Comments welcome, Nils will be pleased to know that I have kept a copy
of this design document in my notes:-)
Richard





reply via email to

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