home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / structs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  16.6 KB  |  458 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19.  
  20. /*
  21.  * This file is included by client.h
  22.  *
  23.  * It can be included by hand after mcom.h
  24.  *
  25.  * All intermodule data structures (i.e. MWContext, etc) should be included
  26.  *  in this file
  27.  */
  28. #ifndef _STRUCTS_H_
  29. #define _STRUCTS_H_
  30.  
  31. #include "ntypes.h"
  32. #include "xp_mcom.h"
  33.  
  34. #include "il_types.h"
  35. #include "lo_ele.h"
  36. #include "shistele.h"
  37. #include "edttypes.h"
  38.  
  39. #ifdef JAVA
  40. #include "prlong.h"
  41. #include "prclist.h"
  42. #endif /* JAVA */
  43.  
  44. /* ------------------------------------------------------------------------ */
  45. /* ============= Typedefs for the global context structure ================ */
  46.  
  47. /* will come out of the ctxtfunc.h file eventually
  48.  */
  49. typedef struct _ContextFuncs ContextFuncs;
  50. /*
  51.  *   This stuff is front end specific.  Add whatever you need.
  52.  */
  53. #if defined(OSF1) && defined(__cplusplus)
  54.     struct fe_ContextData;
  55. #endif
  56.  
  57. #if defined(XP_MAC) && defined(__cplusplus)
  58. class NetscapeContext;
  59. class CHyperView;
  60.  
  61. class CNSContext;
  62. class CHTMLView;
  63. #endif
  64.  
  65. #if ( defined(XP_WIN) || defined(XP_OS2) ) && defined(__cplusplus)
  66. class CAbstractCX;
  67. class CEditView;
  68. class CSaveProgress;
  69. #endif
  70.  
  71. typedef struct FEstruct_ {
  72. #ifndef MOZILLA_CLIENT
  73.     void * generic_data;
  74. #elif defined(XP_WIN) || defined(XP_OS2)
  75. #ifdef __cplusplus
  76.         CAbstractCX *cx;
  77. #else
  78.     void *cx;
  79. #endif
  80. #elif defined(XP_TEXT)
  81.     int doc_cols;
  82.     int doc_lines;
  83.     int cur_top_line;
  84.     int num_anchors;
  85.     int cur_anchor;
  86.  
  87. #elif defined(XP_UNIX)
  88.     struct fe_ContextData *data;
  89. #elif defined(XP_MAC)
  90. #ifdef __cplusplus
  91.     class NetscapeContext*        realContext;
  92.     class CHyperView*        view;
  93.     
  94.     class CNSContext*        newContext;
  95.     class CHTMLView*        newView;
  96. #else
  97.     void*                    realContext;
  98.     void*                    view;
  99.  
  100.     void*                    newContext;
  101.     void*                    newView;    
  102. #endif
  103.  
  104. /*
  105. ** These members are only used by the EDITOR... However, if they
  106. ** are removed for non-editor builds the MWContext structure
  107. ** becomes skewed for java (and the rest of DIST)...
  108. */
  109. #ifdef __cplusplus
  110.     class CEditView*        editview;
  111.     class CSaveProgress*    savedialog;
  112. #else
  113.     void*                    editview;
  114.     void*                    savedialog;
  115. #endif
  116.  
  117. #endif
  118. } FEstruct;
  119.  
  120. #define FEUNITS_X(x,context)   ((int32) ((MWContext *)context)->convertPixX * (x))
  121. #define FEUNITS_Y(y,context)   ((int32) ((MWContext *)context)->convertPixY * (y))
  122.  
  123. struct MessageCopyInfo;
  124.  
  125. /*
  126.     This is a generic context structure.  There should be one context
  127.     per document window.  The context will allow assorted modules to
  128.     pull out things like the URL of the current document as well as
  129.     giving them a place to hand their window specific stuff.
  130.  
  131. */
  132.  
  133. #if defined (OSF1)
  134. /* Forward declaration to make compiler happy on OSF1 */
  135. struct MSG_SearchFrame;
  136. #ifdef XP_CPLUSPLUS
  137. class MSG_IMAPFolderInfoMail;
  138. class MSG_Master;
  139. class MSG_Pane;
  140. class TImapServerState; 
  141. #endif
  142. #endif
  143.  
  144. struct MWContext_ {
  145.     MWContextType type;
  146.  
  147.     char       *url;   /* URL of current document */
  148.     char       * name;    /* name of this context */
  149.     History      hist;  /* Info needed for the window history module */
  150.     FEstruct     fe;    /* Front end specific stuff */
  151.     PRPackedBool          fancyFTP;  /* use fancy ftp ? */
  152.     PRPackedBool          fancyNews; /* use fancy news ? */
  153.     PRPackedBool          intrupt;   /* the user just interrupted things */
  154.     PRPackedBool          graphProgress; /* should the user get visual feedback */
  155.     PRPackedBool          waitingMode;  /* Has a transfer been initiated?  Once a */
  156.                  /* transfer is started, the user cannot select another */
  157.                  /* anchor until either the transfer is aborted, has */
  158.                  /* started to layout, or has been recognized as a */
  159.                  /* separate document handled through an external stream/viewer */
  160.     PRPackedBool          reSize;   /* the user wants to resize the window once the */
  161.                  /* current transfer is over */
  162.     int          fileSort;  /* file sorting method */
  163.     char       * save_as_name;    /* name to save current file as */
  164.     char       * title;        /* title (if supplied) of current document */
  165.     Bool       is_grid_cell;    /* Is this a grid cell */
  166.     struct MWContext_ *grid_parent;    /* pointer to parent of grid cell */
  167.     XP_List *     grid_children;    /* grid children of this context */
  168.     int      convertPixX;    /* convert from pixels to fe-specific coords */
  169.     int      convertPixY;    /* convert from pixels to fe-specific coords */
  170.     ContextFuncs * funcs;       /* function table of display routines */
  171.     PrintSetup    *prSetup;    /* Info about print job */
  172.     PrintInfo    *prInfo;    /* State information for printing process */
  173.  
  174.     /* XXXM12N Stuff for the new, modular Image Library. *********************/
  175.     IL_GroupContext *img_cx;    /* Created by Front Ends.  Passed into Image
  176.                                    Library function calls.  */
  177.     IL_ColorSpace *color_space;  /* Colorspace information for images.  This
  178.                                     should become a part of the FE's display
  179.                                     context when MWContext goes away. */
  180.     IL_IRGB *transparent_pixel; /* Background color to be passed into
  181.                                    IL_GetImage.  Set by Front Ends (?) */
  182.     /*************************************************************************/
  183.  
  184.     int32        images;            /* # of distinct images on this page */
  185.  
  186.     /* ! do not use these !  */
  187.     /* ! these are going away soon ! */
  188.     /* instead see intl_csi.h for the i18n accessor functions */
  189.     int16        do_not_use_win_csid;    /* code set ID of current window    */
  190.     int16        do_not_use_doc_csid;    /* code set ID of current document    */
  191.     int16        do_not_use_relayout;    /* tell conversion to treat relayout case */
  192.     char        *do_not_use_mime_charset;    /* MIME charset from URL            */
  193.  
  194.     struct MSG_CompositionFrame *msg_cframe; /* ditto. */
  195.     struct MSG_SearchFrame *msg_searchFrame; /*state for search, for search contexts*/
  196.     struct MSG_BiffFrame *biff_frame; /* Biff info for this context, if any. */
  197.     struct BM_Frame *bmframe; /* Bookmarks info for this context, if any. */
  198.     
  199.     /* for now, add IMAP mail stuff here */
  200. #ifdef XP_CPLUSPLUS
  201.     class MSG_IMAPFolderInfoMail  *currentIMAPfolder;
  202.     class MSG_Pane                  *imapURLPane;        /* used when updated folders */
  203.     class MSG_Master              *mailMaster;
  204.     class TNavigatorImapConnection   *imapConnection; 
  205. #else
  206.     struct MSG_IMAPFolderInfoMail *currentIMAPfolder;
  207.     struct MSG_Pane                  *imapURLPane;        /* used when updated folders */
  208.     struct MSG_Master               *mailMaster;
  209.     struct TNavigatorImapConnection *imapConnection; 
  210. #endif    
  211.  
  212.     /* for now, add message copy info stuff here */
  213.     struct MessageCopyInfo          *msgCopyInfo;
  214.  
  215.     NPEmbeddedApp *pluginList;    /* plugins on this page */
  216.     void *pluginReconnect; /* yet another full screen hack */
  217.  
  218.     struct MimeDisplayData *mime_data;    /* opaque data used by MIME message
  219.                                            parser (not Mail/News specific,
  220.                                            since MIME objects can show up
  221.                                            in Browser windows too.) */
  222.                                         /* Also overloaded by progress module to hold private crap! */
  223.  
  224. #ifdef MOCHA
  225.     struct JSContext *mocha_context;    /* opaque handle to Mocha state */
  226.     uint32  event_bit;            /* sum of all event capturing objects */
  227.     XP_Bool js_drag_enabled;        /* indicates JS drag enabled */
  228.     int8 js_dragging;            /* indicates which button has JS drag in process */
  229.     XP_List * js_dependent_list;    /* lifetime-linked children of this context */
  230.     MWContext *js_parent;
  231.     int32 js_timeouts_pending;          /* Number of pending JavaScript timeouts */
  232.  
  233. #endif
  234.     XP_Bool restricted_target;            /* TRUE if window is off-limits for opening links into 
  235.                         from mail or other window-grabbing functions.*/
  236.  
  237.     NPEmbeddedApp *pEmbeddedApp; /* yet another full screen hack */
  238.     char * defaultStatus;        /* What string to show in the status area
  239.                                    whenever there's nothing better to show.
  240.                                    FE's should implement FE_Progress so that
  241.                                    if it is passed NULL or "" it will instead
  242.                                    display this string.  libmsg changes this
  243.                                    string all the time for mail and news
  244.                                    contexts. */
  245. #ifdef LAYERS
  246.     CL_Compositor *compositor;  /* The compositor associated with this context */
  247.     XP_Bool blink_hidden;       /* State of blink layers */
  248.     void *blink_timeout;        /* Timeout used for blink hiding/unhiding */
  249. #endif /* LAYERS */
  250.  
  251.     int32      doc_id;            /* unique identifier for generated documents */
  252.     int32      context_id;            /* unique identifier for context */
  253.  
  254.       void       *pHelpInfo;        /* pointer to additional help information;
  255.                                      see ns/lib/libnet/mkhelp.c [EA] */
  256.     
  257. #ifdef JAVA
  258.     /* See ns/sun-java/netscape/net/netStubs.c for the next 2 items: */
  259.  
  260.     /*
  261.     ** This mysterious list is used in two ways: (1) If you're a real
  262.     ** window context, it's a list of all dummy java contexts that were
  263.     ** created for java's network connections. (2) If you're a dummy java
  264.     ** context, it's where you're linked into the list of connections for
  265.     ** the real context:
  266.     */
  267.     PRCList        javaContexts;
  268.  
  269.     /*
  270.     ** Second, if you're a dummy java context, you'll need a pointer to
  271.     ** the stream data so that you can shut down the netlib connection:
  272.     */
  273.     struct nsn_JavaStreamData*    javaContextStreamData;
  274.  
  275.     /*
  276.     ** Stuff for GraphProgress. See lj_embed.c
  277.     */
  278.     Bool        displayingMeteors;
  279.     int64        timeOfFirstMeteorShower;
  280.     int16        numberOfSimultaneousShowers;
  281.  
  282. #endif /* JAVA */
  283.  
  284.     /*
  285.     ** Put the editor stuff at the end so that people can still use the
  286.     ** the Java DLL from the 2.0 dist build with Navigator Gold.
  287.     */
  288.     PRPackedBool is_editor;       /* differentiates between Editor and Browser modes */
  289.     PRPackedBool is_new_document; /* quick access to new doc state (unsaved-no file yet)*/
  290.     PRPackedBool display_paragraph_marks; /* True if we should display paragraph and hard-return symbols. */
  291.     PRPackedBool display_table_borders; /* True if we should display dotted lines around tables with invisible borders. */
  292.     PRPackedBool edit_view_source_hack;
  293.     PRPackedBool edit_loading_url;  /* Hack to let us run the net while in a modal dialog */
  294.     PRPackedBool edit_saving_url;   /*  " */
  295.     PRPackedBool edit_has_backup;   /* Editor has made a session backup */
  296.     PRPackedBool bIsComposeWindow;  /* Editor is a compose window */
  297.  
  298.     /*
  299.      * Webfonts that were loaded by this context
  300.      */
  301.     void *webfontsList;
  302.  
  303.     /* web font stuff */
  304.     /* On Windows,  they are initialized to 0 in cxdc.cpp    */
  305.     int16        WebFontDownLoadCount;    /* # of download for this doc( one download can have multiple fonts) */
  306.     int16        MissedFontFace;            /* have we missed any font? */
  307.  
  308.     /*  number of pixels per point-size */
  309.     double      XpixelsPerPoint;
  310.     double        YpixelsPerPoint;
  311.     
  312.     Bool bJavaScriptCalling;
  313.     /* Allow JavaScript in certain internally generated contexts even
  314.      * when the "enable javascript" pref is turned off.
  315.      * This flag will also be inherited by child grid cells.
  316.      */
  317.     PRPackedBool forceJSEnabled;
  318.  
  319.     /* For increase and decrease font */
  320.     double        fontScalingPercentage;
  321.  
  322.     int INTL_tag;     /* used to tell that we have a valid INTL_CSIInfo */
  323.     INTL_CharSetInfo INTL_CSIInfo; /* new home of private i18n data */
  324.  
  325.     /* the current tab focused data */
  326.     LO_TabFocusData *tab_focus_data;
  327.  
  328.     void *ncast_channel_context;
  329. };
  330.  
  331.  
  332. /* This tells libmime.a whether it has the mime_data slot in MWContext
  333.    (which should always be true eventually, but having this #define here
  334.    makes life easier for me today.)  -- jwz */
  335. #define HAVE_MIME_DATA_SLOT
  336.  
  337.  
  338. /* this is avialible even in non GOLD builds. */
  339. #define EDT_IS_EDITOR(context)       (context != NULL && context->is_editor)
  340. #define EDT_DISPLAY_PARAGRAPH_MARKS(context) (context && context->is_editor && context->display_paragraph_marks)
  341. #define EDT_DISPLAY_TABLE_BORDERS(context) (context && context->is_editor && context->display_table_borders)
  342. #define EDT_RELAYOUT_FLAG (0x2)
  343. #define EDT_IN_RELAYOUT(context)       (context != NULL && ((context->is_editor & EDT_RELAYOUT_FLAG) != 0))
  344.  
  345. #ifdef JAVA
  346.  
  347. /*
  348. ** This macro is used to recover the MWContext* from the javaContexts
  349. ** list pointer:
  350. */
  351. #define MWCONTEXT_PTR(context) \
  352.     ((MWContext*) ((char*) (context) - offsetof(MWContext,javaContexts)))
  353.  
  354. #endif /* JAVA */
  355.  
  356. /* ------------------------------------------------------------------------ */
  357. /* ====================== NASTY UGLY SHORT TERM HACKS ===================== */
  358.  
  359. #define XP_CONTEXTID(ctxt)        ((ctxt)->context_id)
  360. #define XP_DOCID(ctxt)            ((ctxt)->doc_id)
  361. #define XP_SET_DOCID(ctxt, id)    ((ctxt)->doc_id = (id))
  362.  
  363. /* ------------------------------------------------------------------------ */
  364. /* ============= Typedefs for the parser module structures ================ */
  365.  
  366. /*
  367.  * I *think* (but am unsure) that these should be forked off into a
  368.  *   parser specific client level include file
  369.  *
  370.  */
  371.  
  372. typedef int8 TagType;
  373.  
  374. struct PA_Tag_struct {
  375.     TagType type;
  376.     PRPackedBool is_end;
  377.     uint16 newline_count;
  378. #if defined(XP_WIN) || defined(XP_OS2)
  379.     union {                 /* use an anonymous union for debugging purposes*/
  380.         PA_Block data;
  381.         char* data_str;
  382.     };
  383. #else
  384.     PA_Block data;
  385. #endif
  386.     int32 data_len;
  387.     int32 true_len;
  388.     void *lo_data;
  389.     struct PA_Tag_struct *next;
  390.     ED_Element *edit_element;
  391. };
  392.  
  393. #define PA_HAS_PDATA( tag ) (tag->pVoid != 0 )
  394.  
  395. #ifdef XP_UNIX
  396. typedef    char *PAAllocate (intn byte_cnt);
  397. typedef    void  PAFree (char *ptr);
  398. #else
  399. typedef    void *PAAllocate (unsigned int byte_cnt);
  400. typedef    void  PAFree (void *ptr);
  401. #endif
  402. typedef    intn  PA_OutputFunction (void *data_object, PA_Tag *tags, intn status);
  403.  
  404. struct _PA_Functions {
  405.     PAAllocate  *mem_allocate;
  406.     PAFree      *mem_free;
  407.     PA_OutputFunction   *PA_ParsedTag;
  408. };
  409.  
  410. typedef struct PA_InitData_struct {
  411.     PA_OutputFunction   *output_func;
  412. } PA_InitData;
  413.  
  414. /* Structure that defines the characteristics of a new window.
  415.  * Each entry should be structured so that 0 should be the
  416.  * default normal value.  Currently all 0 values
  417.  * bring up a chromeless MWContextBrowser type window of
  418.  * arbitrary size.
  419.  */
  420. struct _Chrome {
  421.     MWContextType type;            /* Must be set to the correct type you want,
  422.                                  * if doesn't exist, define one!!!
  423.                                  */
  424.     Bool show_button_bar;        /* TRUE to display button bar */
  425.     Bool show_url_bar;           /* TRUE to show URL entry area */
  426.      Bool show_directory_buttons; /* TRUE to show directory buttons */
  427.     Bool show_bottom_status_bar; /* TRUE to show bottom status bar */
  428.     Bool show_menu;                 /* TRUE to show menu bar */
  429.     Bool show_security_bar;         /* TRUE to show security bar */
  430.     Bool hide_title_bar;         /* TRUE to hide title bar and window controls */
  431.     int32 w_hint, h_hint;         /* hints for width and height */
  432.     int32 outw_hint, outh_hint;     /* hints for outer window width and height */
  433.     int32 l_hint, t_hint;         /* hints for left and top window positioning */
  434.     Bool topmost;                 /* TRUE for window alwaysOnTop */
  435.     Bool bottommost;             /* TRUE for 'desktop' window */
  436.     Bool z_lock;                 /* TRUE for window which cannot move within z-order */
  437.     Bool is_modal;                 /* TRUE to make window be modal */
  438.     Bool show_scrollbar;         /* TRUE to show scrollbars on window */
  439.     Bool location_is_chrome;     /* TRUE if top or left is specified */
  440.     Bool allow_resize;             /* TRUE to allow resize of windows */
  441.     Bool allow_close;             /* TRUE to allow window to be closed */
  442.     Bool copy_history;             /* TRUE to copy history of prototype context*/
  443.     Bool dependent;                 /* TRUE if this window is to be closed with its parent*/
  444.     Bool disable_commands;            /* TRUE if user has set hot-keys / menus off */
  445.     Bool restricted_target;            /* TRUE if window is off-limits for opening links into 
  446.                             from mail or other window-grabbing functions.*/
  447.     void (* close_callback)(void *close_arg); /* called on window close */
  448.     void *close_arg;             /* passed to close_callback */
  449. };
  450.  
  451.  
  452. #endif /* _STRUCTS_H_ */
  453.  
  454.  
  455.  
  456.  
  457.  
  458.