/* dialog to allow control of the AOI */
static void cropCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void resetCB (Widget w, XtPointer client, XtPointer call);
static void makeGC(void);
static Widget aoi_w;	/* main AIO dialog */
static Widget crop_w;	/* cropping on togglebutton */
static Widget aoix_w;	/* AIO X label */
static Widget aoiy_w;	/* AIO Y label */
static Widget aoiw_w;	/* AIO W label */
static Widget aoih_w;	/* AIO H label */
static Widget mean_w;
static Widget median_w;
static Widget sd_w;
static Widget min_w;
static Widget max_w;
static GC aoiGC;	/* GC to use to draw the AOI */
/* toggle whether the AOI dialog is up */
void
manageAOI ()
{
}

/* create the AOI dialog */
void
createAOI()
{
}

/* handle the operation of the AOI */
void
doAOI (ps, x, y)
PlotState ps;
int x, y;		/* image coords of cursor */
{
}

/* call this to draw an AOI at *aoip.
 * we save pixels underneath each time and can optionally restore them.
 */
void
drawAOI(restore, aoip)
Bool restore;
AOI *aoip;
{
}

/* update the displayed values for the aoi */
void
updateAOI()
{
}

/* set state.aoi to the initial desired size; 
 * unless the image is already cropped (as evidenced by the
 * existance of CROPX/CROPY FITS fields) we set it a little
 * in from the outside because all CCDs have some sort of
 * support somewhere that masks the images.
 */
void
resetAOI()
{
}

void
resetCrop()
{
}

/* called when the crop toggle button changes state.
 */
/* ARGSUSED */
static void
cropCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close push button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the reset push button is activated.
 */
/* ARGSUSED */
static void
resetCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

static void
makeGC()
{
}

/* code handle blinking */
extern Widget toplevel_w;
extern char myclass[];
Widget blinkload1_w;			/* menu bar load1 widget */
Widget blinkload2_w;			/* menu bar load2 widget */
Widget blinkload12_w;			/* menu bar load12 widget */
Widget blinkgo_w;			/* menu bar go widget */
static Widget blink_w;			/* main form dialog */
static Widget blink_da_w;		/* drawing area */
static Widget blinklabel_w;		/* label for which image is in window */
static Pixmap pm1, pm2;			/* the two pixmaps */
static Pixmap bpm;			/* pm1 or pm2 to show */
static int pmw, pmh;			/* size of pixmap */
static int blinkmag;			/* mag factor of image 1 */
static double bRA, bDec;		/* ul corner of AOI on first image */
static int blinking;			/* 0 when off, 1 when running */
static char pm1label[MAXLAB], pm2label[MAXLAB];	/* labels for each blink */
static void blink_to (XtPointer client, XtIntervalId *idp);
static int loadImage1(void);
static int loadImage2(void);
static void loadImage12(void);
static void createBlinkw (void);
static void blinkExpCB (Widget w, XtPointer client, XtPointer call);
static void loadBPM(void);
static void defineBlinkLabel(char *str);
static int findReferenceImage (char *reffile, char *obj, double *era,
    double *ndec, double *wra, double *sdec, char *fn);
static int forceAOI (int x, int y, int w, int h);
static int setRADecAOI (double era, double ndec, double wra, double sdec);
static int getRefFile (char **reffile);
/* called when asked to load one of the two blink images into fresh bitmaps.
 * client will be 1 to load first image, 2 to load the second image, 3 to
 * load 1 with reference and 2 with current.
 */
/* ARGSUSED */
void
blinkLoadCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when asked to start or stop blinking.
 */
/* ARGSUSED */
void
blinkGoCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* blink timeout -- display the other pixmap and repeat if running */
static void
blink_to (client, idp)
XtPointer client;
XtIntervalId *idp;
{
}

/* first one is loaded with pixels inside AOI. */
static int
loadImage1()
{
}

/* second one is loaded from pixels in that same AOI. */
static int
loadImage2()
{
}

/* load both 1 and 2:
 *   find reference image for current object -- set AOI from it and load to 1;
 *   reload current image and load it to 2.
 */
static void
loadImage12()
{
}

static int
getRefFile (char **reffile)
{
}

static int
setRADecAOI (double era, double ndec, double wra, double sdec)
{
}

/* create a new dialog with a DrawingArea the size of pmw, pmh.
 * save it in blink_w.
 */
static void
createBlinkw ()
{
}

/* blink DA expose.
 * fill from current pixmap.
 */
static void
blinkExpCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* set state.aoi to the region bounded by x/y/w/h with in fip->sw/h then
 * update the screen with all new pixels and data.
 * insure w and height are at least 1
 */
static int
forceAOI (int x, int y, int w, int h)
{
}

/* look up obj in reffile. if find it return bounding box and its filename.
 */
static int
findReferenceImage (
char *reffile,	/* full path of reference file */
char *obj,	/* object name */
double *era, double *ndec, double *wra, double *sdec,
char *fn)
{
}

/* load bpm into blink_da_w */
static void
loadBPM()
{
}

/* define what we as the label for the current image */
static void
defineBlinkLabel(str)
char *str;
{
}

/* code to operate the hpc camera.
 * change this module to use a different camera.
 *
 * provide the following entry points:
 *  camCreate()	create the camera setup dialog, but don't manage it. This is
 *		guaranteed to be called before any other cam* entry point.
 *		use it to set up defaults from X resource specifications.
 *  camManage()	manage the camera setup dialog.
 *  camTake1()	takes one image, using the current camera setup
 *  camLoop()	takes images continuously.
 *  camCancel()	cancel all current camera activity.
 *  startBias (char *fn, int n)				take bias calibration
 *  startThermal (char *tfn, char *bfn, int n,double d)	take thermal cal.
 *  startFlat (char *fn, char filter, double d)		take flat cal.
 *
 * use msg() to talk to the operator.
 */
/* info needed when we get pixels from the camera.
 * we save all that we need to take simple exposures, or make bias, thermal
 * and flat reference images. some fields are no used for each exposure use.
 */
typedef enum {} ExpState;

typedef struct {} ExpInfo;

static ExpInfo expinfo;
static void shutterCB (Widget w, XtPointer client, XtPointer call);
static void coolerCB (Widget w, XtPointer client, XtPointer call);
static void goalCB (Widget w, XtPointer client, XtPointer call);
static void countTO (XtPointer client, XtIntervalId *idp);
static void coolerReadCB (Widget w, XtPointer client, XtPointer call);
static void showCoolerTemp(void);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void nextBias (void);
static void nextTherm (void);
static void nextFlat (void);
static void resetExpInfo(void);
static void fpmem2mem(void);
static void gatherExpParams (void);
static Widget cam_w;	/* main camera setup dialog */
static Widget dur_w;	/* duration text field widget */
static Widget sx_w;	/* subimage x text field widget */
static Widget sy_w;	/* subimage y text field widget */
static Widget sw_w;	/* subimage w text field widget */
static Widget sh_w;	/* subimage h text field widget */
static Widget bx_w;	/* binning x text field widget */
static Widget by_w;	/* binning y text field widget */
static Widget shutterO_w;/* shutter Open toggle button */
static Widget shutterC_w;/* shutter Closed toggle button */
static Widget cooler_w;	/* label to display cooler temp */
static Widget coolgoal_w;/* cooler goal temp TF */
static Widget con_w;	/* cooler on TB */
static char cam_id[64];	/* camera id string */
/* fairly generic camera control function interfaces */
static void startExpose(ExpState state, char *fn, int makefpmem, int ntot);
static int getCameraID(char *buf);
static void setCoolerTemp(int temp);
static int getCoolerTemp(int *temp);
void
camManage()
{
}

