Annotation of Amaya/amaya/amaya.h, revision 1.202
1.8 cvs 1: /*
2: *
1.201 cvs 3: * (c) COPYRIGHT MIT and INRIA, 1996-2001.
1.8 cvs 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.197 kahan 34: #include "MathML.h"
35: #include "GraphML.h"
1.84 cvs 36: #include "TextFile.h"
1.1 cvs 37: #include "amayamsg.h"
1.156 cvs 38: #include "parser.h"
1.1 cvs 39:
1.25 cvs 40: #define NAME_LENGTH 32
41:
1.198 cvs 42: #define HTAppName "amaya"
1.201 cvs 43: #define HTAppVersion "V4.4"
44: #define HTAppDate "25 April 2001"
1.130 cvs 45:
46: #define URL_STR "/"
47: #define URL_SEP '/'
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,
1.175 kahan 66: AM_HTTP_CHARSET = 1,
1.196 kahan 67: AM_HTTP_CONTENT_LENGTH = 2,
68: AM_HTTP_REASON = 3
1.139 cvs 69: }
70: AHTHeaderName;
71:
72: /* the structure used for exchanging HTTP header info between the net library
73: and amaya */
74: typedef struct _AHTHeaders
75: {
1.198 cvs 76: char *content_type;
77: char *charset;
78: char *content_length;
79: char *reason;
1.139 cvs 80: }
81: AHTHeaders;
82:
1.50 cvs 83: /* The structures used for request callbacks */
84: typedef void TIcbf (Document doc, int status, char *urlName,
1.139 cvs 85: char *outputfile, const AHTHeaders *http_headers,
1.50 cvs 86: const char *data_block, int data_block_size,
87: void *context);
88:
1.198 cvs 89: typedef void TTcbf (Document doc, int status, char *urlName,
90: char *outputfile, const AHTHeaders *http_headers,
1.50 cvs 91: void *context);
92:
1.25 cvs 93: /* How are Network accesses provided ? */
94: #include "libwww.h"
1.1 cvs 95:
1.66 cvs 96: /* The different events to open a new document */
1.41 cvs 97: typedef enum _ClickEvent {
1.73 cvs 98: CE_ABSOLUTE, CE_RELATIVE, CE_FORM_POST, CE_FORM_GET,
1.153 cvs 99: CE_HELP, CE_MAKEBOOK, CE_LOG , CE_TEMPLATE, CE_INIT,
1.190 cvs 100: CE_CSS, CE_ANNOT
1.41 cvs 101: } ClickEvent;
1.20 cvs 102:
103: #define NO 0
104: #define YES 1
105:
1.165 cvs 106: /* dialogues */
1.20 cvs 107: #define URLForm 1
1.29 cvs 108: #define OpenForm 2
109: #define URLName 3
110: #define LocalName 4
111: #define DirSelect 5
112: #define DocSelect 6
1.20 cvs 113: #define StopCommand 7
1.29 cvs 114: #define SaveForm 8
1.20 cvs 115: #define DirSave 9
116: #define DocSave 10
117: #define ToggleSave 11
1.29 cvs 118: #define NameSave 12
1.30 cvs 119: #define ImgDirSave 13
120: #define Label1 14
121: #define Label2 15
122: #define Label3 16
123: #define Label4 17
1.29 cvs 124: #define ConfirmForm 18
125: #define ConfirmText 19
1.20 cvs 126: #define AttrHREFForm 20
127: #define AttrHREFText 21
128: #define FormAnswer 22
1.120 cvs 129: #define RealmText 23
1.20 cvs 130: #define AnswerText 24
131: #define NameText 25
132: #define PasswordText 26
1.30 cvs 133: #define FilterText 27
134: #define ClassForm 28
1.20 cvs 135: #define ClassSelect 29
136: #define AClassForm 30
1.30 cvs 137: #define AClassSelect 31
138: #define ConfirmSave 32
139: #define ConfirmSaveList 33
1.176 cvs 140: #define BrowserDirSelect 34
141: #define BrowserDocSelect 35
142: #define BrowserFilterText 36
1.168 cvs 143: #define HREFLocalName 37
1.169 kahan 144: #define MakeIdMenu 38
145: #define mElemName 39
146: #define mAddId 40
147: #define mRemoveId 41
1.173 kahan 148: #define mIdUseSelection 42
149: #define mIdStatus 43
1.176 cvs 150: #define FileBrowserForm 44
151: #define FileBrowserText 45
152: #define FileBrowserFilter 46
153: #define FileBrowserLocalName 47
154: #define OptionMenu 48
1.134 cvs 155: /* MAX_SUBMENUS references reserved for submenus of Option menu */
156: /* Do not insert new entries here */
1.91 cvs 157: #define MAX_SUBMENUS 400
1.177 cvs 158: #define About1 450
159: #define About2 451
160: #define About3 452
161: #define Version 453
162: #define AboutForm 454
163: #define TableForm 455
164: #define TableRows 456
165: #define TableCols 457
166: #define TableBorder 458
167: #define MathEntityForm 459
168: #define MathEntityText 460
169: #define TitleForm 461
170: #define TitleText 462
1.192 cvs 171: #define DocInfoForm 463
172: #define DocInfoMimeTypeTitle 464
173: #define DocInfoMimeType 465
174: #define DocInfoCharsetTitle 466
175: #define DocInfoCharset 467
176: #define DocInfoContentTitle 468
177: #define DocInfoContent 469
178: #define DocInfoLocationTitle 470
179: #define DocInfoLocation 471
1.194 cvs 180: #define DocInfoTitle1 472
181: #define DocInfoTitle2 473
182: #define DocInfoContent1 474
183: #define DocInfoContent2 475
184: #define MAX_REF 476
1.20 cvs 185:
1.150 cvs 186: #define FormPrint 1
187: #define PrintOptions 2
188: #define PaperFormat 3
189: #define PrintSupport 4
190: #define PPrinterName 5
191: #define PaperOrientation 6
192: #define PPagesPerSheet 7
193: #define PRINT_MAX_REF 8
1.147 cvs 194:
195: #define ImageURL 1
196: #define ImageLabel 2
197: #define ImageLabel2 3
198: #define ImageLabel3 4
199: #define ImageLabel4 5
200: #define ImageDir 6
201: #define ImageSel 7
202: #define ImageFilter 8
203: #define FormImage 9
204: #define RepeatImage 10
205: #define FormBackground 11
206: #define ImageAlt 12
207: #define FormAlt 13
208: #define IMAGE_MAX_REF 14
209:
210: #define CSSForm 0
211: #define CSSSelect 1
212: #define MAX_CSS_REF 2
213:
214: #define FormMaths 0
215: #define MenuMaths 1
216: #define MAX_MATHS 2
217:
1.165 cvs 218: #ifdef GRAPHML
219: #define FormGraph 0
220: #define MenuGraph 1
221: #define MAX_GRAPH 2
222: #endif /* GRAPHML */
223:
1.11 cvs 224: /* The possible GET/POST/PUT request modes */
225: /*synchronous request*/
226: #define AMAYA_SYNC 1 /*0x000001 */
227: /*synchronous request with incremental callbacks */
228: #define AMAYA_ISYNC 2 /*0x000010 */
229: /*asynchronous request */
1.5 cvs 230: #define AMAYA_ASYNC 4 /*0x000100 */
1.11 cvs 231: /*asynchronous request with incremental callbacks */
1.5 cvs 232: #define AMAYA_IASYNC 8 /*0x001000 */
1.11 cvs 233: /* send the form using the POST HTTP method */
1.5 cvs 234: #define AMAYA_FORM_POST 16 /*0x010000 */
1.11 cvs 235: /* send the form using the GET HTTP method */
1.5 cvs 236: #define AMAYA_FORM_GET 32 /*0x100000 */
1.23 cvs 237: /* bypass caching */
238: #define AMAYA_NOCACHE 64
239: /* don't follow redirections */
240: #define AMAYA_NOREDIR 128
1.48 cvs 241: /* Prevents a stop race condition in ASYNC transfers */
242: #define AMAYA_ASYNC_SAFE_STOP 256
1.60 cvs 243: #define AMAYA_LOAD_CSS 512
1.67 cvs 244: #define AMAYA_FLUSH_REQUEST 1024
1.80 cvs 245: #define AMAYA_USE_PRECONDITIONS 2048
1.123 cvs 246: #define AMAYA_LOAD_IMAGE 4096
1.167 kahan 247: /* post an annonation */
248: #define AMAYA_FILE_POST 8192
249: /* delete an annotation */
250: #define AMAYA_DELETE 16384
1.180 kahan 251: #define AMAYA_MBOOK_IMAGE 32768
1.87 cvs 252: /*
253: * Flags to indicate the action to take when the network options
254: * are modified
255: */
256: #define AMAYA_CACHE_RESTART 1
257: #define AMAYA_PROXY_RESTART 2
1.114 cvs 258: #define AMAYA_LANNEG_RESTART 4
259: #define AMAYA_SAFEPUT_RESTART 8
1.87 cvs 260:
1.26 cvs 261: /*
262: * Flags to indicate the status of the network requests associated
263: * to a document.
264: */
265:
266: #define AMAYA_NET_INACTIVE 1
267: #define AMAYA_NET_ERROR 2
268: #define AMAYA_NET_ACTIVE 4
269:
1.25 cvs 270: /*
271: * Flags for HTParse, specifying which parts of the URL are needed
272: */
273: #define AMAYA_PARSE_ACCESS 16 /* Access scheme, e.g. "HTTP" */
274: #define AMAYA_PARSE_HOST 8 /* Host name, e.g. "www.w3.org" */
275: #define AMAYA_PARSE_PATH 4 /* URL Path, e.g. "pub/WWW/TheProject.html" */
276: #define AMAYA_PARSE_ANCHOR 2 /* Fragment identifier, e.g. "news" */
277: #define AMAYA_PARSE_PUNCTUATION 1 /* Include delimiters, e.g, "/" and ":" */
278: #define AMAYA_PARSE_ALL 31 /* All the parts */
1.1 cvs 279:
1.198 cvs 280: THOT_EXPORT int AMAYA; /* Index of amaya message table */
281: THOT_EXPORT int appArgc;
282: THOT_EXPORT char **appArgv;
283: THOT_EXPORT char TempFileDirectory[MAX_LENGTH];
284: THOT_EXPORT char Answer_text[MAX_LENGTH];
285: THOT_EXPORT char Answer_name[NAME_LENGTH];
286: THOT_EXPORT char Answer_password[NAME_LENGTH];
287: THOT_EXPORT char Display_password[NAME_LENGTH];
288: THOT_EXPORT char ScanFilter[NAME_LENGTH]; /* to scan directories */
289: THOT_EXPORT char MathMLEntityName[MAX_LENGTH]; /* entity name typed by the user for a MathML expression */
290: THOT_EXPORT char IdElemName[MAX_LENGTH]; /* element name typed by the user from the MakeID menu */
291: THOT_EXPORT char IdStatus[50]; /* element name typed by the user from the MakeID menu */
292: THOT_EXPORT char ImgFilter[NAME_LENGTH];
293: THOT_EXPORT char *LastURLName; /* last URL requested */
294: THOT_EXPORT char *DirectoryName; /* local path of the document */
295: THOT_EXPORT char *DocumentName; /* document name */
296: THOT_EXPORT char *SavePath; /* saving path */
297: THOT_EXPORT char *SaveName; /* saving name of the document */
298: THOT_EXPORT char *ObjectName; /* document name */
299: THOT_EXPORT char *SaveImgsURL; /* where to save remote Images */
300: THOT_EXPORT char *TargetName;
301: THOT_EXPORT char *SavingFile; /* complete path or URL of the document */
1.202 ! cvs 302: THOT_EXPORT char *SavedDocumentURL;/* URL of the document that contained
! 303: the elements that are now in the
! 304: Cut and Paste buffer */
1.198 cvs 305: THOT_EXPORT int Lg_password;
306: THOT_EXPORT int BaseDialog;
307: THOT_EXPORT int BasePrint;
308: THOT_EXPORT int BaseImage;
309: THOT_EXPORT int MathsDialogue;
1.165 cvs 310: #ifdef GRAPHML
1.198 cvs 311: THOT_EXPORT int GraphDialogue;
1.165 cvs 312: #endif /* GRAPHML */
1.198 cvs 313: THOT_EXPORT int BaseCSS;
314: THOT_EXPORT int ReturnOption;
315: THOT_EXPORT int NumberRows;
316: THOT_EXPORT int NumberCols;
317: THOT_EXPORT int TBorder;
318: THOT_EXPORT int ReturnOptionMenu;
319: THOT_EXPORT int IdDoc;
320: THOT_EXPORT Document CurrentDocument;
321: THOT_EXPORT Document SavingDocument;
322: THOT_EXPORT Document SavingObject;
323: THOT_EXPORT Document AttrHREFdocument;
324: THOT_EXPORT Document DocBook;
325: THOT_EXPORT Document IncludedDocument;
326: THOT_EXPORT Element AttrHREFelement;
327: THOT_EXPORT char *AttrHREFvalue;
328: THOT_EXPORT Document SelectionDoc;
329: THOT_EXPORT ThotBool IsNewAnchor;
330: THOT_EXPORT ThotBool UseLastTarget;
331: THOT_EXPORT ThotBool LinkAsCSS;
332: THOT_EXPORT ThotBool SaveAsHTML;
333: THOT_EXPORT ThotBool SaveAsXML;
334: THOT_EXPORT ThotBool SaveAsText;
335: THOT_EXPORT ThotBool CopyImages; /* should we copy images in Save As */
336: THOT_EXPORT ThotBool UpdateURLs; /* should we update URLs in Save As */
337: THOT_EXPORT ThotBool UserAnswer;
338: THOT_EXPORT ThotBool InNewWindow;
339: THOT_EXPORT ThotBool SelectionInPRE;
340: THOT_EXPORT ThotBool SelectionInComment;
341: THOT_EXPORT ThotBool SelectionInEM;
342: THOT_EXPORT ThotBool SelectionInSTRONG;
343: THOT_EXPORT ThotBool SelectionInCITE;
344: THOT_EXPORT ThotBool SelectionInABBR;
345: THOT_EXPORT ThotBool SelectionInACRONYM;
346: THOT_EXPORT ThotBool SelectionInINS;
347: THOT_EXPORT ThotBool SelectionInDEL;
348: THOT_EXPORT ThotBool SelectionInDFN;
349: THOT_EXPORT ThotBool SelectionInCODE;
350: THOT_EXPORT ThotBool SelectionInVAR;
351: THOT_EXPORT ThotBool SelectionInSAMP;
352: THOT_EXPORT ThotBool SelectionInKBD;
353: THOT_EXPORT ThotBool SelectionInI;
354: THOT_EXPORT ThotBool SelectionInB;
355: THOT_EXPORT ThotBool SelectionInTT;
356: THOT_EXPORT ThotBool SelectionInBIG;
357: THOT_EXPORT ThotBool SelectionInSMALL;
358: THOT_EXPORT ThotBool SelectionInSub;
359: THOT_EXPORT ThotBool SelectionInSup;
360: THOT_EXPORT ThotBool SelectionInQuote;
361: THOT_EXPORT ThotBool SelectionInBDO;
362: THOT_EXPORT ThotBool HTMLErrorsFound;
363: THOT_EXPORT ThotBool XMLErrorsFound;
364: THOT_EXPORT ThotBool XMLErrorsFoundInProfile;
365: THOT_EXPORT ThotBool XMLNotWellFormed;
366: THOT_EXPORT ThotBool IdApplyToSelection; /* used in the Make ID menu */
367: THOT_EXPORT FILE *ErrFile;
368: THOT_EXPORT char ErrFileName [80];
1.53 cvs 369: typedef enum
370: {
371: docHTML,
1.74 cvs 372: docText,
1.75 cvs 373: docImage,
1.85 cvs 374: docCSS,
1.110 cvs 375: docSource,
1.127 cvs 376: docAnnot,
1.164 cvs 377: docLog,
378: docSVG,
379: docMath,
1.191 cvs 380: docXml
1.53 cvs 381: } DocumentType;
1.64 cvs 382:
383:
384: /* a record for data associated with a request */
385: typedef struct _DocumentMetaDataElement
386: {
1.198 cvs 387: char *initial_url; /* if the server returns a different URL name
388: after a redirection, we store here the one
389: that the browser first asked */
390: char *form_data; /* form data associated with a URL */
391: char *content_type; /* content type returned by the server */
392: char *charset; /* charset returned by the server */
393: char *content_length; /* content length returned by the server */
1.166 cvs 394: ClickEvent method; /* method used to send this data */
395: ThotBool put_default_name; /* URL name was concatenated with DEFAULT_NAME*/
1.135 cvs 396: ThotBool xmlformat; /* the document should be exported in xml format */
1.166 cvs 397:
1.144 kahan 398: #ifdef ANNOTATIONS
399: Document source_doc; /* if the document is an annotation,
400: this variable giveso the annoted document
401: docid */
402: #endif /* ANNOTATIONS */
1.64 cvs 403: } DocumentMetaDataElement;
1.202 ! cvs 404:
1.64 cvs 405:
1.200 cvs 406: #define DocumentTableLength MAX_DOCUMENTS
1.110 cvs 407: /* URL of each loaded document */
1.198 cvs 408: THOT_EXPORT char *DocumentURLs[DocumentTableLength];
1.64 cvs 409: /* Any formdata associated with a URL */
410: THOT_EXPORT DocumentMetaDataElement *DocumentMeta[DocumentTableLength];
1.110 cvs 411: /* Type of document */
1.198 cvs 412: THOT_EXPORT DocumentType DocumentTypes[DocumentTableLength];
1.166 cvs 413: /* Document is in read only mode */
1.198 cvs 414: THOT_EXPORT ThotBool ReadOnlyDocument[DocumentTableLength];
1.110 cvs 415: /* identifier of the document displaying the source code */
1.198 cvs 416: THOT_EXPORT Document DocumentSource[DocumentTableLength];
1.110 cvs 417: /* The whole document is loaded when the corresponding entry in FilesLoading is 0 */
1.198 cvs 418: THOT_EXPORT int FilesLoading[DocumentTableLength];
1.110 cvs 419: /* Status (error, success) of the download of the objects of a document */
1.198 cvs 420: THOT_EXPORT int DocNetworkStatus[DocumentTableLength];
1.156 cvs 421: /* Status of the XHTML document (basic, strict, transitional) */
1.198 cvs 422: THOT_EXPORT int ParsingLevel[DocumentTableLength];
1.42 cvs 423:
1.198 cvs 424: THOT_EXPORT Document W3Loading; /* the document being loaded */
425: THOT_EXPORT Document BackupDocument; /* the current backup */
1.104 cvs 426:
427: /* button indexes */
428: THOT_EXPORT int iStop;
429: THOT_EXPORT int iBack;
430: THOT_EXPORT int iForward;
431: THOT_EXPORT int iReload;
432: THOT_EXPORT int iHome;
433: THOT_EXPORT int iEditor;
434: THOT_EXPORT int iSave;
435: THOT_EXPORT int iPrint;
436: THOT_EXPORT int iFind;
437: THOT_EXPORT int iI;
438: THOT_EXPORT int iB;
439: THOT_EXPORT int iT;
440: THOT_EXPORT int iImage;
441: THOT_EXPORT int iH1;
442: THOT_EXPORT int iH2;
443: THOT_EXPORT int iH3;
444: THOT_EXPORT int iBullet;
445: THOT_EXPORT int iNum;
446: THOT_EXPORT int iDL;
447: THOT_EXPORT int iLink;
448: THOT_EXPORT int iTable;
1.5 cvs 449:
1.64 cvs 450: #define IMAGE_NOT_LOADED 0
1.1 cvs 451: #define IMAGE_LOCAL 1
452: #define IMAGE_LOADED 2
453: #define IMAGE_MODIFIED 3
454:
1.109 cvs 455:
1.198 cvs 456: typedef void (*LoadedImageCallback)(Document doc, Element el, char *file, void *extra);
1.5 cvs 457: typedef struct _ElemImage
458: {
1.27 cvs 459: Element currentElement;/* first element using this image */
1.5 cvs 460: struct _ElemImage *nextElement;
1.27 cvs 461: LoadedImageCallback callback; /* Callback for non-standard handling */
462: void *extra; /* any extra info for the CallBack */
1.5 cvs 463: }
464: ElemImage;
465:
466: typedef struct _LoadedImageDesc
467: {
1.198 cvs 468: char *originalName; /* complete URL of the image */
469: char *localName; /* local name (without path) of the image */
1.58 cvs 470: struct _LoadedImageDesc *prevImage;/* double linked list */
471: struct _LoadedImageDesc *nextImage;/* easier to unchain */
472: Document document; /* document concerned */
473: struct _ElemImage *elImage; /* first element using this image */
474: int imageType; /* the type of the image */
475: int status; /* the status of the image loading */
1.5 cvs 476: }
477: LoadedImageDesc;
1.109 cvs 478:
479: /* the structure used for storing the context of the
480: FetchAndDisplayImages_callback function */
481: typedef struct _FetchImage_context {
1.198 cvs 482: char *base_url;
1.109 cvs 483: LoadedImageDesc *desc;
484: } FetchImage_context;
485:
1.5 cvs 486:
1.14 cvs 487: THOT_EXPORT LoadedImageDesc *ImageURLs;
1.31 cvs 488: THOT_EXPORT LoadedImageDesc *ImageLocal;
1.1 cvs 489:
1.88 cvs 490: /* The default Amaya HOME pages (page shown at boot time */
1.198 cvs 491: #define AMAYA_PAGE "AmayaPage.html"
492: #define AMAYA_PAGE_DOC "http://www.w3.org/Amaya/User/"
1.137 cvs 493:
494: #ifndef MAX_TXT_LEN
495: #define MAX_TXT_LEN 1024 /* Max. length of strings */
496: #endif /* MAX_TXT_LEN */
1.88 cvs 497:
1.25 cvs 498: #endif /* AMAYA_H */
Webmaster