***************************************************************************
*                                                                         *
*  Project: RiscOS                                                        *
*                                                                         *
*  Module:  Wimp                                                          *
*                                                                         *
*  Created: Wed 24-Oct-90      By: Ran Mokady                             *
*                                                                         *
*  First version: 2.80                                                    *
*                                                                         *
*    Copyright:    (C) 1990, Acorn Computers Ltd., Cambridge, England.    *
*                                                                         *
***************************************************************************

Purpose:
========

The WIMP.

***************************************************************************


Change Log:
===========

Version 2.01
 *  Pending slot is now scanned on screen remapping

Version 2.02
 *  Wimp objects to > 256 pages, not >= 256

Version 2.03
 *  Message block too small is now checked for

Version 2.04
 *  Up-to-date value of CAOPointer is now read in OS_ChangeDynamic
     - don't store CAOPointer in Service_NewApplication
     - don't overwrite CAOPointer in Wimp_Initialise

Version 2.05
 *  Doesn't give address exception if 0 pages on startup any more

Version 2.06
 *  Wimp_ReportError <escape> now returns R1=1 or 2 as appropriate

Version 2.07
 *  Enable interrupts in Service_MemoryMoved (MOS bug)

Version 2.08
 *  Implement 2-way scrolling (drag_scrollboth)

Version 2.09
 *  Errors in Wimp_Poll are reported internally
 *  Disables escape conditions explicitly when Wimp_Poll is called

Version 2.10
 *  Remember pointer position over a mode change
 *  Use separate buffers for errors and starttask
    (Problems if task causes an upcall)
 *  Report error if window deleted while dragging
 *  Stop dragging menu / dbox if menus closed
 *  *Help WimpSlot message altered slightly
 *  Move dynamic error block up 4 bytes
    (It's overlaid on the error handler's buffer!)
 *  Ensure that Wimp_CreateMenu can return an error
 *  Check for errors while creating menu icons
 *  Delete menu window if error while creating icons
 *  Correct behaviour of caret / menu selection

Version 2.11
 *  Switch off pointer during 2-D scrolling

Version 2.12
 *  Return child's task handle from Wimp_StartTask (0 if dead)

Version 2.13
 *  Issue Open_Window_Requests after a mode change later on (ie. on the next
    call to Wimp_Poll).  This allows the window structure to be rearranged
    on receipt of the Mode_Change message.

Version 2.14
 *  Bugfix to the above: a copy of the window list is made, in case
    'backdrop' windows cause the window ordering to change, and the
    background and iconbar windows are opened before the Mode_Change message
    is returned, for compatibility.

Version 2.15
 *  Pointer readjustment when dragged window's extent changes is now fixed
    properly (eg. when dragging Filer windows around, the pointer remains
    over the resize box as it should).

Version 2.16
 *  WimpFlags CMOS bit 5 set => windows are allowed to go off the
    bottom-right of the screen when being dragged by the title bar and when
    Wimp_OpenWindow is called on them, unless bit 13 of the window flags is
    set.  Bit 14 of the window flags acts similarly, but is cancelled after
    the next call to Wimp_OpenWindow relating to that window.
 *  Menus automatically have bit 13 of their windowflags set, as well as
    dboxes (ie. windows which are opened using Wimp_CreateMenu or
    Wimp_CreateSubMenu).
 *  When a window is toggled to full size, or when it is being reopened
    because a mode change has occurred, the Wimp sets bit 14 of the window
    flags first (so the next Wimp_OpenWindow will cause it to be kept on the
    screen).
 *  Window extent supplied in Wimp_CreateWindow and Wimp_SetExtent is
    automatically rounded to pixels by the Wimp.
 *  Double-click with different buttons is not allowed any more
 *  Fix bug: iconbar scrolls if the pointer is moved over either end, even
    if a drag is in progress at the time

Version 2.17
 *  Fix bug: scroll bar dragging when window is partly off-screen
 *  Change pointer shape during double-click period
 *  Cancel double-click as soon as ptr moves away
 *  Cancel double-click if Wimp_DragBox is called

Version 2.18
 *  Fix bug: double-click ptr was not reset if shape <> 1
 *  If the menu-owning application knows about Wimp 2.18 (ie.
    Wimp_Initialise was called with R0 >= 218, R1 = "TASK"), then messages
    destined for menu windows are forwarded to the menu owner task.
 *  Wimp_GetMenuState can be called to determine the current state of the
    menu tree (null tree if you are not the menu owner).  It can also
    determine the menu tree corresponding to a given window/icon if the
    window is a menu or an open dialogue box.

Version 2.19
 *  Increase drag timeout period from 0.2 seconds to 0.5 seconds
 *  Report a drag button event immediately if the button is held down and
    the mouse is moved by 16 OS units or more (as for double-click
    cancellation).

Version 2.20
 *  Mode_Change message and reopen-window messages are only sent after a
    mode change if an old-style task was not active when the call to
    Wimp_SetMode was made, or at any time after that prior to the next
    Wimp_Poll.  This is so that old-style tasks do not get new-style windows
    being reopened on top of them, if they execute Wimp_SetMode in their
    !Run sequence (some programs such as !Delta execute Wimp_SetMode (R0=12)
    to try to get the RISC OS Wimp to behave in a more compatible way with
    the Arthur 1.20 version).
 *  Wimp_SetMode is now allowed while a command window is pending, without
    activating it, and if the command window was already active before the
    mode change, a VDU 4 is executed afterwards (to keep the text visible).
 *  *Wimp_SetMode <number> now causes SWI XWimp_SetMode to be called with
    the number supplied.  This command can be put into !Run files by users
    for convenience (eg. if they prefer a certain package to work in a
    particular mode).  The default !Run files of packages should not cause
    the mode to change.