void
camTake1()
{
}

void
camLoop()
{
}

void
camCancel()
{
}

void
camCreate()
{
}

/* called when either of the shutter toggle buttons values changes.
 * client is 1 if this is the Open button, 0 if it's the Close button.
 */
/* ARGSUSED */
static void
shutterCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the cooler state tb changes state.  */
/* ARGSUSED */
static void
coolerCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when RETURN is hit on the goal TF */
/* ARGSUSED */
static void
goalCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when we want a fresh reading of the cooler temp */
/* ARGSUSED */
static void
coolerReadCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

static void
showCoolerTemp()
{
}

/* called when the close button is activated.  */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* count-down timer callback */
/* ARGSUSED */
static void
countTO (client, idp)
XtPointer client;
XtIntervalId *idp;
{
}

/* follows are generic camera control wrapper functions. 
 * these try to be the place where the camera driver meets the X interface.
 */
/* we only open the camera when we absolutely need it. */
static int ccd_fd = -1;	/* cam file descriptor; -1 when not in use */
static CCDExpoParams expP;
static void nextFlat (void);
static int makeFPAccum (void);
static int fileQual (char *fn, int (*qfp)(), char *type);
static void camInputCB (XtPointer client, int *fdp, XtInputId *idp);
static void nextExpose (void);
static void cont_pause(void);
static void saveFImage (void);
static void correctBias(void);
static void correctThermal(void);
static void makeFilename (char *fn);
static int setExpCharacteristics (void);
static int readPixels (void);
static void setFImage (void);
static int openCCD (char *errmsg);
static void closeCCD (void);
/* start taking the first bias frame and save it with the given name and make
 * it the current image. actually we take n of them and average them.
 */
void
startBias (bfn, n)
char *bfn;
int n;
{
}

/* called when fresh pixels have been read and we are working on a bias frame.
 * what we do depends on expinfo.
 * N.B always call setFImage() either for the latest or the final image.
 */
static void
nextBias ()
{
}

/* create a thermal frame with the given file name and make it the current
 *   image. we subtract off the given bias frame as well.
 * actually we take n of them, each d seconds long, and average them.
 */
void
startThermal (tfn, bfn, n, d)
char *tfn;
char *bfn;
int n;
double d;
{
}

/* called when fresh pixels have been read and we are working on a therm frame.
 * what we do depends on expinfo.
 * N.B always call setFImage() either for the latest or the final image.
 */
static void
nextTherm ()
{
}

/* create a flat frame with the given file name and make it the current
 *   image.
 * actually we take n of them, each d seconds long, and average them and 
 *   correct them with the named biad and thermal files.
 */
void
startFlat (ffn, tfn, bfn, filter, n, d)
char *ffn;	/* name of thermal file to create */
char *tfn;	/* name of thermal to use */
char *bfn;	/* name of bias to use */
int filter;	/* really a char but prototype doesn't work :-Z */
int n;		/* number of images to take */
double d;	/* duration of each, seconds */
{
}

/* called when fresh pixels have been read and we are working on a flat frame.
 * what we do depends on expinfo.
 * N.B always call setFImage().
 */
static void
nextFlat ()
{
}

/* copy expinfo.fpmem to expinfo.mem, taking care of under and overflow
 */
static void
fpmem2mem()
{
}

static void
resetExpInfo()
{
}

/* using qfp, see if fn can be used to correct the format described in expP.
 * if not give msg and return -1, else 0 if ok.
 */
static int
fileQual (fn, qfp, type)
char *fn;	/* file to check */
int (*qfp)();	/* qualifier function to use */
char *type;	/* name of goal, for error report */
{}

/* malloc and init the expinfo.fpmem accumulator.
 * return 0 if ok, else msg() and -1.
 */
static int
makeFPAccum()
{
}

/* start an exposure according to the current widget settings and expinfo.
 * arrange for camInputCB to be called when the pixels are ready on ccd_fd.
 * we return void but we still use msg() if error and always reset everything.
 */
static void
startExpose (state, fn, makefpmem, ntot)
ExpState state;
char *fn;
int makefpmem;
int ntot;
{
}

/* called when pixels are ready on ccd_fd.
 * what we do depends on expinfo.
 */
/* ARGSUSED */
static void
camInputCB (client, fdp, idp)
XtPointer client;
int *fdp;		/* pointer to file descriptor */
XtInputId *idp;		/* pointer to what AddInput returned */
{
}

/* allow some X events between continuous exposes */
static void
cont_pause()
{
}

/* issue the read on ccd_fd to start the actual exposure
 * we don't return anything but we use msg() and resetExpInfo() if we fail.
 */
static void
nextExpose()
{
}

/* save state.fimage to disk as expinfo.newfn */
static void
saveFImage ()
{
}

/* correct expinfo.fpmem for bias named in expinfo.biasfn.
 */
static void
correctBias()
{
}

/* correct expinfo.fpmem (assumed to be flat) for the thermal named in
 * expinfo.thermfn.
 */
static void
correctThermal()
{
}

/* fill in expinfo.fn with file name.
 * use fn else make one up; how about the current UTC just like telsched :-)
 */
static void
makeFilename (fn)
char *fn;
{
}

/* get the exposure params from the X widgets into expP. */
static void
gatherExpParams()
{
}

/* send expP to the driver.
 * return 0 if ok else tell user via msg() and return -1.
 */
static int
setExpCharacteristics()
{
}

/* read the pixels from ccd_fd as per expinfo.
 * return 0 if else use msg() and return -1.
 */
static int
readPixels()
{
}

/* reset state.fimage and fill in from expinfo.mem and expP.
 */
static void
setFImage()
{
}

/* fetch the camera id string */
static int
getCameraID(char buf[])
{
}

/* set cooler temp; >= 0 means turn cooler off */
static void
setCoolerTemp(temp)
int temp;
{
}

/* fetch cooler temp, C.
 * return 0 if ok, else -1.
 */
static int
getCoolerTemp(int *temp)
{
}


/* follows are the basic CCD camera control operations */
static char ccd_fn[] = "/dev/telescope/ccdcamera";
static int ccd_nopens;	/* openCCD and closeCCD can be nested */
/* open the CCD camera with O_NONBLOCK and set ccd_fccd_fd.
 * return 0 if ok, else fill errmsg[] with a errmsg and return -1.
 */
static int
openCCD(errmsg)
char *errmsg;
{
}

static void
closeCCD()
{
}

/* dialog to take and control applying bias/thermal/flat corrections.
 */
extern char *basename (char *full);
static Widget createSep (Widget top);
static Widget createApply(void);
static Widget createDir(Widget top);
static Widget createBias (Widget top);
static Widget createTherm (Widget top);
static Widget createFlat (Widget top);
static Widget createFileControls (Widget top, void (*takeCB)(),
    Widget *newFN_wp, void (*scanNewCB)(), Widget *FN_wp, void
    (*scanLastCB)(), Widget *auto_wp);
