Home » Archimedes archive » Acorn User » Acorn User - Shareware Collection (1993).adf » FileTree » !FileTree/FntMenuDoc

!FileTree/FntMenuDoc

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » Acorn User - Shareware Collection (1993).adf » FileTree
Filename: !FileTree/FntMenuDoc
Read OK:
File size: 4086 bytes
Load address: 0000
Exec address: 0000
File contents

               Documentation for the FontMenu module v.1.16

                             � J.R�ling 1990
                        


                                  
                                 WARNING

 The SWI I use is NOT official allocated by ACORN. I did try to get one, but
they refused.  Why, I don't know. Probably because I have no ISV status, and
I did the work on FontMenu not on behalf of one company in particular. I did
discover though that there are a lot of people interrested, and I undestand
that some of them are actually implementing it in their code. So if anyone
at ACORN is reading this, please reconsider my request.




----------------------------------------------------------------------------

                               Introduction

 As more and more outlined fonts for the Archimedes are becoming available,
a problem arrises for applications accessing these fonts. The number of
fonts is not known in advance, so to create a font menu the application has
to figure out the number of fonts, claim enough space to hold a font menu,
and create it. This can be done in the dull single level (straight foreward)
way. This saves some space, and code complexety, but it is not prefered, as
the user will be presented by a sometimes very long menu containing items
with the same prefix, e.g. 

                             Trinity
                             Trinity.Bold
                             Trinity.Bold.Italic
                             Trinity.Medium
                             Trinity.Medium.Italic
                             etc.

 The more fonts become available, the longer this menu becomes, the more
irritating it is. 

 Many applications now are even uncapable of creating menus longer then a
certain amount. Examples of these are !Edit (48 entries), !Draw (64
entries), and even !Impression reacts sick.

 When running more then one application with a font menu, there is arises
another disadvantage of this method. Several applications using a identical
menu structure but not sharing the resource, is not the policy of Acorn on
other subjects. 

 So here is a neat solution for everyone who wants a proper font menu,
without the hassel to create one, and without claiming extra space.

                                                 
                          

                          What does FontMenu do ?

 The FontMenu module is able of creating a multi-level font menu, and lets
every application share the joy. It contains several SWI's to create, and
access this resource. If no application is using the structure anymore
(because they were all quited for example) the memory for the menu structure
will be realesed by FontMenu, so no unnecessary memory is in use. It has no
problems if more than one font directory is in use. The menu is sorted
alphabeticly (even when more than one font directoris are used), so the user
is able to find the required font at an instance. It requires a minimum of
disc access when a new menu is created. New menus are only created if one is
required, and there isn't already a valid one. When a font menu exsists, and
the user has selected a new font directory, the font menu will be rebuild as
soon as the application accesses this font menu. 

 FontMenu creates an multi-leveled font menu. In the example above this is a
menu where 'Trinity' occurs only once, but it will have a submenu containing
two items: 'Bold' and 'Medium'. Because there are two types of
'Trinity.Bold' ('Trinity.Bold' and 'Triniy.Bold.Italic') 'Bold' will have
another submenu. In this submenu the first item will be 'Plain'. This name
is made up, but it is more clear then a empty meny entry. The second entry
will of course be 'Italic'.



                          How does FontMenu work ?

 To use FontMenu it is necessary to understand how the Wimp works, and how
to create a application on the Archimedes environment. It is assumed that
the reader understands the above for the rest of this document.

 When a application wants to access the FontMenu menu structure, it has to
call SWI "FontMenu_Create" before any other FontMenu SWI's are called. This
will assure that a proper font menu structure will be available. This can be
done on initialisation of the application, but is not absolutly necessary.
When exiting the application, SWI "FontMenu_Release" has to be called, so if
this was the only application using the font menu, FontMenu can release the
memory for it. Every time SWI "FontMenu_Create" is called, a counter is
incremented, and if it was zero (this is the initial value), it will create
a new font menu. When calling SWI "FontMenu_Release", the counter is
decremented, and if it reached zero FontMenu will release the menu memory,
as no application is using the menu structure anymore.


 From here on there are two ways of programming when using FontMenu. The
first is the simple one, the second a little bit more complicated, as it
involves the use the Wimp message system.

 The easy way
 ------------
 Whenever the user opens the menu structure of the application by pressing
the MENU button, a call has to be made to FontMenu_Select with R0 pointing
to a point sepearted (zero terminated) font string, and in R1 the value 0 or
1 to tell FontMenu if it allows the user to select the SystemFont. The call
will return with a pointer to the font menu structure in R1. Now it is up to
the programmer what to do with this pointer. When passed in R1 when calling
Wimp_CreateMenu, the menu tree will consist entirely of FontMenu structures.
If the font menu should be a submenu of the applications own menu structure,
the pointer should be put in the submenu-word of the parent menu entry, and
Wimp_CreateMenu should be called with a pointer to the applications own menu
structure.

 When a menu selection was done, the application should determine by the
returned 'menu tree so far' values if the user selected a entry in the font
menu. If so, it should set an internal flag (say 'FontMenuSelected') to
TRUE, else it should set it to FALSE, so later on it is still known if the
user may have selected a new font. After that it should call SWI
"FontMenu_DecodeFontMenu" with R0 pointing to the first menu selection in
the 'menu tree so far' block wich determines the selected font. R1 should
point to a buffer to contain the answer. This buffer must be at least 48
bytes. If on return of this call R0 > 0, the user selected a new font. The
buffer passed in R1 will contain the font name (a point seperated, zero
terminated font string).

 After a menu selction, and taking appropriate actions, the application
should check the mouse button state to see if it has to call SWI
"Wimp_CreateMenu" again. If adjust was used to make the selection, it has to
check  the 'FontMenuSelected' flag to determine if the user selected a font
menu entry. If so, it should call FontMenu_Select as discribed above. This
should be done with R0 pointing to the string FontMenu_DecodeFontMenu
returned. The menu pointer returned by FontMenu_Select has to be put in the
'sub-menu pointer' word of the 'Fonts' entry. Now the call to
Wimp_CreateMenu can be done. In this way it is possible for the user to
click with adjust in the font menu, and keeping the menu on screen after the
selection.

 There is one little drawback of this method. If the user selected a new
!Fonts directory, it will be noted be the FontMenu_Select code, and a new
font menu structure will be generated. This is always the case, also with
the method discribed below. But it could be possible that the user was going
to do something else in the menu, not selecting a font at all. He could for
instance want to quit. Now he (she) has to wait for the FontMenu module to
create the new menu structure, before he (she) is able to access the 'Quit'
entry. So the next solution is to wait with calling FontMenu_Select, until
the user wants to select a new font. This can only be done by making use of
the Wimp message system. The difficult thing of this method (as discribed
later) is that the Wimp is unable to re-open the menu structure entirely
after a menu selection using the ADJUST button. So a little trick has to
solve this problem.

 The hard way
 ------------
 In the applications own menu structure, there should be a menu entry (e.g.
'Fonts') with bit 3 if its menu flags set. The application has to assure
that this bit is set whenever it calls SWI "Wimp_CreateMenu" as it may be
corrupted (see below). So whenever the user puts the pointer above the arrow
on the right of this entry, a warning message (&400C0) will be send by the
Wimp. On receiving of this message, the application should respond by calling
SWI "FontMenu_Select" with R0 pointing to a point sepearted (zero
terminated) font string, and in R1 the value 0 or 1 to tell FontMenu if it
allows the user to select the SystemFont. The font string may be a zero
length string, wich means that no current font is selected. FontMenu will
select the font in its menu structure. If 1 was passed in R1, the first item
in the menu structure will be 'SystemFonts'. In case R1 = 0, this entry will
not be there. This call will return with a pointer to the menu structure in
R1. This pointer should be passed to SWI "Wimp_CreateSubMenu".

 When a menu selection was done, the application should determine by the
returned 'menu tree so far' values if the user selected a entry in the font
menu. If so, it should set an internal flag (say 'FontMenuSelected') to
TRUE, else it should set it to FALSE, so later on it is still known if the
user may have selected a new font. After that it should call SWI
"FontMenu_DecodeFontMenu" with R0 pointing to the first menu selection in
the 'menu tree so far' block wich determines the selected font. R1 should
point to a buffer to contain the answer. This buffer must be at least 48
bytes. If on return of this call R0 > 0, the user selected a new font. The
buffer passed in R1 will contain the font name (a point seperated, zero
terminated font string).

 After a menu selction, and taking appropriate actions, the application
should check the mouse button state to see if it has to call SWI
"Wimp_CreateMenu" again. If adjust was used to make the selection, it has to
check  the 'FontMenuSelected' flag to determine if the user selected a font
menu entry. If so, it should call SWI "FontMenu_Select" as discribed above.
This should be done with R0 pointing to the string SWI
"FontMenu_DecodeFontMenu" returned.  As the MenuWarningFlag in the menu
flags of the menu entry (e.g. 'Fonts') preceding the font menu was set
(phhh!), the Wimp is unable to recreating the whole menu tree automaticly.
So a litle trick has to assure that it will work correct. The menu pointer
returned by SWI "FontMenu_Select" has to be put in the 'sub-menu pointer'
word of the 'Fonts' entry, and the MenuWarningFlag (bit 3) of the menu flags
word of this entry should be cleared. Now the call to SWI "Wimp_CreateMenu"
can be done. In this way it is possible for the user to click with adjust in
the font menu, and keeping the menu on screen after the selection. The next
time the user opens the application menu, the MenuWarningFlag (bit 3) should
be set again, as other applications may have used the font menu in the
meanwhile, and it is necessary that SWI "FontMenu_Select" is called just
before the font menu opens.

 Because some FontMenu SWI's may take some time before they return
(this is due to Font_ListFonts), the Hourglass On & Off SWI's are used
on entry and exit respectively. So in theory it is possible that
whenever one of the FontMenu SWI's take longer than 1/3 of a second, a
hourglass appears. In practice this only occurs when FontMenu_Create
or FontMenu_Select is called and they have to actually create a new
menu structure (Because of a first call, or a changed Font$Path).




                            Notes from the author

 The reason why I wrote this module, is because I'm not only a programmer,
but also a user who likes to work with the Archimedes. This is because it's
a fast machine and because most parts of Risc-OS allow applications to be
very intuitive. I didn't like the way the available fonts were presented in
most applications, so I started to figure out a proper solution: FontMenu.

 I hope that future applications adopt to this method, so please pass it on.
Everybody is free to use it, even in commercial code. The only restriction
is that this document should not be seperated from the FontMenu module, and
that both the module and this document remain unchanged. In case of
commercial use I would like to know this in advance (I could than provide
you with its latest release). My address is at the end of this document. You
can always contact me if you found some bug, or when having other
suggestions.


-----------------------------------------------------------------------------

                                FontMenu SWI's

           Below are the short discriptions of the FontMenu SWI's.
           

FontMenu_Create &8D080
----------------------
On entry: --
On exit : R0 = Number of fonts found

 This will create a font menu structure in RMA, if not already done so. An
error occurs if there is not enough room in RMA to create the menu.



FontMenu_Release &8D081
-----------------------
On entry: --
On exit : --

 This will release the memory taken by the font menu if no tasks are using
it anymore.



FontMenu_Select &8D082
----------------------
On entry: R0 = pointer to point seperated, ctrl terminated font string 
          R1 = SystemFont flag            

On exit : R0 = State flag
          R1 = pointer to font menu structure
          R2 = pointer to 'Alias' menu structure 

 This will tick the font passed in R0 on entry. R1 determines if
'SystemFont' should occur in the menu as follows:

  Value Meaning
    0   'SystemFont' does not occur in the menu
    1   'SystemFont' does occur in the menu
                         
 On exit R0 shows the selection state as follows:

  Value Meaning
    0   To be selected font not found, no ticks
    1   To be selected font found, and ticked  
    2   No font entries found, menu consists one item; 'SystemFont',
        and is ticked
                                                                                  
 R1 will point to the font menu on exit. An error occurs if no font menu exists. 



FontMenu_Deselect &8D083
------------------------
On entry: ---
On exit : --

 This will clear all ticks and marks of the font menu. It is not necessary
to call this SWI before a FontMenu_Select call, as FontMenu_Select will take
care of cleaning up old selection. An error occurs if no font menu exists. 
  
                              

FontMenu_DecodeFontMenu &8D084
------------------------------
On entry: R0 = pointer to a list of font menu selections
          R1 = pointer to a buffer to contain the answer 
               (at least 48 bytes long)
On exit : R0 = Flag (0 = non-sensible/ 1= sensible selection)

 This will decode the font menu selection into a font string for the
FontManager. This string can be passed back to FontMenu_Select to tick the
appropriate entries. An error occurs if no font menu exists. This call makes
use of Wimp_DecodeMenu, but as it is possible that the returned string ends
with 'Plain' (a made up name to distinguise an empty sub-name from the rest
of the sub-names), it has to check for this, and throw away this last
sub-name so the FontManager can recognise the required font. 
  On exit R0 conatains a flag telling you if the selection the user made was
a sensible one. If, for example, the user selected non-leaf menu entry (e.g.
'Trinity.Medium') then this flag will be 0. If the flag is 0, you are
advised not to do anything.



FontMenu_Smash &8D085
---------------------
On entry: --
On exit : --

 This will release the font menu memory without looking at the amount of
times FontMenu_Create was called.



FontMenu_ReCreate &8D086
------------------------
On entry: --
On exit : R0 = Number of fonts found

 This will release a existing font menu, and recreate it.



       ===========================================================

                To contact the author of FontMenu, please write to:

                                          Joris R�ling
                                          Oudestraat 186
                                          8261 CW Kampen
                                          The Netherlands

                                          Tel:05202-27989