Version 2.21
 *  New parameters to Wimp_CreateIcon allowed:
        [R1,#0] = -3 => create icon on iconbar to left of icon handle R0
                  -4 => create icon on iconbar to right of icon handle R0
        R0 = handle of icon to open next to, if [R1,#0] = -3 or -4
        R0 = -1 => create icon at extreme left (-3) or right (-4)
    This allows icons to be recreated and deleted (in order to change their
    width, for example) such that they stay in the same relative position on the
    iconbar.

Version 2.22
 *  BUG FIX: Wimp 2.21 preserves R10 (handle) over calls to 'openiconbar',
    which means that the value of 'handle' is not set up correctly for the
    next call to 'recalcposns' after a mode change.  This in turn results in
    OS memory being scrambled, and address exceptions occurring etc.

Version 2.23
 *  If application sets R0 >= 223 when calling Wimp_Initialise, then
    Wimp_Poll or Wimp_PollIdle with R0 bit 13 clear, bit 22 set => R3 ->
    poll word (must NOT be in application space).  If R0 bit 23 is also set,
    then the word is scanned by the Wimp at the start of the Wimp_Poll loop;
    otherwise it is not scanned until just before the Wimp is about to read
    the mouse (ie. after all messages have been delivered and
    Redraw_Window_Requests sent).  If the Wimp finds that the word is
    non-zero, then it will return R0=13 from Wimp_Poll, with [R1,#0] =
    address of poll word, [R1,#4] = contents.

Version 2.24
 *  Fix bug: the above stuff did not work for Wimp_PollIdle (the error "Bad
    parameter passed to Wimp in R0" was returned, even if no bits above bit
    23 were set in R0.

Version 2.25
 *  "*Wimp_SetMode" command changed to "*WimpMode".

Version 2.26
 *  Wimp automatically sets bit 14 of window flags on Wimp_CreateWindow and
    Wimp_SetExtent.  This forces new windows to be initially on-screen, but
    allows them to be dragged off subsequently.

Version 2.27
 *  Menus and dboxes now get bit 14 set, rather than bit 13.  This allows
    them to be dragged off-screen after initial opening.

Version 2.28
 *  Bit 7 of R1 set on entry to Wimp_ReportError suppresses the 'beep' that
    would normally occur if bit 4 of the WimpFlags was clear.

Version 2.29
 *  Drag movement limit increased from 16 to 32 OS units.

Version 2.30
 *  Double-click movement limit increased from 16 to 32 OS units.
 *  Extra sprites added: file_fea and small_fea.

Version 2.31
 *  Sprites taken out of Wimp and put into Desktop module
 *  Also spots when the Desktop module dies or re-inits

Version 2.32
 *  Don't give error on initialisation if ROM sprites can't be found

Version 2.33
 *  Fix problem with *WimpPalette opening the command window
 *  Fix syntax message for *WimpMode <n>

Version 2.34
 *  Make *IconSprites look for <file>23 if in mono mode
 *  Pick up DeskFS:$.Sprites or DeskFS:$.Sprites23 for ROM sprite area
 *  Add Wimp_ReadSysInfo R0=1 => R0=current Wimp mode

Version 2.35
 *  Fix bug: OpenWindowRequest messages should always be dealt with by the
    Wimp, rather than going to the menu owner (even if he says he knows
    about recent Wimps).

Version 2.36
 *  Message_ModeChange, and window re-opening, is only performed after
    Wimp_SetMode if the new mode is different from the last mode for which a
    message was returned.
 *  Iconbar doesn't scroll on a mode change
 *  Escape in a Wimp_ReportError box causes the non-highlighted box to be
    selected, or the only box if it is highlighted.  Any other key selects
    the highlighted box, or the only box if it isn't highlighted.
 *  Maximum number of created windows increased to 256
 *  "Bad Wimp mode" error returned for Wimp_SetMode to double-pixel modes

Version 2.37
 *  If R0 >= 223 on Wimp_Initialise, then Wimp_Poll(Idle) with bit 24 set =>
    save / restore FP registers.

Version 2.38
 *  Window flags bit 14 (force onto screen once only) moved to bit 21
 *  Window flags bit 14 set => drag ignores extent x1
 *  Window flags bit 15 set => drag ignores extent y0

Version 2.39
 *  Use double-width VDU-5 caret if pixel width <= 2 OS units
 *  Use double-width font caret if caret height > 12 pixel-widths

Version 2.40
 *  Fix bug: don't re-open backdrop and iconbar if same mode

Version 2.41
 *  Fix bug: the following calls should accept window -2:
             Wimp_GetWindowState     Wimp_GetWindowInfo
             Wimp_GetWindowOutline   Wimp_ForceRedraw
             Wimp_DragBox            Wimp_WhichIcon
 *  Caret made single-width again
 *  Free pool converted to words, so > 256 pages are allowed

Version 2.42
 *  Default action of f11 is to toggle the iconbar between front and back

Version 2.43
 *  Fix bug: Wimp_ForceRedraw with handle -2 didn't redraw the iconbar

Version 2.44
 *  *WimpMode <n> doesn't do anything if mode is already current.

Version 2.45
 *  Change f11 behaviour to toggle the 'back' bit of the iconbar
 *  Wimp_GetWindowInfo now accepts R1 bit 0 set => don't return the icon
    definitions (ie. just return the window header).  R1 bits 0..1 are
    cleared before R1 is used as a pointer.
 *  Wimp_LoadTemplate now accepts R1<=0 => just return R1 = size of buffer
    required, R2 = size of indirected data

Version 2.46
 *  Fix bug: Wimp_LoadTemplate mustn't check for R1 >= &8000.

Version 2.47
 *  Make Wimp_OpenWindow prevent windows getting bigger than the screen size
    even if they're not being forced onto the screen.

Version 2.48
 *  If ptr_default sprite has its own palette, don't use Wimp palette
    on mode change.

Version 2.49
 *  Ignore clicks on greyed-out menu items
 *  Return Message_MenusDeleted if menus deleted
 *  Return mouse clicks via messages if message queue non-empty

Version 2.50
 *  Look at ModeFlags HiResMono bit rather than Log2BPP = 0 to decide
    whether to use DeskFS:$.Sprites or DeskFS:$.Sprites23 when Wimp starts
    up, and whether to look for <name>23 in *IconSprites.
 *  Wimp_OpenWindow forces the window on screen if it was previously closed.

Version 2.51
 *  Make menu disappear if SELECT clicked on grey item

Version 2.52
 *  Allow interactive help to 'see' greyed-out menu items
 *  Setting menu flags bit 4 allows you to see submenus of grey items.

Version 2.53
 *  Issue Service_WimpPalette on Wimp_SetPalette
 *  Return R2 = sender's task handle from Wimp_Poll(Idle) if task knows
    about Wimp 2.53.

Version 2.54
 *  Fix bugs: Call int_sendmessage_fromwimp rather than int_sendmessage to
    give taskhandle 0 on return from Wimp_Poll.

Version 2.55
 *  Fix bug: *Iconsprites in mode 23 used wrong R2, giving "Bad file name ''".

Version 2.56
 *  Issue Message_MenusDeleted when escape kills menus

Version 2.57
 *  *IconSprites tries <filename>20 if <= 2 OS units per ypix

Version 2.58
 *  *IconSprites tries <filename><x><y><bpp>, then <filename>
    It also uses the values cached on startup
 *  Wimp_ReadSysInfo (2) returns ptr to xeig,yeig,log2bpp

Version 2.59
 *  *WimpTask works from a dead task, by entering the Wimp as an
    application, initialising and then doing the SWI Wimp_StartTask.  It
    then exits via OS_Exit.

Version 2.60
 *  *IconSprites now puts <x><y> or "23" on the end of the filename.
 *  Wimp_ReadSysInfo (2) returns ptr to suffix

Version 2.61
 *  Implement Wimp$State ("desktop" or "commands")
 *  Wimp_ReadSysInfo (3) returns state of commandflag

Version 2.62
 *  Wimp_ReadSysInfo (3) returns 0=commands, 1=desktop
 *  f11 causes iconbar to come to front if covered, and to the back
    otherwise.  When coming to the front, the backwindow bit is cleared, and
    when going to the back,it is set.

Version 2.63
 *  Still send Message_ModeChange even if same mode, and still re-open
    windows, but don't force windows onto screen u nless screen size smaller
    in x or y.

Version 2.64
 *  Fix FP register saving, and set status=&70000 if not saved
 *  Fix scrolled menu dotted line redrawing
 *  Don't send iconbar to back on mode change
 *  Use OS_CheckModeValid when checking for HiResMono modes initially
 *  Clear bottom bits of palette entries in Wimp_ReadPalette

Version 2.65
 *  Don't send Message_SlotSize if slot is same size
 *  Report memory full errors in Wimp_SlotSize correctly
 *  Make OS_ChangeDynamicArea and findpages work with 16Mb
 *  Allow pointer to go off bottom-right in size dragging (this in fact
    causes the window to expand in the other direction).
 *  Fix bug: don't zero bottom bytes in Wimp_ReadPalette
 *  Avoid 16-bit overflow when setting the pointer bounding box.  This gets
    round a problem with unbounded windows with extent > 2^16, where the
    size drag bounds can be too big.

Version 2.66
 *  Fix bug: Wimp_SlotSize corrupted R4 on exit!

Version 2.67
 *  Fix bug: Wimp_LoadTemplate didn't count indirected data properly
 *  Fix bug: turn double-click ptr off if pending window deleted
 *  Fix bug: allow validation string pointer = 1 and indirected text size <=
    0 in templates.  This allows for indirected sprite icons, where the
    'validation string' pointer is in fact the sprite area CB ptr (0 =>
    system sprites, 1 => Wimp pool).

Version 2.68
 *  Add "-next" parameter to *WimpSlot command
 *  Make "-min parameter to *WimpSlot optional

Version 2.69
 *  Altered default Wimp palette so that the bottom two bits of R,G and B
    are equal (for all but colour 8).  This helps the Wimp and ColourTrans
    to agree about the colours in 256-colour modes, and also results in
    better matching colours from the Wimp.

Version 2.70
 *  Changed to use ResourceFS
 *  Included resource files inside module
 *  Accesses resources via WindowManager$Path

Version 2.71
 *  Implement *WimpWriteDir for changing to Hebrew mode
 *  Menus with title starting "\" are reversed
 *  Wimp_ReadSysInfo (4) returns current write direction

Version 2.72
 *  Fix bug: didn't initialise ROM sprites if loaded after ResourceFS

Version 2.73
 *  Added Wimp_CreateIcon window handles -5 to -8 (prioritised)

Version 2.74
 *  Fix bug: iconbar extent should be pixel-aligned

Version 2.75
 *  Fix bug: return click from menu icon if clicked as the mouse enters

Version 2.76
 *  Icons stored separately from windows. This allows window structs to stay still.
 *  Pass reason code messages <= CloseRequest through the message system
    under task ID 'pmiW' ("Wimp"), this enables mode change to send open
    messages for all windows.
 *  Send messages for all windows being opened after a mode change, and stop
    using the stack to hold the window stacking order for this operation.
 *  Implement infinite windows.
 *  Backwindow bit slightly changed in meaning: now, the frontmost back
    window determines where windows opened behind window -2 get opened; if a
    specific window handle is given, even if that window is behind a back
    window, then the opened window will open behind the window specified.

Version 2.77
 *  Handle rectangle area full redraw screen better.

Version 2.78
 *  Fix bug: address exception when clicking on greyed-out menu item

Version 2.79
 *  Iconize messages implemented.

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

Version: 2.80 Wed 24-Oct-90        Ran Mokady                    
 *  Fix bug, address exception when task died while pointer in one of
    its windows.

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

Version: 2.84 Sun 28-Oct-90        Ran Mokady                    

 *  2.81    Changed number of tasks to 128.

 *  2.82    F11 action (Toggle iconbar) moved to F12.

 *  2.83    Fixed bug, drag user sprite called move address first 
             now calls plot first.

 *  Centre error box on screen.
 *  Fixed bug in 3d writable icons, colour now forced only if icon has a border.
 *  Fixed bug in 3d icons, wrong colours in 8bpp modes.
 *  Added r3-> list of messages expected if task knows about version 284 or later.
 *  Moved task priority and message list code to be conditional on Version >= 284
    and not on Swapping.
 *  Shift-Full_Size toggle to max size that doesn't hide icon bar.


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

Version: 2.85 Mon 12-Nov-90        Ran Mokady                    

* Added border (B) and pointer (P) commands to validation string of
  indirected icons.

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

Version: 2.87 Tue 12-Mar-91        Ran Mokady                    

 02-Jan-91    2.86    Read timeouts and distances from CMOS RAM.
                      Added auto submenu opening.

                      
 05-Mar-91    2.87    Fixed bug in messages lists (blocked all messages if
                      message list was present!).

                      Uses OS_ReadSysInfo to read configured mode/Wimpmode.
                      (Now in same byte).


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

Version: 2.89 Tue 16-Apr-91        Ran Mokady                    

   2.88    Fixed bug: Now Uses OS_ReadSysInfo to read configured
                      mode in both places where it is read.
 
   2.89    Added sysflags_nobounds to enable all windows be opened off screen 
           in all directions.
         *     Fixed bug in NewLook stuff that changed graphics clip window
               while dragging without instant effects enabled.
         *     Added UserBars flag to enable the use of sprites for all the window 
               tools including the scroll bars.
         *     Removed *Configure wimpmode.
         *     Changed template loading to use OS_File, and fall back
               to OS_GBPB if the OS_File fails.
         *     Moved toggle icon bar to Shift+F12
 

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

Version: 2.90 Fri 03-May-91        Ran Mokady                    

 24-Apr-91    2.90    Cache UserBars sprites on init and mode changes.
                *     Divided UserBars title sprite into two.
                *     Read configured mode when first task starts.
                *     Fixed a number of positioning bugs in UserBars stuff
                *     Added slowdown code for portable.
                *     Allow use of 2.00 code if sprites not present for
                      title and scroll bars.
                *     Allow aliasing of pressed sprites to no-pressed sprires if
                      pressed sprite not present.




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

Version: 2.92 Tue 28-May-91        Ran Mokady                    

 06-May-91    2.91    Changed delay configuration units to 1/10 sec.
                *     Added WimpMenuDragDelay
                *     Fixed bug: horizontal scroll bar vanished in 8bpp modes when 
                      y0 was 0 (R7 was set to 0 on entry to getspriteinfo).  
 28-May-91    2.92    Added K command in validation string
                *     Wimp now looks sprites up in Wimp pool if not found in window's
                *



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

Version: 2.93 Sat 01-Jun-91        Ran Mokady                    

                *       Bug fixes

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

Version: 2.94 Thu 13-Jun-91        Ran Mokady                    

                *       Bug fixes


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

Version: 2.95 Mon 22-Jul-91        Ran Mokady                    

                *     Fixed bug, Wimp_ReportError stiffed machine if R1=0 on entry and in text mode.
                *     Fixed bug, !Madness made icon bar move.
                *     Added SWI Wimp_AddMessages
                *     Wimp_Initialise now only reports an error if passed in version is <200 or > 300
                      if 200 < version < 300 then  200 is used as the version number.
                *     Error boxes now only respond to <CR> and <Esc>.

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

Version: 2.96 Wed 07-Aug-91        Ran Mokady                    
               
                *       Bug fixes
                *       Revert to old RISC OS 2.00 palette.


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

Version: 2.97 Wed 28-Aug-91        Ran Mokady                    

                *       Bug fixes
                *       Added redraw filters.

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

Version: 3.00 Tue 17-Sep-91        Ran Mokady                    

Release version ?
---------------------------------------------------------------------------

Version: 3.01 Mon 25-Nov-91        Ran Mokady                    

                * Added Perth power management support.
                * Bug fixes


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

Version: 3.02 Wed 11-Dec-91        David De Vorchik              

 26-Nov-91            Modified to use ColourTrans for colour mapping
 29-Nov-91            Fix bug: WimpSlot now accepts 6 parameters ie: "-min <n>k -max <n>k -next <n>k"
 30-Nov-91            Uses ColourTrans for setting GCOLs.
 30-Nov-91            Wimp_ReadPixTrans now uses dynamic workspace.
 30-Nov-91            Check dither CMOS on mode change and set a suitable workspace location.
 03-Dec-91            Implement Wimp_SetColourMapping.
 05-Dec-91            Optimised for 1:1 mapping on colours - sets needsfactors.
 05-Dec-91            Inversion and greying of sprites re-introduced.
 05-Dec-91            Bug fix: When looking for a sprite tries the wimp pool if all fails.
 05-Dec-91            Bug fix: User gadgets now plot using correct mappings - also optimised for space.
 05-Dec-91            Bug fix: Wimp_ReadPalette reads the mapping palette if applied.
 05-Dec-91            Bug fix: Remapping colours works correctly.
 06-Dec-91            Bug fix: Wimp_ReadPalette now returns the pointer colours if remapping applied.
 06-Dec-91            Bug fix: Screen redraw if Log2BPP >=8 and remapping is *not* applied on setting the palette.
 06-Dec-91            Consistent and improved greying and inversion of sprites.
 09-Dec-91            New caret plotting introduced.
 11-Dec-91    3.02    Bug fix: Caret inversion colours corrected.
                      Added new sprites.

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

Version: 3.04 Wed 15-Jan-92        David De Vorchik              

 30-Dec-91            Bug fix: Die entry when reporting Wimp cannot die error message.
 10-Jan-92    3.03    In monochrome modes always dither Wimp colours 0-7.
 10-Jan-92            Wimp_ReadPalette works properly; R2 =TRUE means return full 24bit values.
 10-Jan-92            Wimp_SetPalette works properly; R2 =TRUE means user specifing full 24bit values.
 10-Jan-92            Bug fix: recalcpalette no longer forces redraw of the screen unless really needed.
 10-Jan-92            Bug fix: Wimp_ReadPalette returns GCOL in bottom eight bits.
 14-Jan-92            Experiment with new inversion code and ColourTrans functions.
 14-Jan-92            Recoded the despatch of Wimp_ReadSysInfo reason codes.
 15-Jan-92    3.04    Bug fix: When setting palette preserve supremacy bits.

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

Version: 3.05 Thu 23-Jan-92        David De Vorchik              

 15-Jan-92            Bug fix: Screen update in 8BPP modes when palette changed.
 18-Jan-92            Dot dash line rotation speed now based on timer, rather than internal counter.
 23-Jan-92    3.05    Tweeked the rotation speed of the line, tad faster.

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

Version: 3.06 Thu 27-Feb-92        David De Vorchik              

  7-Feb-92            Service_WimpSpritesMoved added - R2,R3 -> ROM, RAM sprite pools.
  7-Feb-92            Added sprite name caching routines.
  7-Feb-92            Intergrated the use of sprite name cache.
  7-Feb-92            Improved sorting performed on the sprite list.
  7-Feb-92            Removed lots of conditional assembly from Wimp01.
  8-Feb-92            Removed more conditional assembly, sorted out internationalised code and service trapping.
 12-Feb-92            Bug fix: Message token lookup for media search boxes.
 12-Feb-92            Bug fix: Wimp_ReportError getting the title bar wrong.
 12-Feb-92            Now uses OS_FindMemMapEntries rather than its own *SLOW* implementation.
 12-Feb-92            Wimp_RemoveMessages added.
 12-Feb-92            Improved seaching of messages list - now stored on a per-task basis.
 12-Feb-92            Bug fix: duplicate removal on sprite list sort is biased towards RAM pool.
 13-Feb-92            More conditional code removed (Wimp06).
 13-Feb-92            Icon borders tidyied and added back in.
 14-Feb-92            Template loading catches resources: objects.
 15-Feb-92            Bug fix: caching sprites gets correct prefix.
 16-Feb-92            Indirected menu titles implemented for long application titles.
 16-Feb-92            Bug fix: indirected title bars and wimp created sub-menus.
 16-Feb-92            Bug fix: Rogers palette problems - not converted properly.
 18-Feb-92            Changed the reseting of filters to a default state, and issuing of Service_RegisterFilters
 18-Feb-92            Re-ordered filter despatch workspace; now called using LDMIA Rx,{WP,PC} - coded to macro.
 18-Feb-92            Wimp_ReadSysInfo (5) get current task + version of task.
 19-Feb-92            Bug fix: all filters passed R2 contain task handle.
 23-Feb-92            Only plot the icon borders if task specified Wimp version >= 306, solves clash of validation strings.
 23-Feb-92            Added *ToolSprites command to allow loading of sprite borders for windows.
 24-Feb-92            Caching of the tool sprites information added.
 24-Feb-92            Bug fix: border sprites not seen by Wimp_PlotIcon / Wimp_SpriteOp - saves confusion.
 25-Feb-92            Finished new tools sprites routines.
 25-Feb-92            Changed syntax of ToolSprites to allow no parameters - meaning default set from WindowManger:Tools.
 25-Feb-92            Bug fix: excessive recaching of sprite border pointers - only does once on a mode change.
 25-Feb-92            Bug fix: does not reprogram the VDU 5 glyphs if the tool sprites are present.
 26-Feb-92            Bug fix: slot size genertes the correct error if not enough memory - not gobbldy gook!
 26-Feb-92            Bug fix: source clipping works properly on window gadgets.
 26-Feb-92            Further optimisation of dofunkytitle, dofunkyhscroll and dofunkyvscroll.
 26-Feb-92            Now keeps SpriteOp paramaters cached to save recalculating them.
 26-Feb-92            Some more conditional code removed.
 26-Feb-92            Bug fix: pre-scroll offset for scroll bars adjusted by borders properly.
 26-Feb-92    3.06    If not sprite tools loaded then falls back to VDU 5 style glyphs, including reprogramming welsh doofers.

                        **** BASICLY MADE IT GO LOTS FASTER *****

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

Version: 3.07 Thu 27-Feb-92        Ran Mokady                    

     
Removed check for task version on icon plotting.

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

Version: 3.08 Thu 12-Mar-92        Lawrence Rust                 

 11-Mar-92    3.08    Fix help message for WimpMenuDragDelay - fixes G-RO-8313
 12-Mar-92            Messages flag is initialised immediately after claiming ws to ensure
                        if errors are looked up during init (eg in ValidateMode) no address
                        exceptions occur (e.g. if invalid configured screen mode).
                        Fixes RP-0725 and RP-1679

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

Version: 3.09 Thu 19-Mar-92        Lawrence Rust                 

 19-Mar-92     3.09   LRust - Redraw of pressed gadgets fixed to not leave in pressed state
                        *help text for WimpDragDelay etc. tidied.
                        Iconsprites now no longer merges the window border tools.
                          This speeds up *iconsprites and prevents address exceptions
                          caused by cached toolsprites having moved.
                        Wimp_SetCaretPosition now pages in task losing caret if icon
                          has indirected data.

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

Version: 3.10 Thu 02-Apr-92        Lawrence Rust                 

 * Fixed caret positioning in writable icons by ensuring that
  drawicon_system in Wimp04 adjusts for borders before calling
  findtextorigin - thus text is correctly aligned in bordered icons.
 * Menu titles can be indirected using bit8 of the first menu item
 * KA validation string now causes caret to move to the same character
   position within the new icon when up or down arrow pressed.
 * Fixed bug RP-2025, adjust drag scroll bars without instant vertical effects
   erroneously called a user drag routine, and went BANG!!
 * Fix RP-1809, Wimp_ReportError now forces VDU output back to the
   screen before drawing the error box, and restores re-direction and
   other states on exit
 * Fixed RP-1913, Wimp_Initialise now accepts any control character to
   terminate the task descriptor string.  Subr Count0 fixed to do this.
 * Fix RP-1537.  *WimpPalette now checks that there are exactly 16 palette
   entries in the file, thus avoiding problems with the 256 colour variety
 * KA validation string cause up/down arrow to move to end of new field,
   fixes G-RO-7130, RP-1168
 * Sprite highlighting changed again! fixes RR-1674 and Rp-1402 
 * Sprite graying changed again! fixes RP-2094
 * Initptrs now preserves R0, preventing R0 from being corrupted on Service_Reset
 * Fix RP-2148 and RP-2150 - F command in validation specifying font colours
   now accepts lowercase hex colour numbers.
 * Fix RP-2153 - Mode change now uses default colour mappings for the mode to ensure
   the physical palette isn't changed by use of Wimp_SetColourMapping to alter
   logical colour mapping.  In addition Wimp_SetColourMapping also forces
   re-caching of tool sprites to ensure the cached palette is correct.
 * Fix die entry if tasks are active to restore R12 after (and not before!)
   translating the CantKill error.
 * Respond to service_InvalidateCache
 * Add reason code 7 to ReadSysInfo to return Wimp version

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

Version: 3.11 Tue 07-Apr-92        Lawrence Rust                 

 * 3D scroll bar routines fixed to only plot icons if clipping rectangle is
   non null.  Pressed hscroll bars drawn correctly.  Fixes RP-1766 and other
   3D tool complaints.
 * Service_InvalidateCache disposes of tool_list only, redrawing window with
   empty tool_list calls maketoollist to re-cache tool info.

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

Version: 3.12 Thu 16-Apr-92        Lawrence Rust                 

* ExitPoll only calls post filter if event in R0 is valid (ie not when
  R0 is setup for Wimp_StartTask.
* ExitPoll call to portable module for non null events optimised.
* Recoded scanpollwords to use a packed list of pollword tasks to improve
   search time.  Fixes G-RO-7574
* Submenus now displayed immediately to right of arrow (left in hebrew), not
   to right of window, in case title wider than item.
* Fixed template loading to correctly preserve file handle if insufficient
   RMA to cache the file.  Fixes RO-8608 (Acorn DTP not starting on 1 Mb machine).
* Wimp_ReportError correctly returns cancel if escape pressed with highlight on ok

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

Version: 3.13 Thu 23-Apr-92        Ran Mokady                    

* Remove input focus from iconized windows.

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

Version: 3.14 Fri 24-Apr-92        Ran Mokady                    

* Fixed redraw bug, caret size now takes into account the icon border.


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

Version: 3.15 Fri 24-Apr-92        Ran Mokady                    

* Stop text in non indirected sprite and text icons from being printed if an
  error occurs when plotting the sprite. Fixes bug in !PinPoint.

* Pass correct registers to blockcopy filter.

* Call rectangle filter when system area of window is being drawn.



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

Version: 3.16 Thu 30-Apr-92        Lawrence Rust                 

* Fixed address exception during mode change with little RMA
  VDU 5 glyphs correctly used for undefined toolsprites

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

Version: 3.20 Tue 23-Mar-93        Neil Kelleher                 

* Outline system font implemented: Wimp$font, Wimp$fontsize, Wimp$fontwidth
  control appearance of font used in menus and icons in general.

* Menu width calculated automatically to maximum width of menu items, except
  when a writeable field exists when stated width is used as a minimum.

* Improved background filling for inverted and sprite+text icons.

* Support Wimp_ReadSysInfo (Reason 8) returning system font handle in R0 and 
  symbol font handle in R1.

* 'Kar' bug fixed.

* Wimp now sends message when system font changes. 

* Added new SWI, Wimp_GetIconInfo. 

* Creating icons on icon bar, automatically widen if text (in current system font) 
  doesn't fit- NOTE, if fontwidth changes during desktop use, it is not updated.

* Implemented prototype features for tiling window backdrops and slab in/out
  of border 1 sprite icons.


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

Version: 3.22 Thu 15-Jul-93        Neil Kelleher                 

* various improvements to outline system font. See spec

* new error system allowing severity and extension through service calls

* Medusa memory management support                 

* watchdog to kill off rogue tasks

* New SWI's: ResizeIcon, SetWatchdogState and Extend (direct calling mechanism)

* Speedups and bug fixes.


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

Version: 3.23 Fri 20-Aug-93        Neil Kelleher                 

* CMOS configuration for desktop font.

* GetIconInfo SWI now TextOp

* Return and escape can be used on error boxes with custom buttons

* deleted writables with KRANT validation now ignored when using arrow keys

* various bug fixes

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

Version: 3.24 Fri 27-Aug-93        Neil Kelleher                 

* (O Love) Altered error messages

* Added CMOS control for tiling of window backgrounds.

* various bug fixes

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

Version: 3.25 Fri 03-Sep-93        Neil Kelleher                 

* Added different tile depth support

* rearranged sources

* auto menu width no takes sprites into account

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

Version: 3.27 Fri 17-Sep-93        Neil Kelleher                 

* altered window furniture code - should be more efficient

* made DA sprite area on medusa more efficient

* can *WimpMode outside of desktop

* fixed a few bugs incl. grey modes

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

Version: 3.28 Thu 30-Sep-93        Neil Kelleher                 

* WrCh vector now released on Service_ModeChange - catches 'single tasking'
  apps that change screen mode with OS_ScreenMode rather than VDU 22.

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

Version: 3.29 Thu 30-Sep-93        Neil Kelleher                 

* updated to cope with increased sprite op reason code.

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

Version: 3.30 Mon 04-Oct-93        Neil Kelleher                 

* updated !WIMPSymbol.

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

Version: 3.31 Wed 06-Oct-93        Neil Kelleher                 

* tweaked darwin.

* reorganised sources - can now build with outlinefont off.

* speeded up mode changes

* fixed some selected icon problems.

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

Version: 3.32 Fri 08-Oct-93        Neil Kelleher                 

* On Medusa memory is returned when exiting desktop.

* workaround for toolsprites code causing lots of 'can't find sprite'
---------------------------------------------------------------------------

Version: 3.33 Mon 11-Oct-93        Neil Kelleher                 

* now uses look up table for program errors

* few memory fixes.

* caret is red on 16/32 bit modes.
---------------------------------------------------------------------------

Version: 3.34 Tue 19-Oct-93        Neil Kelleher                 

* yet more memory fixes.

* error block now copied so message trans overwritting buffers is ok.

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

Version: 3.36 Wed 03-Nov-93        Neil Kelleher                 

* and some more memory fixes!

* fixed line across the screen from an error box bug

* increased minimum scrollbar height and fixed cannot scroll to end bug.


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

Version: 3.37 Thu 18-Nov-93        Neil Kelleher                 

* more memory fixes.

* fixed MED-01061

* fixed MED-00973

* fixed MED-01097

* fixed MED-00297

* fixed MED-01103

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

Version: 3.38 Wed 01-Dec-93        Neil Kelleher                 

* fixed MED-00967/8

* fixed MED-00974

* altered icon selection (faster, sprites slightly different colours)
                                                                     
* fixed MED-00966

* ALT-BREAK now used for watchdog

* fixed MED-01342

* fixed MED-01346

* fixed MED-01431



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

Version: 3.39 Thu 09-Dec-93        Neil Kelleher                 

* fixed MED-01406

* fixed MED-00776

* Fixed MED-01228

* Fixed MED-01588

* Fixed MED-00414


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

Version: 3.40 Wed 12-Jan-94        Neil Kelleher                 

* Stopped acknowledging messages from deleting events : fixes MED-00003 and
  MED-00985.

* fixed MED-00943, better handling for iconbar icons with variable text

* fixed MED-00946

* recoded tiling.

* fixed MED-01364

* fixed MED-01418

* fixed MED-01711

* fixed MED-01818

* fixed MED-01894

* fixed MED-02090,1,2122,2146,2202

* fixed MED-02095


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

Version: 3.41 Thu 20-Jan-94        Neil Kelleher                 

* fixed MED-00240

* fixed MED-00563

* fixed MED-02050

* fixed MED-01910

* Tweaked memory management and tiling.
---------------------------------------------------------------------------

Version: 3.42 Fri 21-Jan-94        Neil Kelleher                 

* Improved font manager death recovery

* fixed (MED-00114) toolsprite probs.

* Wimp_ClaimFreeMemory works on machines with more than 28 meg.

* tweaked error box templates
---------------------------------------------------------------------------

Version: 3.44 Mon 31-Jan-94        Neil Kelleher                 

* W_CFM now returns free pool EEK!!!

* fixed MED-01852

* fixed MED-02443

* fixed MED-02497

* fixed MED-01910
 
---------------------------------------------------------------------------

Version: 3.45 Thu 03-Feb-94        Neil Kelleher                 

* improved FM death recovery (now loses fonts so that useage should go down to zero)

* custom buttons get correct border if they are a default (ie. no ok or cancel)

* fixed load template giving spurious errors (affected Magpie and Junior Pinpoint)

* fixed MED-02285

* fixed MED-02269

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

Version: 3.46 Tue 08-Feb-94        Neil Kelleher                 

* fixed MED-01796

* improved Watchdog to cope with special circumstances such as a running
Print Job or output switched to sprite.

* improved font preservation (when to do it/ when not to)

* fixed menu delay offset bug.



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

Version: 3.47 Wed 09-Feb-94        Neil Kelleher                 

* Thought about font preservation and removed it for now.

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

Version: 3.48 Fri 11-Feb-94        Neil Kelleher                 

* Fixed MED-02301, substantially changed unfilled text only icons

* Fixed MED-02598

* Fixed bug that could cause program errors to go wrong themselves

* fixed tiling bug - only occurred when a window had a custom sprite

* put in (different) font preservation checking

* Added 'vertical justification' bit to TestOp, Wimp_RenderText

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

Version: 3.49 Wed 16-Feb-94        Neil Kelleher                 

* Fixed W_CFM (asking for lots of memory didn't fail)

* Added extra FM abuse security (eg. MED-00669)

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

Version: 3.50 Thu 17-Feb-94        Neil Kelleher                 

* changed Sprite Op's 'can't do that in this depth' error to User one.

***************************************************************************
                      MEDUSA - RISC OS 3.50 build
***************************************************************************
*                                                                         *
*  Project: Black                                                         *
*                                                                         *
*  Module:  Wimp                                                          *
*                                                                         *
*  Created: Tue 21-Jun-94      By: Aideen McConville                      *
*                                                                         *
*  First version: 3.50                                                    *
*                                                                         *
*    Copyright:    (C) 1994, Acorn Computers Ltd., Cambridge, England.    *
*                                                                         *
***************************************************************************

Purpose:
========



***************************************************************************


Change Log:
===========


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

Version: 3.50 Tue 21-Jun-94        Aideen McConville             

Moved to new source tree.

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

Version: 3.51 Thu 21-Apr-94        Richard Manby

* added power saving code for Stork

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

Version: 3.52 Tue 02-Aug-94        Aideen McConville             

* Updated hdr.Wimp (from Neil Kelleher)
  Contains new reason codes.

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

Version: 3.53 Thu 18-Aug-94        Steve Cormie                  

* Fixed MED-03541: BadParameters token (which did not appear in any Messages
  file) replaced with BadParm.
* Fixed MED-03390: button texts Quit, Continue and OK (for error dialogue)
  were not looked up in Messages file.

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

Version: 3.54 Tue 13-Sep-94        Steve Cormie                  

* Fixed MED-03700: various messages now looked up.

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

Version: 3.55 Tue 27-Sep-94        Steve Cormie                  

* Fixed MED-03711 and MED-01949: long error messages were being copied over
  workspace causing data aborts.
* Fixed MED-03346: convert ROM patch to source fix, prevent Wimp accessing
  info on taskhandle 0.
* Fixed MED-03135: convert WimpUtils module patch into source fix, workspace
  pointer corrupted before attempting to read from workspace.

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

Version: 3.56 Wed 28-Sep-94        Alan Glover                   

* Fixed MED-03674: could make windows disappear because they were being
  opened behind an iconised window. (s.wimp03)
* Fixed MED-03233: change name of information sprite (should be information
  was info1) (sprites)
* Fixed MED-03145: key names were getting right justified if they appeared
  in writable menu icons. (s.wimp05)
* Fixed MED-03087: finally, really, at last fix nager:sprites22 - change the
  buffer in which the command to load wimp sprites from away from the error
  buffer! (s.wimp01)
    
---------------------------------------------------------------------------

Version: 3.57 Tue 18-Oct-94        Aideen McConville             

* Fixed MED-03691: Wimp 3.57 onwards will expect its Templates to be in
                   'Templates' (s.Iconbar, s.Wimp08, Makefile)

* Also corrected Makefile which was copying 2D tools to Resources.

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

Version: 3.58 Thu 20-Oct-94        Alan Glover                   

* Fixed MED-03800: Avoid an interaction whereby the wimp would obtain a
                   translation table from ColourTrans, and then discard
                   it before it got around to using it. (Affected 16/32bpp
                   sprites in filer windows in 256 (and less) colour modes)
                   (s.wimp01, s.wimp04)

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

Version: 3.59 Sat 29-Oct-94        Aideen McConville             

* Added sprites from !Draw (DXF) and !Printers to Wimp Sprites.
  Also updated Sprites22 and Sprites23 with !Printer sprites.

* Moved Sprites, Sprites22, Sprites23, Tools and Tools3d to UK directory.
  (updated Makefile and s.wimp08 accordingly).

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

Version: 3.60 Mon 31-Oct-94        Steve Cormie                  

* Added directed comments to Messages file for message tokenisation.
* Moved command help/syntax from Global.Messages to Messages file.

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

Version: 3.61 Wed 21-Dec-94        Steve Cormie                  

* Fixed MED-03323: Don't fill 0 sized icons.
* Fixed MED-03865: Changed "Wimp Sprite Pool" to "Wimp sprite pool".

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

Version: 3.62 Mon 16-Jan-95        Aideen McConville             

* Fixed MED-04107: Added JPEG filetype sprite (c85) to Resources.UK.Sprites[22]
                   Also added Resource filetype (fae).

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

Version: 3.63 Wed 18-Jan-95        Steve Cormie                  

* Implemented correct fix for MED-03674 (also fixes MED-04376 which resulted
  from the fix in version 3.56).

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

Version: 3.64 Thu 16-Feb-95        Alan Glover                   

* Looks like 28 Sep '94 was a **bad** day for coding. Fix bug MED-04476,
  which arose from the previous fix for MED-03145. Symptom was Edit>Create>Text
  gave a window without input focus. This was because the caret had got stuck
  in the menu structure!
  
  
---------------------------------------------------------------------------

Version: 3.65 Fri 24-Feb-95        Steve Cormie                  

* Fix for MED-04690: Added sprites file_be8, small_be8 and file_ff0 (were in
  CDFSFiler sprite files).

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

Version: 3.66 Mon 06-Mar-95        Aideen McConville             

* Fixed MED-04771: Shared disc sprites included in Wimp.Sprites[22]
                   AUNMsgs also updated (0.03)

***************************************************************************
                      Black - RISC OS 3.60 (4.28) build
***************************************************************************