StrongED logo

StrongED Home Page
- Experiment 2 -


Experiments with StrongED - 2

By Gavin Wraith

 

The default mode is BaseMode. The other modes simply augment, or override, it. Many features of a mode can be set in the Mode Choices dialog box.

Other features have to be specified in the mode's ModeFile and must be written in StrongED's own command language. BaseMode's ModeFile will be displayed if you click Ctrl-Adjust on StrongED's iconbar icon.

It is a commonplace that programming languages can use variables to denote expressions. Thus

x = "this is some text"

is a piece of text in BBC BASIC. The variable x is defined in it to denote the literal text this is some text. The doublequote characters are used by BASIC to distinguish the literal text. Other languages may use other means to distinguish which parts of the program text refer to literal text; position, for example. Consider the command

echo hello there

in an Obeyfile. The word echo is a command, whereas hello there is literal text. If we put in doublequotes here we do not get the same result.

In BBC BASIC, as in other languages, we distinguish between a number 57 and a string "57". Many languages, not BBC BASIC unfortunately, deal with patterns that can occur in text. It took time for people to realize the advantages of distinguishing separate types of value; that boolean values are distinct from number values, for example, - a distinction that BASIC fails to make but which was recognized fairly early in the history of programming. The distinction between patterns and strings took a little longer to sink in. Similarly, replacement strings (other languages talk of format strings) should really be distinguished from plain vanilla strings. Many languages, and among them StrongED's command language, use strings to denote patterns, with certain characters, known as magic characters, playing a special role. This means that there has to be an escape character to indicate that the character following is to be taken in its literal and non-magical sense. In C, for example, the backslash (\) is used as an escape character.

These observations should be kept in mind if you look at StrongED's help files, because the use of variables defining patterns is fundamental to StrongED's command language. I do not intend to rehearse, or even summarize, these help files here. I mentioned in part 1 that I use a non-standard BaseMode Modefile. Instead, I will describe the steps I took to modify the standard one.

The first thing I wanted to do was get rid of the icons in the smartbar that I knew I was not going to use. Scroll down in the BaseMode Modefile until you reach

#--- Toolbar and mode-menu functions
Functions

The lines starting --->Icon define the icons in the smartbar, from left to right. The lines that follow each of these commands specify how they behave. The first group I removed (or commented out by inserting # at the beginning of the line) was

---->Icon--->---->Lot
---->Help--->---->HBM_low
---->Key---->---->c-L
---->Select->---->ListOfWindows

---->Adjust->---->OpenDialogueBox(LoadFile)

This removed the ListOfWindows icon (I very rarely have more than a couple of windows open at the same time). As well as removing groups I also changed the order in which the groups appeared in the ModeFile. For some groups I provided my own icons, which must go in BaseMode.Sprites or BaseMode.Sprites22. For what happens when you click on,or drag to, an icon it is useful to consult Help->Reference section->List of Functions from StrongED's iconbar menu. In this way it is not too difficult to create new facilities for your own modes, but remember that a mode's own smartbar icons will appear to the right of those provided by the BaseMode. Similarly, the menu items that you provide in a mode's Modefile will appear beneath those furnished by the BaseMode.

So, at least superficially, it is not too difficult to personalize StrongED. It goes without saying that you should always put your modified files only in StrED_cfg, leaving StrongED itself alone. That way, if you are over-ambitious or if your syntax is not correct, you can always restore StrongED to its proper state.

Valid HTML 3.2! RISC OS