Annotation of Amaya/amaya/amaya.h, revision 1.142
1.8 cvs 1: /*
2: *
3: * (c) COPYRIGHT MIT and INRIA, 1996.
4: * Please first read the full copyright statement in file COPYRIGHT.
5: *
6: */
7:
1.59 cvs 8: #ifndef AMAYA_H
1.1 cvs 9: #define AMAYA_H
10:
1.10 cvs 11: /* Thot interface */
12: #include "thot_gui.h"
13: #include "thot_sys.h"
1.79 cvs 14: #include "appstruct.h"
1.10 cvs 15: #include "application.h"
16: #include "attribute.h"
17: #include "browser.h"
18: #include "content.h"
19: #include "dialog.h"
1.103 cvs 20: #include "fileaccess.h"
1.10 cvs 21: #include "interface.h"
22: #include "libmsg.h"
23: #include "message.h"
24: #include "presentation.h"
25: #include "selection.h"
26: #include "reference.h"
27: #include "tree.h"
28: #include "view.h"
1.105 cvs 29: #include "uconvert.h"
1.82 cvs 30: #include "undo.h"
1.1 cvs 31: /* Included headerfiles */
1.10 cvs 32: #include "EDITOR.h"
1.1 cvs 33: #include "HTML.h"
1.84 cvs 34: #include "TextFile.h"
1.1 cvs 35: #include "amayamsg.h"
36:
1.25 cvs 37: #define NAME_LENGTH 32
38:
1.137 cvs 39: #define HTAppName TEXT("amaya")
1.142 ! cvs 40: #define HTAppVersion TEXT("V3.0")
! 41: #define HTAppDate TEXT ("29 march 2000")
1.130 cvs 42:
43: #define URL_STR "/"
44: #define URL_SEP '/'
45: #define WC_URL_STR TEXT ("/")
46: #define WC_URL_SEP TEXT ('/')
1.105 cvs 47:
1.36 cvs 48:
1.94 cvs 49: /* Number of views used in Amaya */
50: #define AMAYA_MAX_VIEW_DOC 7
51:
1.141 cvs 52: /* the type of character convertion we want to make on local URLs */
53: typedef enum _ConvertionType
54: {
55: AM_CONV_NONE = 0,
56: AM_CONV_URL_SEP = 0x1, /* converts URL_SEPs into DIR_SEPs */
57: AM_CONV_PERCENT = 0x2, /* converts %xx into the equiv. char */
58: AM_CONV_ALL = 0xFFFF /* do everything */
59: }
60: ConvertionType;
61:
1.139 cvs 62: /* the HTTP header name we want to make visible to the application */
63: typedef enum _AHTHeaderName
64: {
65: AM_HTTP_CONTENT_TYPE = 0,
66: AM_HTTP_CHARSET = 1
67: }
68: AHTHeaderName;
69:
70: /* the structure used for exchanging HTTP header info between the net library
71: and amaya */
72: typedef struct _AHTHeaders
73: {
74: CHAR_T *content_type;
75: CHAR_T *charset;
76: }
77: AHTHeaders;
78:
1.50 cvs 79: /* The structures used for request callbacks */
80: typedef void TIcbf (Document doc, int status, char *urlName,
1.139 cvs 81: char *outputfile, const AHTHeaders *http_headers,
1.50 cvs 82: const char *data_block, int data_block_size,
83: void *context);
84:
1.138 cvs 85: typedef void TTcbf (Document doc, int status, CHAR_T* urlName,
1.139 cvs 86: CHAR_T* outputfile, const AHTHeaders *http_headers,
1.50 cvs 87: void *context);
88:
1.25 cvs 89: /* How are Network accesses provided ? */
90: #include "libwww.h"
1.1 cvs 91:
1.66 cvs 92: /* The different events to open a new document */
1.41 cvs 93: typedef enum _ClickEvent {
1.73 cvs 94: CE_ABSOLUTE, CE_RELATIVE, CE_FORM_POST, CE_FORM_GET,
1.127 cvs 95: CE_HELP, CE_MAKEBOOK, CE_LOG , CE_TEMPLATE, CE_INIT
96: #ifdef ANNOTATIONS
97: ,CE_ANNOT
98: #endif /* ANNOTATIONS */
1.41 cvs 99: } ClickEvent;
1.20 cvs 100:
101: #define NO 0
102: #define YES 1
103:
104: /* dialogue */
105: #define URLForm 1
1.29 cvs 106: #define OpenForm 2
107: #define URLName 3
108: #define LocalName 4
109: #define DirSelect 5
110: #define DocSelect 6
1.20 cvs 111: #define StopCommand 7
1.29 cvs 112: #define SaveForm 8
1.20 cvs 113: #define DirSave 9
114: #define DocSave 10
115: #define ToggleSave 11
1.29 cvs 116: #define NameSave 12
1.30 cvs 117: #define ImgDirSave 13
118: #define Label1 14
119: #define Label2 15
120: #define Label3 16
121: #define Label4 17
1.29 cvs 122: #define ConfirmForm 18
123: #define ConfirmText 19
1.20 cvs 124: #define AttrHREFForm 20
125: #define AttrHREFText 21
126: #define FormAnswer 22
1.120 cvs 127: #define RealmText 23
1.20 cvs 128: #define AnswerText 24
129: #define NameText 25
130: #define PasswordText 26
1.30 cvs 131: #define FilterText 27
132: #define ClassForm 28
1.20 cvs 133: #define ClassSelect 29
134: #define AClassForm 30
1.30 cvs 135: #define AClassSelect 31
136: #define ConfirmSave 32
137: #define ConfirmSaveList 33
138: #define OptionMenu 34
1.134 cvs 139: /* MAX_SUBMENUS references reserved for submenus of Option menu */
140: /* Do not insert new entries here */
1.91 cvs 141: #define MAX_SUBMENUS 400
142: #define About1 435
143: #define About2 436
144: #define About3 437
145: #define Version 438
146: #define AboutForm 439
1.92 cvs 147: #define TableForm 440
148: #define TableRows 441
149: #define TableCols 442
150: #define TableBorder 443
1.134 cvs 151: #define MathEntityForm 444
152: #define MathEntityText 445
1.142 ! cvs 153: #define TitleForm 446
! 154: #define TitleText 447
! 155: #define MAX_REF 448
1.20 cvs 156:
1.11 cvs 157: /* The possible GET/POST/PUT request modes */
1.1 cvs 158:
1.11 cvs 159: /*synchronous request*/
160: #define AMAYA_SYNC 1 /*0x000001 */
161: /*synchronous request with incremental callbacks */
162: #define AMAYA_ISYNC 2 /*0x000010 */
163: /*asynchronous request */
1.5 cvs 164: #define AMAYA_ASYNC 4 /*0x000100 */
1.11 cvs 165: /*asynchronous request with incremental callbacks */
1.5 cvs 166: #define AMAYA_IASYNC 8 /*0x001000 */
1.11 cvs 167: /* send the form using the POST HTTP method */
1.5 cvs 168: #define AMAYA_FORM_POST 16 /*0x010000 */
1.11 cvs 169: /* send the form using the GET HTTP method */
1.5 cvs 170: #define AMAYA_FORM_GET 32 /*0x100000 */
1.23 cvs 171: /* bypass caching */
172: #define AMAYA_NOCACHE 64
173: /* don't follow redirections */
174: #define AMAYA_NOREDIR 128
1.129 cvs 175: /* post an annonation */
1.136 cvs 176: #define AMAYA_FILE_POST 256
1.48 cvs 177: /* Prevents a stop race condition in ASYNC transfers */
178: #define AMAYA_ASYNC_SAFE_STOP 256
1.60 cvs 179: #define AMAYA_LOAD_CSS 512
1.67 cvs 180: #define AMAYA_FLUSH_REQUEST 1024
1.80 cvs 181: #define AMAYA_USE_PRECONDITIONS 2048
1.123 cvs 182: #define AMAYA_LOAD_IMAGE 4096
1.87 cvs 183:
184: /*
185: * Flags to indicate the action to take when the network options
186: * are modified
187: */
188: #define AMAYA_CACHE_RESTART 1
189: #define AMAYA_PROXY_RESTART 2
1.114 cvs 190: #define AMAYA_LANNEG_RESTART 4
191: #define AMAYA_SAFEPUT_RESTART 8
1.87 cvs 192:
1.26 cvs 193: /*
194: * Flags to indicate the status of the network requests associated
195: * to a document.
196: */
197:
198: #define AMAYA_NET_INACTIVE 1
199: #define AMAYA_NET_ERROR 2
200: #define AMAYA_NET_ACTIVE 4
201:
1.25 cvs 202: /*
203: * Flags for HTParse, specifying which parts of the URL are needed
204: */
205: #define AMAYA_PARSE_ACCESS 16 /* Access scheme, e.g. "HTTP" */
206: #define AMAYA_PARSE_HOST 8 /* Host name, e.g. "www.w3.org" */
207: #define AMAYA_PARSE_PATH 4 /* URL Path, e.g. "pub/WWW/TheProject.html" */
208: #define AMAYA_PARSE_ANCHOR 2 /* Fragment identifier, e.g. "news" */
209: #define AMAYA_PARSE_PUNCTUATION 1 /* Include delimiters, e.g, "/" and ":" */
210: #define AMAYA_PARSE_ALL 31 /* All the parts */
1.1 cvs 211:
1.14 cvs 212: THOT_EXPORT int appArgc;
1.137 cvs 213: THOT_EXPORT CHAR_T** appArgv;
214: THOT_EXPORT CHAR_T TempFileDirectory[MAX_LENGTH];
1.105 cvs 215: THOT_EXPORT CHAR_T Answer_text[MAX_LENGTH];
216: THOT_EXPORT CHAR_T Answer_name[NAME_LENGTH];
217: THOT_EXPORT CHAR_T Answer_password[NAME_LENGTH];
218: THOT_EXPORT CHAR_T Display_password[NAME_LENGTH];
219: THOT_EXPORT CHAR_T ScanFilter[NAME_LENGTH]; /* to scan directories */
1.134 cvs 220: THOT_EXPORT CHAR_T MathMLEntityName[MAX_LENGTH]; /* entity name typed by the user for a MathML expression */
1.137 cvs 221: THOT_EXPORT CHAR_T* LastURLName; /* last URL requested */
222: THOT_EXPORT CHAR_T* DirectoryName; /* local path of the document */
223: THOT_EXPORT CHAR_T* DocumentName; /* document name */
224: THOT_EXPORT CHAR_T* SavePath; /* saving path */
225: THOT_EXPORT CHAR_T* SaveName; /* saving name of the document */
1.105 cvs 226: THOT_EXPORT STRING ObjectName; /* document name */
227: THOT_EXPORT STRING SaveImgsURL; /* where to save remote Images */
228: THOT_EXPORT STRING TargetName;
229: THOT_EXPORT STRING SavingFile; /* complete path or URL of the document */
1.45 cvs 230: THOT_EXPORT int Lg_password;
231: THOT_EXPORT int BaseDialog;
1.14 cvs 232: THOT_EXPORT int ReturnOption;
1.70 cvs 233: THOT_EXPORT int NumberRows;
234: THOT_EXPORT int NumberCols;
235: THOT_EXPORT int TBorder;
1.69 cvs 236: THOT_EXPORT int ReturnOptionMenu;
1.14 cvs 237: THOT_EXPORT Document CurrentDocument;
238: THOT_EXPORT Document SavingDocument;
239: THOT_EXPORT Document SavingObject;
240: THOT_EXPORT Document AttrHREFdocument;
1.45 cvs 241: THOT_EXPORT Document DocBook;
242: THOT_EXPORT Document IncludedDocument;
1.14 cvs 243: THOT_EXPORT Element AttrHREFelement;
1.95 cvs 244: THOT_EXPORT STRING AttrHREFvalue;
1.14 cvs 245: THOT_EXPORT Document SelectionDoc;
1.113 cvs 246: THOT_EXPORT ThotBool IsNewAnchor;
1.115 cvs 247: THOT_EXPORT ThotBool UseLastTarget;
1.116 cvs 248: THOT_EXPORT ThotBool LinkAsCSS;
1.98 cvs 249: THOT_EXPORT ThotBool SaveAsHTML;
250: THOT_EXPORT ThotBool SaveAsXHTML;
251: THOT_EXPORT ThotBool SaveAsText;
252: THOT_EXPORT ThotBool CopyImages; /* should we copy images in Save As */
253: THOT_EXPORT ThotBool UpdateURLs; /* should we update URLs in Save As */
254: THOT_EXPORT ThotBool UserAnswer;
255: THOT_EXPORT ThotBool InNewWindow;
256: THOT_EXPORT ThotBool SelectionInPRE;
257: THOT_EXPORT ThotBool SelectionInComment;
258: THOT_EXPORT ThotBool SelectionInEM;
259: THOT_EXPORT ThotBool SelectionInSTRONG;
260: THOT_EXPORT ThotBool SelectionInCITE;
261: THOT_EXPORT ThotBool SelectionInABBR;
262: THOT_EXPORT ThotBool SelectionInACRONYM;
263: THOT_EXPORT ThotBool SelectionInINS;
264: THOT_EXPORT ThotBool SelectionInDEL;
265: THOT_EXPORT ThotBool SelectionInDFN;
266: THOT_EXPORT ThotBool SelectionInCODE;
267: THOT_EXPORT ThotBool SelectionInVAR;
268: THOT_EXPORT ThotBool SelectionInSAMP;
269: THOT_EXPORT ThotBool SelectionInKBD;
270: THOT_EXPORT ThotBool SelectionInI;
271: THOT_EXPORT ThotBool SelectionInB;
272: THOT_EXPORT ThotBool SelectionInTT;
273: THOT_EXPORT ThotBool SelectionInBIG;
274: THOT_EXPORT ThotBool SelectionInSMALL;
1.100 cvs 275: THOT_EXPORT ThotBool SelectionInSub;
276: THOT_EXPORT ThotBool SelectionInSup;
277: THOT_EXPORT ThotBool SelectionInQuote;
278: THOT_EXPORT ThotBool SelectionInBDO;
1.108 cvs 279: THOT_EXPORT ThotBool HTMLErrorsFound;
1.100 cvs 280:
1.53 cvs 281: typedef enum
282: {
283: docHTML,
1.110 cvs 284: docHTMLRO,
1.74 cvs 285: docText,
1.84 cvs 286: docTextRO,
1.75 cvs 287: docImage,
1.85 cvs 288: docImageRO,
289: docCSS,
1.110 cvs 290: docCSSRO,
291: docSource,
1.127 cvs 292: docSourceRO,
293: #ifdef ANNOTATIONS
294: docAnnot,
295: docAnnotRO
296: #endif /* ANNOTATIONS */
1.53 cvs 297: } DocumentType;
1.64 cvs 298:
299:
300: /* a record for data associated with a request */
301: typedef struct _DocumentMetaDataElement
302: {
1.137 cvs 303: CHAR_T* form_data; /* form data associated with a URL */
1.135 cvs 304: ClickEvent method; /* method used to send this data */
305: ThotBool put_default_name; /* URL name was concatenated with DEFAULT_NAME */
306: ThotBool xmlformat; /* the document should be exported in xml format */
1.64 cvs 307: } DocumentMetaDataElement;
308:
1.1 cvs 309: #define DocumentTableLength 10
1.110 cvs 310: /* URL of each loaded document */
1.137 cvs 311: THOT_EXPORT CHAR_T* DocumentURLs[DocumentTableLength];
1.64 cvs 312: /* Any formdata associated with a URL */
313: THOT_EXPORT DocumentMetaDataElement *DocumentMeta[DocumentTableLength];
1.110 cvs 314: /* Type of document */
1.53 cvs 315: THOT_EXPORT DocumentType DocumentTypes[DocumentTableLength];
1.110 cvs 316: /* identifier of the document displaying the source code */
317: THOT_EXPORT Document DocumentSource[DocumentTableLength];
318: /* The whole document is loaded when the corresponding entry in FilesLoading is 0 */
1.14 cvs 319: THOT_EXPORT int FilesLoading[DocumentTableLength];
1.110 cvs 320: /* Status (error, success) of the download of the objects of a document */
321: THOT_EXPORT int DocNetworkStatus[DocumentTableLength];
1.42 cvs 322:
1.14 cvs 323: THOT_EXPORT Document W3Loading; /* the document being loaded */
1.65 cvs 324: THOT_EXPORT Document BackupDocument; /* the current backup */
1.104 cvs 325:
326: /* button indexes */
327: THOT_EXPORT int iStop;
328: THOT_EXPORT int iBack;
329: THOT_EXPORT int iForward;
330: THOT_EXPORT int iReload;
331: THOT_EXPORT int iHome;
332: THOT_EXPORT int iEditor;
333: THOT_EXPORT int iSave;
334: THOT_EXPORT int iPrint;
335: THOT_EXPORT int iFind;
336: THOT_EXPORT int iI;
337: THOT_EXPORT int iB;
338: THOT_EXPORT int iT;
339: THOT_EXPORT int iImage;
340: THOT_EXPORT int iH1;
341: THOT_EXPORT int iH2;
342: THOT_EXPORT int iH3;
343: THOT_EXPORT int iBullet;
344: THOT_EXPORT int iNum;
345: THOT_EXPORT int iDL;
346: THOT_EXPORT int iLink;
347: THOT_EXPORT int iTable;
1.5 cvs 348:
1.64 cvs 349: #define IMAGE_NOT_LOADED 0
1.1 cvs 350: #define IMAGE_LOCAL 1
351: #define IMAGE_LOADED 2
352: #define IMAGE_MODIFIED 3
353:
1.109 cvs 354:
1.27 cvs 355: #ifdef __STDC__
1.137 cvs 356: typedef void (*LoadedImageCallback)(Document doc, Element el, CHAR_T* file, void *extra);
1.27 cvs 357: #else
358: typedef void (*LoadedImageCallback)();
359: #endif
1.109 cvs 360:
1.5 cvs 361: typedef struct _ElemImage
362: {
1.27 cvs 363: Element currentElement;/* first element using this image */
1.5 cvs 364: struct _ElemImage *nextElement;
1.27 cvs 365: LoadedImageCallback callback; /* Callback for non-standard handling */
366: void *extra; /* any extra info for the CallBack */
1.5 cvs 367: }
368: ElemImage;
369:
370: typedef struct _LoadedImageDesc
371: {
1.105 cvs 372: STRING originalName; /* complete URL of the image */
373: STRING localName; /* local name (without path) of the image */
1.58 cvs 374: struct _LoadedImageDesc *prevImage;/* double linked list */
375: struct _LoadedImageDesc *nextImage;/* easier to unchain */
376: Document document; /* document concerned */
377: struct _ElemImage *elImage; /* first element using this image */
378: int imageType; /* the type of the image */
379: int status; /* the status of the image loading */
1.5 cvs 380: }
381: LoadedImageDesc;
1.109 cvs 382:
383: /* the structure used for storing the context of the
384: FetchAndDisplayImages_callback function */
385: typedef struct _FetchImage_context {
386: STRING base_url;
387: LoadedImageDesc *desc;
388: } FetchImage_context;
389:
1.5 cvs 390:
1.14 cvs 391: THOT_EXPORT LoadedImageDesc *ImageURLs;
1.31 cvs 392: THOT_EXPORT LoadedImageDesc *ImageLocal;
1.1 cvs 393:
1.88 cvs 394: /* The default Amaya HOME pages (page shown at boot time */
395:
1.137 cvs 396: #ifdef _WINDOWS
397: # define AMAYA_PAGE TEXT("\\amaya\\AmayaPage.html")
398: #else /* !_WINDOWS */
399: # define AMAYA_PAGE TEXT("/amaya/AmayaPage.html")
400: #endif /* !_WINDOWS */
401:
402: #define AMAYA_PAGE_DOC TEXT("http://www.w3.org/Amaya/User/")
403:
404: #ifndef MAX_TXT_LEN
405: #define MAX_TXT_LEN 1024 /* Max. length of strings */
406: #endif /* MAX_TXT_LEN */
1.88 cvs 407:
1.25 cvs 408: #endif /* AMAYA_H */
Webmaster