Mode Aid - A Desktop Mode Utility
by Richard G. Hallas

This is an updated version (Version 1.42) of the application from the Volume 5 Issue 3 disc. The modifications are detailed at the end of this help file.

This program is intended to sit on the icon bar the whole time the machine is running, and provide a much neater way of changing between modes than that offered by the Palette Utility.

In addition, Mode Aid will display full information about modes; either the mode currently being used, or any mode which you pick from a list.

How to use Mode Aid
-------------------

Double-click to load as usual. There will be a slight pause before the icon appears, as the program has to find out which modes are available and update its internal list.

User preferences may be saved, and these are reloaded each time Mode Aid is started. If this file is not available for some reason, you will be informed at this stage, and default settings will be used.

Once loaded, the icon (which is supposed to look like a mini-desktop) will sit on the icon bar. A white number in the centre of the icon always shows the number of the mode currently being used.

Clicking Menu on the icon brings up a menu with the usual Info and Quit options, and three others. Of these three central options, two have sub-menu pointers.

Choosing 'Mode Info' leads to a window which displays all the important characteristics of a screen mode. If accessed from the menu, this window will always give information about the mode which is currently in use. Some items, e.g. 'Gap mode', are only seen rarely, whenever they are valid. Most of the information displayed in this window is fairly straightforward. It is displayed graphically, with the black rectangle meant to represent the screen, and the screen resolutions displayed by the side of the screen to which they refer. The memory readout is intended to show how much memory is required for the mode ON THE MACHINE BEING USED. Therefore, on a 1MB machine (with an 8K page-size), Mode 12 would require just 80K. However, on a 4MB machine (with a 32K page-size) it would require 96K. The number shown here is therefore the same as that which appears in the Task Manager. A figure in light grey following this main number shows the actual memory required by the screen mode, before consideration of page-sizes. This is the figure which is rounded up to the nearest 8K, 16K or 32K depending on the size of the machine's memory.

The other icon-bar menu item with a sub-menu pointer leads to the Modes menu. This menu is a repository for mode numbers, and is user-definable. It always has at least one entry, namely 'To Mode', and this entry simply allows you to enter a mode number at the keyboard as in the Palette Utility's Mode menu. Press Return or select the 'To Mode' menu item to change to that mode. If you enter the current screen mode nothing will happen. If you leave the entry blank, the feature will be disabled. As a shortcut, choosing the 'Modes' option itself on the icon-bar menu will switch to this mode, assuming the feature is enabled.

The only other icon-bar menu option leads to the Control window, where the more important and specialised functions are performed. There are four basic functions which can be accessed in this window and these will be described in turn. To use a selected function, click on the mode number from the table of numbers displayed in the lower portion of the window.

1. Get mode info
----------------

This simply opens the Mode Info window described above, but this time with information about the mode you have selected from the table. If closed, the Mode Info window will be opened in the centre of the screen, but if it is open already it will just be updated, so you can move it out of the way of the mode table.

2. Select mode
--------------

This simply switches the desktop mode to the one you clicked, assuming it is available.

3. Add mode to menu
-------------------

This is where the customisation feature comes in. Most users have a small number of screen modes which they use frequently, but not all of which appear in the Palette Utility's menu. Clicking on the table of mode numbers with this function selected will add the mode numbers to the Modes menu. You may not duplicate modes on the menu; trying to do so will simply cause a beep. Each time a mode is added, the updated menu is opened for your inspection. The modes are added in numerical order, with the smallest number at the top of the menu. If the current screen mode appears on the menu, it will be ticked.

Note: if you create a very long list of mode numbers which is taller than the screen, a scroll bar is added to the side of the menu, so all the items can still be accessed. Due to a bug in the Wimp, the red dashed line separating the list of modes from the bottom two menu items is omitted when the menu is scrolled to reveal its position. (This may not be true in RISC OS 3.)

4. Remove from menu
-------------------

This is of course the opposite of (3). Selecting a mode from the table will remove it from the menu and open the menu for your inspection. Trying to remove a mode which is not on the menu causes a beep.

With any of the above four functions, if a mode which you select from the table has been deleted and has therefore become unavailable, it will be greyed out when you click it, and the selected function will not operate. The exception to this is the 'Remove mode' function, which will remove the mode from the menu before greying it out.

Other features
--------------