static void createClose (Widget top);
static void scanDirCB (Widget w, XtPointer client, XtPointer call);
static void takeBiasCB (Widget w, XtPointer client, XtPointer call);
static void scanNewBiasCB (Widget w, XtPointer client, XtPointer call);
static void scanLastBiasCB (Widget w, XtPointer client, XtPointer call);
static void takeThermCB (Widget w, XtPointer client, XtPointer call);
static void scanNewThermCB (Widget w, XtPointer client, XtPointer call);
static void scanLastThermCB (Widget w, XtPointer client, XtPointer call);
static void takeFlatCB (Widget w, XtPointer client, XtPointer call);
static void scanNewFlatCB (Widget w, XtPointer client, XtPointer call);
static void scanLastFlatCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void scanAllFiles(void);
static void getFilename (char fn[], Widget w);
static void getString (char s[], Widget w);
static int getInt (Widget w);
static double getReal (Widget w);
static Widget apply_w;		/* whether to automatically apply corrections */
static Widget dirFN_w;		/* directory for all files */
static Widget biasFN_w;		/* current bias file to use */
static Widget newBiasFN_w;	/* new bias file to create */
static Widget newBiasN_w;	/* number of bias frames to average */
static Widget autoBias_w;	/* True when automatically choose bias name */
static Widget thermFN_w;	/* current therm file to use */
static Widget newThermFN_w;	/* new thermal file to create */
static Widget newThermN_w;	/* number of thermal frames to average */
static Widget newThermD_w;	/* duration of each thermal frame */
static Widget autoTherm_w;	/* True when automatically choose therm name */
static Widget flatFN_w;		/* current flat file to use */
static Widget newFlatFN_w;	/* new flat file to create */
static Widget newFlatF_w;	/* filter type of new flat file */
static Widget newFlatD_w;	/* duration of each flat file */
static Widget newFlatN_w;	/* number of flats */
static Widget autoFlat_w;	/* True when automatically choose flat name */
static Widget corr_w;	/* main correction dialog */
void
manageCorr ()
{
}

void
createCorr()
{
}

/* if enabled, get the current correction filenames and apply them to the
 * current image
 */
void
applyCorr()
{
}

static Widget
createSep (top)
Widget top;
{
}

static Widget
createApply()
{
}

static Widget
createDir(top)
Widget top;
{
}

static Widget
createBias (top)
Widget top;
{
}

static Widget
createTherm (top)
Widget top;
{
}

static Widget
createFlat (top)
Widget top;
{
}

static Widget
createFileControls (top, takeCB, newFN_wp, scanNewCB, FN_wp, scanLastCB,auto_wp)
Widget top;		/* widget to attach to on top */
void (*takeCB)();	/* callback for the "Take new" button */
Widget *newFN_wp;	/* text field widget that holds new file name */
void (*scanNewCB)();	/* callback for the "scan" button for new file */
Widget *FN_wp;		/* text field widget that holds the current file name */
void (*scanLastCB)();	/* callback for the "auto" toggle button */
Widget *auto_wp;	/* toggle widget whose state reads true for auto */
{}

static void
createClose (top)
Widget top;
{
}

/* called when the take-bias button is activated
 */
/* ARGSUSED */
static void
takeBiasCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the take-thermal button is activated
 */
/* ARGSUSED */
static void
takeThermCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the take-flat button is activated
 */
/* ARGSUSED */
static void
takeFlatCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated or a CR is typed in the dir
 * filename text widget.
 */
/* ARGSUSED */
static void
scanDirCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated for the new bias file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanNewBiasCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated for the new thermal file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanNewThermCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated for the new flat file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanNewFlatCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan toggle button changes for the last bias file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanLastBiasCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated for the last thermal file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanLastThermCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the scan button is activated for the last flat file name */
/* N.B. we can get called manually -- DON'T USE ANY OF THE ARGS!!! */
/* ARGSUSED */
static void
scanLastFlatCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* scan and fill in all the filename fields.
 */
static void
scanAllFiles()
{
}

/* fill fn with string from text field widget fn.
 * if it does not begin with '/' we also prepend the string in dirFN_w.
 *   if dirFN_w does not end with '/', we add one before appending w.
 */
static void
getFilename (fn, w)
char fn[];
Widget w;
{}

static void
getString (s, w)
char s[];
Widget w;
{}

static int
getInt (w)
Widget w;
{
}

static double
getReal (w)
Widget w;
{
}

/* dialog to allow deleting the current image from disk */
static void createDel(void);
static int updateDel(void);
static void delCB (Widget w, XtPointer client, XtPointer call);
static Widget del_w;	/* main save dialog */
void
manageDel ()
{
}

static void
createDel()
{
}

/* put state.fname into messageString of del_w dialog.
 * return 0 if ok else -1.
 */
static int
updateDel()
{
}

/* called when the Ok button is activated.
 */
/* ARGSUSED */
static void
delCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* code to handle setting and using the desired display epoch */
static double epoch_mjd;		/* desired display epoch, as an mjd */
static double e2000;			/* handy mjd for 2000 */
static Widget epoch_w;			/* main dialog */
static void set_string(void);
static void okCB (Widget w, XtPointer client, XtPointer call);
void
manageEpoch ()
{
}

void
createEpoch()
{
}

/* return the current precession epoch as a year */
double
pE()
{
}

/* precess the given coordinates, which are epoch 2000, to the current
 * epoch, and return the new values IN PLACE.
 * both args are in radians.
 */
void
p2000toE (double *rap, double *decp)
{
}

/* set the prompt string to match epoch_mjd */
static void
set_string()
{
}

static void
okCB (Widget w, XtPointer client, XtPointer call)
{
}

/* code to display the FITS header of the current image.
 * and a place to capture additional COMMENTs by the user.
 */
static void createFITS(void);
static void addCommentsCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static Widget fits_w;	/* main FITS test dialog */
static Widget rotf_w;	/* the read-only text widget for existing header lines*/
static Widget rwtf_w;	/* the read-write text widget for new comments */
void
manageFITS ()
{
}

/* show the FITS header info for the current image
 * and reset the user comments.
 */
void
updateFITS()
{ }

static void
createFITS()
{
}

/* called when the Add button is activated.
 */
/* ARGSUSED */
static void
addCommentsCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* dialog and XImage code to implement the magnifying glass */
extern void gfit (int pix[], int n, double *maxp, double *cenp, double *fwhmp);
static void da_exp_cb (Widget w, XtPointer client, XtPointer call);
static void showpl_cb (Widget w, XtPointer client, XtPointer call);
static void makeGCs (Display *dsp, Window win);
static void makeGlassXImage (Display *dsp);
static void magCB (Widget w, XtPointer client, XtPointer call);
static void sizeCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void fillGlass (int wx, int wy, unsigned wid, unsigned hei);
static void glassStats (int ix, int iy, int w, int h);
static void displayStats (int mean, int median, int sd, int min, int max,
    int maxx, int maxy);
static void glassPlots (Display *dsp, int x, int y, int w, int h);
static void plot_gaussian (Drawable win, int ww, int wh, int rw, int rh,
    int minp, int maxp, int ix0, int iy0);
