saveas 5 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/* Copyright 1996 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:    saveas.h
 * Purpose: SaveAs Objects
 * Author:  Timothy G Roddis
 * History: 16-Feb-94: TGR: created
 *
 */

#ifndef __SaveAs_h
#define __SaveAs_h

#ifndef __os_h
#include "os.h"
#endif

#ifndef __window_h
30
#include "objects/window.h"
Neil Turton's avatar
Neil Turton committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
#endif

#ifndef __wimp_h
#include "twimp.h"
#endif

/* SaveAs SWI calls *******************************************************************************/

#define SaveAs_SWIChunkBase    0x82bc0
#define SaveAs_ObjectClass     SaveAs_SWIChunkBase
#define SaveAs_ClassSWI        (SaveAs_SWIChunkBase + 0)
#define SaveAs_PostFilter      (SaveAs_SWIChunkBase + 1)
#define SaveAs_PreFilter       (SaveAs_SWIChunkBase + 2)

/* SaveAs Templates *******************************************************************************/

/* flags */

#define SaveAs_GenerateShowEvent             0x00000001
#define SaveAs_GenerateHideEvent             0x00000002
#define SaveAs_ExcludeSelectionButton        0x00000004
#define SaveAs_AutomaticRAMTransfer          0x00000008
#define SaveAs_ClientSupportsRAMTransfer     0x00000010

/* templates */

typedef struct
{
        int        flags;
        char      *filename;
        int        filetype;
        char      *title;
        int        max_title;
        char      *window;

} SaveAsTemplate;

/* component IDs */

#define SaveAs_ComponentIDBase              (SaveAs_SWIChunkBase<<4)

#define SaveAs_Draggable_FileIcon            (SaveAs_ComponentIDBase)
#define SaveAs_WritableField_FileName        (SaveAs_ComponentIDBase + 1)
#define SaveAs_ActionButton_Cancel           (SaveAs_ComponentIDBase + 2)
#define SaveAs_ActionButton_Save             (SaveAs_ComponentIDBase + 3)
#define SaveAs_OptionButton_Selection        (SaveAs_ComponentIDBase + 4)

/* SaveAs Methods *********************************************************************************/

#define SaveAs_GetWindowID             0
#define SaveAs_SetTitle                1
#define SaveAs_GetTitle                2
#define SaveAs_SetFileName             3
#define SaveAs_GetFileName             4
#define SaveAs_SetFileType             5
#define SaveAs_GetFileType             6
#define SaveAs_SetFileSize             7
#define SaveAs_GetFileSize             8
#define SaveAs_SelectionAvailable      9
#define SaveAs_SetDataAddress         10
#define SaveAs_BufferFilled           11
#define SaveAs_FileSaveCompleted      12

/* SaveAs Toolbox Events **************************************************************************/

#define SaveAs_AboutToBeShown     SaveAs_SWIChunkBase
#define SaveAs_DialogueCompleted  (SaveAs_SWIChunkBase + 1)
#define SaveAs_SaveToFile         (SaveAs_SWIChunkBase + 2)
#define SaveAs_FillBuffer         (SaveAs_SWIChunkBase + 3)
#define SaveAs_SaveCompleted      (SaveAs_SWIChunkBase + 4)

typedef struct {
   ToolboxEventHeader hdr;
   int                show_type;
   union {
      struct {
         int                x,y;
      } coords;
      WindowShowObjectBlock full;

   } info;

} SaveAs_AboutToBeShown_Event;

typedef struct {
   ToolboxEventHeader hdr;
} SaveAs_DialogueCompleted_Event;

typedef struct {
   ToolboxEventHeader hdr;
   char               filename [212];
} SaveAs_SaveToFile_Event;

typedef struct {
   ToolboxEventHeader hdr;
   int                size;
   char              *address;
   int                no_bytes;
} SaveAs_FillBuffer_Event;

typedef struct {
   ToolboxEventHeader hdr;
   int                wimp_message_no;
   char               filename [208];
} SaveAs_SaveCompleted_Event;

/* SaveAs Errors **********************************************************************************/


140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
#define SaveAs_ErrorBase           (Program_Error | 0x0080B600)

#define SaveAs_TasksActive        (SaveAs_ErrorBase+0x00)
#define SaveAs_AllocFailed        (SaveAs_ErrorBase+0x01)
#define SaveAs_ShortBuffer        (SaveAs_ErrorBase+0x02)
#define SaveAs_FileNameTooLong    (SaveAs_ErrorBase+0x03)
#define SaveAs_NoSuchTask         (SaveAs_ErrorBase+0x11)
#define SaveAs_NoSuchMethod       (SaveAs_ErrorBase+0x12)
#define SaveAs_NoSuchMiscOpMethod (SaveAs_ErrorBase+0x13)
#define SaveAs_NotType1           (SaveAs_ErrorBase+0x21)
#define SaveAs_NotType3           (SaveAs_ErrorBase+0x23)
#define SaveAs_BufferExceeded     (SaveAs_ErrorBase+0x31)
#define SaveAs_DataAddressUnset   (SaveAs_ErrorBase+0x32)
#define SaveAs_NotFullPath        ((SaveAs_ErrorBase+0x33) & 0xFFFFFFuL) /* Not a program error */
#define SaveAs_SaveFailed         ((SaveAs_ErrorBase+0x34) & 0xFFFFFFuL) /* Not a program error */
Neil Turton's avatar
Neil Turton committed
155 156

#endif