Bintracker Internal State
(state #!optional PARAM)
Get the global application state, or a specific PARAMeter of that state.
Accessor for the main application's GUI widget structure, which is a
Accessor for the default repl buffer widget which is an instance of
(let* ((color-scheme '()) (set-colors (lambda (#!key background background-inactive row-highlight-major row-highlight-minor cursor text text-inactive text-1 text-2 text-3 text-4 text-5 text-6 text-7) (set! color-scheme `((background . ,(or background "#222222")) (background-inactive . ,(or background-inactive "#111111")) (row-highlight-major . ,(or row-highlight-major "#444444")) (row-highlight-minor . ,(or row-highlight-minor "#333333")) (cursor . ,(or cursor "#0066cc")) (text . ,(or text "#00ee00")) (text-inactive . ,(or text-inactive "#00aa00")) (text-1 . ,(or text-1 "#00ee00")) (text-2 . ,(or text-2 "#00ee00")) ;;; numeric commands (text-3 . ,(or text-3 "#00ee00")) ;;; key commands (text-4 . ,(or text-4 "#00ee00")) ;;; reference commands (text-5 . ,(or text-5 "#00ee00")) ;;; trigger commands (text-6 . ,(or text-6 "#00ee00")) ;;; string commands (text-7 . ,(or text-7 "#00ee00")) ;;; modifier commands ))))) (begin (set-colors) (lambda args (case (car args) ((load) (call-with-input-file (string-append "config/color-schemes/" (cadr args) ".scm") (lambda (port) (let ((cs (read port))) (if (and cs (pair? cs) (eqv? 'bt-color-scheme (car cs))) (apply set-colors (cdr cs)) (warning (string-append "config/color-schemes/" (cadr args) ".scm" " is not a valid Bintracker color scheme"))))))) ((set) (alist-update! (cadr args) (caddr args) color-scheme)) (else (alist-ref (car args) color-scheme))))))
This is the interface to Bintracker's application colors. It is a procedure that can be called as follows:
Returns the current value of SETTING.
(colors 'set SETTING VAL)
Sets the current value of SETTING. VAL may be a string containing an HTML RGB color code, or a valid Tk color name.
(colors 'load COLOR-SCHEME)
Loads and applies a color scheme from a configuration file in
config/color-schemes. COLOR-SCHEME must a string naming the config file,
without path or extension.
(set-global! PREFIX OBJ PARAM VAL)
All-purpose shorthand setter, used to implement
(set-state! PARAM VAL)
Change Bintracker's internal state variables.
Return the alist of key-bindings in the given KEY-GROUP.
(set-keybinding-group! KEY-GROUP GROUP-LST)
Set the alist of keybindings in the given KEY-GROUP to GROUP-LST.
(bind-keys! KEY-GROUP KEY-SPEC ACTION . ARGS)
Create a new key binding, or replace an existing one. KEY-GROUP must
be one of
KEY-SPEC shall be a key key binding specifier, using Tk's
angular bracket syntax.
ACTION shall be the name of a procedure or quoted lambda definition,
unless KEY-GROUP is
note-entry. In that case, it should be a note
name, optionally followed by an octave offset.
(key-binding KEY-GROUP KEY-SPEC)
Look up a key binding in the keymap table. Returns
#f if KEY-SPEC` is
not bound in KEY-GROUP.
(inverse-key-binding KEY-GROUP ACTION)
Look up the key binding for ACTION in the given KEY-GROUP.
(key-binding->info KEY-GROUP ACTION)
Construct an info string for the key binding of the given ACTION in the given KEY-GROUP.
Load a keymap. NAME shall be the name of the keymap file to load,
without extension or path. Keymaps are expected to reside in
Loading a keymap does not change active bindings in a running bintracker
instance. You need to call
update-key-bindings! for changes to take
UI Focus Control
(make-focus-control #!optional (ZONES '()))
Returns a UI focus controller, which is a closure that manages the user input focus of a window (eg. a Tk toplevel). A UI buffer within a window is focussed if the buffer's specific event bindings (keypresses etc.) are active. In other words, the buffer that the user currently interacts with that buffer has focus.
A focus controller holds any number of control entries in a ring. Each control entry specifies two procedures, which perform the necessary steps to focus resp. unfocus a single UI buffer.
If you are deriving classes from
<ui-buffer>, you most likely want to
implement focus control support. To do so, you need to do the following:
- provide a slot for a focus controller
- generate a unique focus entry ID
- provide a constructor that performs the necessary steps to add the
resulting widget to the focus controller (see documentation on adding
control entries below). Usually you will want to provide
ui-unfocusmethods and register them as the focus/unfocus procedures.
Bintracker uses a controller named
focus to manage the main
application's top-level window. See below for more information.
When implementing your own top-level windows (eg. plugin dialogues) and
automatic focus traversal by Tk is not sufficient, you can use a focus
controller to manage input focus manually.
The optional ZONES argument may be a list of initial focus control entries. A control entry has the following structure:
(ID FOCUS-THUNK UNFOCUS-THUNK BUFFER)
where ID is a unique identifier, FOCUS-THUNK is a procedure with no arguments that will be called when the associated UI buffer takes focus, UNFOCUS-THUNK is a procedure with no arguments that will be called when the UI buffer loses focus, and BUFFER is the UI buffer element that owns the focus zone.
You can interact with the resulting focus controller FC as follows:
(FC 'add ID FOCUS-THUNK UNFOCUS-THUNK BUFFER ['after ID-AFTER])
Adds a focus control entry. ID, FOCUS-THUNK, and UNFOCUS-THUNK are as
described in the previous paragraph. If
after ID-AFTER is specified,
then the new zone will be added after the control entry ID-AFTER in the
controller ring. Adding an entry with an ID that already exists in the
ring has no effect.
(FC 'remove ID)
Remove the focus control entry ID from the ring.
Pass input focus control to the next entry in the ring.
Pass input focus control to the previous entry in the ring.
(FC 'set ID)
Pass input focus control to control entry ID.
Temporarily disable the focus controller. Unfocusses the currently active entry. U
Re-enable a suspended focus controller. Focus passes to the entry that last held control.
Returns the currently active focus control entry.
(FC 'assoc ID)
Returns the ui buffer associated with the focus entry ID.
List the current entries in the ring, with the active one as the first element.
The focus controller for the main application window. See
make-focus-control above for details on how to interact with focus
control. Any UI buffer within Bintracker's main application window must
register with this controller. This probably applies to your code, if you
<ui-buffer> and directly modify things within the main UI.
The Journal (Edit History)
Bintracker uses a dual undo/redo stack system to track user edits.
On every edit, the redo stack is cleared, and the executed edit action is
pushed to the undo stack, which is part of
bt-gui/Editing for a description of edit actions.
push-undo, the first element of the undo stack is popped and pushed
to the redo stack.
push-redo, the first element of the redo stack is popped
and pushed to the undo stack.
The undo stack size is limited by the
journal-limit global setting.
(make-reverse-action ACTION MMOD)
Generate an action specification that when applied, will revert the edit that results from the given edit ACTION specification.
(clipboard . ARGS)
The global application clipboard. Call this procedure with no arguments to retrieve the current contents of the clipboard. Call it as follows to copy a new chunk of data to the clipboard:
(clipboard 'put CONTENT)
Clipboard CONTENT may be any value except
#f. Any component reading from
the clipboard is responsible for checking if the current clipboard
contents are suitable for the task at hand.
MDAL field node data is commonly stored as a plain list of values (for a single field node) or a list of such lists (for multiple field nodes).