191 lines
4.4 KiB
C
191 lines
4.4 KiB
C
/*
|
|
* wcolorpanelP.h — Private header for color panel three-way split.
|
|
*
|
|
* Shared types between wcolorpanel.c, wcolorpanel_x11.c, and
|
|
* wcolorpanel_wl.c. Included after WINGsP.h.
|
|
*/
|
|
|
|
#ifndef WCOLORPANEL_P_H
|
|
#define WCOLORPANEL_P_H
|
|
|
|
typedef struct CPColor {
|
|
RColor rgb;
|
|
RHSVColor hsv;
|
|
enum {
|
|
cpNone,
|
|
cpRGB,
|
|
cpHSV
|
|
} set;
|
|
} CPColor;
|
|
|
|
typedef struct WheelMatrix {
|
|
unsigned int width, height;
|
|
unsigned char *data[3];
|
|
unsigned char values[256];
|
|
} wheelMatrix;
|
|
|
|
enum {
|
|
CPmenuNewFromFile,
|
|
CPmenuRename,
|
|
CPmenuRemove,
|
|
CPmenuCopy,
|
|
CPmenuNewFromClipboard
|
|
};
|
|
|
|
enum {
|
|
CLmenuAdd,
|
|
CLmenuRename,
|
|
CLmenuRemove
|
|
};
|
|
|
|
#define PWIDTH 194
|
|
#define PHEIGHT 266
|
|
#define colorWheelSize 150
|
|
#define customPaletteWidth 182
|
|
#define customPaletteHeight 106
|
|
#define knobThickness 8
|
|
|
|
#define SPECTRUM_WIDTH 511
|
|
#define SPECTRUM_HEIGHT 360
|
|
|
|
#define COLORWHEEL_PART 1
|
|
#define CUSTOMPALETTE_PART 2
|
|
|
|
typedef struct W_ColorPanel {
|
|
WMWindow *win;
|
|
WMFont *font8;
|
|
WMFont *font12;
|
|
void *clientData;
|
|
WMAction2 *action;
|
|
|
|
/* Common Stuff */
|
|
WMColorWell *colorWell;
|
|
WMButton *magnifyBtn;
|
|
WMButton *wheelBtn;
|
|
WMButton *slidersBtn;
|
|
WMButton *customPaletteBtn;
|
|
WMButton *colorListBtn;
|
|
|
|
/* Magnifying Glass */
|
|
void *magnifyGlass;
|
|
|
|
/* ColorWheel Panel */
|
|
WMFrame *wheelFrm;
|
|
WMSlider *wheelBrightnessS;
|
|
WMView *wheelView;
|
|
|
|
/* Slider Panels */
|
|
WMFrame *slidersFrm;
|
|
WMFrame *seperatorFrm;
|
|
WMButton *grayBtn;
|
|
WMButton *rgbBtn;
|
|
WMButton *cmykBtn;
|
|
WMButton *hsbBtn;
|
|
/* Gray Scale Panel */
|
|
WMFrame *grayFrm;
|
|
WMLabel *grayMinL;
|
|
WMLabel *grayMaxL;
|
|
WMSlider *grayBrightnessS;
|
|
WMTextField *grayBrightnessT;
|
|
WMButton *grayPresetBtn[7];
|
|
|
|
/* RGB Panel */
|
|
WMButton *rgbDecB;
|
|
WMButton *rgbHexB;
|
|
WMFrame *rgbFrm;
|
|
WMLabel *rgbMinL;
|
|
WMLabel *rgbMaxL;
|
|
WMSlider *rgbRedS;
|
|
WMSlider *rgbGreenS;
|
|
WMSlider *rgbBlueS;
|
|
WMTextField *rgbRedT;
|
|
WMTextField *rgbGreenT;
|
|
WMTextField *rgbBlueT;
|
|
enum {
|
|
RGBdec,
|
|
RGBhex
|
|
} rgbState;
|
|
|
|
/* CMYK Panel */
|
|
WMFrame *cmykFrm;
|
|
WMLabel *cmykMinL;
|
|
WMLabel *cmykMaxL;
|
|
WMSlider *cmykCyanS;
|
|
WMSlider *cmykMagentaS;
|
|
WMSlider *cmykYellowS;
|
|
WMSlider *cmykBlackS;
|
|
WMTextField *cmykCyanT;
|
|
WMTextField *cmykMagentaT;
|
|
WMTextField *cmykYellowT;
|
|
WMTextField *cmykBlackT;
|
|
|
|
/* HSB Panel */
|
|
WMFrame *hsbFrm;
|
|
WMSlider *hsbHueS;
|
|
WMSlider *hsbSaturationS;
|
|
WMSlider *hsbBrightnessS;
|
|
WMTextField *hsbHueT;
|
|
WMTextField *hsbSaturationT;
|
|
WMTextField *hsbBrightnessT;
|
|
|
|
/* Custom Palette Panel */
|
|
WMFrame *customPaletteFrm;
|
|
WMPopUpButton *customPaletteHistoryBtn;
|
|
WMFrame *customPaletteContentFrm;
|
|
WMPopUpButton *customPaletteMenuBtn;
|
|
WMView *customPaletteContentView;
|
|
|
|
/* Color List Panel */
|
|
WMFrame *colorListFrm;
|
|
WMPopUpButton *colorListHistoryBtn;
|
|
WMList *colorListContentLst;
|
|
WMPopUpButton *colorListColorMenuBtn;
|
|
WMPopUpButton *colorListListMenuBtn;
|
|
|
|
/* Look-Up Tables and Images */
|
|
wheelMatrix *wheelMtrx;
|
|
WMNativePixmap wheelImg;
|
|
WMNativePixmap selectionImg;
|
|
WMNativePixmap selectionBackImg;
|
|
RImage *customPaletteImg;
|
|
char *lastBrowseDir;
|
|
|
|
/* Common Data Fields */
|
|
CPColor color; /* Current color */
|
|
WMColorPanelMode mode; /* Current color selection mode */
|
|
WMColorPanelMode slidersmode; /* Current color sel. mode sliders panel */
|
|
WMColorPanelMode lastChanged; /* Panel that last changed the color */
|
|
int colx, coly; /* (x,y) of sel.-marker in WheelMode */
|
|
int palx, paly; /* (x,y) of sel.-marker in
|
|
CustomPaletteMode */
|
|
double palXRatio, palYRatio; /* Ratios in x & y between
|
|
original and scaled
|
|
palettesize */
|
|
int currentPalette;
|
|
char *configurationPath;
|
|
|
|
struct {
|
|
unsigned int continuous:1;
|
|
unsigned int dragging:1;
|
|
} flags;
|
|
} W_ColorPanel;
|
|
|
|
|
|
|
|
/* Exported from wcolorpanel.c for backend magnifying glass files */
|
|
void updateSwatch(struct W_ColorPanel *panel, struct CPColor color);
|
|
void wheelInit(struct W_ColorPanel *panel);
|
|
void wheelRender(struct W_ColorPanel *panel);
|
|
void wheelPaint(struct W_ColorPanel *panel);
|
|
void grayInit(struct W_ColorPanel *panel);
|
|
void rgbInit(struct W_ColorPanel *panel);
|
|
void cmykInit(struct W_ColorPanel *panel);
|
|
void hsbInit(struct W_ColorPanel *panel);
|
|
int getPickerPart(struct W_ColorPanel *panel, int x, int y);
|
|
void readConfiguration(struct W_ColorPanel *panel);
|
|
void closeWindowCallback(void *w, void *data);
|
|
void modeButtonCallback(void *w, void *data);
|
|
void convertCPColor(struct CPColor *color);
|
|
|
|
#endif /* WCOLORPANEL_P_H */
|