#ifndef ANTENNA_H
#define ANTENNA_H

#ifdef ANTENNA_ALLOCATE
#define EXTERN
#else
#define EXTERN extern
#endif

#define AZ  1
#define EL  2

#define SEL_NONE 0
#define SEL_INC 1
#define SEL_DEC 2
#define SEL_DRAG 3

struct ShapeDef
{  
  XPoint pts[20];
  int    numofpts;
  int    isOutlined;
  GC     gcOutline;
  int    isFilled;
  GC     gcFill;  
  double angle;
  double xScale;
  double yScale;
  int    radiusCenterOffset;
};

struct DrawDef
{ 
  int    type;
  struct ShapeDef selector;
  struct ShapeDef pointer;
  struct ShapeDef pedpointer;
  struct ShapeDef headpointer;
  int    xCenter;
  int    yCenter;
  double incAngle;
  int    moveType;
  int    sunRadius;
  double sunErrVal;
  double sunPos;
  Window win;
  Pixmap drawBuffer;
  Pixmap dial;
  unsigned int width;
  unsigned int height;
};


struct AntInfo
{
  int     mode;
  int     isStopped;
  float   fpos;
  float   fposCur;
  float   fposMin;
  float   fposMax;
  float   fvel;
  float   fvelCur;
  int     velMin;
  int     velMax;
  double  fsunErrMax;
  struct  DrawDef posDrawDef;
};


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

/****************************************
** Globlal User Created Variables
** Set these variables in antenna.C
****************************************/
EXTERN Display      *mainDisplay;
EXTERN int          mainScreen;
EXTERN XtAppContext appContext;

/****************************************
** Global UIL Created Functions
******************************************/
Widget CreateantMainWinWgt(Widget parent);


EXTERN struct AntInfo az, el;

EXTERN UINT2  lRotateELPast95Deg;
EXTERN UINT2  lSunTrkMode;
EXTERN UINT2  lShowStablePlatformParams;
EXTERN SINT4  siggenMin_c;
EXTERN SINT4  siggenMax_c;
EXTERN SINT4  siggenCur_c;
EXTERN SINT4  siggenRqst_c;
EXTERN UINT4  antCmdVal_c;
EXTERN UINT4  antStatVal_c;
EXTERN UINT4  antStatCritVal_c;

EXTERN GC  gcSolidRed, gcSolidGreen, gcSolidBlack;
EXTERN GC  gcGreen2, gcGreen4, gcGreen6;
EXTERN GC  gcSolidYellow, gcErase, gcFont;

EXTERN Pixmap lampRedPm, lampGrnPm;

EXTERN Window trpwr_win, rad_win, servpwr_win;
EXTERN Window azstopda_win, elstopda_win;

EXTERN struct dsp_siggen_cal    siggencal_c;
EXTERN struct dsp_manual_setup  dspsetup_c;


/* inform */
void createInformMenu(Widget parent_wgt_a);
void popupInformMenu(void);
void popdownInformMenu(void);

class IoSummary
{
  private:
  public:
    void create(Widget parent_wgt_a);
    void popup(void);
    void popdown(void);
    void update(double fage, int in_cnt, int iout_cnt, int iout_err);

};
EXTERN IoSummary ioSummary;

class TimeSet 
{
  private:
  public:
    void create(Widget parent_wgt_a);
    void popup(void);
    void popdown(void);
    void update(void);
};
EXTERN TimeSet timeSet;



void get_time(SINT4* piyear_a, SINT4* piday_a, SINT4* pisecond_a);
void initInfo(void);
void pwrUpAnt(void);

void azPosRqstOutput(FLT4 angle);
void elPosRqstOutput(FLT4 angle);
void initInfo(void);
void initAzElDrawStuff(void);
void initAzElPosVelStuff(void);

#undef EXTERN
#endif