A further feature of Mode Aid is the ability to switch between two desktop modes by clicking Select or Adjust on the icon-bar icon. The two modes used can be entered into the two writable icons in the Control window. If you leave either box blank, then when you press Return or click the icon-bar icon, both boxes will be blanked out, and the feature is disabled. If both numbers are the same, then clicking the icon-bar icon will change to that mode, but once in it, the function will again be disabled.

The 'Update modes' icon, if clicked, will go through the whole list of modes to check their validity. This is useful if you have loaded some extra modes since Mode Aid was started.

Finally, there is a 'Save setup' icon. Clicking this will save the user-defined menu, the 'To Mode' entry and the two switching-modes in a file which is automatically loaded upon startup. A beep will acknowledge the save. If for some reason the save fails, you will be informed and allowed to try again.

Mode Aid supports extensive interactive help via Acorn's !Help or !Spy applications. This help is context-sensitive within the Control window.

Updates
-------

Version 1.26 of Mode Aid was released on the disc for RISC User, Volume 5 Issue 3. Version 1.42 contains the following improvements:

- The vertical graphic resolution in the Mode Info window was incorrect for Gap modes. (This bug was corrected in version 1.27.) Thanks to Mr Ken Cowap for pointing this out.

- For 'BBC Gap' modes and Teletext modes, the Mode Info window now also displays 'Text only', and puts 'n/a' in the graphic resolution icons, since graphic commands do not work in these modes, and they cannot be used with the desktop.

- Clicking on the 'Modes' item on the icon bar menu used to open the submenu directly. Now, as a convenient shortcut, it switches to the mode number contained in the 'To mode' submenu option.

- Clicking in the Modes menu with Adjust used to produce strange effects, including the tick appearing against the wrong mode entry. This has been corrected, as has menu handling in general.

- A tick now also appears against the 'To mode' submenu entry if it is displaying the current mode.

- Error handling has been improved, and Mode Aid now checks any mode change before performing it; if the mode has been deleted or is unavailable, an error will be generated and no mode change will take place.

- The minimum memory required for any given mode is displayed to the right of the memory used display in light grey, rounded to the nearest 1K. On 1MB machines the two figures will usually be the same, but not always. It is this figure which is rounded up to the nearest page boundary, this being a multiple of 8K, 16K and 32K for 1MB, 2MB and 4MB machines respectively.

- When writing this application in the first place, I did not notice the last two mode variables in the PRM (as they are rather hidden by a block of text preceding them, and appear detached from the rest of the list). These two variables give the resolution of the screen in pixels. Mode Aid previously worked these out by a rather convoluted method, but now it reads them directly. Although this does not give any visible difference when using the program, we can at least be sure that these figures will always be correct.

- The Mode Info window now displays the number of OS units for all graphic modes as well as the display of screen pixels.

- The various colourful icons in the Mode Info window have been redistributed to give them a more sensible layout, and in order to accommodate the OS units displays. Since the X and Y Eigenfactors relate to the scaling of text, these have been moved next to the text resolution labels (and re-coloured), and their old positions (and colour) next to the graphic resolution displays have been inherited by the new OS units displays. Some of the other labels have also been moved and neatened up slightly.

- A cute little white-on-blue 'i' icon has been added to the info box (to draw attention to the next enhancement). Release-clicking on this icon generates an alert message. (This is of course intentional!) The copyright message has also been made less gaudy, although it is no less arresting.

- The interactive help facility has been enhanced, and now gives full details about all the contents of the Mode Info window (as well as the Control window, about which it gave info previously). A few of the Control window help messages have been made slightly less wordy in order to save memory.

- A bug was introduced into version 1.32 which meant that clicking on the icon bar icon when the 'switch-mode' settings were the same, continually changed into the same mode. This is now fixed.

- When the 'Select mode' function is on, clicking a mode number in the table will now only change to the mode if it is not currently selected.

- Another very minor bug which opened the Mode Info window when deleting a non-existent mode from the table has now been corrected.

- A small modification has stopped Mode Aid from loading the icon sprite !ModeAid (which is unnecessary) into its own sprite area. This saves about K, and is the only thing which finally allowed the compressed !RunImage to continue running in 32K!

Note: Mode Aid now occupies a 32K wimpslot, but fills it to bursting point! The Basic source code is supplied, but is a little less intelligible than in previous versions because a lot of single-statement lines have been brought together in order to save a few bytes memory (it really was necessary!). Anyway, the meaningful variable and procedure names (and REM statements) have been retained, so it is still reasonably easy to follow if you wish to examine it.

 RISC User 1992
