Annotation of Amaya/amaya/amaya.h, revision 1.128

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

Webmaster