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

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

Webmaster