M @haddad–For the preexisting TAB problem, at least on Windows or GNU/Linux, I now can offer a decent solution. It’s non-invasive, in the sense that the following snippet can be dropped into an ‘init/’ script; though it also works, of course, if added to controls.lisp, where the essential class, om:new-fun-enter-view
, resides.
(in-package :om)
;; I don't know how much of what follows is dependent on LW 8; thus, to be safe:
#+lispworks
(eval-when (:compile-toplevel :load-toplevel :execute)
(assert (>= system::*major-version-number* 8)))
(eval-when (:compile-toplevel :load-toplevel :execute)
#+lispworks (import '(sys:gesture-spec
sys:gesture-spec-data
sys:coerce-to-gesture-spec
capi::gesture-callbacks
capi:text-input-pane-complete-text
om-api::get-om-character))
#-lispworks (import 'alexandria:appendf))
;; Sanity check: gesture-spec made from #\Tab has same keycode as :om-key-tab:
(assert (eq :om-key-tab (get-om-character (code-char (gesture-spec-data (coerce-to-gesture-spec #\Tab))))))
;; TAB-completion:
(defmethod shared-initialize ((obj new-fun-enter-view) slot-names
&rest keys
&key gesture-callbacks
&allow-other-keys)
"GESTURE-CALLBACKS is priority-based: elements passed in the initialization alist override predefined bindings."
(appendf gesture-callbacks '((#\Tab . text-input-pane-complete-text)))
(apply #'call-next-method obj slot-names :gesture-callbacks gesture-callbacks keys))
And here is my explanation. Since LispWorks manages text-completion for capi::text-input-pane
ingeneral and controls.lisp already gives the OpenMusic-specific behavior, it’s just a question of telling LW when to activate it. You can do by passing (capi::text-input-pane-complete-text) to the :gesture-callbacks
initarg or the capi:text-input-pane
container (or a subclass, such as new-fun-enter-view
is), instantiated whenever (open-ttybox)
gets a call.
:gesture-callbacks
takes an association list. The format is a little flexible, but in the simplest case, each CDR designates a unary callback and each CAR a keystroke descriptor, which gets canonicalized automatically by (sys:coerce-to-gesture-spec)
.
-Jonathan