00000000  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00000010  20 44 6f 63 75 6d 65 6e  74 61 74 69 6f 6e 20 66  | Documentation f|
00000020  6f 72 20 74 68 65 20 46  6f 6e 74 4d 65 6e 75 20  |or the FontMenu |
00000030  6d 6f 64 75 6c 65 20 76  2e 31 2e 31 36 0a 0a 20  |module v.1.16.. |
00000040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 a9 20 4a 2e  |            . J.|
00000060  52 d6 6c 69 6e 67 20 31  39 39 30 0a 20 20 20 20  |R.ling 1990.    |
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000080  20 20 20 20 0a 0a 0a 20  20 20 20 20 20 20 20 20  |    ...         |
00000090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000a0  20 20 20 20 20 20 20 20  20 0a 20 20 20 20 20 20  |         .      |
000000b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000c0  20 20 20 20 20 20 20 20  20 20 20 57 41 52 4e 49  |           WARNI|
000000d0  4e 47 0a 0a 20 54 68 65  20 53 57 49 20 49 20 75  |NG.. The SWI I u|
000000e0  73 65 20 69 73 20 4e 4f  54 20 6f 66 66 69 63 69  |se is NOT offici|
000000f0  61 6c 20 61 6c 6c 6f 63  61 74 65 64 20 62 79 20  |al allocated by |
00000100  41 43 4f 52 4e 2e 20 49  20 64 69 64 20 74 72 79  |ACORN. I did try|
00000110  20 74 6f 20 67 65 74 20  6f 6e 65 2c 20 62 75 74  | to get one, but|
00000120  0a 74 68 65 79 20 72 65  66 75 73 65 64 2e 20 20  |.they refused.  |
00000130  57 68 79 2c 20 49 20 64  6f 6e 27 74 20 6b 6e 6f  |Why, I don't kno|
00000140  77 2e 20 50 72 6f 62 61  62 6c 79 20 62 65 63 61  |w. Probably beca|
00000150  75 73 65 20 49 20 68 61  76 65 20 6e 6f 20 49 53  |use I have no IS|
00000160  56 20 73 74 61 74 75 73  2c 20 61 6e 64 0a 49 20  |V status, and.I |
00000170  64 69 64 20 74 68 65 20  77 6f 72 6b 20 6f 6e 20  |did the work on |
00000180  46 6f 6e 74 4d 65 6e 75  20 6e 6f 74 20 6f 6e 20  |FontMenu not on |
00000190  62 65 68 61 6c 66 20 6f  66 20 6f 6e 65 20 63 6f  |behalf of one co|
000001a0  6d 70 61 6e 79 20 69 6e  20 70 61 72 74 69 63 75  |mpany in particu|
000001b0  6c 61 72 2e 20 49 20 64  69 64 0a 64 69 73 63 6f  |lar. I did.disco|
000001c0  76 65 72 20 74 68 6f 75  67 68 20 74 68 61 74 20  |ver though that |
000001d0  74 68 65 72 65 20 61 72  65 20 61 20 6c 6f 74 20  |there are a lot |
000001e0  6f 66 20 70 65 6f 70 6c  65 20 69 6e 74 65 72 72  |of people interr|
000001f0  65 73 74 65 64 2c 20 61  6e 64 20 49 20 75 6e 64  |ested, and I und|
00000200  65 73 74 61 6e 64 0a 74  68 61 74 20 73 6f 6d 65  |estand.that some|
00000210  20 6f 66 20 74 68 65 6d  20 61 72 65 20 61 63 74  | of them are act|
00000220  75 61 6c 6c 79 20 69 6d  70 6c 65 6d 65 6e 74 69  |ually implementi|
00000230  6e 67 20 69 74 20 69 6e  20 74 68 65 69 72 20 63  |ng it in their c|
00000240  6f 64 65 2e 20 53 6f 20  69 66 20 61 6e 79 6f 6e  |ode. So if anyon|
00000250  65 0a 61 74 20 41 43 4f  52 4e 20 69 73 20 72 65  |e.at ACORN is re|
00000260  61 64 69 6e 67 20 74 68  69 73 2c 20 70 6c 65 61  |ading this, plea|
00000270  73 65 20 72 65 63 6f 6e  73 69 64 65 72 20 6d 79  |se reconsider my|
00000280  20 72 65 71 75 65 73 74  2e 0a 0a 0a 0a 0a 2d 2d  | request......--|
00000290  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000002d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 20 20 20 20  |----------..    |
000002e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002f0  20 20 20 20 20 20 20 20  20 20 20 49 6e 74 72 6f  |           Intro|
00000300  64 75 63 74 69 6f 6e 0a  0a 20 41 73 20 6d 6f 72  |duction.. As mor|
00000310  65 20 61 6e 64 20 6d 6f  72 65 20 6f 75 74 6c 69  |e and more outli|
00000320  6e 65 64 20 66 6f 6e 74  73 20 66 6f 72 20 74 68  |ned fonts for th|
00000330  65 20 41 72 63 68 69 6d  65 64 65 73 20 61 72 65  |e Archimedes are|
00000340  20 62 65 63 6f 6d 69 6e  67 20 61 76 61 69 6c 61  | becoming availa|
00000350  62 6c 65 2c 0a 61 20 70  72 6f 62 6c 65 6d 20 61  |ble,.a problem a|
00000360  72 72 69 73 65 73 20 66  6f 72 20 61 70 70 6c 69  |rrises for appli|
00000370  63 61 74 69 6f 6e 73 20  61 63 63 65 73 73 69 6e  |cations accessin|
00000380  67 20 74 68 65 73 65 20  66 6f 6e 74 73 2e 20 54  |g these fonts. T|
00000390  68 65 20 6e 75 6d 62 65  72 20 6f 66 0a 66 6f 6e  |he number of.fon|
000003a0  74 73 20 69 73 20 6e 6f  74 20 6b 6e 6f 77 6e 20  |ts is not known |
000003b0  69 6e 20 61 64 76 61 6e  63 65 2c 20 73 6f 20 74  |in advance, so t|
000003c0  6f 20 63 72 65 61 74 65  20 61 20 66 6f 6e 74 20  |o create a font |
000003d0  6d 65 6e 75 20 74 68 65  20 61 70 70 6c 69 63 61  |menu the applica|
000003e0  74 69 6f 6e 20 68 61 73  0a 74 6f 20 66 69 67 75  |tion has.to figu|
000003f0  72 65 20 6f 75 74 20 74  68 65 20 6e 75 6d 62 65  |re out the numbe|
00000400  72 20 6f 66 20 66 6f 6e  74 73 2c 20 63 6c 61 69  |r of fonts, clai|
00000410  6d 20 65 6e 6f 75 67 68  20 73 70 61 63 65 20 74  |m enough space t|
00000420  6f 20 68 6f 6c 64 20 61  20 66 6f 6e 74 20 6d 65  |o hold a font me|
00000430  6e 75 2c 0a 61 6e 64 20  63 72 65 61 74 65 20 69  |nu,.and create i|
00000440  74 2e 20 54 68 69 73 20  63 61 6e 20 62 65 20 64  |t. This can be d|
00000450  6f 6e 65 20 69 6e 20 74  68 65 20 64 75 6c 6c 20  |one in the dull |
00000460  73 69 6e 67 6c 65 20 6c  65 76 65 6c 20 28 73 74  |single level (st|
00000470  72 61 69 67 68 74 20 66  6f 72 65 77 61 72 64 29  |raight foreward)|
00000480  0a 77 61 79 2e 20 54 68  69 73 20 73 61 76 65 73  |.way. This saves|
00000490  20 73 6f 6d 65 20 73 70  61 63 65 2c 20 61 6e 64  | some space, and|
000004a0  20 63 6f 64 65 20 63 6f  6d 70 6c 65 78 65 74 79  | code complexety|
000004b0  2c 20 62 75 74 20 69 74  20 69 73 20 6e 6f 74 20  |, but it is not |
000004c0  70 72 65 66 65 72 65 64  2c 20 61 73 0a 74 68 65  |prefered, as.the|
000004d0  20 75 73 65 72 20 77 69  6c 6c 20 62 65 20 70 72  | user will be pr|
000004e0  65 73 65 6e 74 65 64 20  62 79 20 61 20 73 6f 6d  |esented by a som|
000004f0  65 74 69 6d 65 73 20 76  65 72 79 20 6c 6f 6e 67  |etimes very long|
00000500  20 6d 65 6e 75 20 63 6f  6e 74 61 69 6e 69 6e 67  | menu containing|
00000510  20 69 74 65 6d 73 0a 77  69 74 68 20 74 68 65 20  | items.with the |
00000520  73 61 6d 65 20 70 72 65  66 69 78 2c 20 65 2e 67  |same prefix, e.g|
00000530  2e 20 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |. ..            |
00000540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000550  20 54 72 69 6e 69 74 79  0a 20 20 20 20 20 20 20  | Trinity.       |
00000560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000570  20 20 20 20 20 20 54 72  69 6e 69 74 79 2e 42 6f  |      Trinity.Bo|
00000580  6c 64 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |ld.             |
00000590  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000005a0  54 72 69 6e 69 74 79 2e  42 6f 6c 64 2e 49 74 61  |Trinity.Bold.Ita|
000005b0  6c 69 63 0a 20 20 20 20  20 20 20 20 20 20 20 20  |lic.            |
000005c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000005d0  20 54 72 69 6e 69 74 79  2e 4d 65 64 69 75 6d 0a  | Trinity.Medium.|
000005e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000005f0  20 20 20 20 20 20 20 20  20 20 20 20 20 54 72 69  |             Tri|
00000600  6e 69 74 79 2e 4d 65 64  69 75 6d 2e 49 74 61 6c  |nity.Medium.Ital|
00000610  69 63 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |ic.             |
00000620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000630  65 74 63 2e 0a 0a 20 54  68 65 20 6d 6f 72 65 20  |etc... The more |
00000640  66 6f 6e 74 73 20 62 65  63 6f 6d 65 20 61 76 61  |fonts become ava|
00000650  69 6c 61 62 6c 65 2c 20  74 68 65 20 6c 6f 6e 67  |ilable, the long|
00000660  65 72 20 74 68 69 73 20  6d 65 6e 75 20 62 65 63  |er this menu bec|
00000670  6f 6d 65 73 2c 20 74 68  65 20 6d 6f 72 65 0a 69  |omes, the more.i|
00000680  72 72 69 74 61 74 69 6e  67 20 69 74 20 69 73 2e  |rritating it is.|
00000690  20 0a 0a 20 4d 61 6e 79  20 61 70 70 6c 69 63 61  | .. Many applica|
000006a0  74 69 6f 6e 73 20 6e 6f  77 20 61 72 65 20 65 76  |tions now are ev|
000006b0  65 6e 20 75 6e 63 61 70  61 62 6c 65 20 6f 66 20  |en uncapable of |
000006c0  63 72 65 61 74 69 6e 67  20 6d 65 6e 75 73 20 6c  |creating menus l|
000006d0  6f 6e 67 65 72 20 74 68  65 6e 20 61 0a 63 65 72  |onger then a.cer|
000006e0  74 61 69 6e 20 61 6d 6f  75 6e 74 2e 20 45 78 61  |tain amount. Exa|
000006f0  6d 70 6c 65 73 20 6f 66  20 74 68 65 73 65 20 61  |mples of these a|
00000700  72 65 20 21 45 64 69 74  20 28 34 38 20 65 6e 74  |re !Edit (48 ent|
00000710  72 69 65 73 29 2c 20 21  44 72 61 77 20 28 36 34  |ries), !Draw (64|
00000720  0a 65 6e 74 72 69 65 73  29 2c 20 61 6e 64 20 65  |.entries), and e|
00000730  76 65 6e 20 21 49 6d 70  72 65 73 73 69 6f 6e 20  |ven !Impression |
00000740  72 65 61 63 74 73 20 73  69 63 6b 2e 0a 0a 20 57  |reacts sick... W|
00000750  68 65 6e 20 72 75 6e 6e  69 6e 67 20 6d 6f 72 65  |hen running more|
00000760  20 74 68 65 6e 20 6f 6e  65 20 61 70 70 6c 69 63  | then one applic|
00000770  61 74 69 6f 6e 20 77 69  74 68 20 61 20 66 6f 6e  |ation with a fon|
00000780  74 20 6d 65 6e 75 2c 20  74 68 65 72 65 20 69 73  |t menu, there is|
00000790  20 61 72 69 73 65 73 0a  61 6e 6f 74 68 65 72 20  | arises.another |
000007a0  64 69 73 61 64 76 61 6e  74 61 67 65 20 6f 66 20  |disadvantage of |
000007b0  74 68 69 73 20 6d 65 74  68 6f 64 2e 20 53 65 76  |this method. Sev|
000007c0  65 72 61 6c 20 61 70 70  6c 69 63 61 74 69 6f 6e  |eral application|
000007d0  73 20 75 73 69 6e 67 20  61 20 69 64 65 6e 74 69  |s using a identi|
000007e0  63 61 6c 0a 6d 65 6e 75  20 73 74 72 75 63 74 75  |cal.menu structu|
000007f0  72 65 20 62 75 74 20 6e  6f 74 20 73 68 61 72 69  |re but not shari|
00000800  6e 67 20 74 68 65 20 72  65 73 6f 75 72 63 65 2c  |ng the resource,|
00000810  20 69 73 20 6e 6f 74 20  74 68 65 20 70 6f 6c 69  | is not the poli|
00000820  63 79 20 6f 66 20 41 63  6f 72 6e 20 6f 6e 0a 6f  |cy of Acorn on.o|
00000830  74 68 65 72 20 73 75 62  6a 65 63 74 73 2e 20 0a  |ther subjects. .|
00000840  0a 20 53 6f 20 68 65 72  65 20 69 73 20 61 20 6e  |. So here is a n|
00000850  65 61 74 20 73 6f 6c 75  74 69 6f 6e 20 66 6f 72  |eat solution for|
00000860  20 65 76 65 72 79 6f 6e  65 20 77 68 6f 20 77 61  | everyone who wa|
00000870  6e 74 73 20 61 20 70 72  6f 70 65 72 20 66 6f 6e  |nts a proper fon|
00000880  74 20 6d 65 6e 75 2c 0a  77 69 74 68 6f 75 74 20  |t menu,.without |
00000890  74 68 65 20 68 61 73 73  65 6c 20 74 6f 20 63 72  |the hassel to cr|
000008a0  65 61 74 65 20 6f 6e 65  2c 20 61 6e 64 20 77 69  |eate one, and wi|
000008b0  74 68 6f 75 74 20 63 6c  61 69 6d 69 6e 67 20 65  |thout claiming e|
000008c0  78 74 72 61 20 73 70 61  63 65 2e 0a 0a 20 20 20  |xtra space...   |
000008d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000008f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 0a 20  |              . |
00000900  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000910  20 20 20 20 20 20 20 20  20 0a 0a 20 20 20 20 20  |         ..     |
00000920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000930  20 20 20 20 20 57 68 61  74 20 64 6f 65 73 20 46  |     What does F|
00000940  6f 6e 74 4d 65 6e 75 20  64 6f 20 3f 0a 0a 20 54  |ontMenu do ?.. T|
00000950  68 65 20 46 6f 6e 74 4d  65 6e 75 20 6d 6f 64 75  |he FontMenu modu|
00000960  6c 65 20 69 73 20 61 62  6c 65 20 6f 66 20 63 72  |le is able of cr|
00000970  65 61 74 69 6e 67 20 61  20 6d 75 6c 74 69 2d 6c  |eating a multi-l|
00000980  65 76 65 6c 20 66 6f 6e  74 20 6d 65 6e 75 2c 20  |evel font menu, |
00000990  61 6e 64 20 6c 65 74 73  0a 65 76 65 72 79 20 61  |and lets.every a|
000009a0  70 70 6c 69 63 61 74 69  6f 6e 20 73 68 61 72 65  |pplication share|
000009b0  20 74 68 65 20 6a 6f 79  2e 20 49 74 20 63 6f 6e  | the joy. It con|
000009c0  74 61 69 6e 73 20 73 65  76 65 72 61 6c 20 53 57  |tains several SW|
000009d0  49 27 73 20 74 6f 20 63  72 65 61 74 65 2c 20 61  |I's to create, a|
000009e0  6e 64 0a 61 63 63 65 73  73 20 74 68 69 73 20 72  |nd.access this r|
000009f0  65 73 6f 75 72 63 65 2e  20 49 66 20 6e 6f 20 61  |esource. If no a|
00000a00  70 70 6c 69 63 61 74 69  6f 6e 20 69 73 20 75 73  |pplication is us|
00000a10  69 6e 67 20 74 68 65 20  73 74 72 75 63 74 75 72  |ing the structur|
00000a20  65 20 61 6e 79 6d 6f 72  65 0a 28 62 65 63 61 75  |e anymore.(becau|
00000a30  73 65 20 74 68 65 79 20  77 65 72 65 20 61 6c 6c  |se they were all|
00000a40  20 71 75 69 74 65 64 20  66 6f 72 20 65 78 61 6d  | quited for exam|
00000a50  70 6c 65 29 20 74 68 65  20 6d 65 6d 6f 72 79 20  |ple) the memory |
00000a60  66 6f 72 20 74 68 65 20  6d 65 6e 75 20 73 74 72  |for the menu str|
00000a70  75 63 74 75 72 65 0a 77  69 6c 6c 20 62 65 20 72  |ucture.will be r|
00000a80  65 61 6c 65 73 65 64 20  62 79 20 46 6f 6e 74 4d  |ealesed by FontM|
00000a90  65 6e 75 2c 20 73 6f 20  6e 6f 20 75 6e 6e 65 63  |enu, so no unnec|
00000aa0  65 73 73 61 72 79 20 6d  65 6d 6f 72 79 20 69 73  |essary memory is|
00000ab0  20 69 6e 20 75 73 65 2e  20 49 74 20 68 61 73 20  | in use. It has |
00000ac0  6e 6f 0a 70 72 6f 62 6c  65 6d 73 20 69 66 20 6d  |no.problems if m|
00000ad0  6f 72 65 20 74 68 61 6e  20 6f 6e 65 20 66 6f 6e  |ore than one fon|
00000ae0  74 20 64 69 72 65 63 74  6f 72 79 20 69 73 20 69  |t directory is i|
00000af0  6e 20 75 73 65 2e 20 54  68 65 20 6d 65 6e 75 20  |n use. The menu |
00000b00  69 73 20 73 6f 72 74 65  64 0a 61 6c 70 68 61 62  |is sorted.alphab|
00000b10  65 74 69 63 6c 79 20 28  65 76 65 6e 20 77 68 65  |eticly (even whe|
00000b20  6e 20 6d 6f 72 65 20 74  68 61 6e 20 6f 6e 65 20  |n more than one |
00000b30  66 6f 6e 74 20 64 69 72  65 63 74 6f 72 69 73 20  |font directoris |
00000b40  61 72 65 20 75 73 65 64  29 2c 20 73 6f 20 74 68  |are used), so th|
00000b50  65 20 75 73 65 72 0a 69  73 20 61 62 6c 65 20 74  |e user.is able t|
00000b60  6f 20 66 69 6e 64 20 74  68 65 20 72 65 71 75 69  |o find the requi|
00000b70  72 65 64 20 66 6f 6e 74  20 61 74 20 61 6e 20 69  |red font at an i|
00000b80  6e 73 74 61 6e 63 65 2e  20 49 74 20 72 65 71 75  |nstance. It requ|
00000b90  69 72 65 73 20 61 20 6d  69 6e 69 6d 75 6d 20 6f  |ires a minimum o|
00000ba0  66 0a 64 69 73 63 20 61  63 63 65 73 73 20 77 68  |f.disc access wh|
00000bb0  65 6e 20 61 20 6e 65 77  20 6d 65 6e 75 20 69 73  |en a new menu is|
00000bc0  20 63 72 65 61 74 65 64  2e 20 4e 65 77 20 6d 65  | created. New me|
00000bd0  6e 75 73 20 61 72 65 20  6f 6e 6c 79 20 63 72 65  |nus are only cre|
00000be0  61 74 65 64 20 69 66 20  6f 6e 65 20 69 73 0a 72  |ated if one is.r|
00000bf0  65 71 75 69 72 65 64 2c  20 61 6e 64 20 74 68 65  |equired, and the|
00000c00  72 65 20 69 73 6e 27 74  20 61 6c 72 65 61 64 79  |re isn't already|
00000c10  20 61 20 76 61 6c 69 64  20 6f 6e 65 2e 20 57 68  | a valid one. Wh|
00000c20  65 6e 20 61 20 66 6f 6e  74 20 6d 65 6e 75 20 65  |en a font menu e|
00000c30  78 73 69 73 74 73 2c 20  61 6e 64 0a 74 68 65 20  |xsists, and.the |
00000c40  75 73 65 72 20 68 61 73  20 73 65 6c 65 63 74 65  |user has selecte|
00000c50  64 20 61 20 6e 65 77 20  66 6f 6e 74 20 64 69 72  |d a new font dir|
00000c60  65 63 74 6f 72 79 2c 20  74 68 65 20 66 6f 6e 74  |ectory, the font|
00000c70  20 6d 65 6e 75 20 77 69  6c 6c 20 62 65 20 72 65  | menu will be re|
00000c80  62 75 69 6c 64 20 61 73  0a 73 6f 6f 6e 20 61 73  |build as.soon as|
00000c90  20 74 68 65 20 61 70 70  6c 69 63 61 74 69 6f 6e  | the application|
00000ca0  20 61 63 63 65 73 73 65  73 20 74 68 69 73 20 66  | accesses this f|
00000cb0  6f 6e 74 20 6d 65 6e 75  2e 20 0a 0a 20 46 6f 6e  |ont menu. .. Fon|
00000cc0  74 4d 65 6e 75 20 63 72  65 61 74 65 73 20 61 6e  |tMenu creates an|
00000cd0  20 6d 75 6c 74 69 2d 6c  65 76 65 6c 65 64 20 66  | multi-leveled f|
00000ce0  6f 6e 74 20 6d 65 6e 75  2e 20 49 6e 20 74 68 65  |ont menu. In the|
00000cf0  20 65 78 61 6d 70 6c 65  20 61 62 6f 76 65 20 74  | example above t|
00000d00  68 69 73 20 69 73 20 61  0a 6d 65 6e 75 20 77 68  |his is a.menu wh|
00000d10  65 72 65 20 27 54 72 69  6e 69 74 79 27 20 6f 63  |ere 'Trinity' oc|
00000d20  63 75 72 73 20 6f 6e 6c  79 20 6f 6e 63 65 2c 20  |curs only once, |
00000d30  62 75 74 20 69 74 20 77  69 6c 6c 20 68 61 76 65  |but it will have|
00000d40  20 61 20 73 75 62 6d 65  6e 75 20 63 6f 6e 74 61  | a submenu conta|
00000d50  69 6e 69 6e 67 0a 74 77  6f 20 69 74 65 6d 73 3a  |ining.two items:|
00000d60  20 27 42 6f 6c 64 27 20  61 6e 64 20 27 4d 65 64  | 'Bold' and 'Med|
00000d70  69 75 6d 27 2e 20 42 65  63 61 75 73 65 20 74 68  |ium'. Because th|
00000d80  65 72 65 20 61 72 65 20  74 77 6f 20 74 79 70 65  |ere are two type|
00000d90  73 20 6f 66 0a 27 54 72  69 6e 69 74 79 2e 42 6f  |s of.'Trinity.Bo|
00000da0  6c 64 27 20 28 27 54 72  69 6e 69 74 79 2e 42 6f  |ld' ('Trinity.Bo|
00000db0  6c 64 27 20 61 6e 64 20  27 54 72 69 6e 69 79 2e  |ld' and 'Triniy.|
00000dc0  42 6f 6c 64 2e 49 74 61  6c 69 63 27 29 20 27 42  |Bold.Italic') 'B|
00000dd0  6f 6c 64 27 20 77 69 6c  6c 20 68 61 76 65 0a 61  |old' will have.a|
00000de0  6e 6f 74 68 65 72 20 73  75 62 6d 65 6e 75 2e 20  |nother submenu. |
00000df0  49 6e 20 74 68 69 73 20  73 75 62 6d 65 6e 75 20  |In this submenu |
00000e00  74 68 65 20 66 69 72 73  74 20 69 74 65 6d 20 77  |the first item w|
00000e10  69 6c 6c 20 62 65 20 27  50 6c 61 69 6e 27 2e 20  |ill be 'Plain'. |
00000e20  54 68 69 73 20 6e 61 6d  65 0a 69 73 20 6d 61 64  |This name.is mad|
00000e30  65 20 75 70 2c 20 62 75  74 20 69 74 20 69 73 20  |e up, but it is |
00000e40  6d 6f 72 65 20 63 6c 65  61 72 20 74 68 65 6e 20  |more clear then |
00000e50  61 20 65 6d 70 74 79 20  6d 65 6e 79 20 65 6e 74  |a empty meny ent|
00000e60  72 79 2e 20 54 68 65 20  73 65 63 6f 6e 64 20 65  |ry. The second e|
00000e70  6e 74 72 79 0a 77 69 6c  6c 20 6f 66 20 63 6f 75  |ntry.will of cou|
00000e80  72 73 65 20 62 65 20 27  49 74 61 6c 69 63 27 2e  |rse be 'Italic'.|
00000e90  0a 0a 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |....            |
00000ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 48 6f  |              Ho|
00000eb0  77 20 64 6f 65 73 20 46  6f 6e 74 4d 65 6e 75 20  |w does FontMenu |
00000ec0  77 6f 72 6b 20 3f 0a 0a  20 54 6f 20 75 73 65 20  |work ?.. To use |
00000ed0  46 6f 6e 74 4d 65 6e 75  20 69 74 20 69 73 20 6e  |FontMenu it is n|
00000ee0  65 63 65 73 73 61 72 79  20 74 6f 20 75 6e 64 65  |ecessary to unde|
00000ef0  72 73 74 61 6e 64 20 68  6f 77 20 74 68 65 20 57  |rstand how the W|
00000f00  69 6d 70 20 77 6f 72 6b  73 2c 20 61 6e 64 20 68  |imp works, and h|
00000f10  6f 77 0a 74 6f 20 63 72  65 61 74 65 20 61 20 61  |ow.to create a a|
00000f20  70 70 6c 69 63 61 74 69  6f 6e 20 6f 6e 20 74 68  |pplication on th|
00000f30  65 20 41 72 63 68 69 6d  65 64 65 73 20 65 6e 76  |e Archimedes env|
00000f40  69 72 6f 6e 6d 65 6e 74  2e 20 49 74 20 69 73 20  |ironment. It is |
00000f50  61 73 73 75 6d 65 64 20  74 68 61 74 0a 74 68 65  |assumed that.the|
00000f60  20 72 65 61 64 65 72 20  75 6e 64 65 72 73 74 61  | reader understa|
00000f70  6e 64 73 20 74 68 65 20  61 62 6f 76 65 20 66 6f  |nds the above fo|
00000f80  72 20 74 68 65 20 72 65  73 74 20 6f 66 20 74 68  |r the rest of th|
00000f90  69 73 20 64 6f 63 75 6d  65 6e 74 2e 0a 0a 20 57  |is document... W|
00000fa0  68 65 6e 20 61 20 61 70  70 6c 69 63 61 74 69 6f  |hen a applicatio|
00000fb0  6e 20 77 61 6e 74 73 20  74 6f 20 61 63 63 65 73  |n wants to acces|
00000fc0  73 20 74 68 65 20 46 6f  6e 74 4d 65 6e 75 20 6d  |s the FontMenu m|
00000fd0  65 6e 75 20 73 74 72 75  63 74 75 72 65 2c 20 69  |enu structure, i|
00000fe0  74 20 68 61 73 20 74 6f  0a 63 61 6c 6c 20 53 57  |t has to.call SW|
00000ff0  49 20 22 46 6f 6e 74 4d  65 6e 75 5f 43 72 65 61  |I "FontMenu_Crea|
00001000  74 65 22 20 62 65 66 6f  72 65 20 61 6e 79 20 6f  |te" before any o|
00001010  74 68 65 72 20 46 6f 6e  74 4d 65 6e 75 20 53 57  |ther FontMenu SW|
00001020  49 27 73 20 61 72 65 20  63 61 6c 6c 65 64 2e 20  |I's are called. |
00001030  54 68 69 73 0a 77 69 6c  6c 20 61 73 73 75 72 65  |This.will assure|
00001040  20 74 68 61 74 20 61 20  70 72 6f 70 65 72 20 66  | that a proper f|
00001050  6f 6e 74 20 6d 65 6e 75  20 73 74 72 75 63 74 75  |ont menu structu|
00001060  72 65 20 77 69 6c 6c 20  62 65 20 61 76 61 69 6c  |re will be avail|
00001070  61 62 6c 65 2e 20 54 68  69 73 20 63 61 6e 20 62  |able. This can b|
00001080  65 0a 64 6f 6e 65 20 6f  6e 20 69 6e 69 74 69 61  |e.done on initia|
00001090  6c 69 73 61 74 69 6f 6e  20 6f 66 20 74 68 65 20  |lisation of the |
000010a0  61 70 70 6c 69 63 61 74  69 6f 6e 2c 20 62 75 74  |application, but|
000010b0  20 69 73 20 6e 6f 74 20  61 62 73 6f 6c 75 74 6c  | is not absolutl|
000010c0  79 20 6e 65 63 65 73 73  61 72 79 2e 0a 57 68 65  |y necessary..Whe|
000010d0  6e 20 65 78 69 74 69 6e  67 20 74 68 65 20 61 70  |n exiting the ap|
000010e0  70 6c 69 63 61 74 69 6f  6e 2c 20 53 57 49 20 22  |plication, SWI "|
000010f0  46 6f 6e 74 4d 65 6e 75  5f 52 65 6c 65 61 73 65  |FontMenu_Release|
00001100  22 20 68 61 73 20 74 6f  20 62 65 20 63 61 6c 6c  |" has to be call|
00001110  65 64 2c 20 73 6f 20 69  66 0a 74 68 69 73 20 77  |ed, so if.this w|
00001120  61 73 20 74 68 65 20 6f  6e 6c 79 20 61 70 70 6c  |as the only appl|
00001130  69 63 61 74 69 6f 6e 20  75 73 69 6e 67 20 74 68  |ication using th|
00001140  65 20 66 6f 6e 74 20 6d  65 6e 75 2c 20 46 6f 6e  |e font menu, Fon|
00001150  74 4d 65 6e 75 20 63 61  6e 20 72 65 6c 65 61 73  |tMenu can releas|
00001160  65 20 74 68 65 0a 6d 65  6d 6f 72 79 20 66 6f 72  |e the.memory for|
00001170  20 69 74 2e 20 45 76 65  72 79 20 74 69 6d 65 20  | it. Every time |
00001180  53 57 49 20 22 46 6f 6e  74 4d 65 6e 75 5f 43 72  |SWI "FontMenu_Cr|
00001190  65 61 74 65 22 20 69 73  20 63 61 6c 6c 65 64 2c  |eate" is called,|
000011a0  20 61 20 63 6f 75 6e 74  65 72 20 69 73 0a 69 6e  | a counter is.in|
000011b0  63 72 65 6d 65 6e 74 65  64 2c 20 61 6e 64 20 69  |cremented, and i|
000011c0  66 20 69 74 20 77 61 73  20 7a 65 72 6f 20 28 74  |f it was zero (t|
000011d0  68 69 73 20 69 73 20 74  68 65 20 69 6e 69 74 69  |his is the initi|
000011e0  61 6c 20 76 61 6c 75 65  29 2c 20 69 74 20 77 69  |al value), it wi|
000011f0  6c 6c 20 63 72 65 61 74  65 0a 61 20 6e 65 77 20  |ll create.a new |
00001200  66 6f 6e 74 20 6d 65 6e  75 2e 20 57 68 65 6e 20  |font menu. When |
00001210  63 61 6c 6c 69 6e 67 20  53 57 49 20 22 46 6f 6e  |calling SWI "Fon|
00001220  74 4d 65 6e 75 5f 52 65  6c 65 61 73 65 22 2c 20  |tMenu_Release", |
00001230  74 68 65 20 63 6f 75 6e  74 65 72 20 69 73 0a 64  |the counter is.d|
00001240  65 63 72 65 6d 65 6e 74  65 64 2c 20 61 6e 64 20  |ecremented, and |
00001250  69 66 20 69 74 20 72 65  61 63 68 65 64 20 7a 65  |if it reached ze|
00001260  72 6f 20 46 6f 6e 74 4d  65 6e 75 20 77 69 6c 6c  |ro FontMenu will|
00001270  20 72 65 6c 65 61 73 65  20 74 68 65 20 6d 65 6e  | release the men|
00001280  75 20 6d 65 6d 6f 72 79  2c 0a 61 73 20 6e 6f 20  |u memory,.as no |
00001290  61 70 70 6c 69 63 61 74  69 6f 6e 20 69 73 20 75  |application is u|
000012a0  73 69 6e 67 20 74 68 65  20 6d 65 6e 75 20 73 74  |sing the menu st|
000012b0  72 75 63 74 75 72 65 20  61 6e 79 6d 6f 72 65 2e  |ructure anymore.|
000012c0  0a 0a 0a 20 46 72 6f 6d  20 68 65 72 65 20 6f 6e  |... From here on|
000012d0  20 74 68 65 72 65 20 61  72 65 20 74 77 6f 20 77  | there are two w|
000012e0  61 79 73 20 6f 66 20 70  72 6f 67 72 61 6d 6d 69  |ays of programmi|
000012f0  6e 67 20 77 68 65 6e 20  75 73 69 6e 67 20 46 6f  |ng when using Fo|
00001300  6e 74 4d 65 6e 75 2e 20  54 68 65 0a 66 69 72 73  |ntMenu. The.firs|
00001310  74 20 69 73 20 74 68 65  20 73 69 6d 70 6c 65 20  |t is the simple |
00001320  6f 6e 65 2c 20 74 68 65  20 73 65 63 6f 6e 64 20  |one, the second |
00001330  61 20 6c 69 74 74 6c 65  20 62 69 74 20 6d 6f 72  |a little bit mor|
00001340  65 20 63 6f 6d 70 6c 69  63 61 74 65 64 2c 20 61  |e complicated, a|
00001350  73 20 69 74 0a 69 6e 76  6f 6c 76 65 73 20 74 68  |s it.involves th|
00001360  65 20 75 73 65 20 74 68  65 20 57 69 6d 70 20 6d  |e use the Wimp m|
00001370  65 73 73 61 67 65 20 73  79 73 74 65 6d 2e 0a 0a  |essage system...|
00001380  20 54 68 65 20 65 61 73  79 20 77 61 79 0a 20 2d  | The easy way. -|
00001390  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 20 57 68 65  |-----------. Whe|
000013a0  6e 65 76 65 72 20 74 68  65 20 75 73 65 72 20 6f  |never the user o|
000013b0  70 65 6e 73 20 74 68 65  20 6d 65 6e 75 20 73 74  |pens the menu st|
000013c0  72 75 63 74 75 72 65 20  6f 66 20 74 68 65 20 61  |ructure of the a|
000013d0  70 70 6c 69 63 61 74 69  6f 6e 20 62 79 20 70 72  |pplication by pr|
000013e0  65 73 73 69 6e 67 0a 74  68 65 20 4d 45 4e 55 20  |essing.the MENU |
000013f0  62 75 74 74 6f 6e 2c 20  61 20 63 61 6c 6c 20 68  |button, a call h|
00001400  61 73 20 74 6f 20 62 65  20 6d 61 64 65 20 74 6f  |as to be made to|
00001410  20 46 6f 6e 74 4d 65 6e  75 5f 53 65 6c 65 63 74  | FontMenu_Select|
00001420  20 77 69 74 68 20 52 30  20 70 6f 69 6e 74 69 6e  | with R0 pointin|
00001430  67 0a 74 6f 20 61 20 70  6f 69 6e 74 20 73 65 70  |g.to a point sep|
00001440  65 61 72 74 65 64 20 28  7a 65 72 6f 20 74 65 72  |earted (zero ter|
00001450  6d 69 6e 61 74 65 64 29  20 66 6f 6e 74 20 73 74  |minated) font st|
00001460  72 69 6e 67 2c 20 61 6e  64 20 69 6e 20 52 31 20  |ring, and in R1 |
00001470  74 68 65 20 76 61 6c 75  65 20 30 20 6f 72 0a 31  |the value 0 or.1|
00001480  20 74 6f 20 74 65 6c 6c  20 46 6f 6e 74 4d 65 6e  | to tell FontMen|
00001490  75 20 69 66 20 69 74 20  61 6c 6c 6f 77 73 20 74  |u if it allows t|
000014a0  68 65 20 75 73 65 72 20  74 6f 20 73 65 6c 65 63  |he user to selec|
000014b0  74 20 74 68 65 20 53 79  73 74 65 6d 46 6f 6e 74  |t the SystemFont|
000014c0  2e 20 54 68 65 20 63 61  6c 6c 0a 77 69 6c 6c 20  |. The call.will |
000014d0  72 65 74 75 72 6e 20 77  69 74 68 20 61 20 70 6f  |return with a po|
000014e0  69 6e 74 65 72 20 74 6f  20 74 68 65 20 66 6f 6e  |inter to the fon|
000014f0  74 20 6d 65 6e 75 20 73  74 72 75 63 74 75 72 65  |t menu structure|
00001500  20 69 6e 20 52 31 2e 20  4e 6f 77 20 69 74 20 69  | in R1. Now it i|
00001510  73 20 75 70 20 74 6f 0a  74 68 65 20 70 72 6f 67  |s up to.the prog|
00001520  72 61 6d 6d 65 72 20 77  68 61 74 20 74 6f 20 64  |rammer what to d|
00001530  6f 20 77 69 74 68 20 74  68 69 73 20 70 6f 69 6e  |o with this poin|
00001540  74 65 72 2e 20 57 68 65  6e 20 70 61 73 73 65 64  |ter. When passed|
00001550  20 69 6e 20 52 31 20 77  68 65 6e 20 63 61 6c 6c  | in R1 when call|
00001560  69 6e 67 0a 57 69 6d 70  5f 43 72 65 61 74 65 4d  |ing.Wimp_CreateM|
00001570  65 6e 75 2c 20 74 68 65  20 6d 65 6e 75 20 74 72  |enu, the menu tr|
00001580  65 65 20 77 69 6c 6c 20  63 6f 6e 73 69 73 74 20  |ee will consist |
00001590  65 6e 74 69 72 65 6c 79  20 6f 66 20 46 6f 6e 74  |entirely of Font|
000015a0  4d 65 6e 75 20 73 74 72  75 63 74 75 72 65 73 2e  |Menu structures.|
000015b0  0a 49 66 20 74 68 65 20  66 6f 6e 74 20 6d 65 6e  |.If the font men|
000015c0  75 20 73 68 6f 75 6c 64  20 62 65 20 61 20 73 75  |u should be a su|
000015d0  62 6d 65 6e 75 20 6f 66  20 74 68 65 20 61 70 70  |bmenu of the app|
000015e0  6c 69 63 61 74 69 6f 6e  73 20 6f 77 6e 20 6d 65  |lications own me|
000015f0  6e 75 20 73 74 72 75 63  74 75 72 65 2c 0a 74 68  |nu structure,.th|
00001600  65 20 70 6f 69 6e 74 65  72 20 73 68 6f 75 6c 64  |e pointer should|
00001610  20 62 65 20 70 75 74 20  69 6e 20 74 68 65 20 73  | be put in the s|
00001620  75 62 6d 65 6e 75 2d 77  6f 72 64 20 6f 66 20 74  |ubmenu-word of t|
00001630  68 65 20 70 61 72 65 6e  74 20 6d 65 6e 75 20 65  |he parent menu e|
00001640  6e 74 72 79 2c 20 61 6e  64 0a 57 69 6d 70 5f 43  |ntry, and.Wimp_C|
00001650  72 65 61 74 65 4d 65 6e  75 20 73 68 6f 75 6c 64  |reateMenu should|
00001660  20 62 65 20 63 61 6c 6c  65 64 20 77 69 74 68 20  | be called with |
00001670  61 20 70 6f 69 6e 74 65  72 20 74 6f 20 74 68 65  |a pointer to the|
00001680  20 61 70 70 6c 69 63 61  74 69 6f 6e 73 20 6f 77  | applications ow|
00001690  6e 20 6d 65 6e 75 0a 73  74 72 75 63 74 75 72 65  |n menu.structure|
000016a0  2e 0a 0a 20 57 68 65 6e  20 61 20 6d 65 6e 75 20  |... When a menu |
000016b0  73 65 6c 65 63 74 69 6f  6e 20 77 61 73 20 64 6f  |selection was do|
000016c0  6e 65 2c 20 74 68 65 20  61 70 70 6c 69 63 61 74  |ne, the applicat|
000016d0  69 6f 6e 20 73 68 6f 75  6c 64 20 64 65 74 65 72  |ion should deter|
000016e0  6d 69 6e 65 20 62 79 20  74 68 65 0a 72 65 74 75  |mine by the.retu|
000016f0  72 6e 65 64 20 27 6d 65  6e 75 20 74 72 65 65 20  |rned 'menu tree |
00001700  73 6f 20 66 61 72 27 20  76 61 6c 75 65 73 20 69  |so far' values i|
00001710  66 20 74 68 65 20 75 73  65 72 20 73 65 6c 65 63  |f the user selec|
00001720  74 65 64 20 61 20 65 6e  74 72 79 20 69 6e 20 74  |ted a entry in t|
00001730  68 65 20 66 6f 6e 74 0a  6d 65 6e 75 2e 20 49 66  |he font.menu. If|
00001740  20 73 6f 2c 20 69 74 20  73 68 6f 75 6c 64 20 73  | so, it should s|
00001750  65 74 20 61 6e 20 69 6e  74 65 72 6e 61 6c 20 66  |et an internal f|
00001760  6c 61 67 20 28 73 61 79  20 27 46 6f 6e 74 4d 65  |lag (say 'FontMe|
00001770  6e 75 53 65 6c 65 63 74  65 64 27 29 20 74 6f 0a  |nuSelected') to.|
00001780  54 52 55 45 2c 20 65 6c  73 65 20 69 74 20 73 68  |TRUE, else it sh|
00001790  6f 75 6c 64 20 73 65 74  20 69 74 20 74 6f 20 46  |ould set it to F|
000017a0  41 4c 53 45 2c 20 73 6f  20 6c 61 74 65 72 20 6f  |ALSE, so later o|
000017b0  6e 20 69 74 20 69 73 20  73 74 69 6c 6c 20 6b 6e  |n it is still kn|
000017c0  6f 77 6e 20 69 66 20 74  68 65 0a 75 73 65 72 20  |own if the.user |
000017d0  6d 61 79 20 68 61 76 65  20 73 65 6c 65 63 74 65  |may have selecte|
000017e0  64 20 61 20 6e 65 77 20  66 6f 6e 74 2e 20 41 66  |d a new font. Af|
000017f0  74 65 72 20 74 68 61 74  20 69 74 20 73 68 6f 75  |ter that it shou|
00001800  6c 64 20 63 61 6c 6c 20  53 57 49 0a 22 46 6f 6e  |ld call SWI."Fon|
00001810  74 4d 65 6e 75 5f 44 65  63 6f 64 65 46 6f 6e 74  |tMenu_DecodeFont|
00001820  4d 65 6e 75 22 20 77 69  74 68 20 52 30 20 70 6f  |Menu" with R0 po|
00001830  69 6e 74 69 6e 67 20 74  6f 20 74 68 65 20 66 69  |inting to the fi|
00001840  72 73 74 20 6d 65 6e 75  20 73 65 6c 65 63 74 69  |rst menu selecti|
00001850  6f 6e 20 69 6e 0a 74 68  65 20 27 6d 65 6e 75 20  |on in.the 'menu |
00001860  74 72 65 65 20 73 6f 20  66 61 72 27 20 62 6c 6f  |tree so far' blo|
00001870  63 6b 20 77 69 63 68 20  64 65 74 65 72 6d 69 6e  |ck wich determin|
00001880  65 73 20 74 68 65 20 73  65 6c 65 63 74 65 64 20  |es the selected |
00001890  66 6f 6e 74 2e 20 52 31  20 73 68 6f 75 6c 64 0a  |font. R1 should.|
000018a0  70 6f 69 6e 74 20 74 6f  20 61 20 62 75 66 66 65  |point to a buffe|
000018b0  72 20 74 6f 20 63 6f 6e  74 61 69 6e 20 74 68 65  |r to contain the|
000018c0  20 61 6e 73 77 65 72 2e  20 54 68 69 73 20 62 75  | answer. This bu|
000018d0  66 66 65 72 20 6d 75 73  74 20 62 65 20 61 74 20  |ffer must be at |
000018e0  6c 65 61 73 74 20 34 38  0a 62 79 74 65 73 2e 20  |least 48.bytes. |
000018f0  49 66 20 6f 6e 20 72 65  74 75 72 6e 20 6f 66 20  |If on return of |
00001900  74 68 69 73 20 63 61 6c  6c 20 52 30 20 3e 20 30  |this call R0 > 0|
00001910  2c 20 74 68 65 20 75 73  65 72 20 73 65 6c 65 63  |, the user selec|
00001920  74 65 64 20 61 20 6e 65  77 20 66 6f 6e 74 2e 20  |ted a new font. |
00001930  54 68 65 0a 62 75 66 66  65 72 20 70 61 73 73 65  |The.buffer passe|
00001940  64 20 69 6e 20 52 31 20  77 69 6c 6c 20 63 6f 6e  |d in R1 will con|
00001950  74 61 69 6e 20 74 68 65  20 66 6f 6e 74 20 6e 61  |tain the font na|
00001960  6d 65 20 28 61 20 70 6f  69 6e 74 20 73 65 70 65  |me (a point sepe|
00001970  72 61 74 65 64 2c 20 7a  65 72 6f 0a 74 65 72 6d  |rated, zero.term|
00001980  69 6e 61 74 65 64 20 66  6f 6e 74 20 73 74 72 69  |inated font stri|
00001990  6e 67 29 2e 0a 0a 20 41  66 74 65 72 20 61 20 6d  |ng)... After a m|
000019a0  65 6e 75 20 73 65 6c 63  74 69 6f 6e 2c 20 61 6e  |enu selction, an|
000019b0  64 20 74 61 6b 69 6e 67  20 61 70 70 72 6f 70 72  |d taking appropr|
000019c0  69 61 74 65 20 61 63 74  69 6f 6e 73 2c 20 74 68  |iate actions, th|
000019d0  65 20 61 70 70 6c 69 63  61 74 69 6f 6e 0a 73 68  |e application.sh|
000019e0  6f 75 6c 64 20 63 68 65  63 6b 20 74 68 65 20 6d  |ould check the m|
000019f0  6f 75 73 65 20 62 75 74  74 6f 6e 20 73 74 61 74  |ouse button stat|
00001a00  65 20 74 6f 20 73 65 65  20 69 66 20 69 74 20 68  |e to see if it h|
00001a10  61 73 20 74 6f 20 63 61  6c 6c 20 53 57 49 0a 22  |as to call SWI."|
00001a20  57 69 6d 70 5f 43 72 65  61 74 65 4d 65 6e 75 22  |Wimp_CreateMenu"|
00001a30  20 61 67 61 69 6e 2e 20  49 66 20 61 64 6a 75 73  | again. If adjus|
00001a40  74 20 77 61 73 20 75 73  65 64 20 74 6f 20 6d 61  |t was used to ma|
00001a50  6b 65 20 74 68 65 20 73  65 6c 65 63 74 69 6f 6e  |ke the selection|
00001a60  2c 20 69 74 20 68 61 73  20 74 6f 0a 63 68 65 63  |, it has to.chec|
00001a70  6b 20 20 74 68 65 20 27  46 6f 6e 74 4d 65 6e 75  |k  the 'FontMenu|
00001a80  53 65 6c 65 63 74 65 64  27 20 66 6c 61 67 20 74  |Selected' flag t|
00001a90  6f 20 64 65 74 65 72 6d  69 6e 65 20 69 66 20 74  |o determine if t|
00001aa0  68 65 20 75 73 65 72 20  73 65 6c 65 63 74 65 64  |he user selected|
00001ab0  20 61 20 66 6f 6e 74 0a  6d 65 6e 75 20 65 6e 74  | a font.menu ent|
00001ac0  72 79 2e 20 49 66 20 73  6f 2c 20 69 74 20 73 68  |ry. If so, it sh|
00001ad0  6f 75 6c 64 20 63 61 6c  6c 20 46 6f 6e 74 4d 65  |ould call FontMe|
00001ae0  6e 75 5f 53 65 6c 65 63  74 20 61 73 20 64 69 73  |nu_Select as dis|
00001af0  63 72 69 62 65 64 20 61  62 6f 76 65 2e 20 54 68  |cribed above. Th|
00001b00  69 73 0a 73 68 6f 75 6c  64 20 62 65 20 64 6f 6e  |is.should be don|
00001b10  65 20 77 69 74 68 20 52  30 20 70 6f 69 6e 74 69  |e with R0 pointi|
00001b20  6e 67 20 74 6f 20 74 68  65 20 73 74 72 69 6e 67  |ng to the string|
00001b30  20 46 6f 6e 74 4d 65 6e  75 5f 44 65 63 6f 64 65  | FontMenu_Decode|
00001b40  46 6f 6e 74 4d 65 6e 75  0a 72 65 74 75 72 6e 65  |FontMenu.returne|
00001b50  64 2e 20 54 68 65 20 6d  65 6e 75 20 70 6f 69 6e  |d. The menu poin|
00001b60  74 65 72 20 72 65 74 75  72 6e 65 64 20 62 79 20  |ter returned by |
00001b70  46 6f 6e 74 4d 65 6e 75  5f 53 65 6c 65 63 74 20  |FontMenu_Select |
00001b80  68 61 73 20 74 6f 20 62  65 20 70 75 74 20 69 6e  |has to be put in|
00001b90  20 74 68 65 0a 27 73 75  62 2d 6d 65 6e 75 20 70  | the.'sub-menu p|
00001ba0  6f 69 6e 74 65 72 27 20  77 6f 72 64 20 6f 66 20  |ointer' word of |
00001bb0  74 68 65 20 27 46 6f 6e  74 73 27 20 65 6e 74 72  |the 'Fonts' entr|
00001bc0  79 2e 20 4e 6f 77 20 74  68 65 20 63 61 6c 6c 20  |y. Now the call |
00001bd0  74 6f 0a 57 69 6d 70 5f  43 72 65 61 74 65 4d 65  |to.Wimp_CreateMe|
00001be0  6e 75 20 63 61 6e 20 62  65 20 64 6f 6e 65 2e 20  |nu can be done. |
00001bf0  49 6e 20 74 68 69 73 20  77 61 79 20 69 74 20 69  |In this way it i|
00001c00  73 20 70 6f 73 73 69 62  6c 65 20 66 6f 72 20 74  |s possible for t|
00001c10  68 65 20 75 73 65 72 20  74 6f 0a 63 6c 69 63 6b  |he user to.click|
00001c20  20 77 69 74 68 20 61 64  6a 75 73 74 20 69 6e 20  | with adjust in |
00001c30  74 68 65 20 66 6f 6e 74  20 6d 65 6e 75 2c 20 61  |the font menu, a|
00001c40  6e 64 20 6b 65 65 70 69  6e 67 20 74 68 65 20 6d  |nd keeping the m|
00001c50  65 6e 75 20 6f 6e 20 73  63 72 65 65 6e 20 61 66  |enu on screen af|
00001c60  74 65 72 20 74 68 65 0a  73 65 6c 65 63 74 69 6f  |ter the.selectio|
00001c70  6e 2e 0a 0a 20 54 68 65  72 65 20 69 73 20 6f 6e  |n... There is on|
00001c80  65 20 6c 69 74 74 6c 65  20 64 72 61 77 62 61 63  |e little drawbac|
00001c90  6b 20 6f 66 20 74 68 69  73 20 6d 65 74 68 6f 64  |k of this method|
00001ca0  2e 20 49 66 20 74 68 65  20 75 73 65 72 20 73 65  |. If the user se|
00001cb0  6c 65 63 74 65 64 20 61  20 6e 65 77 0a 21 46 6f  |lected a new.!Fo|
00001cc0  6e 74 73 20 64 69 72 65  63 74 6f 72 79 2c 20 69  |nts directory, i|
00001cd0  74 20 77 69 6c 6c 20 62  65 20 6e 6f 74 65 64 20  |t will be noted |
00001ce0  62 65 20 74 68 65 20 46  6f 6e 74 4d 65 6e 75 5f  |be the FontMenu_|
00001cf0  53 65 6c 65 63 74 20 63  6f 64 65 2c 20 61 6e 64  |Select code, and|
00001d00  20 61 20 6e 65 77 0a 66  6f 6e 74 20 6d 65 6e 75  | a new.font menu|
00001d10  20 73 74 72 75 63 74 75  72 65 20 77 69 6c 6c 20  | structure will |
00001d20  62 65 20 67 65 6e 65 72  61 74 65 64 2e 20 54 68  |be generated. Th|
00001d30  69 73 20 69 73 20 61 6c  77 61 79 73 20 74 68 65  |is is always the|
00001d40  20 63 61 73 65 2c 20 61  6c 73 6f 20 77 69 74 68  | case, also with|
00001d50  0a 74 68 65 20 6d 65 74  68 6f 64 20 64 69 73 63  |.the method disc|
00001d60  72 69 62 65 64 20 62 65  6c 6f 77 2e 20 42 75 74  |ribed below. But|
00001d70  20 69 74 20 63 6f 75 6c  64 20 62 65 20 70 6f 73  | it could be pos|
00001d80  73 69 62 6c 65 20 74 68  61 74 20 74 68 65 20 75  |sible that the u|
00001d90  73 65 72 20 77 61 73 20  67 6f 69 6e 67 0a 74 6f  |ser was going.to|
00001da0  20 64 6f 20 73 6f 6d 65  74 68 69 6e 67 20 65 6c  | do something el|
00001db0  73 65 20 69 6e 20 74 68  65 20 6d 65 6e 75 2c 20  |se in the menu, |
00001dc0  6e 6f 74 20 73 65 6c 65  63 74 69 6e 67 20 61 20  |not selecting a |
00001dd0  66 6f 6e 74 20 61 74 20  61 6c 6c 2e 20 48 65 20  |font at all. He |
00001de0  63 6f 75 6c 64 20 66 6f  72 0a 69 6e 73 74 61 6e  |could for.instan|
00001df0  63 65 20 77 61 6e 74 20  74 6f 20 71 75 69 74 2e  |ce want to quit.|
00001e00  20 4e 6f 77 20 68 65 20  28 73 68 65 29 20 68 61  | Now he (she) ha|
00001e10  73 20 74 6f 20 77 61 69  74 20 66 6f 72 20 74 68  |s to wait for th|
00001e20  65 20 46 6f 6e 74 4d 65  6e 75 20 6d 6f 64 75 6c  |e FontMenu modul|
00001e30  65 20 74 6f 0a 63 72 65  61 74 65 20 74 68 65 20  |e to.create the |
00001e40  6e 65 77 20 6d 65 6e 75  20 73 74 72 75 63 74 75  |new menu structu|
00001e50  72 65 2c 20 62 65 66 6f  72 65 20 68 65 20 28 73  |re, before he (s|
00001e60  68 65 29 20 69 73 20 61  62 6c 65 20 74 6f 20 61  |he) is able to a|
00001e70  63 63 65 73 73 20 74 68  65 20 27 51 75 69 74 27  |ccess the 'Quit'|
00001e80  0a 65 6e 74 72 79 2e 20  53 6f 20 74 68 65 20 6e  |.entry. So the n|
00001e90  65 78 74 20 73 6f 6c 75  74 69 6f 6e 20 69 73 20  |ext solution is |
00001ea0  74 6f 20 77 61 69 74 20  77 69 74 68 20 63 61 6c  |to wait with cal|
00001eb0  6c 69 6e 67 20 46 6f 6e  74 4d 65 6e 75 5f 53 65  |ling FontMenu_Se|
00001ec0  6c 65 63 74 2c 20 75 6e  74 69 6c 0a 74 68 65 20  |lect, until.the |
00001ed0  75 73 65 72 20 77 61 6e  74 73 20 74 6f 20 73 65  |user wants to se|
00001ee0  6c 65 63 74 20 61 20 6e  65 77 20 66 6f 6e 74 2e  |lect a new font.|
00001ef0  20 54 68 69 73 20 63 61  6e 20 6f 6e 6c 79 20 62  | This can only b|
00001f00  65 20 64 6f 6e 65 20 62  79 20 6d 61 6b 69 6e 67  |e done by making|
00001f10  20 75 73 65 20 6f 66 0a  74 68 65 20 57 69 6d 70  | use of.the Wimp|
00001f20  20 6d 65 73 73 61 67 65  20 73 79 73 74 65 6d 2e  | message system.|
00001f30  20 54 68 65 20 64 69 66  66 69 63 75 6c 74 20 74  | The difficult t|
00001f40  68 69 6e 67 20 6f 66 20  74 68 69 73 20 6d 65 74  |hing of this met|
00001f50  68 6f 64 20 28 61 73 20  64 69 73 63 72 69 62 65  |hod (as discribe|
00001f60  64 0a 6c 61 74 65 72 29  20 69 73 20 74 68 61 74  |d.later) is that|
00001f70  20 74 68 65 20 57 69 6d  70 20 69 73 20 75 6e 61  | the Wimp is una|
00001f80  62 6c 65 20 74 6f 20 72  65 2d 6f 70 65 6e 20 74  |ble to re-open t|
00001f90  68 65 20 6d 65 6e 75 20  73 74 72 75 63 74 75 72  |he menu structur|
00001fa0  65 20 65 6e 74 69 72 65  6c 79 0a 61 66 74 65 72  |e entirely.after|
00001fb0  20 61 20 6d 65 6e 75 20  73 65 6c 65 63 74 69 6f  | a menu selectio|
00001fc0  6e 20 75 73 69 6e 67 20  74 68 65 20 41 44 4a 55  |n using the ADJU|
00001fd0  53 54 20 62 75 74 74 6f  6e 2e 20 53 6f 20 61 20  |ST button. So a |
00001fe0  6c 69 74 74 6c 65 20 74  72 69 63 6b 20 68 61 73  |little trick has|
00001ff0  20 74 6f 0a 73 6f 6c 76  65 20 74 68 69 73 20 70  | to.solve this p|
00002000  72 6f 62 6c 65 6d 2e 0a  0a 20 54 68 65 20 68 61  |roblem... The ha|
00002010  72 64 20 77 61 79 0a 20  2d 2d 2d 2d 2d 2d 2d 2d  |rd way. --------|
00002020  2d 2d 2d 2d 0a 20 49 6e  20 74 68 65 20 61 70 70  |----. In the app|
00002030  6c 69 63 61 74 69 6f 6e  73 20 6f 77 6e 20 6d 65  |lications own me|
00002040  6e 75 20 73 74 72 75 63  74 75 72 65 2c 20 74 68  |nu structure, th|
00002050  65 72 65 20 73 68 6f 75  6c 64 20 62 65 20 61 20  |ere should be a |
00002060  6d 65 6e 75 20 65 6e 74  72 79 20 28 65 2e 67 2e  |menu entry (e.g.|
00002070  0a 27 46 6f 6e 74 73 27  29 20 77 69 74 68 20 62  |.'Fonts') with b|
00002080  69 74 20 33 20 69 66 20  69 74 73 20 6d 65 6e 75  |it 3 if its menu|
00002090  20 66 6c 61 67 73 20 73  65 74 2e 20 54 68 65 20  | flags set. The |
000020a0  61 70 70 6c 69 63 61 74  69 6f 6e 20 68 61 73 20  |application has |
000020b0  74 6f 20 61 73 73 75 72  65 0a 74 68 61 74 20 74  |to assure.that t|
000020c0  68 69 73 20 62 69 74 20  69 73 20 73 65 74 20 77  |his bit is set w|
000020d0  68 65 6e 65 76 65 72 20  69 74 20 63 61 6c 6c 73  |henever it calls|
000020e0  20 53 57 49 20 22 57 69  6d 70 5f 43 72 65 61 74  | SWI "Wimp_Creat|
000020f0  65 4d 65 6e 75 22 20 61  73 20 69 74 20 6d 61 79  |eMenu" as it may|
00002100  20 62 65 0a 63 6f 72 72  75 70 74 65 64 20 28 73  | be.corrupted (s|
00002110  65 65 20 62 65 6c 6f 77  29 2e 20 53 6f 20 77 68  |ee below). So wh|
00002120  65 6e 65 76 65 72 20 74  68 65 20 75 73 65 72 20  |enever the user |
00002130  70 75 74 73 20 74 68 65  20 70 6f 69 6e 74 65 72  |puts the pointer|
00002140  20 61 62 6f 76 65 20 74  68 65 20 61 72 72 6f 77  | above the arrow|
00002150  0a 6f 6e 20 74 68 65 20  72 69 67 68 74 20 6f 66  |.on the right of|
00002160  20 74 68 69 73 20 65 6e  74 72 79 2c 20 61 20 77  | this entry, a w|
00002170  61 72 6e 69 6e 67 20 6d  65 73 73 61 67 65 20 28  |arning message (|
00002180  26 34 30 30 43 30 29 20  77 69 6c 6c 20 62 65 20  |&400C0) will be |
00002190  73 65 6e 64 20 62 79 20  74 68 65 0a 57 69 6d 70  |send by the.Wimp|
000021a0  2e 20 4f 6e 20 72 65 63  65 69 76 69 6e 67 20 6f  |. On receiving o|
000021b0  66 20 74 68 69 73 20 6d  65 73 73 61 67 65 2c 20  |f this message, |
000021c0  74 68 65 20 61 70 70 6c  69 63 61 74 69 6f 6e 20  |the application |
000021d0  73 68 6f 75 6c 64 20 72  65 73 70 6f 6e 64 20 62  |should respond b|
000021e0  79 20 63 61 6c 6c 69 6e  67 0a 53 57 49 20 22 46  |y calling.SWI "F|
000021f0  6f 6e 74 4d 65 6e 75 5f  53 65 6c 65 63 74 22 20  |ontMenu_Select" |
00002200  77 69 74 68 20 52 30 20  70 6f 69 6e 74 69 6e 67  |with R0 pointing|
00002210  20 74 6f 20 61 20 70 6f  69 6e 74 20 73 65 70 65  | to a point sepe|
00002220  61 72 74 65 64 20 28 7a  65 72 6f 0a 74 65 72 6d  |arted (zero.term|
00002230  69 6e 61 74 65 64 29 20  66 6f 6e 74 20 73 74 72  |inated) font str|
00002240  69 6e 67 2c 20 61 6e 64  20 69 6e 20 52 31 20 74  |ing, and in R1 t|
00002250  68 65 20 76 61 6c 75 65  20 30 20 6f 72 20 31 20  |he value 0 or 1 |
00002260  74 6f 20 74 65 6c 6c 20  46 6f 6e 74 4d 65 6e 75  |to tell FontMenu|
00002270  20 69 66 20 69 74 0a 61  6c 6c 6f 77 73 20 74 68  | if it.allows th|
00002280  65 20 75 73 65 72 20 74  6f 20 73 65 6c 65 63 74  |e user to select|
00002290  20 74 68 65 20 53 79 73  74 65 6d 46 6f 6e 74 2e  | the SystemFont.|
000022a0  20 54 68 65 20 66 6f 6e  74 20 73 74 72 69 6e 67  | The font string|
000022b0  20 6d 61 79 20 62 65 20  61 20 7a 65 72 6f 0a 6c  | may be a zero.l|
000022c0  65 6e 67 74 68 20 73 74  72 69 6e 67 2c 20 77 69  |ength string, wi|
000022d0  63 68 20 6d 65 61 6e 73  20 74 68 61 74 20 6e 6f  |ch means that no|
000022e0  20 63 75 72 72 65 6e 74  20 66 6f 6e 74 20 69 73  | current font is|
000022f0  20 73 65 6c 65 63 74 65  64 2e 20 46 6f 6e 74 4d  | selected. FontM|
00002300  65 6e 75 20 77 69 6c 6c  0a 73 65 6c 65 63 74 20  |enu will.select |
00002310  74 68 65 20 66 6f 6e 74  20 69 6e 20 69 74 73 20  |the font in its |
00002320  6d 65 6e 75 20 73 74 72  75 63 74 75 72 65 2e 20  |menu structure. |
00002330  49 66 20 31 20 77 61 73  20 70 61 73 73 65 64 20  |If 1 was passed |
00002340  69 6e 20 52 31 2c 20 74  68 65 20 66 69 72 73 74  |in R1, the first|
00002350  20 69 74 65 6d 0a 69 6e  20 74 68 65 20 6d 65 6e  | item.in the men|
00002360  75 20 73 74 72 75 63 74  75 72 65 20 77 69 6c 6c  |u structure will|
00002370  20 62 65 20 27 53 79 73  74 65 6d 46 6f 6e 74 73  | be 'SystemFonts|
00002380  27 2e 20 49 6e 20 63 61  73 65 20 52 31 20 3d 20  |'. In case R1 = |
00002390  30 2c 20 74 68 69 73 20  65 6e 74 72 79 20 77 69  |0, this entry wi|
000023a0  6c 6c 0a 6e 6f 74 20 62  65 20 74 68 65 72 65 2e  |ll.not be there.|
000023b0  20 54 68 69 73 20 63 61  6c 6c 20 77 69 6c 6c 20  | This call will |
000023c0  72 65 74 75 72 6e 20 77  69 74 68 20 61 20 70 6f  |return with a po|
000023d0  69 6e 74 65 72 20 74 6f  20 74 68 65 20 6d 65 6e  |inter to the men|
000023e0  75 20 73 74 72 75 63 74  75 72 65 20 69 6e 0a 52  |u structure in.R|
000023f0  31 2e 20 54 68 69 73 20  70 6f 69 6e 74 65 72 20  |1. This pointer |
00002400  73 68 6f 75 6c 64 20 62  65 20 70 61 73 73 65 64  |should be passed|
00002410  20 74 6f 20 53 57 49 20  22 57 69 6d 70 5f 43 72  | to SWI "Wimp_Cr|
00002420  65 61 74 65 53 75 62 4d  65 6e 75 22 2e 0a 0a 20  |eateSubMenu"... |
00002430  57 68 65 6e 20 61 20 6d  65 6e 75 20 73 65 6c 65  |When a menu sele|
00002440  63 74 69 6f 6e 20 77 61  73 20 64 6f 6e 65 2c 20  |ction was done, |
00002450  74 68 65 20 61 70 70 6c  69 63 61 74 69 6f 6e 20  |the application |
00002460  73 68 6f 75 6c 64 20 64  65 74 65 72 6d 69 6e 65  |should determine|
00002470  20 62 79 20 74 68 65 0a  72 65 74 75 72 6e 65 64  | by the.returned|
00002480  20 27 6d 65 6e 75 20 74  72 65 65 20 73 6f 20 66  | 'menu tree so f|
00002490  61 72 27 20 76 61 6c 75  65 73 20 69 66 20 74 68  |ar' values if th|
000024a0  65 20 75 73 65 72 20 73  65 6c 65 63 74 65 64 20  |e user selected |
000024b0  61 20 65 6e 74 72 79 20  69 6e 20 74 68 65 20 66  |a entry in the f|
000024c0  6f 6e 74 0a 6d 65 6e 75  2e 20 49 66 20 73 6f 2c  |ont.menu. If so,|
000024d0  20 69 74 20 73 68 6f 75  6c 64 20 73 65 74 20 61  | it should set a|
000024e0  6e 20 69 6e 74 65 72 6e  61 6c 20 66 6c 61 67 20  |n internal flag |
000024f0  28 73 61 79 20 27 46 6f  6e 74 4d 65 6e 75 53 65  |(say 'FontMenuSe|
00002500  6c 65 63 74 65 64 27 29  20 74 6f 0a 54 52 55 45  |lected') to.TRUE|
00002510  2c 20 65 6c 73 65 20 69  74 20 73 68 6f 75 6c 64  |, else it should|
00002520  20 73 65 74 20 69 74 20  74 6f 20 46 41 4c 53 45  | set it to FALSE|
00002530  2c 20 73 6f 20 6c 61 74  65 72 20 6f 6e 20 69 74  |, so later on it|
00002540  20 69 73 20 73 74 69 6c  6c 20 6b 6e 6f 77 6e 20  | is still known |
00002550  69 66 20 74 68 65 0a 75  73 65 72 20 6d 61 79 20  |if the.user may |
00002560  68 61 76 65 20 73 65 6c  65 63 74 65 64 20 61 20  |have selected a |
00002570  6e 65 77 20 66 6f 6e 74  2e 20 41 66 74 65 72 20  |new font. After |
00002580  74 68 61 74 20 69 74 20  73 68 6f 75 6c 64 20 63  |that it should c|
00002590  61 6c 6c 20 53 57 49 0a  22 46 6f 6e 74 4d 65 6e  |all SWI."FontMen|
000025a0  75 5f 44 65 63 6f 64 65  46 6f 6e 74 4d 65 6e 75  |u_DecodeFontMenu|
000025b0  22 20 77 69 74 68 20 52  30 20 70 6f 69 6e 74 69  |" with R0 pointi|
000025c0  6e 67 20 74 6f 20 74 68  65 20 66 69 72 73 74 20  |ng to the first |
000025d0  6d 65 6e 75 20 73 65 6c  65 63 74 69 6f 6e 20 69  |menu selection i|
000025e0  6e 0a 74 68 65 20 27 6d  65 6e 75 20 74 72 65 65  |n.the 'menu tree|
000025f0  20 73 6f 20 66 61 72 27  20 62 6c 6f 63 6b 20 77  | so far' block w|
00002600  69 63 68 20 64 65 74 65  72 6d 69 6e 65 73 20 74  |ich determines t|
00002610  68 65 20 73 65 6c 65 63  74 65 64 20 66 6f 6e 74  |he selected font|
00002620  2e 20 52 31 20 73 68 6f  75 6c 64 0a 70 6f 69 6e  |. R1 should.poin|
00002630  74 20 74 6f 20 61 20 62  75 66 66 65 72 20 74 6f  |t to a buffer to|
00002640  20 63 6f 6e 74 61 69 6e  20 74 68 65 20 61 6e 73  | contain the ans|
00002650  77 65 72 2e 20 54 68 69  73 20 62 75 66 66 65 72  |wer. This buffer|
00002660  20 6d 75 73 74 20 62 65  20 61 74 20 6c 65 61 73  | must be at leas|
00002670  74 20 34 38 0a 62 79 74  65 73 2e 20 49 66 20 6f  |t 48.bytes. If o|
00002680  6e 20 72 65 74 75 72 6e  20 6f 66 20 74 68 69 73  |n return of this|
00002690  20 63 61 6c 6c 20 52 30  20 3e 20 30 2c 20 74 68  | call R0 > 0, th|
000026a0  65 20 75 73 65 72 20 73  65 6c 65 63 74 65 64 20  |e user selected |
000026b0  61 20 6e 65 77 20 66 6f  6e 74 2e 20 54 68 65 0a  |a new font. The.|
000026c0  62 75 66 66 65 72 20 70  61 73 73 65 64 20 69 6e  |buffer passed in|
000026d0  20 52 31 20 77 69 6c 6c  20 63 6f 6e 74 61 69 6e  | R1 will contain|
000026e0  20 74 68 65 20 66 6f 6e  74 20 6e 61 6d 65 20 28  | the font name (|
000026f0  61 20 70 6f 69 6e 74 20  73 65 70 65 72 61 74 65  |a point seperate|
00002700  64 2c 20 7a 65 72 6f 0a  74 65 72 6d 69 6e 61 74  |d, zero.terminat|
00002710  65 64 20 66 6f 6e 74 20  73 74 72 69 6e 67 29 2e  |ed font string).|
00002720  0a 0a 20 41 66 74 65 72  20 61 20 6d 65 6e 75 20  |.. After a menu |
00002730  73 65 6c 63 74 69 6f 6e  2c 20 61 6e 64 20 74 61  |selction, and ta|
00002740  6b 69 6e 67 20 61 70 70  72 6f 70 72 69 61 74 65  |king appropriate|
00002750  20 61 63 74 69 6f 6e 73  2c 20 74 68 65 20 61 70  | actions, the ap|
00002760  70 6c 69 63 61 74 69 6f  6e 0a 73 68 6f 75 6c 64  |plication.should|
00002770  20 63 68 65 63 6b 20 74  68 65 20 6d 6f 75 73 65  | check the mouse|
00002780  20 62 75 74 74 6f 6e 20  73 74 61 74 65 20 74 6f  | button state to|
00002790  20 73 65 65 20 69 66 20  69 74 20 68 61 73 20 74  | see if it has t|
000027a0  6f 20 63 61 6c 6c 20 53  57 49 0a 22 57 69 6d 70  |o call SWI."Wimp|
000027b0  5f 43 72 65 61 74 65 4d  65 6e 75 22 20 61 67 61  |_CreateMenu" aga|
000027c0  69 6e 2e 20 49 66 20 61  64 6a 75 73 74 20 77 61  |in. If adjust wa|
000027d0  73 20 75 73 65 64 20 74  6f 20 6d 61 6b 65 20 74  |s used to make t|
000027e0  68 65 20 73 65 6c 65 63  74 69 6f 6e 2c 20 69 74  |he selection, it|
000027f0  20 68 61 73 20 74 6f 0a  63 68 65 63 6b 20 20 74  | has to.check  t|
00002800  68 65 20 27 46 6f 6e 74  4d 65 6e 75 53 65 6c 65  |he 'FontMenuSele|
00002810  63 74 65 64 27 20 66 6c  61 67 20 74 6f 20 64 65  |cted' flag to de|
00002820  74 65 72 6d 69 6e 65 20  69 66 20 74 68 65 20 75  |termine if the u|
00002830  73 65 72 20 73 65 6c 65  63 74 65 64 20 61 20 66  |ser selected a f|
00002840  6f 6e 74 0a 6d 65 6e 75  20 65 6e 74 72 79 2e 20  |ont.menu entry. |
00002850  49 66 20 73 6f 2c 20 69  74 20 73 68 6f 75 6c 64  |If so, it should|
00002860  20 63 61 6c 6c 20 53 57  49 20 22 46 6f 6e 74 4d  | call SWI "FontM|
00002870  65 6e 75 5f 53 65 6c 65  63 74 22 20 61 73 20 64  |enu_Select" as d|
00002880  69 73 63 72 69 62 65 64  20 61 62 6f 76 65 2e 0a  |iscribed above..|
00002890  54 68 69 73 20 73 68 6f  75 6c 64 20 62 65 20 64  |This should be d|
000028a0  6f 6e 65 20 77 69 74 68  20 52 30 20 70 6f 69 6e  |one with R0 poin|
000028b0  74 69 6e 67 20 74 6f 20  74 68 65 20 73 74 72 69  |ting to the stri|
000028c0  6e 67 20 53 57 49 0a 22  46 6f 6e 74 4d 65 6e 75  |ng SWI."FontMenu|
000028d0  5f 44 65 63 6f 64 65 46  6f 6e 74 4d 65 6e 75 22  |_DecodeFontMenu"|
000028e0  20 72 65 74 75 72 6e 65  64 2e 20 20 41 73 20 74  | returned.  As t|
000028f0  68 65 20 4d 65 6e 75 57  61 72 6e 69 6e 67 46 6c  |he MenuWarningFl|
00002900  61 67 20 69 6e 20 74 68  65 20 6d 65 6e 75 0a 66  |ag in the menu.f|
00002910  6c 61 67 73 20 6f 66 20  74 68 65 20 6d 65 6e 75  |lags of the menu|
00002920  20 65 6e 74 72 79 20 28  65 2e 67 2e 20 27 46 6f  | entry (e.g. 'Fo|
00002930  6e 74 73 27 29 20 70 72  65 63 65 64 69 6e 67 20  |nts') preceding |
00002940  74 68 65 20 66 6f 6e 74  20 6d 65 6e 75 20 77 61  |the font menu wa|
00002950  73 20 73 65 74 0a 28 70  68 68 68 21 29 2c 20 74  |s set.(phhh!), t|
00002960  68 65 20 57 69 6d 70 20  69 73 20 75 6e 61 62 6c  |he Wimp is unabl|
00002970  65 20 74 6f 20 72 65 63  72 65 61 74 69 6e 67 20  |e to recreating |
00002980  74 68 65 20 77 68 6f 6c  65 20 6d 65 6e 75 20 74  |the whole menu t|
00002990  72 65 65 20 61 75 74 6f  6d 61 74 69 63 6c 79 2e  |ree automaticly.|
000029a0  0a 53 6f 20 61 20 6c 69  74 6c 65 20 74 72 69 63  |.So a litle tric|
000029b0  6b 20 68 61 73 20 74 6f  20 61 73 73 75 72 65 20  |k has to assure |
000029c0  74 68 61 74 20 69 74 20  77 69 6c 6c 20 77 6f 72  |that it will wor|
000029d0  6b 20 63 6f 72 72 65 63  74 2e 20 54 68 65 20 6d  |k correct. The m|
000029e0  65 6e 75 20 70 6f 69 6e  74 65 72 0a 72 65 74 75  |enu pointer.retu|
000029f0  72 6e 65 64 20 62 79 20  53 57 49 20 22 46 6f 6e  |rned by SWI "Fon|
00002a00  74 4d 65 6e 75 5f 53 65  6c 65 63 74 22 20 68 61  |tMenu_Select" ha|
00002a10  73 20 74 6f 20 62 65 20  70 75 74 20 69 6e 20 74  |s to be put in t|
00002a20  68 65 20 27 73 75 62 2d  6d 65 6e 75 20 70 6f 69  |he 'sub-menu poi|
00002a30  6e 74 65 72 27 0a 77 6f  72 64 20 6f 66 20 74 68  |nter'.word of th|
00002a40  65 20 27 46 6f 6e 74 73  27 20 65 6e 74 72 79 2c  |e 'Fonts' entry,|
00002a50  20 61 6e 64 20 74 68 65  20 4d 65 6e 75 57 61 72  | and the MenuWar|
00002a60  6e 69 6e 67 46 6c 61 67  20 28 62 69 74 20 33 29  |ningFlag (bit 3)|
00002a70  20 6f 66 20 74 68 65 20  6d 65 6e 75 20 66 6c 61  | of the menu fla|
00002a80  67 73 0a 77 6f 72 64 20  6f 66 20 74 68 69 73 20  |gs.word of this |
00002a90  65 6e 74 72 79 20 73 68  6f 75 6c 64 20 62 65 20  |entry should be |
00002aa0  63 6c 65 61 72 65 64 2e  20 4e 6f 77 20 74 68 65  |cleared. Now the|
00002ab0  20 63 61 6c 6c 20 74 6f  20 53 57 49 20 22 57 69  | call to SWI "Wi|
00002ac0  6d 70 5f 43 72 65 61 74  65 4d 65 6e 75 22 0a 63  |mp_CreateMenu".c|
00002ad0  61 6e 20 62 65 20 64 6f  6e 65 2e 20 49 6e 20 74  |an be done. In t|
00002ae0  68 69 73 20 77 61 79 20  69 74 20 69 73 20 70 6f  |his way it is po|
00002af0  73 73 69 62 6c 65 20 66  6f 72 20 74 68 65 20 75  |ssible for the u|
00002b00  73 65 72 20 74 6f 20 63  6c 69 63 6b 20 77 69 74  |ser to click wit|
00002b10  68 20 61 64 6a 75 73 74  20 69 6e 0a 74 68 65 20  |h adjust in.the |
00002b20  66 6f 6e 74 20 6d 65 6e  75 2c 20 61 6e 64 20 6b  |font menu, and k|
00002b30  65 65 70 69 6e 67 20 74  68 65 20 6d 65 6e 75 20  |eeping the menu |
00002b40  6f 6e 20 73 63 72 65 65  6e 20 61 66 74 65 72 20  |on screen after |
00002b50  74 68 65 20 73 65 6c 65  63 74 69 6f 6e 2e 20 54  |the selection. T|
00002b60  68 65 20 6e 65 78 74 0a  74 69 6d 65 20 74 68 65  |he next.time the|
00002b70  20 75 73 65 72 20 6f 70  65 6e 73 20 74 68 65 20  | user opens the |
00002b80  61 70 70 6c 69 63 61 74  69 6f 6e 20 6d 65 6e 75  |application menu|
00002b90  2c 20 74 68 65 20 4d 65  6e 75 57 61 72 6e 69 6e  |, the MenuWarnin|
00002ba0  67 46 6c 61 67 20 28 62  69 74 20 33 29 20 73 68  |gFlag (bit 3) sh|
00002bb0  6f 75 6c 64 0a 62 65 20  73 65 74 20 61 67 61 69  |ould.be set agai|
00002bc0  6e 2c 20 61 73 20 6f 74  68 65 72 20 61 70 70 6c  |n, as other appl|
00002bd0  69 63 61 74 69 6f 6e 73  20 6d 61 79 20 68 61 76  |ications may hav|
00002be0  65 20 75 73 65 64 20 74  68 65 20 66 6f 6e 74 20  |e used the font |
00002bf0  6d 65 6e 75 20 69 6e 20  74 68 65 0a 6d 65 61 6e  |menu in the.mean|
00002c00  77 68 69 6c 65 2c 20 61  6e 64 20 69 74 20 69 73  |while, and it is|
00002c10  20 6e 65 63 65 73 73 61  72 79 20 74 68 61 74 20  | necessary that |
00002c20  53 57 49 20 22 46 6f 6e  74 4d 65 6e 75 5f 53 65  |SWI "FontMenu_Se|
00002c30  6c 65 63 74 22 20 69 73  20 63 61 6c 6c 65 64 20  |lect" is called |
00002c40  6a 75 73 74 0a 62 65 66  6f 72 65 20 74 68 65 20  |just.before the |
00002c50  66 6f 6e 74 20 6d 65 6e  75 20 6f 70 65 6e 73 2e  |font menu opens.|
00002c60  0a 0a 20 42 65 63 61 75  73 65 20 73 6f 6d 65 20  |.. Because some |
00002c70  46 6f 6e 74 4d 65 6e 75  20 53 57 49 27 73 20 6d  |FontMenu SWI's m|
00002c80  61 79 20 74 61 6b 65 20  73 6f 6d 65 20 74 69 6d  |ay take some tim|
00002c90  65 20 62 65 66 6f 72 65  20 74 68 65 79 20 72 65  |e before they re|
00002ca0  74 75 72 6e 0a 28 74 68  69 73 20 69 73 20 64 75  |turn.(this is du|
00002cb0  65 20 74 6f 20 46 6f 6e  74 5f 4c 69 73 74 46 6f  |e to Font_ListFo|
00002cc0  6e 74 73 29 2c 20 74 68  65 20 48 6f 75 72 67 6c  |nts), the Hourgl|
00002cd0  61 73 73 20 4f 6e 20 26  20 4f 66 66 20 53 57 49  |ass On & Off SWI|
00002ce0  27 73 20 61 72 65 20 75  73 65 64 0a 6f 6e 20 65  |'s are used.on e|
00002cf0  6e 74 72 79 20 61 6e 64  20 65 78 69 74 20 72 65  |ntry and exit re|
00002d00  73 70 65 63 74 69 76 65  6c 79 2e 20 53 6f 20 69  |spectively. So i|
00002d10  6e 20 74 68 65 6f 72 79  20 69 74 20 69 73 20 70  |n theory it is p|
00002d20  6f 73 73 69 62 6c 65 20  74 68 61 74 0a 77 68 65  |ossible that.whe|
00002d30  6e 65 76 65 72 20 6f 6e  65 20 6f 66 20 74 68 65  |never one of the|
00002d40  20 46 6f 6e 74 4d 65 6e  75 20 53 57 49 27 73 20  | FontMenu SWI's |
00002d50  74 61 6b 65 20 6c 6f 6e  67 65 72 20 74 68 61 6e  |take longer than|
00002d60  20 31 2f 33 20 6f 66 20  61 20 73 65 63 6f 6e 64  | 1/3 of a second|
00002d70  2c 20 61 0a 68 6f 75 72  67 6c 61 73 73 20 61 70  |, a.hourglass ap|
00002d80  70 65 61 72 73 2e 20 49  6e 20 70 72 61 63 74 69  |pears. In practi|
00002d90  63 65 20 74 68 69 73 20  6f 6e 6c 79 20 6f 63 63  |ce this only occ|
00002da0  75 72 73 20 77 68 65 6e  20 46 6f 6e 74 4d 65 6e  |urs when FontMen|
00002db0  75 5f 43 72 65 61 74 65  0a 6f 72 20 46 6f 6e 74  |u_Create.or Font|
00002dc0  4d 65 6e 75 5f 53 65 6c  65 63 74 20 69 73 20 63  |Menu_Select is c|
00002dd0  61 6c 6c 65 64 20 61 6e  64 20 74 68 65 79 20 68  |alled and they h|
00002de0  61 76 65 20 74 6f 20 61  63 74 75 61 6c 6c 79 20  |ave to actually |
00002df0  63 72 65 61 74 65 20 61  20 6e 65 77 0a 6d 65 6e  |create a new.men|
00002e00  75 20 73 74 72 75 63 74  75 72 65 20 28 42 65 63  |u structure (Bec|
00002e10  61 75 73 65 20 6f 66 20  61 20 66 69 72 73 74 20  |ause of a first |
00002e20  63 61 6c 6c 2c 20 6f 72  20 61 20 63 68 61 6e 67  |call, or a chang|
00002e30  65 64 20 46 6f 6e 74 24  50 61 74 68 29 2e 0a 0a  |ed Font$Path)...|
00002e40  0a 0a 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
00002e50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 4e  |               N|
00002e60  6f 74 65 73 20 66 72 6f  6d 20 74 68 65 20 61 75  |otes from the au|
00002e70  74 68 6f 72 0a 0a 20 54  68 65 20 72 65 61 73 6f  |thor.. The reaso|
00002e80  6e 20 77 68 79 20 49 20  77 72 6f 74 65 20 74 68  |n why I wrote th|
00002e90  69 73 20 6d 6f 64 75 6c  65 2c 20 69 73 20 62 65  |is module, is be|
00002ea0  63 61 75 73 65 20 49 27  6d 20 6e 6f 74 20 6f 6e  |cause I'm not on|
00002eb0  6c 79 20 61 20 70 72 6f  67 72 61 6d 6d 65 72 2c  |ly a programmer,|
00002ec0  0a 62 75 74 20 61 6c 73  6f 20 61 20 75 73 65 72  |.but also a user|
00002ed0  20 77 68 6f 20 6c 69 6b  65 73 20 74 6f 20 77 6f  | who likes to wo|
00002ee0  72 6b 20 77 69 74 68 20  74 68 65 20 41 72 63 68  |rk with the Arch|
00002ef0  69 6d 65 64 65 73 2e 20  54 68 69 73 20 69 73 20  |imedes. This is |
00002f00  62 65 63 61 75 73 65 20  69 74 27 73 0a 61 20 66  |because it's.a f|
00002f10  61 73 74 20 6d 61 63 68  69 6e 65 20 61 6e 64 20  |ast machine and |
00002f20  62 65 63 61 75 73 65 20  6d 6f 73 74 20 70 61 72  |because most par|
00002f30  74 73 20 6f 66 20 52 69  73 63 2d 4f 53 20 61 6c  |ts of Risc-OS al|
00002f40  6c 6f 77 20 61 70 70 6c  69 63 61 74 69 6f 6e 73  |low applications|
00002f50  20 74 6f 20 62 65 0a 76  65 72 79 20 69 6e 74 75  | to be.very intu|
00002f60  69 74 69 76 65 2e 20 49  20 64 69 64 6e 27 74 20  |itive. I didn't |
00002f70  6c 69 6b 65 20 74 68 65  20 77 61 79 20 74 68 65  |like the way the|
00002f80  20 61 76 61 69 6c 61 62  6c 65 20 66 6f 6e 74 73  | available fonts|
00002f90  20 77 65 72 65 20 70 72  65 73 65 6e 74 65 64 20  | were presented |
00002fa0  69 6e 0a 6d 6f 73 74 20  61 70 70 6c 69 63 61 74  |in.most applicat|
00002fb0  69 6f 6e 73 2c 20 73 6f  20 49 20 73 74 61 72 74  |ions, so I start|
00002fc0  65 64 20 74 6f 20 66 69  67 75 72 65 20 6f 75 74  |ed to figure out|
00002fd0  20 61 20 70 72 6f 70 65  72 20 73 6f 6c 75 74 69  | a proper soluti|
00002fe0  6f 6e 3a 20 46 6f 6e 74  4d 65 6e 75 2e 0a 0a 20  |on: FontMenu... |
00002ff0  49 20 68 6f 70 65 20 74  68 61 74 20 66 75 74 75  |I hope that futu|
00003000  72 65 20 61 70 70 6c 69  63 61 74 69 6f 6e 73 20  |re applications |
00003010  61 64 6f 70 74 20 74 6f  20 74 68 69 73 20 6d 65  |adopt to this me|
00003020  74 68 6f 64 2c 20 73 6f  20 70 6c 65 61 73 65 20  |thod, so please |
00003030  70 61 73 73 20 69 74 20  6f 6e 2e 0a 45 76 65 72  |pass it on..Ever|
00003040  79 62 6f 64 79 20 69 73  20 66 72 65 65 20 74 6f  |ybody is free to|
00003050  20 75 73 65 20 69 74 2c  20 65 76 65 6e 20 69 6e  | use it, even in|
00003060  20 63 6f 6d 6d 65 72 63  69 61 6c 20 63 6f 64 65  | commercial code|
00003070  2e 20 54 68 65 20 6f 6e  6c 79 20 72 65 73 74 72  |. The only restr|
00003080  69 63 74 69 6f 6e 0a 69  73 20 74 68 61 74 20 74  |iction.is that t|
00003090  68 69 73 20 64 6f 63 75  6d 65 6e 74 20 73 68 6f  |his document sho|
000030a0  75 6c 64 20 6e 6f 74 20  62 65 20 73 65 70 65 72  |uld not be seper|
000030b0  61 74 65 64 20 66 72 6f  6d 20 74 68 65 20 46 6f  |ated from the Fo|
000030c0  6e 74 4d 65 6e 75 20 6d  6f 64 75 6c 65 2c 20 61  |ntMenu module, a|
000030d0  6e 64 0a 74 68 61 74 20  62 6f 74 68 20 74 68 65  |nd.that both the|
000030e0  20 6d 6f 64 75 6c 65 20  61 6e 64 20 74 68 69 73  | module and this|
000030f0  20 64 6f 63 75 6d 65 6e  74 20 72 65 6d 61 69 6e  | document remain|
00003100  20 75 6e 63 68 61 6e 67  65 64 2e 20 49 6e 20 63  | unchanged. In c|
00003110  61 73 65 20 6f 66 0a 63  6f 6d 6d 65 72 63 69 61  |ase of.commercia|
00003120  6c 20 75 73 65 20 49 20  77 6f 75 6c 64 20 6c 69  |l use I would li|
00003130  6b 65 20 74 6f 20 6b 6e  6f 77 20 74 68 69 73 20  |ke to know this |
00003140  69 6e 20 61 64 76 61 6e  63 65 20 28 49 20 63 6f  |in advance (I co|
00003150  75 6c 64 20 74 68 61 6e  20 70 72 6f 76 69 64 65  |uld than provide|
00003160  0a 79 6f 75 20 77 69 74  68 20 69 74 73 20 6c 61  |.you with its la|
00003170  74 65 73 74 20 72 65 6c  65 61 73 65 29 2e 20 4d  |test release). M|
00003180  79 20 61 64 64 72 65 73  73 20 69 73 20 61 74 20  |y address is at |
00003190  74 68 65 20 65 6e 64 20  6f 66 20 74 68 69 73 20  |the end of this |
000031a0  64 6f 63 75 6d 65 6e 74  2e 20 59 6f 75 0a 63 61  |document. You.ca|
000031b0  6e 20 61 6c 77 61 79 73  20 63 6f 6e 74 61 63 74  |n always contact|
000031c0  20 6d 65 20 69 66 20 79  6f 75 20 66 6f 75 6e 64  | me if you found|
000031d0  20 73 6f 6d 65 20 62 75  67 2c 20 6f 72 20 77 68  | some bug, or wh|
000031e0  65 6e 20 68 61 76 69 6e  67 20 6f 74 68 65 72 0a  |en having other.|
000031f0  73 75 67 67 65 73 74 69  6f 6e 73 2e 0a 0a 0a 2d  |suggestions....-|
00003200  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003240  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 0a 20 20  |------------..  |
00003250  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 46 6f  |              Fo|
00003270  6e 74 4d 65 6e 75 20 53  57 49 27 73 0a 0a 20 20  |ntMenu SWI's..  |
00003280  20 20 20 20 20 20 20 20  20 42 65 6c 6f 77 20 61  |         Below a|
00003290  72 65 20 74 68 65 20 73  68 6f 72 74 20 64 69 73  |re the short dis|
000032a0  63 72 69 70 74 69 6f 6e  73 20 6f 66 20 74 68 65  |criptions of the|
000032b0  20 46 6f 6e 74 4d 65 6e  75 20 53 57 49 27 73 2e  | FontMenu SWI's.|
000032c0  0a 20 20 20 20 20 20 20  20 20 20 20 0a 0a 46 6f  |.           ..Fo|
000032d0  6e 74 4d 65 6e 75 5f 43  72 65 61 74 65 20 26 38  |ntMenu_Create &8|
000032e0  44 30 38 30 0a 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |D080.-----------|
000032f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 4f 6e 20 65  |-----------.On e|
00003300  6e 74 72 79 3a 20 2d 2d  0a 4f 6e 20 65 78 69 74  |ntry: --.On exit|
00003310  20 3a 20 52 30 20 3d 20  4e 75 6d 62 65 72 20 6f  | : R0 = Number o|
00003320  66 20 66 6f 6e 74 73 20  66 6f 75 6e 64 0a 0a 20  |f fonts found.. |
00003330  54 68 69 73 20 77 69 6c  6c 20 63 72 65 61 74 65  |This will create|
00003340  20 61 20 66 6f 6e 74 20  6d 65 6e 75 20 73 74 72  | a font menu str|
00003350  75 63 74 75 72 65 20 69  6e 20 52 4d 41 2c 20 69  |ucture in RMA, i|
00003360  66 20 6e 6f 74 20 61 6c  72 65 61 64 79 20 64 6f  |f not already do|
00003370  6e 65 20 73 6f 2e 20 41  6e 0a 65 72 72 6f 72 20  |ne so. An.error |
00003380  6f 63 63 75 72 73 20 69  66 20 74 68 65 72 65 20  |occurs if there |
00003390  69 73 20 6e 6f 74 20 65  6e 6f 75 67 68 20 72 6f  |is not enough ro|
000033a0  6f 6d 20 69 6e 20 52 4d  41 20 74 6f 20 63 72 65  |om in RMA to cre|
000033b0  61 74 65 20 74 68 65 20  6d 65 6e 75 2e 0a 0a 0a  |ate the menu....|
000033c0  0a 46 6f 6e 74 4d 65 6e  75 5f 52 65 6c 65 61 73  |.FontMenu_Releas|
000033d0  65 20 26 38 44 30 38 31  0a 2d 2d 2d 2d 2d 2d 2d  |e &8D081.-------|
000033e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000033f0  0a 4f 6e 20 65 6e 74 72  79 3a 20 2d 2d 0a 4f 6e  |.On entry: --.On|
00003400  20 65 78 69 74 20 3a 20  2d 2d 0a 0a 20 54 68 69  | exit : --.. Thi|
00003410  73 20 77 69 6c 6c 20 72  65 6c 65 61 73 65 20 74  |s will release t|
00003420  68 65 20 6d 65 6d 6f 72  79 20 74 61 6b 65 6e 20  |he memory taken |
00003430  62 79 20 74 68 65 20 66  6f 6e 74 20 6d 65 6e 75  |by the font menu|
00003440  20 69 66 20 6e 6f 20 74  61 73 6b 73 20 61 72 65  | if no tasks are|
00003450  20 75 73 69 6e 67 0a 69  74 20 61 6e 79 6d 6f 72  | using.it anymor|
00003460  65 2e 0a 0a 0a 0a 46 6f  6e 74 4d 65 6e 75 5f 53  |e.....FontMenu_S|
00003470  65 6c 65 63 74 20 26 38  44 30 38 32 0a 2d 2d 2d  |elect &8D082.---|
00003480  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003490  2d 2d 2d 0a 4f 6e 20 65  6e 74 72 79 3a 20 52 30  |---.On entry: R0|
000034a0  20 3d 20 70 6f 69 6e 74  65 72 20 74 6f 20 70 6f  | = pointer to po|
000034b0  69 6e 74 20 73 65 70 65  72 61 74 65 64 2c 20 63  |int seperated, c|
000034c0  74 72 6c 20 74 65 72 6d  69 6e 61 74 65 64 20 66  |trl terminated f|
000034d0  6f 6e 74 20 73 74 72 69  6e 67 20 0a 20 20 20 20  |ont string .    |
000034e0  20 20 20 20 20 20 52 31  20 3d 20 53 79 73 74 65  |      R1 = Syste|
000034f0  6d 46 6f 6e 74 20 66 6c  61 67 20 20 20 20 20 20  |mFont flag      |
00003500  20 20 20 20 20 20 0a 0a  4f 6e 20 65 78 69 74 20  |      ..On exit |
00003510  3a 20 52 30 20 3d 20 53  74 61 74 65 20 66 6c 61  |: R0 = State fla|
00003520  67 0a 20 20 20 20 20 20  20 20 20 20 52 31 20 3d  |g.          R1 =|
00003530  20 70 6f 69 6e 74 65 72  20 74 6f 20 66 6f 6e 74  | pointer to font|
00003540  20 6d 65 6e 75 20 73 74  72 75 63 74 75 72 65 0a  | menu structure.|
00003550  20 20 20 20 20 20 20 20  20 20 52 32 20 3d 20 70  |          R2 = p|
00003560  6f 69 6e 74 65 72 20 74  6f 20 27 41 6c 69 61 73  |ointer to 'Alias|
00003570  27 20 6d 65 6e 75 20 73  74 72 75 63 74 75 72 65  |' menu structure|
00003580  20 0a 0a 20 54 68 69 73  20 77 69 6c 6c 20 74 69  | .. This will ti|
00003590  63 6b 20 74 68 65 20 66  6f 6e 74 20 70 61 73 73  |ck the font pass|
000035a0  65 64 20 69 6e 20 52 30  20 6f 6e 20 65 6e 74 72  |ed in R0 on entr|
000035b0  79 2e 20 52 31 20 64 65  74 65 72 6d 69 6e 65 73  |y. R1 determines|
000035c0  20 69 66 0a 27 53 79 73  74 65 6d 46 6f 6e 74 27  | if.'SystemFont'|
000035d0  20 73 68 6f 75 6c 64 20  6f 63 63 75 72 20 69 6e  | should occur in|
000035e0  20 74 68 65 20 6d 65 6e  75 20 61 73 20 66 6f 6c  | the menu as fol|
000035f0  6c 6f 77 73 3a 0a 0a 20  20 56 61 6c 75 65 20 4d  |lows:..  Value M|
00003600  65 61 6e 69 6e 67 0a 20  20 20 20 30 20 20 20 27  |eaning.    0   '|
00003610  53 79 73 74 65 6d 46 6f  6e 74 27 20 64 6f 65 73  |SystemFont' does|
00003620  20 6e 6f 74 20 6f 63 63  75 72 20 69 6e 20 74 68  | not occur in th|
00003630  65 20 6d 65 6e 75 0a 20  20 20 20 31 20 20 20 27  |e menu.    1   '|
00003640  53 79 73 74 65 6d 46 6f  6e 74 27 20 64 6f 65 73  |SystemFont' does|
00003650  20 6f 63 63 75 72 20 69  6e 20 74 68 65 20 6d 65  | occur in the me|
00003660  6e 75 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |nu.             |
00003670  20 20 20 20 20 20 20 20  20 20 20 20 0a 20 4f 6e  |            . On|
00003680  20 65 78 69 74 20 52 30  20 73 68 6f 77 73 20 74  | exit R0 shows t|
00003690  68 65 20 73 65 6c 65 63  74 69 6f 6e 20 73 74 61  |he selection sta|
000036a0  74 65 20 61 73 20 66 6f  6c 6c 6f 77 73 3a 0a 0a  |te as follows:..|
000036b0  20 20 56 61 6c 75 65 20  4d 65 61 6e 69 6e 67 0a  |  Value Meaning.|
000036c0  20 20 20 20 30 20 20 20  54 6f 20 62 65 20 73 65  |    0   To be se|
000036d0  6c 65 63 74 65 64 20 66  6f 6e 74 20 6e 6f 74 20  |lected font not |
000036e0  66 6f 75 6e 64 2c 20 6e  6f 20 74 69 63 6b 73 0a  |found, no ticks.|
000036f0  20 20 20 20 31 20 20 20  54 6f 20 62 65 20 73 65  |    1   To be se|
00003700  6c 65 63 74 65 64 20 66  6f 6e 74 20 66 6f 75 6e  |lected font foun|
00003710  64 2c 20 61 6e 64 20 74  69 63 6b 65 64 20 20 0a  |d, and ticked  .|
00003720  20 20 20 20 32 20 20 20  4e 6f 20 66 6f 6e 74 20  |    2   No font |
00003730  65 6e 74 72 69 65 73 20  66 6f 75 6e 64 2c 20 6d  |entries found, m|
00003740  65 6e 75 20 63 6f 6e 73  69 73 74 73 20 6f 6e 65  |enu consists one|
00003750  20 69 74 65 6d 3b 20 27  53 79 73 74 65 6d 46 6f  | item; 'SystemFo|
00003760  6e 74 27 2c 0a 20 20 20  20 20 20 20 20 61 6e 64  |nt',.        and|
00003770  20 69 73 20 74 69 63 6b  65 64 0a 20 20 20 20 20  | is ticked.     |
00003780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000037c0  20 20 20 20 20 20 20 20  20 20 20 20 20 0a 20 52  |             . R|
000037d0  31 20 77 69 6c 6c 20 70  6f 69 6e 74 20 74 6f 20  |1 will point to |
000037e0  74 68 65 20 66 6f 6e 74  20 6d 65 6e 75 20 6f 6e  |the font menu on|
000037f0  20 65 78 69 74 2e 20 41  6e 20 65 72 72 6f 72 20  | exit. An error |
00003800  6f 63 63 75 72 73 20 69  66 20 6e 6f 20 66 6f 6e  |occurs if no fon|
00003810  74 20 6d 65 6e 75 20 65  78 69 73 74 73 2e 20 0a  |t menu exists. .|
00003820  0a 0a 0a 46 6f 6e 74 4d  65 6e 75 5f 44 65 73 65  |...FontMenu_Dese|
00003830  6c 65 63 74 20 26 38 44  30 38 33 0a 2d 2d 2d 2d  |lect &8D083.----|
00003840  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003850  2d 2d 2d 2d 0a 4f 6e 20  65 6e 74 72 79 3a 20 2d  |----.On entry: -|
00003860  2d 2d 0a 4f 6e 20 65 78  69 74 20 3a 20 2d 2d 0a  |--.On exit : --.|
00003870  0a 20 54 68 69 73 20 77  69 6c 6c 20 63 6c 65 61  |. This will clea|
00003880  72 20 61 6c 6c 20 74 69  63 6b 73 20 61 6e 64 20  |r all ticks and |
00003890  6d 61 72 6b 73 20 6f 66  20 74 68 65 20 66 6f 6e  |marks of the fon|
000038a0  74 20 6d 65 6e 75 2e 20  49 74 20 69 73 20 6e 6f  |t menu. It is no|
000038b0  74 20 6e 65 63 65 73 73  61 72 79 0a 74 6f 20 63  |t necessary.to c|
000038c0  61 6c 6c 20 74 68 69 73  20 53 57 49 20 62 65 66  |all this SWI bef|
000038d0  6f 72 65 20 61 20 46 6f  6e 74 4d 65 6e 75 5f 53  |ore a FontMenu_S|
000038e0  65 6c 65 63 74 20 63 61  6c 6c 2c 20 61 73 20 46  |elect call, as F|
000038f0  6f 6e 74 4d 65 6e 75 5f  53 65 6c 65 63 74 20 77  |ontMenu_Select w|
00003900  69 6c 6c 20 74 61 6b 65  0a 63 61 72 65 20 6f 66  |ill take.care of|
00003910  20 63 6c 65 61 6e 69 6e  67 20 75 70 20 6f 6c 64  | cleaning up old|
00003920  20 73 65 6c 65 63 74 69  6f 6e 2e 20 41 6e 20 65  | selection. An e|
00003930  72 72 6f 72 20 6f 63 63  75 72 73 20 69 66 20 6e  |rror occurs if n|
00003940  6f 20 66 6f 6e 74 20 6d  65 6e 75 20 65 78 69 73  |o font menu exis|
00003950  74 73 2e 20 0a 20 20 0a  20 20 20 20 20 20 20 20  |ts. .  .        |
00003960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003970  20 20 20 20 20 20 0a 0a  46 6f 6e 74 4d 65 6e 75  |      ..FontMenu|
00003980  5f 44 65 63 6f 64 65 46  6f 6e 74 4d 65 6e 75 20  |_DecodeFontMenu |
00003990  26 38 44 30 38 34 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |&8D084.---------|
000039a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000039b0  2d 2d 2d 2d 2d 0a 4f 6e  20 65 6e 74 72 79 3a 20  |-----.On entry: |
000039c0  52 30 20 3d 20 70 6f 69  6e 74 65 72 20 74 6f 20  |R0 = pointer to |
000039d0  61 20 6c 69 73 74 20 6f  66 20 66 6f 6e 74 20 6d  |a list of font m|
000039e0  65 6e 75 20 73 65 6c 65  63 74 69 6f 6e 73 0a 20  |enu selections. |
000039f0  20 20 20 20 20 20 20 20  20 52 31 20 3d 20 70 6f  |         R1 = po|
00003a00  69 6e 74 65 72 20 74 6f  20 61 20 62 75 66 66 65  |inter to a buffe|
00003a10  72 20 74 6f 20 63 6f 6e  74 61 69 6e 20 74 68 65  |r to contain the|
00003a20  20 61 6e 73 77 65 72 20  0a 20 20 20 20 20 20 20  | answer .       |
00003a30  20 20 20 20 20 20 20 20  28 61 74 20 6c 65 61 73  |        (at leas|
00003a40  74 20 34 38 20 62 79 74  65 73 20 6c 6f 6e 67 29  |t 48 bytes long)|
00003a50  0a 4f 6e 20 65 78 69 74  20 3a 20 52 30 20 3d 20  |.On exit : R0 = |
00003a60  46 6c 61 67 20 28 30 20  3d 20 6e 6f 6e 2d 73 65  |Flag (0 = non-se|
00003a70  6e 73 69 62 6c 65 2f 20  31 3d 20 73 65 6e 73 69  |nsible/ 1= sensi|
00003a80  62 6c 65 20 73 65 6c 65  63 74 69 6f 6e 29 0a 0a  |ble selection)..|
00003a90  20 54 68 69 73 20 77 69  6c 6c 20 64 65 63 6f 64  | This will decod|
00003aa0  65 20 74 68 65 20 66 6f  6e 74 20 6d 65 6e 75 20  |e the font menu |
00003ab0  73 65 6c 65 63 74 69 6f  6e 20 69 6e 74 6f 20 61  |selection into a|
00003ac0  20 66 6f 6e 74 20 73 74  72 69 6e 67 20 66 6f 72  | font string for|
00003ad0  20 74 68 65 0a 46 6f 6e  74 4d 61 6e 61 67 65 72  | the.FontManager|
00003ae0  2e 20 54 68 69 73 20 73  74 72 69 6e 67 20 63 61  |. This string ca|
00003af0  6e 20 62 65 20 70 61 73  73 65 64 20 62 61 63 6b  |n be passed back|
00003b00  20 74 6f 20 46 6f 6e 74  4d 65 6e 75 5f 53 65 6c  | to FontMenu_Sel|
00003b10  65 63 74 20 74 6f 20 74  69 63 6b 20 74 68 65 0a  |ect to tick the.|
00003b20  61 70 70 72 6f 70 72 69  61 74 65 20 65 6e 74 72  |appropriate entr|
00003b30  69 65 73 2e 20 41 6e 20  65 72 72 6f 72 20 6f 63  |ies. An error oc|
00003b40  63 75 72 73 20 69 66 20  6e 6f 20 66 6f 6e 74 20  |curs if no font |
00003b50  6d 65 6e 75 20 65 78 69  73 74 73 2e 20 54 68 69  |menu exists. Thi|
00003b60  73 20 63 61 6c 6c 20 6d  61 6b 65 73 0a 75 73 65  |s call makes.use|
00003b70  20 6f 66 20 57 69 6d 70  5f 44 65 63 6f 64 65 4d  | of Wimp_DecodeM|
00003b80  65 6e 75 2c 20 62 75 74  20 61 73 20 69 74 20 69  |enu, but as it i|
00003b90  73 20 70 6f 73 73 69 62  6c 65 20 74 68 61 74 20  |s possible that |
00003ba0  74 68 65 20 72 65 74 75  72 6e 65 64 20 73 74 72  |the returned str|
00003bb0  69 6e 67 20 65 6e 64 73  0a 77 69 74 68 20 27 50  |ing ends.with 'P|
00003bc0  6c 61 69 6e 27 20 28 61  20 6d 61 64 65 20 75 70  |lain' (a made up|
00003bd0  20 6e 61 6d 65 20 74 6f  20 64 69 73 74 69 6e 67  | name to disting|
00003be0  75 69 73 65 20 61 6e 20  65 6d 70 74 79 20 73 75  |uise an empty su|
00003bf0  62 2d 6e 61 6d 65 20 66  72 6f 6d 20 74 68 65 20  |b-name from the |
00003c00  72 65 73 74 0a 6f 66 20  74 68 65 20 73 75 62 2d  |rest.of the sub-|
00003c10  6e 61 6d 65 73 29 2c 20  69 74 20 68 61 73 20 74  |names), it has t|
00003c20  6f 20 63 68 65 63 6b 20  66 6f 72 20 74 68 69 73  |o check for this|
00003c30  2c 20 61 6e 64 20 74 68  72 6f 77 20 61 77 61 79  |, and throw away|
00003c40  20 74 68 69 73 20 6c 61  73 74 0a 73 75 62 2d 6e  | this last.sub-n|
00003c50  61 6d 65 20 73 6f 20 74  68 65 20 46 6f 6e 74 4d  |ame so the FontM|
00003c60  61 6e 61 67 65 72 20 63  61 6e 20 72 65 63 6f 67  |anager can recog|
00003c70  6e 69 73 65 20 74 68 65  20 72 65 71 75 69 72 65  |nise the require|
00003c80  64 20 66 6f 6e 74 2e 20  0a 20 20 4f 6e 20 65 78  |d font. .  On ex|
00003c90  69 74 20 52 30 20 63 6f  6e 61 74 61 69 6e 73 20  |it R0 conatains |
00003ca0  61 20 66 6c 61 67 20 74  65 6c 6c 69 6e 67 20 79  |a flag telling y|
00003cb0  6f 75 20 69 66 20 74 68  65 20 73 65 6c 65 63 74  |ou if the select|
00003cc0  69 6f 6e 20 74 68 65 20  75 73 65 72 20 6d 61 64  |ion the user mad|
00003cd0  65 20 77 61 73 0a 61 20  73 65 6e 73 69 62 6c 65  |e was.a sensible|
00003ce0  20 6f 6e 65 2e 20 49 66  2c 20 66 6f 72 20 65 78  | one. If, for ex|
00003cf0  61 6d 70 6c 65 2c 20 74  68 65 20 75 73 65 72 20  |ample, the user |
00003d00  73 65 6c 65 63 74 65 64  20 6e 6f 6e 2d 6c 65 61  |selected non-lea|
00003d10  66 20 6d 65 6e 75 20 65  6e 74 72 79 20 28 65 2e  |f menu entry (e.|
00003d20  67 2e 0a 27 54 72 69 6e  69 74 79 2e 4d 65 64 69  |g..'Trinity.Medi|
00003d30  75 6d 27 29 20 74 68 65  6e 20 74 68 69 73 20 66  |um') then this f|
00003d40  6c 61 67 20 77 69 6c 6c  20 62 65 20 30 2e 20 49  |lag will be 0. I|
00003d50  66 20 74 68 65 20 66 6c  61 67 20 69 73 20 30 2c  |f the flag is 0,|
00003d60  20 79 6f 75 20 61 72 65  0a 61 64 76 69 73 65 64  | you are.advised|
00003d70  20 6e 6f 74 20 74 6f 20  64 6f 20 61 6e 79 74 68  | not to do anyth|
00003d80  69 6e 67 2e 0a 0a 0a 0a  46 6f 6e 74 4d 65 6e 75  |ing.....FontMenu|
00003d90  5f 53 6d 61 73 68 20 26  38 44 30 38 35 0a 2d 2d  |_Smash &8D085.--|
00003da0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003db0  2d 2d 2d 0a 4f 6e 20 65  6e 74 72 79 3a 20 2d 2d  |---.On entry: --|
00003dc0  0a 4f 6e 20 65 78 69 74  20 3a 20 2d 2d 0a 0a 20  |.On exit : --.. |
00003dd0  54 68 69 73 20 77 69 6c  6c 20 72 65 6c 65 61 73  |This will releas|
00003de0  65 20 74 68 65 20 66 6f  6e 74 20 6d 65 6e 75 20  |e the font menu |
00003df0  6d 65 6d 6f 72 79 20 77  69 74 68 6f 75 74 20 6c  |memory without l|
00003e00  6f 6f 6b 69 6e 67 20 61  74 20 74 68 65 20 61 6d  |ooking at the am|
00003e10  6f 75 6e 74 20 6f 66 0a  74 69 6d 65 73 20 46 6f  |ount of.times Fo|
00003e20  6e 74 4d 65 6e 75 5f 43  72 65 61 74 65 20 77 61  |ntMenu_Create wa|
00003e30  73 20 63 61 6c 6c 65 64  2e 0a 0a 0a 0a 46 6f 6e  |s called.....Fon|
00003e40  74 4d 65 6e 75 5f 52 65  43 72 65 61 74 65 20 26  |tMenu_ReCreate &|
00003e50  38 44 30 38 36 0a 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |8D086.----------|
00003e60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 4f  |--------------.O|
00003e70  6e 20 65 6e 74 72 79 3a  20 2d 2d 0a 4f 6e 20 65  |n entry: --.On e|
00003e80  78 69 74 20 3a 20 52 30  20 3d 20 4e 75 6d 62 65  |xit : R0 = Numbe|
00003e90  72 20 6f 66 20 66 6f 6e  74 73 20 66 6f 75 6e 64  |r of fonts found|
00003ea0  0a 0a 20 54 68 69 73 20  77 69 6c 6c 20 72 65 6c  |.. This will rel|
00003eb0  65 61 73 65 20 61 20 65  78 69 73 74 69 6e 67 20  |ease a existing |
00003ec0  66 6f 6e 74 20 6d 65 6e  75 2c 20 61 6e 64 20 72  |font menu, and r|
00003ed0  65 63 72 65 61 74 65 20  69 74 2e 0a 0a 0a 0a 20  |ecreate it..... |
00003ee0  20 20 20 20 20 20 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |      ==========|
00003ef0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003f20  3d 0a 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |=..             |
00003f30  20 20 20 54 6f 20 63 6f  6e 74 61 63 74 20 74 68  |   To contact th|
00003f40  65 20 61 75 74 68 6f 72  20 6f 66 20 46 6f 6e 74  |e author of Font|
00003f50  4d 65 6e 75 2c 20 70 6c  65 61 73 65 20 77 72 69  |Menu, please wri|
00003f60  74 65 20 74 6f 3a 0a 0a  20 20 20 20 20 20 20 20  |te to:..        |
00003f70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003f90  20 20 4a 6f 72 69 73 20  52 d6 6c 69 6e 67 0a 20  |  Joris R.ling. |
00003fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00003fc0  20 20 20 20 20 20 20 20  20 4f 75 64 65 73 74 72  |         Oudestr|
00003fd0  61 61 74 20 31 38 36 0a  20 20 20 20 20 20 20 20  |aat 186.        |
00003fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004000  20 20 38 32 36 31 20 43  57 20 4b 61 6d 70 65 6e  |  8261 CW Kampen|
00004010  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00004020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004030  20 20 20 20 20 20 20 20  20 20 20 54 68 65 20 4e  |           The N|
00004040  65 74 68 65 72 6c 61 6e  64 73 0a 0a 20 20 20 20  |etherlands..    |
00004050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004070  20 20 20 20 20 20 54 65  6c 3a 30 35 32 30 32 2d  |      Tel:05202-|
00004080  32 37 39 38 39 0a                                 |27989.|
00004086