denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] Scheme Interface: a refinement


From: Richard Shann
Subject: [Denemo-devel] Scheme Interface: a refinement
Date: Tue, 23 Sep 2008 17:29:20 +0100

There is a subtlety to accessing the dialog commands from Scheme. A
script might reasonably want to do one of three things
        - supply what the user might supply
        - actually let the user choose, with optionally a suggested default
        - run the dialog just as it would be from the menuitem

For example, the OpenTemplate dialog could be run by a script to open a
particular template, or to let the user choose one from a suggested
template directory, or choose one from Denemo's currently preferred
directory.
Likewise, the (d-InitialClef), which at present invokes the dialog with
the last chosen clef as default choice, could be invoked from Scheme
either to set a specific clef, or run the dialog with a suggested choice
or run the dialog with the last chosen clef.
We have one GString type parameter for all this:
I propose
(d-InitialClef) runs the dialog as normal
(d-InitialClef "treble") sets the initial clef to treble
(d-InitialClef "\0treble") runs the dialog with treble as the default
choice.
and similarly for other dialogs. 
The way to think about the semantics of the parameter is that it is a
sequence of NULL terminated strings, the first being the value being
forced (so, no dialog) or, if NULL the second is the suggested value, if
that is also NULL then it can be omitted.

(BTW I think we are skating on thin ice using optional parameters - I
haven't seen anything that positively states the the SCM_STRINGP(x) call
is guaranteed not to access memory at x unless it is a pointer to a
valid Scheme object, but it seems to be so. It does not coredump if you
pass it invalid pointers. If it turns out not so we will need to have an
extra layer adding a dummy parameter to calls that don't have the
optional parameter).

Richard






reply via email to

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