Wimp Interface for Basic Editor
by John Kitchener

This application is based on BEdit by Mike Summerton, which originally appeared in RISC User 3:7, and has a large number of extra features to make the interface with the Basic Editor even more flexible. Before using this application you must copy the BasicEdit module from the Modules directory on Applications Disc 2 into the !BEdit2.Files directory. Note that users of RISC OS 3 do not have the Basic Editor module provided, as Edit under RISC OS 3 can handle Basic programs directly.

Purpose
-------
This application provides easy access to the Basic Editor via an icon on the icon bar, which is installed when the application is run. The application has many options for loading, saving and printing Basic files and will give helpful messages to the Help application supplied on Applications Disc 1.

Using BEdit2
------------
Dragging a Basic program onto the icon bar icon will result in the program being loaded into the Basic Editor, while clicking on the icon bar icon enters the Editor with no program. Holding down Shift while dragging a file or clicking on the icon results in Basic being entered rather than the Editor.

Four function keys are set up for use from within the Editor:

Ctrl-Shift-F3
Creates a Basic file called 'BasBuff' in the !BEdit2 application directory and then returns to the Desktop. This file contains the Basic program that was being edited. This key can be used as a temporary return to the Desktop, and clicking Select on the icon bar icon will reload this file into the Editor so editing can continue. If you wish to save the edited file from the Desktop, click Menu on the icon bar icon and choose the Save option. A standard save box will be shown, from which you can drag the Basic icon to the required directory and the edited Basic file will be saved and 'BasBuff' deleted.

Ctrl-Shift-F4
Returns to the Desktop. The program being edited must be saved using function key F3 before exiting this way or any changes will be lost.

Ctrl-Shift-F12
Exits from the Basic Editor to Basic and runs the program.

Ctrl-Shift-Print
Generates a file of type Listing containing a text listing of the Basic program being edited. This can be dragged to a printer driver when you return to the Desktop. The filename used for the listing is derived from the name of the Basic file being edited, whose name is truncated to eight chars long and '_L' appended to the end; thus '!RunImage' would be listed to '!RunImag_L'.

NOTE: When you exit to the Desktop with Ctrl-Shift-F3 the icon bar icon will blink to show that an edit is in progress. Saving the file from the icon bar menu will cancel this 'pending edit' state and the icon will return to normal. If you attempt to edit another file while a previous file is 'pending' an error message will be produced.

BEdit2 Menu Options
-------------------
Clicking Menu on the icon bar icon shows a menu containing the following:
 Info     displays a standard Info box
 Options  displays a submenu as detailed below
 Save     displays a standard Save box
 Quit     quits the application

The Options submenu is as follows:

File Load: This option leads to a dialogue box with 3 radio buttons: Autoload On, User Prompt and Autoload Off. These three buttons control the actions of BEdit2 when you double-click on a Basic file. With Auto On selected the Basic file will be loaded and the Basic Editor will be entered automatically. With User Prompt selected a dialogue box will be displayed asking the user if he wishes to Edit this file. If OK is clicked the file will be edited, and if Cancel is clicked the file will be passed back to the RISC OS Filer and will be *Run. With Auto Off selected BEdit2 will do nothing, and the Basic file will be *Run by the Filer in the normal way.

File Save: This option also leads to a dialogue box with 3 radio buttons: Source Path, Default Path and a user entered pathname. With Source Path selected the Basic file will be saved in the same directory as the source file (if the same name is used the source file will be overwritten). With Default Path selected the Basic file will always be saved to the default directory (see below). With user pathname selected the Basic file will be saved to the directory as shown in the writable icon.

Print: This leads to a dialogue box identical to the File Save box above, and all actions are the same but operate on the Print file, not on the Basic saving option.

Save Optns: This saves the current option settings to disc (including any user pathnames) in a file called 'Options' within the !BEdit2 application directory. This file is reloaded and the saved options are selected whenever BEdit2 is run.

NOTE: The user selectable pathnames in the Save and Print option windows must be full pathnames, including filing system, root, and directories. If an attempt is made to set the pathname to anything less than a root directory then it will be set to the current value of <Root$Dir>.

BEdit2 has error checking routines and can determine if a program is Basic before opening the Editor; click on the Cancel icon to abort the edit, or click on OK if you do wish to continue with a non-Basic file... but be warned the Basic Editor may crash.

System Variables
----------------
<Bedit2File$Name> - holds the name of the file being edited or 'NoName' if the Editor was started without a file.

<Bedit2Save$Path> - holds the return filepath of the file being edited.

<Bedit2New$Path>  - holds the default filepath for a new Basic file.

<Bedit2Prnt$Name> - holds the filename of the Listing file generated by Ctrl-Shift-Print.

<Bedit2Edit$Flag> - TRUE if in 'pending edit' state, FALSE otherwise.

When you click Select on the icon bar icon to open the Editor without a Basic file, the path stored in <Bedit2New$Path> is used to specify where the new file will be saved. The default filepath in <Bedit2New$Path> can be set to your own system requirements by editing the !BEdit2.Files.!Run2 file; as supplied the path set will be that contained in <Root$Dir>, which is defined to point to the root directory of this magazine disc.

If Save Options is set to Default then all files will be saved using the <Bedit2New$Path> pathname.

Listing Filetype
----------------
Listing files have filetype &0BA to distinguish them from normal text files. If dragged to the Printer Driver they will be 'Pretty Printed' by the driver provided the BEdit2 application has been seen by the Filer. If BEdit2 has not been seen then the driver will ask the user what to do with the file.

NOTE: After pressing Ctrl-Shift-Print within the Editor the Basic text is sent to a buffer file within the !Bedit2 application; the final Listing type file is not produced until the user returns to the Desktop. When a long listing file has to be processed several seconds of Hourglass activity may occur before the Desktop is entered.

 RISC User 1992