static int glassMag;	/* mag factor; 1 means no glass */
static int glassSize;	/* width and height of the glass area BEFORE mag */
static Widget glass_w;	/* the main glass form dialog */
static Widget mean_w;	/* mean pixel value in glass area */
static Widget median_w;	/* median pixel value in glass area */
static Widget sd_w;	/* sd in glass area */
static Widget min_w;	/* min pixel value in glass area */
static Widget max_w;	/* max pixel value in glass area */
static Widget maxat_w;	/* where max pixel in glass is */
static Widget da_w;	/* plot drawing area */
static Widget showpl_w;	/* whether to show plots TB */
static Widget snap_w;	/* snap-to-max TB */
static Widget gauss_w;	/* Gaussian fit overlay TB */
static XImage *glassXI;	/* glass XImage -- NULL means make a new one */
static GC glassGC;	/* GC for use drawing the glass */
static GC plotGC;	/* GC to use for misc stuff in plots */
static Pixel grid_p;	/* color to use for plotting grid */
static Pixel gauss_p;	/* color to use for plotting the gaussian */
/* toggle whether the Glass dialog is up */
void
manageGlass ()
{
}

/* create the Glass dialog */
void
createGlass()
{
}

/* handle the operation of the magnifying glass.
 * this is called whenever there is left button activity over the image.
 * TODO: when glassMag is 1, just do the outline and the plots.
 */
void
doGlass (dsp, win, ps, wx, wy, wid, hei)
Display *dsp;
Window win;
PlotState ps;
int wx, wy;		/* window coords of cursor */
unsigned wid, hei;	/* window size */
{
}

/* callback from the plot drawing area.
 * just erase it, since we don't store the last plot.
 * also, maintain a 2x1 aspect ratio.
 */
