home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1997-09-03 | 53.0 KB | 2,147 lines
Kasoft Software File Box Module Reference Manual (Format width is 76 characters) - Copyright © Kasoft Software 1997 Neither the whole nor any part of this manual, or the software described herein may be adapted or reproduced in any material form except with the prior written approval of the author. The software described in this manual is subject to continuous development and improvement. All information of a technical nature and particulars of the software and its use (including the information and particulars in this manual) are given by Kasoft Software in good faith. However, Kasoft Software will not accept liability for any loss or damage arising from the use of the software or the documentation in this manual. All correspondence should be addressed to the address given in the release note. The relocatable module 'FileBox' was programmed by Kade Hansson. This module is suitable for use with all ARM-based computers running Acorn RISC OS version 3.10 or later. This manual or the software it documents has no connection with Acorn Computers Limited, but necessary registration of the module title and allocation of a software interrupt chunk number has been carried out. Thus, the software should not interfere with other software which has taken similar precautions. KASOFT and the Kasoft device are trademarks of Kasoft Software, and owned by Kade Hansson. ACORN is a trademark of Acorn Computers Limited. Edition 2 (ASCII text file version) Published September 1997; Issue 2 Written by Kade Hansson Published by Kasoft Typesetting Code KM09602,02T - Contents Introduction Introduction to the File Box module The Load window The Save window Program information Interactive help Overview *Command protocol SWI protocol Controlling File Box Technical Details *Command protocol Getting an input filename Getting an output filename Resetting File Box SWI protocol Getting an input filename Getting an output filename Controlling File Box File Box errors SWI Calls FileBox_InitiateLoadFromFiler (SWI &48240) FileBox_PollLoadFromFiler (SWI &48241) FileBox_InitiateSaveToFiler (SWI &48242) FileBox_PollSaveToFiler (SWI &48243) FileBox_AbortLoad (SWI &48244) FileBox_AbortSave (SWI &48245) FileBox_DoLoadFromFiler (SWI &48246) FileBox_DoSaveToFiler (SWI &48247) FileBox_Control (SWI &48248) FileBox_PollControl (SWI &48249) FileBox_AbortControl (SWI &4824A) FileBox_FiletypeExtendOp (SWI &4824B) Service Calls Service_FileBoxWorkspace (Service &48240) *Commands *Desktop_FileBox *Help FileBox *IOVarsOff *IOVarsOn *InputPrompt *InputReset *InputTitle *OutputReset *OutputTitle *OutputType *ResetFileBox System Variables FileBox$GetInputFilename FileBox$GetOutputFilename - Introduction The Kasoft File Box module provides loading and saving facilities for Desktop tasks. Any task, including one that is running in a task window, can use File Box as a simple means of implementing the standard file dragging procedures for the loading and saving of files. The technical intricacies of the RISC OS Desktop saving and loading protocols are hidden from tasks, with File Box acting as a useful intermediary. This module was written by Kasoft Software and it is subject to continuous development and improvement. Updates to new versions and licences for distributing this module with commercial software are available. Feel free to contact us at the address given on the release note. Criticisms and suggestions for improvement will be appreciated. Please note that copyright subsists in this software, so you should familiarize yourself with the licence which accompanied it. The Load window The File Box Load window is displayed when a task requires an input file to be specified. If a task window requested this Load window, then its appearance is often accompanied by a message in that task window, giving the user more information on what is required. The Load window will usually open under the mouse pointer. There are several available responses to a Load window: • To specify an input file, simply drag it onto the Load window. Do not drag it to the parent task window. • Alternatively, you can type the full pathname of the input file, and press the Return key or click on OK. • To abandon the operation either click on Cancel (or the close icon) or press the Escape key. The Save window The File Box Save window is displayed when a task requires an output file to be specified. If a task window requested this Save window, then its appearance is often accompanied by a message in that task window, giving the user more information on what is required. The Save window will usually open under the mouse pointer. There are several available responses to a Save window: • To specify an output file, type a leafname for the file (or use the name supplied, if there is one) and drag the file icon to a directory viewer. • Alternatively, you can type the full pathname of the output file, and press the Return key or click on OK. • To abandon the operation either click on Cancel (or the close icon) or press the Escape key. Program information To obtain information on the version of the File Box module you are using, click Menu over a File Box window. Alternatively, you can type: *Help FileBox at the command line. Interactive help The File Box task supports interactive help (provided by the !Help application found in the Apps directory), so that moving the pointer over various elements of the Load and Save windows will cause helpful instructions and information to be displayed in the interactive help window. - Overview There are two levels available to users of File Box facilities: • The *Command level allows users to access the most simple File Box facilities from the command line of a task window, within a TaskObey or TaskExec file, within any Desktop task or within any language running in a task window, such as BASIC. • The preferred level of File Box operation is the SWI level, where File Box facilities are accessed by programmers using the sophisticated SWI calls provided by the File Box module. *Command protocol To specify a filename from the command line or within a program running in a task window often involves entering a long and complicated pathname. File Box avoids this by allowing filenames to be specified using the standard file dragging procedures. To specify the full pathname of a file to be loaded or used for input in a task window, all that is necessary is to read the value of a system variable. *Commands are also provided to allow the title, prompt and default filename which appear in the Load window to be customized. To specify the full pathname of a file to be saved or used for output in a task window, all that is necessary is to read the value of another system variable. *Commands are also provided to allow the title, file type and default filename which appear in the Save window to be customized. SWI protocol Several SWIs are provided to allow sophisticated control of all File Box facilities. One SWI initiates either a Load or Save operation, involving the opening a Load or Save window, which can have various aspects customized as required. Another SWI allows polling of the progress of the Load or Save operation, and will inform your task of the user's response when it occurs. A SWI is provided to perform an entire Load operation in one step, and there is a similar SWI for Save operations. These calls are simpler to use, but offer slightly less flexibility than the two step method. Controlling File Box A miscellaneous SWI allows the user to control and investigate other aspects of the File Box Desktop task, such as: • Starting, quitting and restarting the File Box task. • Reading the task handle of the File Box task. • Specifying either 2D or 3D windows. • Reading the type (2D or 3D) of windows currently used by the File Box task. • Opening and closing the program information window. • Moving the Load and Save windows, or forcing them to the front of the window stack. • Enabling or disabling the File Box system variables. • Reading and setting various attributes of the windows opened when using the File Box system variables. - Technical Details *Command protocol Before you can use the *Command protocol, you must enable the File Box system variables using the command: *IOVarsOn If you are reading many system variables at a time, you must disable the File Box variables again, so that the operating system does not attempt to read their values. The following command disables the File Box system variables: *IOVarsOff If the operating system does read a File Box variable while the Desktop is suspended (during *Show from ShellCLI, for example), then the computer can crash. Even if the Desktop is active, it is inconvenient if you are presented with a spurious Load or Save window while reading many system variables at a time. Getting an input filename To specify an input filename via File Box facilities, it is simply a matter of referring to the system variable: FileBox$GetInputFilename For example, if you want to *Dump a file from a task window, using File Box to specify the input filename, you simply enter the command: *Dump <FileBox$GetInputFilename> If you are using the File Box variables to specify an input filename from within a program, you might like to customize various attributes of the Load window using the commands: *InputTitle <title text> *InputPrompt <prompt text> *Set FileBox$GetInputFilename <default filename> To reset the attributes of the Load window to their default values, simply use the command: *InputReset Getting an output filename To specify an output filename via File Box facilities, it is simply a matter of referring to the system variable: FileBox$GetOutputFilename For example, if you want to save the system sprite area contents from a task window, using File Box to specify the output filename, you simply enter the command: *SSave <FileBox$GetOutputFilename> If you are using the File Box variables to specify an output filename from within a program, you might like to customize various attributes of the Save window using the commands: *OutputTitle <title text> *OutputType <filetype> *Set FileBox$GetOutputFilename <default filename> To reset the attributes of the Save window to their default values, simply use the command: *OutputReset Resetting File Box If a task window exits before File Box receives a response via a Load or Save window opened by that task window, File Box will be stuck a busy state, even after that Load or Save window is closed. In order to reset File Box so that it is no longer busy, use the command: *ResetFileBox SWI protocol The following SWIs are provided by the File Box module to allow tasks to make use of File Box input file facilities: • FileBox_InitiateLoadFromFiler (SWI &48240) • FileBox_PollLoadFromFiler (SWI &48241) • FileBox_AbortLoad (SWI &48244) • FileBox_DoLoadFromFiler (SWI &48246) The following SWIs are provided by the File Box module to allow tasks to make use of File Box output file facilities: • FileBox_InitiateSaveToFiler (SWI &48242) • FileBox_PollSaveToFiler (SWI &48243) • FileBox_AbortSave (SWI &48245) • FileBox_DoSaveToFiler (SWI &48247) Getting an input filename To obtain a filename for input via File Box facilities, the first step is to call the SWI routine FileBox_InitiateLoadFromFiler (SWI &48240), passing details specifying various elements of the Load window, such as the title text, the prompt text and the default filename. A Load window will be opened, and you will be able to poll for the user's response using the SWI routine FileBox_PollLoadFromFiler (SWI &48241). To abort the operation before the user responds, simply call FileBox_AbortLoad (SWI &48244) The SWI routine FileBox_DoLoadFromFiler (SWI &48246) condenses all of the steps outlined above into one simple call. However, by using this routine it is not possible to perform background processing while your task is waiting for the user's response, and it is also not possible to abort the operation before the user responds (after a certain period of time has elapsed, for example). Getting an output filename To obtain a filename for output via File Box facilities, the first step is to call the SWI routine FileBox_InitiateSaveToFiler (SWI &48242), passing details specifying various elements of the Save window, such as the title text, the sprite name of the file icon and the default filename. A Save window will be opened, and you will be able to poll for the user's response using the SWI routine FileBox_PollSaveToFiler (SWI &48243). To abort the operation before the user responds, simply call FileBox_AbortLoad (SWI &48245) The SWI routine FileBox_DoSaveToFiler (SWI &48247) condenses all of the steps outlined above into one simple call. However, by using this routine it is not possible to perform background processing while your task is waiting for the user's response, and it is also not possible to abort the operation before the user responds. Controlling File Box The multi-purpose SWI routine FileBox_Control (SWI &48248) provides miscellaneous control functions. Its primary purpose is to control the File Box Desktop task, and many reason codes cause communications with the File Box task via a semaphore mechanism. Because communication with the File Box task via FileBox_Control is not instantaneous, two other calls allow you to wait for an operation to be completed or abandon the current operation. These SWI routines are FileBox_PollControl (SWI &48249) and FileBox_AbortControl (SWI &4824A). The FileBox_Control SWI also provides direct access to and control over the *Command protocol. These calls are faster than their corresponding *Command and often provide more control. However, it is recommended that the preferred SWI protocol be used instead. Support for FiletypeExtend FileBox supports the Kasoft FiletypeExtend extension, and the routines it uses to allow this have been made publicly available through the SWI routine FileBox_FiletypeExtendOp (SWI &4824B). File Box errors The errors generated by the File Box module are described here. The SWI chunk number (&48240) should be added to the error numbers given here to get the full error number. FileBox busy on Load File Box error number 0. This error occurs when an attempt is made to open a Load window while a Load operation is still in progress, If this error occurs repeatedly, call the routine FileBox_AbortLoad (SWI &48244). FileBox inactive on Load File Box error number 1. This error occurs when an attempt is made to poll a Load operation when none is in progress. This may occur when another task calls FileBox_AbortLoad (SWI &48244) while your task is polling. FileBox busy on Save File Box error number 2. This error occurs when an attempt is made to open a Save window while a Save operation is still in progress, If this error occurs repeatedly, call the routine FileBox_AbortSave (SWI &48245). FileBox inactive on Save File Box error number 3. This error occurs when an attempt is made to poll a Save operation when none is in progress. This may occur when another task calls FileBox_AbortSave (SWI &48244) while your task is polling. Bad FileBox_Control reason code File Box error number 8. This error occurs if FileBox_Control (SWI &48248) is passed a reason code which has no defined purpose. Currently valid reason codes for FileBox_Control are in the range 0-32 (inclusive). FileBox busy on Control File Box error number 9. This error occurs when the user attempts to perform a control action when a previously specified action has not yet been completed. Your task must either wait until FileBox_PollControl (SWI &48249) returns 0, or abort the current operation, using the routine FileBox_AbortControl (SWI &4824A), before the new operation can be carried out. File Box task is already active File Box error number 62. This error occurs when an attempt is made to start the File Box Desktop task when it is already registered with the Wimp. FileBox task is inactive File Box error number 63. This error occurs when an operation which requires the presence of the File Box Desktop task is attempted. Use FileBox_Control 0 (SWI &48248) or *Desktop to start the File Box task. - SWI Calls - FileBox_InitiateLoadFromFiler (SWI &48240) Initiates a File Box Load operation which only accepts files dragged from Filer windows On entry: R0 = pointer to title text (maximum 16 characters, including null) R1 = pointer to prompt text (maximum 16 characters, including null) R2 = pointer to default filename On exit: R0-R2 preserved Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: If the File Box task is not registered with the Wimp, the error File Box task is inactive is returned. If you try to start the File Box task using *Desktop or FileBox_Control 0 (SWI &48248) after getting this error, you may find that repeating the call is successful. If a Load window is not already open, then a window is opened on the Desktop ready to accept a file dragged to it from a Filer window, or a filename typed into its writable icon. The title text is used in the Load window's title bar and the prompt appears above the default filename. If a Load window is already open, the error FileBox busy on Load is produced. After making this call, it is expected that the caller will repeatedly poll for a response using FileBox_PollLoadFromFiler (SWI &48241). Related SWIs: FileBox_PollLoadFromFiler (SWI &48241), FileBox_AbortLoad (SWI &48244). FileBox_DoLoadFromFiler (SWI &48246) Related vectors: None - FileBox_PollLoadFromFiler (SWI &48241) Reports on the progress of the current File Box Load operation (from a Filer window) On entry: R2 = pointer to filename buffer On exit: R0 = status indicator R1 = filetype if file dragged, otherwise preserved R2 = pointer to updated filename buffer if file specified, otherwise preserved Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call should only be made after FileBox_InitiateLoadFromFiler (SWI &48240) has been called. If no Load operation is underway then the error FileBox inactive on Load is produced. If the File Box Desktop task has been killed since the call to FileBox_InitiateLoadFromFiler then the error File Box task is inactive will be returned. In this case you can attempt to restart File Box using *Desktop or FileBox_Control 0 (SWI &48248). If this fails (as will be revealed by a subsequent call), you must call FileBox_AbortLoad (SWI &48244). The status indicators returned in R0 are: R0 Meaning -1 File Box is waiting for a user response. Continue to poll. 0 Load window was closed, and the Load operation abandoned. 1 A name was typed, and Return pressed or OK clicked upon. The buffer at R2 is updated to contain the filename entered. 2 A file was dragged to the Load window. R1 is set to the filetype, and the buffer at R2 is updated to contain the full pathname of the file. When the user responds (R0 > -1), File Box automatically closes the Load window and becomes inactive in preparation for the next Load operation. If, for some reason, you do not want to continue polling (if *Desktop failed to restart the File Box Desktop task, for instance) you must call FileBox_AbortLoad, so that other callers may make use of the File Box loading facilities. Related SWIs: FileBox_InitiateLoadFromFiler (SWI &48240), FileBox_AbortLoad (SWI &48244). FileBox_DoLoadFromFiler (SWI &48246) Related vectors: None - FileBox_InitiateSaveToFiler (SWI &48242) Initiates a File Box Save operation which only allows files to be dragged to Filer windows On entry: R0 = pointer to title text (maximum 16 characters, including null) R1 = pointer to file sprite name (maximum 16 characters, including null) R2 = pointer to default filename R3 = filetype On exit: R0-R3 preserved Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: If the File Box task is not registered with the Wimp, the error File Box task is inactive is returned. If you try to start the File Box task using *Desktop or FileBox_Control 0 (SWI &48248) after getting this error, you may find that repeating the call is successful. If a Save window is not already open, then a window is opened on the Desktop ready to have its file icon dragged to a Filer window or to have a name typed into its writable icon. The title text is used in the Save window's title bar and the default filename appears in the writable icon. If a Save window is already open, the error FileBox busy on Save is produced. After making this call, it is expected that the caller will repeatedly poll for a response using FileBox_PollSaveToFiler (SWI &48242). Related SWIs: FileBox_PollSaveToFiler (SWI &48243), FileBox_AbortSave (SWI &48245), FileBox_DoSaveToFiler (SWI &48247) Related vectors: None - FileBox_PollSaveToFiler (SWI &48243) Reports on the progress of the current File Box Save operation (to a Filer window) On entry: R2 = pointer to filename buffer On exit: R0 = status indicator R1 preserved R2 = pointer to updated filename buffer if file specified, otherwise preserved Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call should only be made after FileBox_InitiateSaveToFiler (SWI &48242) has been called. If no Save operation is underway then the error FileBox inactive on Save is produced. If the File Box Desktop task has been killed since the call to FileBox_InitiateSaveToFiler then the error File Box task is inactive will be returned. In this case you can attempt to restart File Box using *Desktop or FileBox_Control 0 (SWI &48248). If this fails (as will be revealed by a subsequent call), you must call FileBox_AbortSave (SWI &48245). The status indicators returned in R0 are: R0 Meaning -1 File Box is waiting for a user response. Continue to poll. 0 Save window was closed, and the Save operation abandoned. 1 A name was typed, and Return pressed or OK clicked upon. The buffer at R2 is updated to contain the filename entered. 2 The file icon was dragged from the Save window into a Filer display. The buffer at R2 is updated to contain the full pathname of the drag destination. When the user responds (R0 > -1), FileBox automatically closes the Save window and becomes inactive in preparation for the next Save operation. If, for some reason, you do not want to continue polling (if *Desktop failed to restart the File Box Desktop task, for instance) you must call FileBox_AbortSave, so that other callers may make use of the File Box saving facilities. Related SWIs: FileBox_InitiateSaveToFiler (SWI &48242), FileBox_AbortSave (SWI &48245). FileBox_DoSaveToFiler (SWI &48247) Related vectors: None - FileBox_AbortLoad (SWI &48244) Aborts the current File Box Load operation On entry: - On exit: - Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call should only be made by the task currently calling FileBox_PollLoadFromFiler (SWI &48241) in order to abort the current Load operation and close the File Box loading window. If no Load operation is underway, this SWI will return without signalling an error. If a Load operation is pending (it has been initiated, but as yet the File Box task has not opened a Load window), this SWI call will force File Box into an inactive state. If a Load operation is underway, the window will be closed and this SWI call will force File Box into an inactive state. If a Load operation has been completed (and the window has been closed) but the result has not been returned through polling, this operation will force File Box into an inactive state. Any task which continues to poll after this SWI has been called will receive the error FileBox inactive on Load. Related SWIs: FileBox_InitiateLoadFromFiler (SWI &48240), FileBox_PollLoadFromFiler (SWI &48241) Related vectors: None - FileBox_AbortSave (SWI &48245) Aborts the current File Box Save operation On entry: - On exit: - Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call should only be made by the task currently calling FileBox_PollSaveToFiler (SWI &48243) in order to abort the current Save operation and close the File Box saving window. If no Save operation is underway, this SWI will return without signalling an error. If a Save operation is pending (it has been initiated, but as yet the File Box task has not opened a Save window), this SWI call will force File Box into an inactive state. If a Save operation is underway, the window will be closed and this SWI call will force File Box into an inactive state. If a Save operation has been completed (and the window has been closed) but the result has not been returned through polling, this operation will force File Box into an inactive state. Any task which continues to poll after this SWI has been called will receive the error FileBox inactive on Save. Related SWIs: FileBox_InitiateSaveToFiler (SWI &48242), FileBox_PollSaveToFiler (SWI &48243) Related vectors: None - FileBox_DoLoadFromFiler (SWI &48246) Performs a complete File Box Load operation On entry: R0 = pointer to title text (maximum 16 characters, including null) R1 = pointer to prompt text (maximum 16 characters, including null) R2 = pointer to filename buffer (containing default filename) On exit: R0 = result indicator R1 = filetype if file dragged, otherwise preserved R2 = pointer to updated filename buffer if file specified, otherwise preserved Interrupts: Interrupts are enabled Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: If the File Box task is not registered with the Wimp, the error File Box task is inactive is returned. If you try to start the File Box task using *Desktop or FileBox_Control 0 (SWI &48248) after getting this error, you may find that repeating the call is successful. If a Load window is not already open, then a window is opened on the Desktop ready to accept a file dragged to it from a Filer window, or a filename typed into its writable icon. The title text is used in the Load window's title bar and the prompt appears above the default filename. If a Load window is already open, the error FileBox busy on Load is produced. After opening a Load window, this call will repeatedly poll until the user responds or the Escape key is pressed whilst the calling task has the input focus. If the Escape key is pressed (and the calling task has the input focus) then the error Escape will be returned and the Load operation aborted (the Load window will be closed). If the File Box Desktop task is killed during the polling process then the error File Box task is inactive will be returned. In this case you can attempt to restart File Box using *Desktop or FileBox_Control 0 (SWI &48248). Upon getting a user response, one of the following result indicators is returned in R0: R0 Meaning 0 Load window was closed, and the Load operation abandoned. 1 A name was typed, and Return pressed or OK clicked upon. The buffer at R2 is updated to contain the filename entered. 2 A file was dragged to the Load window. R1 is set to the filetype, and the buffer at R2 is updated to contain the full pathname of the file. When the user responds, File Box automatically closes the Load window and becomes inactive in preparation for the next Load operation. Related SWIs: FileBox_InitiateLoadFromFiler (SWI &48240), FileBox_PollLoadFromFiler (SWI &48241) Related vectors: None - FileBox_DoSaveToFiler (SWI &48247) Performs a complete File Box Save operation On entry: R0 = pointer to title text (maximum 16 characters, including null) R1 = pointer to file sprite name (maximum 16 characters, including null) R2 = pointer to filename buffer (containing default filename) R3 = filetype On exit: R0 = result indicator R2 = pointer to updated filename buffer if file specified, otherwise preserved Interrupts: Interrupts are enabled Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: If the File Box task is not registered with the Wimp, the error File Box task is inactive is returned. If you try to start the File Box task using *Desktop or FileBox_Control 0 (SWI &48248) after getting this error, you may find that repeating the call is successful. If a Save window is not already open, then a window is opened on the Desktop ready to have its file icon dragged to a Filer window or to have a name typed into its writable icon. The title text is used in the Save window's title bar and the default filename appears in the writable icon. If a Save window is already open, the error FileBox busy on Save is produced. After opening a Save window, this call will repeatedly poll until the user responds or the Escape key is pressed whilst the calling task has the input focus. If the Escape key is pressed (and the calling task has the input focus) then the error Escape will be returned and the Load operation aborted (the loading window will be closed). If the File Box Desktop task is killed during the polling process then the error File Box task is inactive will be returned. In this case you can attempt to restart File Box using *Desktop or FileBox_Control 0 (SWI &48248). Upon getting a user response, one of the following result indicators is returned in R0: R0 Meaning 0 Save window was closed, and the Save operation abandoned. 1 A name was typed, and Return pressed or OK clicked upon. The buffer at R2 is updated to contain the filename entered. 2 The file icon was dragged from the Save window into a Filer display. The buffer at R2 is updated to contain the full pathname of the drag destination. When the user responds, File Box automatically closes the Save window and becomes inactive in preparation for the next Save operation. Related SWIs: FileBox_InitiateSaveToFiler (SWI &48242), FileBox_PollSaveToFiler (SWI &48243) Related vectors: None - FileBox_Control (SWI &48248) Perform miscellaneous control actions On entry: R0 = reason code Other registers depend on reason code On exit: R0 preserved Other registers depend on reason code Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: The action carried out by FileBox_Control is determined by the reason code in R0 as follows: R0 Action 0 Start File Box task 1 Quit File Box task 2 Restart File Box task 3 Return task handle of File Box task 4 Use 2D windows (effective from next start/restart) 5 Use 3D windows (effective from next start/restart) 6 Use appropriate windows, based on bit 0 of CMOS byte 140 (effective from next start/restart) 7 Read current window style (effective from next start/restart) 8 Open program information dialogue box (or bring to front) 9 Close program information dialogue box (or bring to front) 10 Move Load window (or bring to front) 11 Move Save window (or bring to front) 12 Enable File Box system variables 13 Disable File Box system variables 14 Read input variable name 15 Read window title for input variable 16 Set window title for input variable 17 Restore default window title for input variable 18 Read prompt text for input variable 19 Set prompt text for input variable 20 Restore default prompt text for input variable 21 Read default filename for input and output variable 22 Set default filename for input and output variable 23 Restore null string as default filename for input and output variables 24 Restore default title, prompt and filename for input variable 25 Read output variable name 26 Read window title for output variable 27 Set window title for output variable 28 Restore default window title for output variable 29 Read filetype for output variable 30 Set filetype for output variable 31 Restore default filetype for output variable 32 Restore default title, filetype and filename for output variable For details on each of these reason codes, see below. Related SWIs: FileBox_PollControl (SWI &48249), FileBox_AbortControl (SWI &4824A) Related vectors: None - FileBox_Control 0 to 2 (SWI &48248) Starts, quits or restarts the File Box Desktop task On entry: R0 = 0, 1 or 2 On exit: R0 preserved Use: FileBox_Control 0 attempts to start the File Box task immediately. If the File Box task is already running then the error File Box task is already active is generated. FileBox_Control 1 attempts to cause the File Box task to exit. This action is queued until File Box next returns from polling the Wimp. FileBox_Control 2 attempts to cause the File Box task to exit and then be restarted. This will ensure that the correct set of windows (2D or 3D) is in use. This action is queued until File Box next returns from polling the Wimp. - FileBox_Control 3 (SWI &48248) Returns task handle of File Box Desktop task On entry: R0 = 3 On exit: R0 preserved R1 = task handle, or 0 or -1 if File Box task is inactive Use: If the File Box task is registered with the Wimp, this call returns the task handle by which the Wimp refers to the task in R1. If the File Box task is unregistered, R1 = 0 or -1 on exit. - FileBox_Control 4 to 6 (SWI &48248) Sets the style of windows currently in use On entry: R0 = 4, 5 or 6 On exit: R0 preserved Use: FileBox_Control 4 selects 2D-style windows. FileBox_Control 5 selects 3D-style windows. FileBox_Control 6 selects the appropriate window style based on the computer's configuration. Specifically, it selects 3D-style windows only if bit 0 of CMOS RAM byte number 140 is set, and 2D-style windows otherwise. Window style selections only come into effect the next time the File Box Desktop task is started or restarted, using FileBox_Control 0 or 2. - FileBox_Control 7 (SWI &48248) Returns the style of windows currently in use On entry: R0 = 7 On exit: R0 preserved R1 = style number Use: The value of R0 on exit corresponds to the style of windows that will be selected on the next start or restart of the File Box task: R0 Meaning 0 Window style will based on computer's configuration (bit 0 of CMOS RAM byte number 140). 2 2D-style windows will be selected 3 3D-style windows will be selected - FileBox_Control 8 (SWI &48248) Open program information dialogue box On entry: R0 = 8 R1 = screen x-coordinate of top edge of window visible area (in OS units) R2 = screen y-coordinate of left edge of window visible area (in OS units) On exit: R0-R2 preserved Use: This call opens the program information window at the given position on the screen. If this window is already open, it is moved to the new position specified. This action is queued until the File Box task next returns from polling the Wimp. - FileBox_Control 9 (SWI &48248) Close program information dialogue box On entry: R0 = 9 On exit: R0 preserved Use: This call closes the program information window if it isn't already closed. This action is queued until the File Box task next returns from polling the Wimp. - FileBox_Control 10 and 11 (SWI &48248) Move the Load or Save window (or bring it to the front of the window stack) On entry: R0 = 10 or 11 R1 = screen x-coordinate of top edge of window visible area (in OS units) R2 = screen y-coordinate of left edge of window visible area (in OS units) On exit: R0-R2 preserved Use: FileBox_Control 10 moves the Load window (if it is open) to the position specified. FileBox_Control 11 moves the Save window (if it is open) to the position specified. If R1 = -1 on entry, the relevant window is not moved, but merely brought to the front of the window stack in in its current position. These actions are queued until the File Box task next returns from polling the Wimp. - FileBox_Control 12 and 13 (SWI &48248) Enables or disables the File Box system variables On entry: R0 = 12 or 13 On exit: R0 preserved Use: FileBox_Control 12 enables the File Box system variables FileBox$GetInputFilename and FileBox$GetOutputFilename. FileBox_Control 13 disables these system variables. - FileBox_Control 14 and 25 (SWI &48248) Read input or output system variable name On entry: R0 = 14 or 25 R1 = pointer to buffer to contain name of system variable (at least 32 bytes) On exit: R0 preserved R1 = pointer to updated buffer containing name of requested system variable (null terminated) Use: These call returns a null terminated string in the specified buffer based on the reason code: R0 String returned 14 FileBox$GetInputFilename 25 FileBox$GetOutputFilename - FileBox_Control 15, 18, 21, 26 and 29 (SWI &48248) Read attributes of Load and Save windows used by File Box system variables On entry: R0 = 15, 18, 21, 26 or 29 R1 = pointer to buffer to contain string (see below for minimum buffer size) On exit: R0 preserved R1 = pointer to updated buffer containing null terminated string Use: These calls returns a null terminated string in the specified buffer based on the reason code: R0 String returned 15 Window title used by input variable (up to 16 characters, including null) 18 Prompt text used by input variable (up to 16 characters, including null) 21 Default filename used by both input and output variables (up to 256 characters, including null) 26 Window title used by output variable (up to 16 characters, including null) 29 Hexadecimal filetype number used by output variable (up to 4 characters including null) or xxx, indicating no filetype. - FileBox_Control 16, 19, 22, 27 and 30 (SWI &48248) Set attributes of Load and Save windows used by File Box system variables On entry: R0 = 16, 19, 22, 27 or 30 R1 = pointer to buffer containing null terminated string On exit: R0,R1 preserved Use: These calls change an input or output variable Load/Save window attribute string, depending on the reason code: R0 Attribute written 16 Window title used by input variable (up to 16 characters, including null) 19 Prompt text used by input variable (up to 16 characters, including null) 22 Default filename used by both input and output variables (up to 256 characters, including null) 27 Window title used by output variable (up to 16 characters, including null) 30 Filetype used by output variable (up to 9 characters, including null). The string passed may be a hexadecimal filetype number, the filetype textual equivalent or xxx, indicating no filetype. A Bad file type error will be generated if the filetype is not recognized. - FileBox_Control 17, 20, 23, 24, 28, 31 and 32 (SWI &48248) Restore default attributes for Load and Save windows used by File Box system variables On entry: R0 = 17, 20, 23, 24, 28, 31 or 32 On exit: R0,R1 preserved Use: These restore default values for specific attributes, depending on the reason code: R0 Attribute written 17 Window title used by input variable is set to Input from: 20 Prompt text used by input variable is set to Filename: 23 Default filename used by both input and output variables is set to an empty string 24 All default input variable Load window attributes 28 Window title used by output variable is set to Output to: 31 Filetype used by output variable is set to none (xxx), represented by a white box icon. 32 All default output variable Save window attributes - FileBox_PollControl (SWI &48249) Return the number of the control action currently in progress On entry: - On exit: R0 = reason code corresponding to current control action (0 means no action in progress) Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call returns the reason code corresponding to the currently queued FileBox_Control action. If R0 = 0 on exit, then no action is waiting to be carried out. Related SWIs: FileBox_Control (SWI &48248), FileBox_AbortControl (SWI &4824A) Related vectors: None - FileBox_AbortControl (SWI &4824A) Abort any control action currently in progress On entry: - On exit: R0 = reason code corresponding to previous control action state Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This call returns the reason code corresponding to the previously queued FileBox_Control action, which has since been removed from the queue by this call. If R0 = 0 on exit, then no action is waiting to be carried out, and this call has no effect. Related SWIs: FileBox_Control (SWI &48248), FileBox_PollControl (SWI &48249) Related vectors: None - FileBox_FiletypeExtendOp (SWI &4824B) Support routines for FiletypeExtend On entry: R0 = reason code Other registers depend on reason code On exit: R0 preserved Other registers depend on reason code Interrupts: Interrupt status is not defined Fast interrupts are enabled Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: The action carried out by FileBox_FiletypeExtendOp is determined by the reason code in R0 as follows: R0 Action 0 Generate large icon name 1 Generate small icon name 2 Load address to raw filetype 3 Map raw filetype For details on each of these reason codes, see below. Related SWIs: None Related vectors: None - FileBox_FiletypeExtendOp 0 and 1 (SWI &4824B) Generate large or small icon name On entry: R0 = 0 or 1 R1 = filetype number R2 = buffer for sprite name On exit: R0-R2 preserved Use: The buffer is filled with the sprite name that should be used to represent a file having the given filetype number: • If the filetype is -1, then file_xxx (R0 = 0) or small_xxx (R0 = 1) is generated. • If the filetype is in the range &000-&FFF, then file_xxx (R0 = 0) or small_xxx (R0 = 1) is generated, where xxx is the 12-bit filetype in hexadecimal. • If the filetype is outside this range, then file_xxxxx (R0 = 0) or small_xxxxx (R0 = 1) is generated, where xxx is the 20-bit filetype in hexadecimal. - FileBox_FiletypeExtendOp 2 (SWI &4824B) Load address to raw filetype On entry: R0 = 2 R2 = load address On exit: R0,R2 preserved R1 = raw filetype number Use: The filetype number is extracted from the load address in a manner compatible with FiletypeExtend. No other mapping is applied, so invisible files are returned with their full 20-bit type, and similarly no mapping is applied to squashed files. - FileBox_FiletypeExtendOp 3 (SWI &4824B) Remap raw filetype On entry: R0 = 3 R1 = raw filetype number On exit: R0 preserved R1 = mapped filetype number Use: If the raw filetype number is specified by one of the following mappings, it is remapped: Raw Mapped Mapping description &FFxxx &xxx Invisible files &FExxx &FCA Squashed files - Service Calls - Service_FileBoxWorkspace (Service Call &48240) Request for address of FileBox module workspace On entry: R1 = &48240 On exit: R1 = 0 to claim, else preserved to pass on R2 = address of FileBox module workspace if claimed, preserved otherwise Use This call is for internal use only. It must not be claimed by any module other than FileBox itself. - *Commands - *Desktop_FileBox Command to initialize File Box Desktop task Syntax: *Desktop_FileBox Parameters: None Use: This command is provided for the use of the Desktop, in order to start up the File Box Desktop task automatically. Do not use *Desktop_FileBox, use either *Desktop or FileBox_Control 0 (SWI &48248) instead. Related commands: *Desktop Related SWIs: FileBox_Control (SWI &48248), Wimp_StartTask (SWI &400DE) Related vectors: None - *Help FileBox Displays information about the FileBox module Syntax: *Help FileBox Parameters: None Use: This command gives miscellaneous information about the version of the FileBox module currently present in the system, including the version number, date of assembly, a brief overview and a list of commands provided. Examples: *Help FileBox ==> Help on keyword FileBox Kasoft FileBox Written by Kade Hansson ©1996 Kasoft Software FileBox provides SWIs which allow non-Wimp programs running on the desktop to make use of the RISC OS desktop file dragging conventions. In addition, FileBox provides system variables which allow *-commands issued on the desktop to obtain file names using FileBox facilities. All rights reserved. No part of this software may be reproduced, stored or publicly distributed without the written permission of Kasoft Software. ==> Help on keyword FileBox Module is: File Box 0.50 (08 Sep 1996) © Kasoft Commands provided: IOVarsOn IOVarsOff InputPrompt InputTitle InputReset OutputType OutputTitle OutputReset ResetFileBox Desktop_FileBox It has help on: FileBox Related commands: *Help Related SWIs: None Related vectors: None - *IOVarsOff Disables File Box input and output system variables Syntax: *IOVarsOff Parameters: None Use: The command *IOVarsOff disables the system variables FileBox$GetInputFilename and FileBox$GetOutputFilename. This is essential if the system variables are being enumerated (e.g. by *Show), as spurious save and load windows can appear, or the system can crash. This command is equivalent to FileBox_Control 13 (SWI &48248). The File Box system variables are disabled by default. That is, they are disabled whenever the File Box module is loaded, reloaded or reinitialized. Related commands: *IOVarsOn, *Show Related SWIs: FileBox_Control (SWI &48248) - *IOVarsOn Enables File Box input and output system variables Syntax: *IOVarsOn Parameters: None Use: The command *IOVarsOn enables the system variables FileBox$GetInputFilename and FileBox$GetOutputFilename. This command is equivalent to FileBox_Control 14 (SWI &48248). The File Box system variables are disabled by default. That is, they are disabled whenever the File Box module is loaded, reloaded or reinitialized. It is therefore necessary to ensure that the variables are enabled if you plan to use them. Related commands: *IOVarsOff, *Show Related SWIs: FileBox_Control (SWI &48248) - *InputPrompt Change or read the input variable prompt text Syntax: *InputPrompt [<prompt text>] Parameters: <prompt text> the text to be used as the input prompt (maximum 15 characters) Use: This command changes the prompt text which appears in the Load window when the value of FileBox$GetInputFilename is requested. If the prompt text is omitted, the current prompt text is displayed. It is equivalent to FileBox_Control 18 and 19 (SWI &48248). Example: *InputPrompt Filename: Related commands: *InputTitle, *InputReset Related SWIs: FileBox_Control (SWI &48248) - *InputReset Restore the default attributes to the input variable Load window Syntax: *InputReset Parameters: None Use: This command restores the default prompt text (Filename:), window title (Input from:) and filename (null string) to the Load window which appears when the value of the variable FileBox$GetInputFilename is requested. It is equivalent to calling the routine FileBox_Control 24 (SWI &48248). Related commands: *InputPrompt, *InputTitle Related SWIs: FileBox_Control (SWI &48248) - *InputTitle Change or read the input variable title bar text Syntax: *InputTitle [<title text>] Parameters: <title text> the text to be used as the input title (maximum 15 characters) Use: This command changes the title bar text which appears in the Load window when the value of FileBox$GetInputFilename is requested. If the title text is omitted, the current title is displayed. It is equivalent to FileBox_Control 15 and 16 (SWI &48248). Example: *InputTitle Input from: Related commands: *InputPrompt, *InputReset Related SWIs: FileBox_Control (SWI &48248) - *OutputReset Restore the default attributes to the output variable Save window Syntax: *OutputReset Parameters: None Use: This command restores the default filetype (none, xxx), window title (Output to:) and filename (null string) to the Save window which appears when the value of the variable FileBox$GetOutputFilename is requested. It is equivalent to calling the routine FileBox_Control 32 (SWI &48248). Related commands: *OutputType, *OutputTitle Related SWIs: FileBox_Control (SWI &48248) - *OutputTitle Change or read the output variable title bar text Syntax: *OutputTitle [<title text>] Parameters: <title text> the text to be used as the output title (maximum 15 characters) Use: This command changes the title bar text which appears in the Save window when the value of FileBox$GetOutputFilename is requested. If the title text is omitted, the current title is displayed. It is equivalent to FileBox_Control 26 and 27 (SWI &48248). Example: *OutputTitle Output to: Related commands: *OutputType, *OutputReset Related SWIs: FileBox_Control (SWI &48248) - *OutputType Change or read the output variable filetype Syntax: *OutputType [<filetype> | xxx] Parameters: <filetype> the filetype number or textual equivalent Use: This command changes the filetype icon which appears in the Save window when the value of FileBox$GetOutputFilename is requested. The parameter can be a hexadecimal filetype number, the textual equivalent or xxx, which indicates no type (represented by a white box icon). If the parameter is omitted, the current filetype is displayed. This command is equivalent to FileBox_Control 29 and 30 (SWI &48248). Examples: *OutputType No type xxx *OutputType Text *OutputType Text FFF *OutputType FFD *OutputType Data FFD *OutputType RMInfo *OutputType RMInfo E0002 *OutputType E0001 *OutputType DAInfo E0001 Related commands: *OutputTitle, *OutputReset Related SWIs: FileBox_Control (SWI &48248) - *ResetFileBox Abort all Load and Save operations Syntax: *ResetFileBox Parameters: None Use: *ResetFileBox causes all File Box Load and Save operations to be abandoned and the corresponding windows to be closed. All tasks using File Box facilities which continue to poll will receive the error File Box inactive on Load or File Box inactive on Save. This command should be used with caution. It is equivalent to calls to each of the routines FileBox_AbortLoad (SWI &48244) and FileBox_AbortSave (SWI &48245). Related commands: None Related SWIs: FileBox_AbortLoad (SWI &48244), FileBox_AbortSave (SWI &48245) - System Variables - FileBox$GetInputFilename Filename for data input or loading (must be enabled using *IOVarsOn or similar) Reading: When the value of this variable is requested, a call is made to FileBox_DoLoadFromFiler (SWI &48246) using the title text, prompt text and default filename currently set up. If the request is made from a task window, then a File Box Load window will be opened on the Desktop. If the request is made from other environments the system may crash (although the Escape key can sometimes be used). If an error occurs, the Close icon is clicked on or the Escape key is pressed then a null filename will be returned in response to the request. Otherwise, the value of this variable will be the filename specified by the user via dragging or typing. Reading example: *Echo <FileBox$GetInputFilename> ADFS::KaModula2.$.InputFile Writing: Writing this variable sets the default filename used for the read action. It is equivalent to a call to FileBox_Control 22 (SWI &48248). Writing example: *Set FileBox$GetInputFilename InputFile Related commands: *IOVarsOn, *IOVarsOff, *InputPrompt, *InputReset, *InputTitle Related SWIs: FileBox_DoLoadFromFiler (SWI &48246), FileBox_Control (SWI &48248) - FileBox$GetOutputFilename Filename for data output or saving (must be enabled using *IOVarsOn or similar) Reading: When the value of this variable is requested, a call is made to FileBox_DoSaveToFiler (SWI &48247) using the title text, filetype and default filename currently set up. If the request is made from a task window, then a File Box Save window will be opened on the Desktop. If the request is made from other environments the system may crash (although the Escape key can sometimes be used). If an error occurs, the Close icon is clicked on or the Escape key is pressed then a null filename will be returned in response to the request. Otherwise, the value of this variable will be the filename specified by the user via dragging or typing. Reading example: *Echo <FileBox$GetOutputFilename> ADFS::KaModula2.$.OutputFile Writing: Writing this variable sets the default filename used for the read action. It is equivalent to a call to FileBox_Control 22 (SWI &48248). Writing example: *Set FileBox$GetOutputFilename OutputFile Related commands: *IOVarsOn, *IOVarsOff, *OutputType, *OutputReset, *OutputTitle Related SWIs: FileBox_DoSaveToFiler (SWI &48247), FileBox_Control (SWI &48248) -