• Andrew Hodgkinson's avatar
    First a minor warning - the various Res files are out of sync in this build. · 7656a1b3
    Andrew Hodgkinson authored
    Only the Browse resources are currently valid.
    
    Added Utils.Icons - has a few archives inside containing the resources
    (well, some of them) used to build various UI sprites for various builds.
    Archived because these are unlikely to change much, and putting them on
    CVS was a move to, well, archive the stuff...
    
    SaveDBox objects vanquished and requirements in !Run[D] files removed. The
    data save code fits much more neatly in amongst the data load protocol
    stuff now (with the slight exception of having to split the SaveObject
    source into SaveObject and SaveFile - the former handles multiple persistent
    dialogues for Shift+Click on links and the like, the latter handles 'one at
    a time' transient dialogues for save source and similar). Export Link is now
    supported, too, and writes a 'proper' version URI file. You'll find that
    double-clicking on old URI files will work as the URI handler picks them up,
    whilst new version ones don't; however, dragging onto the browser will only
    work with new version files. Note that support for saving and loading URL
    files (ANT suite stuff) is present too, so old URI files can be typed as URL
    files if you want to keep them working without modification - the URI
    handler itself will hopefully support the defined URI file format soon;
    double-clicking on old URI files will stop working at that point. Note
    there are *lots* of changes in every Res file to support all this. This may
    all seem a bit pointless to some, but the changes do in fact make it very
    easy to add new save dialogues all over the place. Certainly much easier
    than with the previous system, anyway. In fact, post script, image
    'save as sprite' took about half an hour, which I hope proves the worth
    of the new system.
    
    Merged in newer hotlist code with support for drag cancelling with Escape
    (all relevant Res files appropriately updated) and cancelling scrolling
    when you've reached the window scroll limit. Had to move some of the
    Wimp message handling stuff to the central Protocols source, as clashes
    were occuring, and also the hotlist routines were using independent saving
    code - a lot of duplicated effort. This was fair enough as at the time the
    Hotlist code was written, the Save code couldn't be used in the way it is
    now.
    
    New Save Source and Print buttons on the toolbar of some builds.
    
    Phoenix Sprites file made more efficient - the Acorn base section has been
    split from the animated upper region. Browse build has a new grey fade
    sprite at the back, which is less grainy than the previous one and only
    uses 16 colours (with a 16 greyscale palette).
    
    Not really a bug, bug the routine to start an image fetch for INPUT
    TYPE=IMAGE forms items only did so if the src field (or equivalent, for
    this tag type) was non-NULL. In fact, you should always call image_new_image
    and let that handle the rest, otherwise other sections of the code will fail
    as they try to obtain an image number for a given HStream and get -1 back.
    This problem only generally manifested itself when loading an HTML file to
    the browser straight from an application, as many src fields become NULL
    when the relativisation routines find nothing to relativise to...
    
    Authentication got broken somewhere along the line - this has been fixed
    (in HTMLLib and the browser).
    
    Ctrl+Click on a cross referenced image updates *all* copies, not just the
    one with the image data attached.
    
    Next big step: Rip up TBEvents.h and rebuild that whole approach somewhat.
    To all those working on the code, my apologies but this means all Res files
    will receive a very large number of alterations and there will be extensive
    code changes too (mostly naming convention stuff), in more or less all
    source files. I am endeavouring to ensure that the new numberspace
    convention does not clash with the work being done by Kevin on
    internationalisation.
    7656a1b3
Global 9.29 KB
/* Copyright 1997 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/***************************************************/
/* File   : Global.c                               */
/*                                                 */
/* Purpose: Holds all of the browser's globals.    */
/*                                                 */
/* Author : A.D.Hodgkinson                         */
/*                                                 */
/* History: 12-Nov-96: Created.                    */
/***************************************************/

#include "setjmp.h"

#include "wimp.h"
#include "event.h"

#include "svcprint.h"
#include "Global.h"
#include "Utils.h"

#ifdef TRACE

  /********************************************************/
  /* Trace level, for debug purposes only.                */
  /*                                                      */
  /* All trace output is done through the Printf function */
  /* which has an identical API to printf. This is        */
  /* commonly used for TML card output but any debug      */
  /* library can be linked in provided it provides the    */
  /* Printf interface.                                    */
  /*                                                      */
  /* Some debug output takes advantage of 16 colour modes */
  /* on the debug machine and sends VDU codes to change   */
  /* the text colour. This may influence the approach     */
  /* taken if authoring an alternative debugging library. */
  /*                                                      */
  /* Debug output is only available if the entire project */
  /* is compiled with TRACE defined in the compiler.      */
  /*                                                      */
  /* Some extra error messages (such as missing component */
  /* IDs) will be raised in TRACE builds. Even more may   */
  /* be raised by defining STRICT_PARSER in the compiler; */
  /* this ensures any image processing errors are         */
  /* reported and (e.g.) badly nested framesets will      */
  /* generate an appropriate complaint. STRICT_PARSER     */
  /* browser-owned errors are defined in the Messages     */
  /* file; TRACE errors are hard coded.                   */
  /*                                                      */
  /* Bit  Purpose                          Arg      Value */
  /*                                                      */
  /* 0    MessageTrans related messages    MsgT         1 */
  /* 1    Toolbar handler messages         TBar         2 */
  /* 2    Null claim/release messages      Null         4 */
  /* 3    Browser window created/deleted   Wind         8 */
  /* 4    Menu handler messages            Menu        16 */
  /* 5    Routine start, poll, exit        Rout        32 */
  /* 6    Fetcher functions                Fetc        64 */
  /* 7    Memory handling function calls   Memo       128 */
  /* 8    Reformatter functions            Refo       256 */
  /* 9    Redraw functions                 Redr       512 */
  /* 10   Font library functions           Font      1024 */
  /* 11   Bounding box info for redraws    BBox      2048 */
  /* 12   Low level memory tracing         LMem      4096 */
  /* 13   Running malloc/free count        CMal      8192 */
  /* 14   Running flex alloc/free count    CFle     16384 */
  /* 15   Image handling code              Imag     32768 */
  /* 16   History (local and global)       Hist     65536 */
  /* 17   Frames                           Fram    131072 */
  /* 18   Stream and memcpy/memmove trace  Stre    262144 */
  /* 19   Indications of special tags      Circ    524288 */
  /* 20   Table parsing information        Tabl   1048576 */
  /* 21   URI handler interfacing          URIH   2097152 */
  /* 22   Keyboard control functions       KeyC   4194304 */
  /* 23   Redraw rectangle display         RBox   8388608 */
  /* 24   JavaScript functions             JScr  16777216 */
  /* 25   Hotlist manager                  Hotl  33554432 */
  /* 26   Save functions                   Save  67108864 */
  /* 27   Dragging (dashed outlines etc.)  Drag 134217728 */
  /* 28   Message protocol tracing         MsgP 268435456 */
  /*                                                      */
  /* To use, put -debug or -d into the command line args  */
  /* for running !RunImage, followed by a series of comma */
  /* separated values which are as given above. Use 'All' */
  /* for everything, though with caution (large amounts   */
  /* of output will be generated!). For example:          */
  /*                                                      */
  /*         Run !RunImage -d MsgT,Menu,Rout %%*0         */
  /********************************************************/

  unsigned int tl;
  int          malloccount;
  int          flexcount = 0;

#endif

jmp_buf         env;                           /* Used for error handler, so it can jump back to poll look if  */
                                               /* the user selects OK rather than Cancel                       */

int             quit;                          /* Set to 1 to indicate a successful exit should occur          */
int             modechanged;                   /* Set to 1 immediately after a mode change                     */
int             printing;                      /* Set to 1 during a printing loop, else 0                      */
int             drag_in_progress;              /* Somebody somewhere in the browser is doing a drag operation  */
int             authorising;                   /* Set to 1 during authorisation of a fetch (all fetches stop)  */

int             wimp_version;
int             nested_wimp;                   /* Wimp version, flag to say the nested window manager is       */
int             task_handle;                   /* present, Wimp task handle, pointer to sprite block.          */
int             sprite_block;

int             taskmodule_ds_registered;      /* Set to 1 if the dialler status service call is being watched */
int             uri_module_present;            /* Set to 1 if the URI module is present and may be used        */

MessagesFD      meb;                           /* MessageTrans Messages file control block                     */
MessagesFD    * chb;                           /* MessageTrans Choices file control block allocated in RMA     */
MessagesFD    * cob;                           /* MessageTrans Control file control block allocated in RMA     */
char            tokens   [Limits_Message];     /* lookup_token/choice puts looked up data in here              */
char            lasttokn [Limits_Token];       /* The last token looked up is stored here for future reference */

int             messages_list [] = {0};

IdBlock         idb;                           /* For all Toolbox-registered event handlers                    */
int             event_code_list [] = {0};

WimpPollBlock   b;                             /* For Toolbox-registered Wimp event handlers                   */

int             null_counter;                  /* When zero, null events will be disabled, else enabled. For   */
                                               /* each time something wants to claim nulls, it increments this */
                                               /* and decrements it when finished                              */
int             bullets;                       /* Number of bullet sprites available                           */
unsigned int    animation_frames;              /* Holds the number of animation frames in the Sprites file     */

browser_data  * last_browser;                  /* Points to the last browser_data structure in the linked list */
                                               /* of structures associated with all browser windows, or NULL   */
                                               /* there are no browser windows. The structure is defined in    */
                                               /* Global.h                                                     */
browser_data  * highlight_frame = NULL;        /* The currently highlighted frame (if any)                     */

global_choices  choices;                       /* To store [temporary] global choices (from the Choices file)  */
fixed_choices   fixed;                         /* To store fixed choices (from the Messages file)              */

char            program_name[Limits_TaskName]; /* _TaskName token contents put in here, for the flex library   */

_kernel_oserror erb;                           /* Global error block for custom errors                         */

menu_source     menusrc = Menu_None;           /* For Wimp menus - opened from forms, from history icons, etc. */
void          * menuhdl;                       /* For any extra info needed with a menu                        */

#ifndef SINGLE_USER
  userdef       user;                          /* For multiuser builds, holds details of the current user      */
#endif