static void
da_exp_cb (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the Show plot TB changes state */
/* ARGSUSED */
static void
showpl_cb (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* make the GC to draw a border around the glass and get other colors.
 */
static void
makeGCs (dsp, win)
Display *dsp;
Window win;
{
}

/* called when one of the magnification toggle buttons changes state.
 * client is the new mag factor: 1, 2, or 4.
 */
/* ARGSUSED */
static void
magCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when one of the size toggle buttons changes state.
 * client is the new size: 32 or 64
 */
/* ARGSUSED */
static void
sizeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close push button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* make glassXI of size glassSize*glassMag.
 */
static void
makeGlassXImage (dsp)
Display *dsp;
{
}

/* fill glassXI with magnified view of ximagep */
static void
fillGlass (wx, wy, wid, hei)
int wx, wy;	/* window coords of glass center */
unsigned wid;	/* window width */
unsigned hei;	/* window height */
{
}

/* compute and display the stats of a wXh region of pixels centered at x/y */
static void
glassStats (x, y, w, h)
int x, y;		/* image coords of cursor center */
int w, h;		/* size of region, in image pixels */
{
}

static void
displayStats (mean, median, sd, min, max, maxx, maxy)
int mean, median, sd, min, max, maxx, maxy;
{
}

/* compute and display the cross-section plots in da_w.
 */
static void
glassPlots (dsp, x, y, w, h)
Display *dsp;
int x, y;		/* image coords of cursor center */
int w, h;		/* size of region, in image pixels */
{
}

/* plot the gaussion fit to the given row and col */
static void
plot_gaussian (win, ww, wh, rw, rh, minp, maxp, ix0, iy0)
Drawable win;	/* where too draw */
int ww, wh;	/* window width and height */
int rw, rh;	/* region width and height */
int minp, maxp;	/* drawing range, pixels */
int ix0, iy0;	/* image pixel used as center */
{
}

/* dialog to ask the desired GSC limiting magnitude */
double gsclimit;
double huntrad;
static Widget gsc_w;		/* overall Form Dialog */
static Widget hunt_w;		/* TF holding max hunt radius */
static Widget gsclimit_w;	/* TF holding path to cdrom mount point */
static Widget gsccdrompath_w;	/* TF holding path to cdrom mount point */
static Widget gsccachepath_w;	/* TF holding path to cache dir */
static void okCB (Widget w, XtPointer client, XtPointer call);
static void gscget (void);
static void gscset (void);
void
manageGSCLimit ()
{
}

/* create the widgets and set up the defaults from them.
 */
void
createGSCLimit()
{
}

static void
okCB (Widget w, XtPointer client, XtPointer call)
{
}

/* set the widgets to the current global values */
static void
gscset()
{
}

/* read the widgets to set the gsclimit and huntrad globals and call GSCSetup()
 * with the directories.
 */
static void
gscget()
{
}

/* code to perform the image processing operations */
/* fill in state.xpixels[] with an array of NXCOLS pixels from the desired lut
 * type. if luttype != UNDEF_LUT first XFreeColor the existing pixels.
 * exit if can't.
 * TODO: do better than exit.
 */
void
initXPixels(lt)
LutType lt;
{
}

/* fill in state.lut[] so it returns black pixels for indices at or below
 * state.lo, white for indeces at or above state.hi, and a linear grey-scale
 * ramp in between. state.xpixels[] is an array of NXCOLS from black to white.
 * if state.inverse, then it's just the opposite.
 */
void
setLut ()
{
}

 
/* compute state.stats
 * only tricky part is that we might want the stats _outside_ the aoi too!
 */
void
computeStats()
{
}

/* convert from image to window coords, IN PLACE */
void
image2window (xp, yp)
int *xp, *yp;
{
}

/* the luts */
/* to add one:
 *   add to LutType enum in luts.h
 *   update initXPixels() in ip.c
 *   add the array of LutDef here.
 *   add a selection in winhist.c
 */
LutDef heat_lut[LUTLN] = {};
LutDef rainbow_lut[LUTLN] = {};
LutDef standard_lut[LUTLN] = {};
/* dialog to allow selection of magnification */
static void mtbCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void FtoX1(void);
static void FtoX2(void);
static void FtoX4(void);
static void FtoX1_2(void);
static void FtoX1_4(void);
static void FtoXMagN(int n);
static void FtoXShrinkN(int n);
static Widget mag_w;	/* main magnification dialog */
void
manageMag ()
{
}

void
createMag()
{
}

/* given state.fimage and the aoi, crop, mag and lut info,
 *    fill in state.ximagep with the resulting scene.
 */
void
FtoXImage()
{
}

/* called when a magnification toggle button changes state.
 * client is the new mag value as a numerator over MAGDENOM.
 */
/* ARGSUSED */
static void
mtbCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

static void FtoX1()
{
}

static void FtoX2()
{
}

static void FtoX4()
{
}

static void FtoX1_2()
{
}

static void FtoX1_4()
{
}

/* magnify by simple pixel replication */
static void FtoXMagN (m)
int m;	/* mag factor */
{
}

/* simple pixel averaging */
static void FtoXShrinkN (s)
int s;	/* shrink factor */
{
}

/* main program for HPC camera program.
 * while the camera portion of this program is specific to the HPC camera,
 * the control menus and all the rest of the program is general purpose.
 * we maintain up to one image in memory. it can be displayed via an X
 * window after being processed in several ways. we can write the image to
 * disk in FITS format, or read the image from disk from a FITS format fike.
 */
static char title[] = "Camera V2.57";
/* history (got a late start at this :-(
 * 2.57	 5 Jun 97: use new generic camera .h and driver interfaces
 * 2.56	17 Jan 97: all new photometry algorithm
 *                 add x and y to rubber band tool
 * 2.55	14 Jan 97: relink to get setWCSFITS with fabs(cdelt1);
 *                 gauss report is now noise median + peak above that.
 * 2.54	25 Dec 96: fix mark ra/dec header when mag != 1:1
 * 2.53	22 Dec 96: add file history
 * 2.52 19 Dec 96: clear msg before each new image.
 * 2.51	17 Dec 96: added Mark RA/Dec option
 * 2.50 13 Dec 96: exit when out of mem; allow taking multiple flats too.
 * 2.49	11 Dec 96: add histo graph range option
 * 2.48  3 Dec 96: fewer stars needed for WCS fit; report mag and err to .001.
 * 2.47  5 Nov 96: add NOLISTEN build macro and switch to generic fifo.
 * 2.46 31 Oct 96: add comments to FLATMEAN and CRVAL1,2 FITS fields
 * 2.45 18 Sep 96: guard against cursor outside images; different rubber pixel.
 * 2.44 17 Sep 96: add cross-section plot to measure dialog.
 *		    rearrange menus a little
 * 2.42  16 Sep 96: tighten up AOI checking in blink.c
 */
Widget toplevel_w;
XtAppContext app;
char myclass[] = "Camera";
Colormap camcm;
int fifoListen;
State state;
static void makeMain(void);
static void addOptionsMenu(Widget mb);
static void initState(void);
static void openCB (Widget w, XtPointer client, XtPointer call);
static void saveCB (Widget w, XtPointer client, XtPointer call);
static void delCB (Widget w, XtPointer client, XtPointer call);
static void quitCB (Widget w, XtPointer client, XtPointer call);
static void winCB (Widget w, XtPointer client, XtPointer call);
static void magCB (Widget w, XtPointer client, XtPointer call);
static void aoiCB (Widget w, XtPointer client, XtPointer call);
static void glassCB (Widget w, XtPointer client, XtPointer call);
static void fitsCB (Widget w, XtPointer client, XtPointer call);
static void measureCB (Widget w, XtPointer client, XtPointer call);
static void gsclimCB (Widget w, XtPointer client, XtPointer call);
static void epochCB (Widget w, XtPointer client, XtPointer call);
static void corrCB (Widget w, XtPointer client, XtPointer call);
static void camSetupCB (Widget w, XtPointer client, XtPointer call);
static void cam1CB (Widget w, XtPointer client, XtPointer call);
static void camContCB (Widget w, XtPointer client, XtPointer call);
static void camCancelCB (Widget w, XtPointer client, XtPointer call);
static void listenCB (Widget w, XtPointer client, XtPointer call);
static void resetAOICB (Widget w, XtPointer client, XtPointer call);
static void privcm(void);
static void hist_add (char *full, char *base);
static void createHistoryMenu (void);
static void histCB (Widget w, XtPointer client, XtPointer call);
static Widget msg_w;	/* general purpose message line */
static Widget fn_w;	/* file name label */
static Widget histw[MAXHIST];	/* file history widgets */
static Widget filepdm;		/* file pulldown menu, so we can add to it */
static int nhist;		/* number of histw in use */
static String fallbacks[] = {};
static int autolistenok;	/* set with -a to allow auto listen mode */
int 
main (ac, av)
int ac;
char *av[];
{}

static void
makeMain()
{
}

/* add the Options pulldown we need to have the widgets for.
 */
static void
addOptionsMenu (mb)
Widget mb;	/* menuBar */
{
}

/* write a new message to the msg area */
void
msg (char *fmt, ...)
{
}

/* save fn in state.fname and add to history list if not already there.
 * and update fn_w message.
 */
void
setFileName (fn)
char *fn;
{
}

/* debug aid */
void
printState()
{
}

static void
initState()
{
}

/* ARGSUSED */
static void openCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void saveCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void delCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called from the Quit button on the File pulldown with client == 0.
 * called from the "Are you sure" question dialog with client == 1.
 */
/* ARGSUSED */
static void quitCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void winCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void magCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void aoiCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void glassCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void fitsCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void measureCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void gsclimCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void epochCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void corrCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void camSetupCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void cam1CB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void camContCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void camCancelCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void listenCB (Widget w, XtPointer client, XtPointer call)
{
}

/* ARGSUSED */
static void resetAOICB (Widget w, XtPointer client, XtPointer call)
{
}

/* build a private colormap for toplevel_w and save in camcm */
static void
privcm()
{
}

/* add new to hist list, unless already there */
static void
hist_add (char *full, char *base)
{
}

/* add the widgets for the history portion of the file pulldown */
static void
createHistoryMenu ()
{
}

/* called when a history file is selected */
static void
histCB (Widget w, XtPointer client, XtPointer call)
{
}

/* code to support the angle/velocity measurement dialog */
static void createMeasure (void);
static void createGCs (Display *dsp, Window win);
static void p2RefCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void updateAll (void);
static void wcoords (int ix, int iy, int *wx, int *wy);
static void drawPlot (PlotState ps);
static Widget measure_w;	/* main measure dialog */
static Widget mda_w;		/* drawing area for cross-section plot */
static Widget p1x_w;		/* p1 x label */
static Widget p1y_w;		/* p1 y label */
static Widget p1ra_w;		/* p1 ra label */
static Widget p1dec_w;		/* p1 dec label */
static Widget p1jd_w;		/* p1 jd label */
static Widget p2x_w;		/* p2 x label */
static Widget p2y_w;		/* p2 y label */
static Widget p2ra_w;		/* p2 ra label */
static Widget p2dec_w;		/* p2 dec label */
static Widget p2jd_w;		/* p2 jd label */
static Widget delx_w;		/* delta x label */
static Widget dely_w;		/* delta y label */
static Widget delra_w;		/* delta ra label */
static Widget deldec_w;		/* delta dec label */
static Widget deljd_w;		/* delta jd label */
static Widget sep_w;		/* angular separation label */
static Widget psep_w;		/* pixel separation label */
static Widget vel_w;		/* velocity label */
static GC plotGC;		/* plot GC */
static Pixel border_p;		/* border color */
static Pixel grid_p;		/* grid color */
static Pixel gauss_p;		/* gauss color */
static int p1set, p2set;	/* whether p1 and p2 are set */
static double p1ra, p1dec, p1jd;
static int p1radecok;
static int p1x, p1y;
static double p2ra, p2dec, p2jd;
static int p2radecok;
static int p2x, p2y;
static char blank[] = "             ";
/* toggle whether the measure dialog is up */
void
manageMeasure ()
{
}

/* update everthing based on new loc */
void
doMeasure (PlotState ps, int x, int y, int raddecok, double ra, double dec)
{
}

/* create the measure dialog */
static void
createMeasure()
{
}

static void
createGCs (dsp, win)
Display *dsp;
Window win;
{
}

/* called to make p2 the new reference */
/* ARGSUSED */
static void
p2RefCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called to close down */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

static void
updateAll()
{
}

/* given image coords find window coords.
 */
static void
wcoords (int ix, int iy, int *wx, int *wy)
{
}

static void
drawPlot (PlotState ps)
{
}

/* code to ask file name and open a fresh image file */
static void openCB(Widget w, XtPointer client, XtPointer call);
static int prepOpen (char fn[], char errmsg[]);
static Widget open_w;		/* the main open dialog widget */
/* we listen to this fifo for file names to display.
 * we always unlink the fifo file and recreate it.
 */
static char filefifo[] = "/tmp/CameraFilename";
static void filefifoCB (XtPointer client, int *fdp, XtInputId *idp);
void
manageOpen()
{
}

/* create the menu and start listing to the filefifo.
 */
void
createOpen()
{
}

/* do everything we need to once we have created a new state.fimage.
 * this is used when a new file has been opened, or one has been read from
 * the camera.
 */
void
presentNewFImage()
{
}

/* open and display the given file.
 * if name ends with .fth, first apply fdecompress to a copy.
 * return 0 if ok, else -1.
 */
int
openFile (fn)
char *fn;
{
}

/* called when the Ok Apply button on the file open box is pressed.
 */
/* ARGSUSED */
static void
openCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when there is input from the filefifo.
 */
static void
filefifoCB (client, fdp, idp)
XtPointer client;       /* file name */
int *fdp;               /* pointer to file descriptor */
XtInputId *idp;         /* pointer to input id */
{
}

/* open fn for reading and return the fd.
 * if fn ends in .fth we copy to a tmp location and apply fdecompress.
 * if all is well, return fd, else fill errmsg[] and return -1.
 */
static int
prepOpen (fn, errmsg)
char fn[];
char errmsg[];
{}

/* code handle photometry reports
 * we do the main menu and the differential stuff here.
 * the absolute photometry is done in photomasb.c
 */
static void apReport (int newap);
static void create_photom_w (void);
static Widget create_diff_w (Widget top);
static void modeCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void apCB (Widget w, XtPointer client, XtPointer call);
static void lockapCB (Widget w, XtPointer client, XtPointer call);
static void makeGC(void);
static void diffReport(void);
static wantPhotom;		/* !0 when want any photom stuff */
static wantAbs;			/* 1 for abs, 0 for differential. */
static Widget photom_w;		/* toplevel photom dialog */
static Widget rap_w;		/* text widget to hold StarDfn.rAp */
static Widget rsrch_w;		/* text widget to hold StarDfn.rsrch */
static Widget lockap_w;		/* the lock aperature TB */
static Widget ix_w, iy_w;	/* labels to report star x/y */
static Widget ra_w, dec_w;	/* labels to report star RA/Dec */
static Widget p_w;		/* brightest pixel in star */
static Widget fwhm_w;		/* star full width half max */
static GC photGC;		/* GC to use to mark photometric stars */
static char duh[] = "????";
/* stuff for differential photometry mode */
static Widget diff_w;		/* toplevel differential manager */
static void setRefCB (Widget w, XtPointer client, XtPointer call);
static StarStats newStar;	/* last star computed */
static StarStats refStar;	/* reference star, unless .p == 0 */
static Widget mag_w, magerr_w;	/* labels to report star magnitude and err */
static Widget magref_w;		/* text widget with desired reference mag */
/* called from the overall photometry feature on/off PB */
/* ARGSUSED */
void
photomCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* used by the abs photom to set and lock the aperture found in the
 * photcal file.
 */
void
setAp (newap)
int newap;
{
}

/* called when mouse button is pressed to report photometry.
 */
void
doPhotom (ix, iy)
int ix, iy;	/* image coordinates of mouse */
{
}

/* display the aperture value in rap_w.
 * take care not to actually change the widget unless it is really different
 *   so as to avoid useless valueChanged callbacks.
 */
static void
apReport (int newap)
{
}

/* create all the dialogs; only manage the main one now though.
 * initially the mode is for differential.
 */
static void
create_photom_w()
{
}

/* create the differential dialog chunk.
 * it is a child of the main photom_w form widget.
 * start attaching at top_w.
 * don't connect anything to the bottom of photo_w but return the lowest widget
 *   made in the form.
 */
static Widget
create_diff_w (top_w)
Widget top_w;
{
}

/* called to change between diff and abs mode.
 * we are connected to the AbsMode toggle button.
 */
/* ARGSUSED */
static void
modeCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called from the Close pushbutton */
/* ARGSUSED */
static void
closeCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when anything is changed in the manual aperature TF */
/* ARGSUSED */
static void
apCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when the Lock Aperture TB changes state */
/* ARGSUSED */
static void
lockapCB (Widget w, XtPointer client, XtPointer call)
{
}

/* report differential magnitude -- newStar wrt refStar */
static void
diffReport()
{
}

/* called when the current star is to be made the reference differential star */
/* ARGSUSED */
static void
setRefCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

static void
makeGC()
{
}

/* code handle absolute photometry (the main stuff is in photom.c) */
extern void solve_sphere (double A, double b, double cc, double sc,
    double *cap, double *Bp);
/* indeces into various data structures for the 4 filters */
enum {};

static void cancelCB (Widget w, XtPointer client, XtPointer call);
static void defRefCB (Widget w, XtPointer client, XtPointer call);
static void create_absref_w(void);
static void setTestStar_w(void);
static void setAbsRef_w(void);
static void getAbsRef_w(void);
static void absOkCB (Widget w, XtPointer client, XtPointer call);
static void absApplyCB (Widget w, XtPointer client, XtPointer call);
static void absCloseCB (Widget w, XtPointer client, XtPointer call);
static void overrideCB (Widget w, XtPointer client, XtPointer call);
static void create_k_w(void);
static void setK_w(void);
static void getK_w(void);
static void resetStarListCB (Widget w, XtPointer client, XtPointer call);
static void resetTestStar(void);
static void readPhotCalFileCB (Widget w, XtPointer client, XtPointer call);
static void readPhotCalFile ();
static int readPhotCalOut ();
static void readPhotCalDef (int all);
static void setPhotcalDate(void);
static void kOkCB (Widget w, XtPointer client, XtPointer call);
static int getFilter (FImage *fip, int *code, char *name);
static int getAirmass (FImage *fip, double *amp);
static int getExptime (FImage *fip, double *expp);
static double normalizedVobs (StarStats *sp, double exp);
static char duh[] = "  ???? ";
static Widget abs_w;		/* toplevel absolute manager */
static Widget refname_w;	/* label for reference object name */
static Widget abs_w;            /* toplevel absolute manager */
static Widget absref_w;		/* toplevel reference star dialog */
static Widget k_w;		/* toplevel kp/kpp dialog */
static Widget ra_w;		/* label for test star ra */
static Widget dec_w;		/* label for test star dec */
static Widget setref_w;		/* tb -- true when want to set ref inst cor */
static Widget photcaldeffn_w;	/* TF to hold default photcal file name */
static Widget photcalfn_w;	/* TF to hold photcal file name */
static Widget photcaldate_w;	/* TF to hold photcal date */
static Widget autoread_w;	/* TB to auto read photcal image on each file */
/* stuff needed to compute and display info about one filter */
typedef struct {} AbsPhot;

/* one set per filter */
static AbsPhot absphot[NF];
/* value for AbsPhot.cor */
enum {};

/* list of test stars.
 * these are copies of the values of these fields when they were last
 * seen in the absphot structure. we swap them in and out as they are
 * needed so all the other code can always just use absphot.
 */
typedef struct {} ListStar;

static int growStarList (double ra, double dec);
static void starListToAbsPhot (int i);
static void absPhotToStarList (int i);
static int establishTestStar(FImage *fip, StarStats *sp);
static ListStar *starlist;	/* list of all test stars we are working on */
static int nstarlist;		/* number of stars in list */
static int starlistn;		/* current one in use */
/* a new image has just been loaded.
 * if abs photometry is currently active and autoread_w is true, search and
 * load calibration constants for the date of this image from photcol.out.
 */
void
readAbsPhotom()
{
}

/* create the absolute dialog chunk of the main photom dialog.
 * it is a child of the main photom_w form widget.
 * start attaching at top_w.
 * don't connect anything to the bottom of parent_w but return the lowest
 *   widget made in the form.
 */
Widget
createAbsPhot_w (parent_w, top_w)
Widget parent_w;
Widget top_w;
{
}

/* called to turn abs menus on or off.
 */
void
manageAbsPhot (whether)
int whether;
{
}

/* do whatever we need to when the the right mouse button is hit and we are
 * in absolute photometry mode.
 * the info about the star we just found is in newStar.
 */
void
absPhotWork(newStar)
StarStats *newStar;
{
}

/* handy callback to unmanage the widget named by client */
/* ARGSUSED */
static void
cancelCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when we want to allow defining a new abs mode ref star */
/* ARGSUSED */
static void
defRefCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* create the dialog to allow entering True BVRI for the star that will serve
 * as the reference for absolute photometry.
 */
static void
create_absref_w()
{
}

/* find the new star in the starlist, or add it if not found.
 * set starlistn to its index.
 */
static int
establishTestStar (fip, sp)
FImage *fip;
StarStats *sp;
{
}

/* set up the widgets displaying what we know of the test star in absphot.
 * also set the ra_w/dec_w widgets.
 */
static void
setTestStar_w(void)
{
}

/* copy the info about the reference star to their display widgets */
static void
setAbsRef_w()
{
}

/* get the info from the reference star true magnitude widgets */
static void
getAbsRef_w()
{
}

/* called when we want to copy the true abs widgets to their values.
 * also unmanage absdef_w and turn off the set reference control.
 */
/* ARGSUSED */
static void
absOkCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when we want to copy the true abs widgets to their values.
 */
/* ARGSUSED */
static void
absApplyCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when we want to drop the Reference dialog.
 * unmanage the dialog and make sure the setref control is off.
 */
/* ARGSUSED */
static void
absCloseCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called when we want to allow defining the k photometric constants */
/* ARGSUSED */
static void
overrideCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* create the dialog to allow entering new values for the k photometric
 * constants used in absolute photometry.
 */
static void
create_k_w()
{
}

/* copy the kp and kpp values to their display widgets.
 */
static void
setK_w()
{
}

/* get the info from the kp and kpp widgets */
static void
getK_w()
{
}

/* called when we want to use new values from the kp and kpp widgets.
 * also unmanage k_w and reset the Instrument corrections.
 * client is 1 if we also want to close the dialog.
 */
/* ARGSUSED */
static void
kOkCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called to reset the list of known test stars */
/* ARGSUSED */
static void
resetStarListCB (Widget w, XtPointer client, XtPointer call)
{
}

/* called to read photcal file */
/* ARGSUSED */
static void
readPhotCalFileCB (Widget w, XtPointer client, XtPointer call)
{
}

/* read the photcal.out filename named in photcalfn_w and look for an entry
 * within JDWINDOW of the date in photcaldate_w.
 * if nothing appropriate, then try file named in photcaldeffn_w.
 * if found anything from either place, fill in all of absphot.
 */
static void
readPhotCalFile()
{
}

/* open and read the given photcal.out file for the entry matching the jd.
 * if found ok set the new values and return 0, else return -1.
 */
static int
readPhotCalOut (char fn[], double jd)
{}

/* read the photcal.def file named by photcaldeffn_w: always set the "true"
 *   values absphot[*].rV.
 * if "all" is set then also set abshot[*].rV0/kp/kpp.
 */
static void
readPhotCalDef(int all)
{
}

/* set photcaldate_w to DATE-OBS field of state.fimage */
static void
setPhotcalDate()
{
}

/* reset the entries in absphot relating to the test star */
static void
resetTestStar()
{
}

/* convert the filter named in FILTER in fip to one of our enum codes */
static int
getFilter (FImage *fip, int *code, char *name)
{
}

static int
getAirmass (FImage *fip, double *amp)
{
}

static int
getExptime (FImage *fip, double *expp)
{
}

/* find the observed brightness of the given star normalized to the given
 * exposure time.
 */
static double
normalizedVobs (sp, exp)
StarStats *sp;	/* observed star */
double exp;	/* exp time, seconds */
{
}

/* add one entry to starlist.
 * set the RA and Dec fields and reset all the others.
 * return 0 if ok else -1 if no more memory.
 */
static int
growStarList (double ra, double dec)
{
}

/* copy appropriate absphot fields to starlist[i] */
static void
absPhotToStarList (i)
int i;
{
}

/* copy fields from starlist[i] to the appropriate absphot fields
 */
static void
starListToAbsPhot (i)
int i;
{
}

/* dialog to allow saving the current image somewhere */
static void createSave(void);
static void saveCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static Widget save_w;	/* main save dialog */
static Widget dir_w;	/* text field containing directory */
static Widget fn_w;	/* text field containing file name */
void
manageSave ()
{
}

/* put state.fname into dir_w and fn_w
 * if fname has no directory portion, leave dir_w unchanged.
 */
void
updateSave()
{
}

static void
createSave()
{
}

/* called when the save button is activated.
 */
/* ARGSUSED */
static void
saveCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* code to handle GSC stars and calibration */
static void makeGCs(void);
static GC gscGC;
static GC starGC;
static int findImageCenterFOV (FImage *fip, double *rap, double *decp, double
    *fovp, char errmsg[]);
/* called when asked to mark the GSC stars.
 * if set, mark stars; else remove them.
 */
/* ARGSUSED */
void
markGSCCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when asked to mark the stars once.
 */
/* ARGSUSED */
void
markStarsCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when asked to mark header ra/dec location once */
/* ARGSUSED */
void
markHdrRADecCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* if already have state.gsc_* arrays just draw them,
 * else do fresh lookup first.
 */
void
markGSC()
{
}

/* reclaim GSC list, if any */
void
resetGSC()
{
}

static void
makeGCs()
{
}

/* using the C* fields in fip, find image center and fov.
 * return 0 if ok, else excuse in msg[] and -1.
 */
static int
findImageCenterFOV (FImage *fip,
double *rap, double *decp, double *fovp, char errmsg[])
{
}

/* code handle setting the C* WCS fields */
/* called when asked to set the WCS fields */
/* ARGSUSED */
void
setWCSCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* dialog to display and control the window function.
 * window means lo and hi pixel bandpass.
 * we also do the histogram stuff here.
 */
static void autoCB (Widget w, XtPointer client, XtPointer call);
static void invCB (Widget w, XtPointer client, XtPointer call);
static void lutCB (Widget w, XtPointer client, XtPointer call);
static void aoiCB (Widget w, XtPointer client, XtPointer call);
static void aoiNotCB (Widget w, XtPointer client, XtPointer call);
static void allCB (Widget w, XtPointer client, XtPointer call);
static void lohiCB (Widget w, XtPointer client, XtPointer call);
static void newHistCB (Widget w, XtPointer client, XtPointer call);
static void hdaInCB (Widget w, XtPointer client, XEvent *ev, Boolean *cont);
static void hdaExpCB (Widget w, XtPointer client, XtPointer call);
static void closeCB (Widget w, XtPointer client, XtPointer call);
static void drawHistogram (void);
static Widget win_w;	/* main window dialog */
static Widget mean_w;	/* label to display mean */
static Widget median_w;	/* label to display median */
static Widget sd_w;	/* label to display standard deviation */
static Widget min_w;	/* label to display min pixel value */
static Widget max_w;	/* label to display max pixel value */
static Widget auto_w;	/* tb to select whether we apply hist to window */
static Widget meanw_w;	/* tb to select whether we want mean window algo */
static Widget aoi_w;	/* tb to select whether stats apply just to AOI */
static Widget aoinot_w;	/* tb to select whether stats apply to all but AOI */
static Widget all_w;	/* tb to select whether stats apply to entire image */
static Widget lohi_w;	/* tb to select whether histo is just lo..hi */
static Widget hlog_w;	/* tb to select whether histo shown as log() */
static Widget lotf_w;	/* window lo value text field */
static Widget hitf_w;	/* window hi value text field */
static Widget hda_w;	/* histogram drawing area */
void
manageWin ()
{
}

void
createWin()
{
}

/* given the state.stats info, draw the Win menu display */
void
updateWin()
{
}

/* pick a new state.lo/hi and recompute state.lut.
 * if want autowindowing we compute from the stats, else we use the lo/hitf_w.
 */
void
setWindow()
{
}

/* called when either the "auto win" toggle button or one of it's
 * algorithm selection toggle buttons changes state.
 * what it amounts to is "just do it" if we want auto windowing.
 */
/* ARGSUSED */
static void
autoCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the "inverse video" tb changes state.
 * what it amounts to is "just do it" if we want auto windowing.
 */
/* ARGSUSED */
static void
invCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called to change luts.
 * client is one of the LutType enums.
 */
/* ARGSUSED */
static void
lutCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the aoi-onlytoggle button changes state.
 */
/* ARGSUSED */
static void
aoiCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the aoi-not toggle button changes state.
 */
/* ARGSUSED */
static void
aoiNotCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the entire-image toggle button changes state.
 */
/* ARGSUSED */
static void
allCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the lo or hi text field is activated with CR
 */
/* ARGSUSED */
static void
lohiCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when there is input activity in the drawing area
 */
/* ARGSUSED */
static void
hdaInCB (w, client, ev, cont)
Widget w;
XtPointer client;
XEvent *ev;
Boolean *cont;
{
}

/* called when the histogram drawing area gets an expose
 */
/* ARGSUSED */
static void
hdaExpCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when the close button is activated.
 */
/* ARGSUSED */
static void
closeCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called when all we need do it redo the histogram and stats */
/* ARGSUSED */
static void
newHistCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* draw im_hist in the hda_w widget.
 * also draw the state.lo/hi bars.
 * this may safely be called before the hda_w has been exposed or before an
 *   image has been read in.
 */
static void
drawHistogram ()
{
}

/* code to create and manage the state.imageDA, ximagep and the daGC.
 */
extern Widget toplevel_w;
static void drawXImage(void);
static void makeGC(void);
static void daExpCB (Widget w, XtPointer client, XtPointer call);
static void daButtonCB (Widget w, XtPointer client, XEvent *ev,
    Boolean *continue_to_dispatch);
static void doReport (PlotState ps, int x, int y);
/* using toplevel_w, find the depth the server wants images and the number of
 * bit per pixel in the arrays we store them in.
 */
void
initDepth()
{
}

/* reapply the lut to update state.ximagep and redraw the scene.
 * this is intended to just redraw the current image with a new lut. if the
 * image is being changed or is being cropped, use newXImage().
 * this is safe to call before we've read in an image.
 */
void
updateXImage()
{
}

/* given state.fimage make a new ximagep for it and a new DrawingArea for it
 *   off state.imageSW.
 * then fill in ximagep by calling FtoXImage().
 * this is intended for when the image changes or is cropped to a new size.
 * pixels will get drawn due to the expose of the new DrawingArea.
 * this is harmless to call before we've read in an image.
 */
void
newXImage()
{
}

/* redraw the given portion of the current scene */
void
refreshScene(x, y, w, h)
int x, y, w, h;
{
}

/* send the entire XImage to the DrawingArea
 * also draw the current aoi and GSC stars, if any.
 */
static void
drawXImage()
{
}

static void
makeGC()
{
}

/* called when we get an Expose event from the DrawingArea
 */
/* ARGSUSED */
static void
daExpCB (w, client, call)
Widget w;
XtPointer client;
XtPointer call;
{
}

/* called on receipt of a MotionNotify while Button1 or 2 is down or any
 * ButtonPress/ButonRelease while the cursor is over the imageDA window.
 */
/* ARGSUSED */
static void
daButtonCB (w, client, ev, continue_to_dispatch)
Widget w;
XtPointer client;
XEvent *ev;
Boolean *continue_to_dispatch;
{
}

/* report the pixel value under the cursor */
static void
doReport (ps, x, y)
PlotState ps;
int x, y;		/* image coords of cursor */
{
}

/* called to set or unset the watch cursor.
 * allow for nested requests.
 */
void
watch_cursor(want)
int want;
{
}

/* handy way to set one resource for a widget.
 * shouldn't use this if you have several things to set for the same widget.
 */
void
set_something (w, resource, value)
Widget w;
char *resource;
char *value;
{
}

/* handy way to get one resource for a widget.
 * shouldn't use this if you have several things to get for the same widget.
 */
void
get_something (w, resource, value)
Widget w;
char *resource;
char *value;
{
}

/* return the given XmString resource from the given widget as a char *.
 * N.B. based on a sample in Heller, pg 178, the string back from
 *   XmStringGetLtoR should be XtFree'd. Therefore, OUR caller should always
 *   XtFree (*txtp).
 */
void
get_xmstring (w, resource, txtp)
Widget w;
char *resource;
char **txtp;
{
}

void
set_xmstring (w, resource, txt)
Widget w;
char *resource;
char *txt;
{
}

/* print something to the labelString XmString resource of the given widget.
 * take care not to do the i/o if it's the same string again.
 */
void
wlprintf (Widget w, char *fmt, ...)
{
}

/* print something to the value String resource of the given text widget.
 * take care not to do the i/o if it's the same string again.
 */
void
wtprintf (Widget w, char *fmt, ...)
{
}

/* given an array of Menu items, build and return a MenuBar widget.
 */
Widget
makeMenuBar (par, menus, nmenus)
Widget par;
Menu menus[];
int nmenus;
{}

/* get the named color in *p.
 * return 0 if the color was found, else -1.
 */
int
get_color_resource (dsp, myclass, cname, p)
Display *dsp;
char *myclass;
char *cname;
Pixel *p;
{
}

