WimpWorks Editors
Introduction
WimpWorks can, in addition to
WEMs, have additional editors (eg. the subroutine
editor) integrated into it at runtime.
New editors consist of an application directory installed within
!WimpWorks.Resources.Editors .
Format of an Editor
An Editor is an application (a directory starting with an exclamation
mark - '!') containing at least three files:
- !Run - (Obey)
- !RunImage - (BASIC)
- !Sprites - (Sprite)
!Run
This file is run when WimpWorks is started and should be used to
inform WimpWorks how much memory this editor takes up. The amount will
depend on the number of variables, size of code etc. An example file is:
| !Run file for !ButtonBar, a WWv2 Editor
| © Jaffa Software 1997. All rights reserved.
Set WimpWorks$ButtonBar$Dir <Obey$Dir>
IconSprites <WimpWorks$ButtonBar$Dir>.!Sprites
If "<WimpWorks$Dir>"<>"" Then Run <WimpWorks$Dir>.Resources.AddSlot -plus 4K
!RunImage
This is the main file which contains subroutines called by the main
WimpWorks editor, the subroutines are described below (for an editor
called !ButtonBar):
- FNbuttonbar = "..." - This FN is the leafname of
the editor's directory (with the ! stripped) and should return
the prefix for the following functions. In this example it
returned "button"
- FNbutton_menu = "..." - Returns the string to
use in the "Editors" menu.
- FNbutton_init = 0 - Called exactly once when WimpWorks is
started should load any templates necessary etc.
- FNbutton_exit = (TRUE | FALSE) - Called when the user
wishes to quit WimpWorks. Should return TRUE if it is allowed or
FALSE if not.
- FNbutton_clear = 0 - Called when the current project is
being cleared, all project dependant data should be removed and
any windows reset to their initial state.
- FNbutton_load(file$) = 0 - Called when a new
project is being loaded. file$ contains the complete path
of the new project.
- FNbuton_event(num%, eva$, evb$, evc$) = 0 - Called
when an event within WimpWorks has occured.
- num% is the event number
- eva$, evb$, evc$ are the strings passed to
PROCjaffa_event or FNjaffa_event. The decode strings for
the internal events can be found in
!WimpWorks.Resources.Events
- FNbutton_save(file%) = 0 - Called when the project
is being saved. file% contains the handle of the project's
"WWv2Data" file being saved.
- FNbutton_basic_init(file%) = 0 - Called when the
project is being saved and the BASIC file produced before it
is linked with the main WimpWorks library. file% contains
the file handle. Any code saved here (which should be detokenised
BASIC) will be called exactly once when the application is started
and should perform as little as possible, ie. call a procedure
which is saved in the following function.
- FNbutton_basic_save(file%) = 0 - Called after the
above function and should be where the majority of BASIC code
is defined. The above function did not need any subroutine headers
defined, however the output of this function goes straight into
the raw file.
In all the above functions curApp$ contains the full
filename of the current project, and curEdit% contains the
current editor number, ie. yours. Your current editor number is also your
item number within editMenu% (the "Editors" menu).
!Sprites
This file is technically optional, however should be included
as then your editor will look attractive within a directory display.
Conclusion
Any queries on this specification, or on how to achieve a particular
task should be directed to the below email address or to the
mailing list.
© Jaffa Software 1998.
Last modified: Wed Aug 5 10:26:37 BST 1998
(Now uses MML)
|