/* ===========================================================================

  IRISNET.H    Global variables and functions for IRISNET 

=============================================================================*/
#ifndef IRISNET_H
#define IRISNET_H

#ifdef IRISNET_ALLOCATE
#define EXTERN
#else
#define EXTERN extern
#endif

/*****************************************
** Global Legacy Variables
** Set these variables in irisNet.C
****************************************/
EXTERN Widget       UxTopLevel;
EXTERN Display      *UxDisplay;
EXTERN int          UxScreen;
EXTERN XtAppContext UxAppContext;

/****************************************
** Globlal User Created Variables
** Set these variables in irisNet.C
****************************************/
EXTERN Display      *applDisplay;
EXTERN int          applScreen;
EXTERN XtAppContext appContext;


////////////////////////////////////////////
// Uncomment for printf
////////////////////////////////////
//#define DEBUG

// defines
#define RES_CONVERT( res_name, res_value) \
        XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1

// Classes
struct SiteInfo
{
    int       alloced;
    int       type;
    int       x; 
    int       y;
    char      alias[50];
    char      hostname[50];
    char      display[50];
    int       status;
    int       curTools[MAX_NUM_SITE_TOOLS];  // These are utils setup, qiris...
};

struct ConnectInfo
{
   int alloced;
   int startSiteNum;
   int startConnectEdge;
   int startX;   /* This is only for finding slope */
   int startY;   /* This is only for finding slope */
   int stopSiteNum;
   int stopConnectEdge;
   int stopX;   /* This is only for finding slope */
   int stopY;   /* This is only for finding slope */
};


struct IrisNet
{
   char   checkFileFormat[100]; 
   int    width;
   int    height;
   struct SiteInfo  site[TOTAL_SITES_PLUS_EXTRA]; /* sites + iris and manuals */
   struct ConnectInfo connectSite[TOTAL_CONNECTS];
   int    curNumPollProcess;
   int    curTimeBetweenUpdate; //seconds
   char   bgFilename[20];                       // Background filename 
};
EXTERN struct IrisNet irisNet;
EXTERN char   irisVersion[TOTAL_SITES][50];
EXTERN FLT4   fIrisVersion[TOTAL_SITES];
EXTERN FLT4   fHighestIrisVersion;
EXTERN UINT2  lShowIrisVersion;


class IrisNetWindow
{
   private :
      char      thisHostname[50];
      Pixel     toolsTopShadow;
      Pixel     toolsBottomShadow;
   public  :
                IrisNetWindow();
      int       iSavePopup;
      int       toolType;
      Position  toolBarX;
      Position  toolBarY;
      void      init(void);
      char      *getThisHostname(void);
      Widget   getIrisNetDA_wgt(void);
      void      updateToolsPB(void);
};
EXTERN IrisNetWindow irisNetWindow;

class SiteName
{
   private :
   public  :
      void create(Widget parent);
      void popup(void);
      void popupSelected(int isite_selected_a);
      void popdown(void);
};
EXTERN SiteName siteName;

class SiteTools
{
   private :
   public  :
      void create(Widget parent);
      void popup(UINT4 isite_num_a, struct SiteInfo *site_info);
      void popdown();
};
EXTERN SiteTools siteTools;

class RmtCmdStat
{
   private :
   public  :
      void create(Widget parent);
      void popup(void);
      void popdown(void);
      void write(char *info);
};
EXTERN RmtCmdStat rmtCmdStat;

class DataTools
{
   private :
   public  :
      void create(Widget parent);
      void popup();
      void popdown();
};
EXTERN DataTools dataTools;

class Config 
{
   private :
   public  :
      void create(Widget parent);
      void popup();
      void popdown();
      int  getPendNumPollProcess();
      int  getPendTimeBetweenUpdate();
};
EXTERN Config config;

EXTERN Audio audio;

#undef EXTERN
#endif

