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

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

Webmaster