/* **********************************************************************
 * *                                                                    *
 * *                   IRIS Color Setup                                 *
 * *                                                                    *
 * **********************************************************************
 * File: utils/colorsetup/color_setup.h
 *
 *         COPYRIGHT (c) 1996, 1997, 1998, 1999, 2001, 2003  BY
 *          SIGMET INCORPORATED, WESTFORD MASSACHUSETTS, U.S.A.
 *
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */

#ifndef COLOR_SETUP_H
#define COLOR_SETUP_H

#ifdef COLOR_SETUP_ALLOCATE
#define EXTERN
#else
#define EXTERN extern
#endif


#define SPECIAL_COLOR_CELL_X    10
#define COLOR_CELL_X            40
#define COLOR_CELL_WID          80
#define COLOR_CELL_HGT          30

#define NEW                     1 
#define DELETE                  2

#define COLOR_SET               1
#define CUST_SCALE              2

#define CS_RED                  1
#define CS_GREEN                2
#define CS_BLUE                 3

#define CS_UPPER                1
#define CS_LOWER                2

#define CS_START                1
#define CS_STOP                 2

#define CS_NO_ERROR             0
#define CS_ERROR_LOADING_FILE   1
#define CS_ERROR_SETUP_LIMITS   2

#define CS_PALETTE_DEFAULT      1
#define CS_PALETTE_3D           2


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

/*******************************************************
**
** Variables
**
************************************************/

EXTERN GC             fillGC,  defaultGC, fontGC;
EXTERN GC             blackGC, redGC, whiteGC;
EXTERN GC             eraseDialogGC, eraseApplGC;

EXTERN UINT2           lColorSetupWVRemoteHelp;
EXTERN char            sColorSetupWVHelpFilename[20];


EXTERN Colormap        colormap_c;
#define UIMX_COLORMAP colormap_c
EXTERN Visual          *pVisual_c;
#define UIMX_VISUAL   pVisual_c

EXTERN XVisualInfo     VisualInfo_c;
EXTERN SINT4           iDepth_c;    

#define BACKGROUND_COLOR "#C5B2A8"
#define TEXTBACK_COLOR   "#66717F"


/*******************************************************
**
** Prototypes
**
************************************************/

/*************************************************
** color_setup_func
*************************************************/

/* colorfunc */

Widget XprivateAppInitialize
(XtAppContext * app_context_return,
 String application_class,
 XrmOptionDescRec *options,
 Cardinal num_options,
 int *argc_in_out,
 String *argv_in_out,
 String *fallback_resources,
 ArgList args_in,
 Cardinal num_args_in,
 Colormap *pColormap_a,
 XVisualInfo *pVisualInfo_a );

void  saveColorSetup(void);
void  restoreColorSetup(void);
void  loadColorSetup(void);
void  repairColorSetup(void);
void  setLoadFileErrorStatus(UINT4 err_status);
UINT4 getLoadFileErrorStatus(void);

void loadColorSetExampleD(void);
void loadColorSetExampleV(void);
void loadColorSetExampleKDP(void);
void loadColorSetExampleGrey(void);
void loadColorPaletteExample(UINT4 palette_type_a);
void loadSpecialColorExample(void);
void loadCustomScaleExample(void);

void unifyColorPalette(void);

void  setDataType(UINT4 data_type);
UINT4 getDataType(void);

void  setNumLevels(UINT4 num_levels);
UINT4 getNumLevels(void);

void  setColorScaleUnitsType(UINT2 lrain_rate_in_hour);
UINT4 getColorScaleFlags(void);

void  setColorScaleStartValue(UINT4 level_num, FLT4 val, 
        struct data_convert *convert);
FLT4  getColorScaleStartValue(UINT4 level_num, struct data_convert *convert);

void  getColorScaleTxt(char start[16][8], char stop[16][8]);

void  setColorScaleThresh(UINT4 thresh_type);
void  clrColorScaleThresh(UINT4 thresh_type);
UINT1 getColorScaleThresh(UINT4 thresh_type);
void  toggleColorScaleThresh(UINT4 thresh_type);

