Annotation of Amaya/amaya/amaya.h, revision 1.199
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.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.199 ! cvs 43: #define HTAppVersion "V4.3.2"
! 44: #define HTAppDate "23 March 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 */
302: THOT_EXPORT int Lg_password;
303: THOT_EXPORT int BaseDialog;
304: THOT_EXPORT int BasePrint;
305: THOT_EXPORT int BaseImage;
306: THOT_EXPORT int MathsDialogue;
1.165 cvs 307: #ifdef GRAPHML
1.198 cvs 308: THOT_EXPORT int GraphDialogue;
1.165 cvs 309: #endif /* GRAPHML */
1.198 cvs 310: THOT_EXPORT int BaseCSS;
311: THOT_EXPORT int ReturnOption;
312: THOT_EXPORT int NumberRows;
313: THOT_EXPORT int NumberCols;
314: THOT_EXPORT int TBorder;
315: THOT_EXPORT int ReturnOptionMenu;
316: THOT_EXPORT int IdDoc;
317: THOT_EXPORT Document CurrentDocument;
318: THOT_EXPORT Document SavingDocument;
319: THOT_EXPORT Document SavingObject;
320: THOT_EXPORT Document AttrHREFdocument;
321: THOT_EXPORT Document DocBook;
322: THOT_EXPORT Document IncludedDocument;
323: THOT_EXPORT Element AttrHREFelement;
324: THOT_EXPORT char *AttrHREFvalue;
325: THOT_EXPORT Document SelectionDoc;
326: THOT_EXPORT ThotBool IsNewAnchor;
327: THOT_EXPORT ThotBool UseLastTarget;
328: THOT_EXPORT ThotBool LinkAsCSS;
329: THOT_EXPORT ThotBool SaveAsHTML;
330: THOT_EXPORT ThotBool SaveAsXML;
331: THOT_EXPORT ThotBool SaveAsText;
332: THOT_EXPORT ThotBool CopyImages; /* should we copy images in Save As */
333: THOT_EXPORT ThotBool UpdateURLs; /* should we update URLs in Save As */
334: THOT_EXPORT ThotBool UserAnswer;
335: THOT_EXPORT ThotBool InNewWindow;
336: THOT_EXPORT ThotBool SelectionInPRE;
337: THOT_EXPORT ThotBool SelectionInComment;
338: THOT_EXPORT ThotBool SelectionInEM;
339: THOT_EXPORT ThotBool SelectionInSTRONG;
340: THOT_EXPORT ThotBool SelectionInCITE;
341: THOT_EXPORT ThotBool SelectionInABBR;
342: THOT_EXPORT ThotBool SelectionInACRONYM;
343: THOT_EXPORT ThotBool SelectionInINS;
344: THOT_EXPORT ThotBool SelectionInDEL;
345: THOT_EXPORT ThotBool SelectionInDFN;
346: THOT_EXPORT ThotBool SelectionInCODE;
347: THOT_EXPORT ThotBool SelectionInVAR;
348: THOT_EXPORT ThotBool SelectionInSAMP;
349: THOT_EXPORT ThotBool SelectionInKBD;
350: THOT_EXPORT ThotBool SelectionInI;
351: THOT_EXPORT ThotBool SelectionInB;
352: THOT_EXPORT ThotBool SelectionInTT;
353: THOT_EXPORT ThotBool SelectionInBIG;
354: THOT_EXPORT ThotBool SelectionInSMALL;
355: THOT_EXPORT ThotBool SelectionInSub;
356: THOT_EXPORT ThotBool SelectionInSup;
357: THOT_EXPORT ThotBool SelectionInQuote;
358: THOT_EXPORT ThotBool SelectionInBDO;
359: THOT_EXPORT ThotBool HTMLErrorsFound;
360: THOT_EXPORT ThotBool XMLErrorsFound;
361: THOT_EXPORT ThotBool XMLErrorsFoundInProfile;
362: THOT_EXPORT ThotBool XMLNotWellFormed;
363: THOT_EXPORT ThotBool IdApplyToSelection; /* used in the Make ID menu */
364: THOT_EXPORT FILE *ErrFile;
365: THOT_EXPORT char ErrFileName [80];
1.53 cvs 366: typedef enum
367: {
368: docHTML,
1.74 cvs 369: docText,
1.75 cvs 370: docImage,
1.85 cvs 371: docCSS,
1.110 cvs 372: docSource,
1.127 cvs 373: docAnnot,
1.164 cvs 374: docLog,
375: docSVG,
376: docMath,
1.191 cvs 377: docXml
1.53 cvs 378: } DocumentType;
1.64 cvs 379:
380:
381: /* a record for data associated with a request */
382: typedef struct _DocumentMetaDataElement
383: {
1.198 cvs 384: char *initial_url; /* if the server returns a different URL name
385: after a redirection, we store here the one
386: that the browser first asked */
387: char *form_data; /* form data associated with a URL */
388: char *content_type; /* content type returned by the server */
389: char *charset; /* charset returned by the server */
390: char *content_length; /* content length returned by the server */
1.166 cvs 391: ClickEvent method; /* method used to send this data */
392: ThotBool put_default_name; /* URL name was concatenated with DEFAULT_NAME*/
1.135 cvs 393: ThotBool xmlformat; /* the document should be exported in xml format */
1.166 cvs 394:
1.144 kahan 395: #ifdef ANNOTATIONS
396: Document source_doc; /* if the document is an annotation,
397: this variable giveso the annoted document
398: docid */
399: #endif /* ANNOTATIONS */
1.64 cvs 400: } DocumentMetaDataElement;
401:
1.1 cvs 402: #define DocumentTableLength 10
1.110 cvs 403: /* URL of each loaded document */
1.198 cvs 404: THOT_EXPORT char *DocumentURLs[DocumentTableLength];
1.64 cvs 405: /* Any formdata associated with a URL */
406: THOT_EXPORT DocumentMetaDataElement *DocumentMeta[DocumentTableLength];
1.110 cvs 407: /* Type of document */
1.198 cvs 408: THOT_EXPORT DocumentType DocumentTypes[DocumentTableLength];
1.166 cvs 409: /* Document is in read only mode */
1.198 cvs 410: THOT_EXPORT ThotBool ReadOnlyDocument[DocumentTableLength];
1.110 cvs 411: /* identifier of the document displaying the source code */
1.198 cvs 412: THOT_EXPORT Document DocumentSource[DocumentTableLength];
1.110 cvs 413: /* The whole document is loaded when the corresponding entry in FilesLoading is 0 */
1.198 cvs 414: THOT_EXPORT int FilesLoading[DocumentTableLength];
1.110 cvs 415: /* Status (error, success) of the download of the objects of a document */
1.198 cvs 416: THOT_EXPORT int DocNetworkStatus[DocumentTableLength];
1.156 cvs 417: /* Status of the XHTML document (basic, strict, transitional) */
1.198 cvs 418: THOT_EXPORT int ParsingLevel[DocumentTableLength];
1.42 cvs 419:
1.198 cvs 420: THOT_EXPORT Document W3Loading; /* the document being loaded */
421: THOT_EXPORT Document BackupDocument; /* the current backup */
1.104 cvs 422:
423: /* button indexes */
424: THOT_EXPORT int iStop;
425: THOT_EXPORT int iBack;
426: THOT_EXPORT int iForward;
427: THOT_EXPORT int iReload;
428: THOT_EXPORT int iHome;
429: THOT_EXPORT int iEditor;
430: THOT_EXPORT int iSave;
431: THOT_EXPORT int iPrint;
432: THOT_EXPORT int iFind;
433: THOT_EXPORT int iI;
434: THOT_EXPORT int iB;
435: THOT_EXPORT int iT;
436: THOT_EXPORT int iImage;
437: THOT_EXPORT int iH1;
438: THOT_EXPORT int iH2;
439: THOT_EXPORT int iH3;
440: THOT_EXPORT int iBullet;
441: THOT_EXPORT int iNum;
442: THOT_EXPORT int iDL;
443: THOT_EXPORT int iLink;
444: THOT_EXPORT int iTable;
1.5 cvs 445:
1.64 cvs 446: #define IMAGE_NOT_LOADED 0
1.1 cvs 447: #define IMAGE_LOCAL 1
448: #define IMAGE_LOADED 2
449: #define IMAGE_MODIFIED 3
450:
1.109 cvs 451:
1.198 cvs 452: typedef void (*LoadedImageCallback)(Document doc, Element el, char *file, void *extra);
1.5 cvs 453: typedef struct _ElemImage
454: {
1.27 cvs 455: Element currentElement;/* first element using this image */
1.5 cvs 456: struct _ElemImage *nextElement;
1.27 cvs 457: LoadedImageCallback callback; /* Callback for non-standard handling */
458: void *extra; /* any extra info for the CallBack */
1.5 cvs 459: }
460: ElemImage;
461:
462: typedef struct _LoadedImageDesc
463: {
1.198 cvs 464: char *originalName; /* complete URL of the image */
465: char *localName; /* local name (without path) of the image */
1.58 cvs 466: struct _LoadedImageDesc *prevImage;/* double linked list */
467: struct _LoadedImageDesc *nextImage;/* easier to unchain */
468: Document document; /* document concerned */
469: struct _ElemImage *elImage; /* first element using this image */
470: int imageType; /* the type of the image */
471: int status; /* the status of the image loading */
1.5 cvs 472: }
473: LoadedImageDesc;
1.109 cvs 474:
475: /* the structure used for storing the context of the
476: FetchAndDisplayImages_callback function */
477: typedef struct _FetchImage_context {
1.198 cvs 478: char *base_url;
1.109 cvs 479: LoadedImageDesc *desc;
480: } FetchImage_context;
481:
1.5 cvs 482:
1.14 cvs 483: THOT_EXPORT LoadedImageDesc *ImageURLs;
1.31 cvs 484: THOT_EXPORT LoadedImageDesc *ImageLocal;
1.1 cvs 485:
1.88 cvs 486: /* The default Amaya HOME pages (page shown at boot time */
1.198 cvs 487: #define AMAYA_PAGE "AmayaPage.html"
488: #define AMAYA_PAGE_DOC "http://www.w3.org/Amaya/User/"
1.137 cvs 489:
490: #ifndef MAX_TXT_LEN
491: #define MAX_TXT_LEN 1024 /* Max. length of strings */
492: #endif /* MAX_TXT_LEN */
1.88 cvs 493:
1.25 cvs 494: #endif /* AMAYA_H */
Webmaster