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