void  setCustScale(UINT4 cust_scale);
UINT4 getCustScale(void);
void  setCustScaleColorSet(UINT4 color_set);
UINT4 getCustScaleColorSet(void);
UINT4 getCustScaleColorSetPaletteNum(UINT4 color_set_num);
void  setCustScaleNewName(UINT4 idx, char *name);
void  setCustScaleName(UINT4 idx, char *name);
char  *getCustScaleName(UINT4 idx);
void  deleteCustScaleName(UINT4 idx);
void  getCustScaleNameFree(SINT4 *first_free_idx, UINT4 *total_free);

void  setColorSet(UINT4 color_set);
UINT4 getColorSet(void);
void  setColorSetNewName(UINT4 idx, char *name);
void  setColorSetName(UINT4 idx, char *name);
char  *getColorSetName(UINT4 idx);
void  deleteColorSetName(UINT4 idx);
void  getColorSetNameFree(SINT4 *first_free_idx, UINT4 *total_free);

void  setColorSetNumSel(UINT4 color_num_sel);
UINT4 getColorSetNumSel(void);
UINT4 getColorSetPaletteNum(UINT4 color_set_num);
UINT4 getColorSetPaletteNumSel(void);
void  setColorSetPaletteNum(UINT4 color_set_num, UINT4 color_set_pal_num);


void   setColorPaletteNumSel(UINT4 color_num_sel);
UINT4  getColorPaletteNumSel(void);
void   setColorPaletteExtendedNumSel(UINT4 color_num_extended_sel);
UINT4  getColorPaletteExtendedNumSel(void);
UINT4  getAllocedPaletteCell(UINT4 color_palette_num, UINT4 color_palette_extended_num);
void   setAllocedPaletteCell(UINT4 color_palette_num, UINT4 color_palette_extended_num, UINT4 pixel);
UINT4  getAllocedPaletteCellSel(void);
void   setAllocedPaletteCellSel(UINT4 pixel);
void   getAllocedPaletteColor(UINT4 color_palette_num, UINT4 color_palette_extended_num,
         UINT1 *red, UINT1 *green, UINT1 *blue);
void   getAllocedPaletteColorSel(UINT1 *red, UINT1 *green, UINT1 *blue);
void   setAllocedPaletteColor(UINT4 color_palette_num, 
          UINT4 color_palette_extended_num, UINT1 red, UINT1 green, UINT1 blue);


void   setSpecialColorNumSel(UINT4 special_color_num_sel);
UINT4  getSpecialColorNumSel(void);
UINT4  getAllocedSpecialCell(UINT4 special_color_num);
void   setAllocedSpecialCell(UINT4 special_color_num, UINT4 pixel);
UINT4  getAllocedSpecialCellSel(void);
void   setAllocedSpecialCellSel(UINT4 pixel);
void   getAllocedSpecialColor(UINT4 special_color_num,
        UINT1 *red, UINT1 *green, UINT1 *blue);
void   getAllocedSpecialColorSel(UINT1 *red, UINT1 *green, UINT1 *blue);
void   setAllocedSpecialColor(UINT4 special_color_num, 
        UINT1 red, UINT1 green, UINT1 blue);

void MakeListFile(void);

void ColorSetLabel( Widget wgt_a, const char* snam_a );

/* color_set_dialog */


/*************************************************
** color_setup_applshell
*************************************************/
void initColorSetupMenu(void);
void createColorSetupMsgBox(void);
void updateCustScaleMB(UINT4 cust_scale_idx);
void updateColorSetOM(UINT4 color_set_idx);
void updateColorScaleColor(UINT4 color_scale_num);

/*************************************************
** color_set_dialog
*************************************************/
void createColorSetDialog(swidget parent_wgt);
void popupColorSetDialog(void);
void popdownColorSetDialog(void);
void updateColorSetMB(UINT4 color_set_idx);
void updateColorSet(UINT4 color_set_num, UINT4 color_set_num_selected);
void updateColorPalette(UINT4 color_palette_num,
    UINT4 color_palette_num_selected);

/*************************************************
** special_color_edit_dialog
*************************************************/
void createSpecialColorDialog(swidget parent_wgt);
void popupSpecialColorDialog(void);
void popdownSpecialColorDialog(void);

/*************************************************
** rename_dialog
*************************************************/
void createRenameDialog(swidget parent_wgt);
void destroyRenameDialog(void);
void popupRenameDialog(UINT4 type, UINT4 action);
void popdownRenameDialog(void);

#undef EXTERN
#endif

