/*
*
* (c) Copyright 1993-1994 Adobe Systems Incorporated.
* All rights reserved.
*
* Permission to use, copy, modify, distribute, and sublicense this software
* and its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notices appear in all copies and that
* both those copyright notices and this permission notice appear in
* supporting documentation and that the name of Adobe Systems Incorporated
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. No trademark license
* to use the Adobe trademarks is hereby granted. If the Adobe trademark
* "Display PostScript"(tm) is used to describe this software, its
* functionality or for any other purpose, such use shall be limited to a
* statement that this software works in conjunction with the Display
* PostScript system. Proper trademark attribution to reflect Adobe's
* ownership of the trademark shall be given whenever any such reference to
* the Display PostScript system is made.
*
* ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
* ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
* TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
* PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
*
* Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
* Incorporated which may be registered in certain jurisdictions
*
* Author: Adobe Systems Incorporated
*/
/* $XFree86$ */
#ifndef X_NOT_POSIX
#include <unistd.h>
#endif
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <stdlib.h>
/* There are no words to describe how I feel about having to do this */
#if XmVersion > 1001
#include <Xm/ManagerP.h>
#else
#endif
#include <Xm/SeparatoG.h>
#include <Xm/DrawingA.h>
#include <Xm/RowColumn.h>
#include <Xm/MessageB.h>
#include <DPS/dpsXclient.h>
#include "dpsXcommonI.h"
#include <DPS/dpsXshare.h>
#include "eyedrop16.xbm"
#include "eyedropmask16.xbm"
#include "eyedrop32.xbm"
#include "eyedropmask32.xbm"
#include "heyedrop.xbm"
#include "square.xbm"
#include "squaremask.xbm"
#include "CSBwraps.h"
#include <math.h>
#include <stdio.h>
#include <pwd.h>
#include <DPS/ColorSBP.h>
/* Turn a string into a compound string */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
XtRBoolean, sizeof(Boolean),
};
static Boolean SetColor (Widget w, CSBColorSpace space, double c1, double c2, double c3, double c4, Bool setSpace);
static XtGeometryResult GeometryManager (Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed);
static void ChangeManaged (Widget w);
static void ClassInitialize (void);
/* Core class part */
{
/* class_name */ "ColorSelectionBox",
/* widget_size */ sizeof(ColorSelectionBoxRec),
/* class_initialize */ ClassInitialize,
/* class_part_initialize */ ClassPartInitialize,
/* class_inited */ False,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ True,
/* compress_exposure */ XtExposeCompressMultiple,
/* compress_enterleave */ True,
/* visible_interest */ False,
/* destroy */ Destroy,
/* resize */ Resize,
/* expose */ NULL,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback offsets */ NULL,
/* tm_table */ NULL,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ NULL,
/* extension */ NULL,
},
/* Composite class part */
{
/* geometry_manager */ GeometryManager,
/* change_managed */ ChangeManaged,
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
/* extension */ NULL,
},
/* Constraint class part */
{
/* resources */ NULL,
/* num_resources */ 0,
/* constraint_size */ 0,
/* initialize */ NULL,
/* destroy */ NULL,
/* set_values */ NULL,
/* extension */ NULL,
},
/* Manager class part */
{
/* translations */ XtInheritTranslations,
/* syn_resources */ NULL,
/* num_syn_resources */ 0,
/* syn_constraint_resources */ NULL,
/* num_syn_constraint_resources */ 0,
/* parent_process */ XmInheritParentProcess,
/* extension */ NULL,
},
/* ColorSelectionBox class part */
{
/* set_color */ SetColor,
/* get_color */ GetColor,
/* extension */ NULL,
}
};
{
return result;
} else return NULL;
}
{
register char ch;
register int i;
for (i = 0; i < size; i++) {
}
return TRUE;
}
/* ARGSUSED */
{
static CSBColorSpace c;
if (*num_args != 0) { /* Check for correct number */
"cvtStringToColorSpace", "wrongParameters",
"XtToolkitError",
"String to colorspace conversion needs no extra arguments",
}
/* Lower case the value */
/* Try to convert if a short enough string specified */
if (!badConvert) {
else badConvert = True;
}
/* String too long or unknown value -- issue warning */
if (badConvert) {
} else {
}
return !badConvert;
}
/* ARGSUSED */
{
static CSBRenderingType c;
if (*num_args != 0) { /* Check for correct number */
"cvtStringToRenderingType", "wrongParameters",
"XtToolkitError",
"String to rendering type conversion needs no extra arguments",
}
/* Lower case the value */
/* Try to convert if a short enough string specified */
if (!badConvert) {
else badConvert = True;
}
/* String too long or unknown value -- issue warning */
if (badConvert) {
} else {
}
return !badConvert;
}
static void ClassInitialize(void)
{
/* Register converters */
}
/* ARGSUSED */
{
}
}
}
static void ToUserSpace(
{
}
{
float w, h;
}
}
}
{
float w, h;
}
height);
height);
steps);
height);
steps);
}
}
{
float w, h;
}
height);
steps);
}
}
{
float w, h;
}
}
}
{
if (!XtIsRealized(csb)) return;
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
/* ARGSUSED */
static void FormResize(
Widget w,
{
}
}
}
}
static void FillCallbackRec(
{
}
/* ARGSUSED */
static void OKCallback(
Widget w,
{
}
/* ARGSUSED */
static void ApplyCallback(
Widget w,
{
}
/* ARGSUSED */
static void ResetCallback(
Widget w,
{
}
/* ARGSUSED */
static void CancelCallback(
Widget w,
{
}
/* ARGSUSED */
{
}
/* ARGSUSED */
static void ChangeLabelCallback(
Widget w,
{
}
{
}
{
}
typedef struct {
} RenderingRec;
/* ARGSUSED */
static void SetRenderingCallback(
Widget w,
{
}
{
RenderingRec *r;
r = XtNew(RenderingRec);
r->rendering = CSBDisplayDPS;
SetRenderingCallback, (XtPointer) r);
r = XtNew(RenderingRec);
r->rendering = CSBDisplayX;
SetRenderingCallback, (XtPointer) r);
r = XtNew(RenderingRec);
r->rendering = CSBDisplayBoth;
SetRenderingCallback, (XtPointer) r);
}
typedef struct {
int n;
} PaletteRec;
/* ARGSUSED */
static void SetPaletteCallback(
Widget w,
{
}
DrawPalette(p->csb);
}
{
int j, k;
PaletteRec *p;
j = 0;
for (k = 0; k < PALETTE_MAX; k++) {
p = XtNew(PaletteRec);
p->n = k;
NULL);
}
SetPaletteCallback, (XtPointer) p);
}
if (j != 0) XtManageChildren(managed, j);
}
{
int i;
int depth;
i = 0;
i = 0;
i = 0;
args, i);
(char *) heyedrop_bits,
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
palette_frame, args, i);
i = 0;
i = 0;
args, i);
i = 0;
i = 0;
args, i);
i = 0;
i = 0;
dock_frame, args, i);
{
int q;
}
}
i = 0;
i = 0;
w, args, i);
}
{
XtSetSensitive(w, False);
XtSetSensitive(w, False);
"noBackgroundMessage",
XtUnmanageChild(w);
XtUnmanageChild(w);
}
/* labelString is changed by this */
{
register char *ch;
int i;
ch = labelString;
for (i = 0; i < n; i++) {
*ch++ = '\0';
}
}
{
int i;
for (i = 0; i < 4; i++) {
}
}
}
{
XtManageChildren(children, n);
}
{
}
{
}
}
{
}
/* ARGSUSED */
static void SetRGBCallback(
Widget w,
{
int i, j;
j = 0;
for (i = 1; i < 3; i++) {
}
}
{
}
/* ARGSUSED */
static void SetCMYKCallback(
Widget w,
{
int i, j;
j = 0;
for (i = 1; i < 4; i++) {
}
}
{
}
/* ARGSUSED */
static void SetHSBCallback(
Widget w,
{
int i, j;
j = 0;
for (i = 1; i < 3; i++) {
}
}
{
}
/* ARGSUSED */
static void SetGrayCallback(
Widget w,
{
int i, j;
j = 0;
for (i = 1; i < 4; i++) {
}
}
{
}
{
}
{
double r, g, bl;
double h, s, b;
double f, m, n, k;
int i;
} else {
h = 6.0 * h;
if (h >= 6.0) h = 0.0;
i = (int) h;
f = h - (double)i;
m = b * (1.0 - s);
n = b * (1.0 - (s * f));
k = b * (1.0 - (s * (1.0 - f)));
switch(i) {
default:
case 0: r = b; g = k; bl = m; break;
case 1: r = n; g = b; bl = m; break;
case 2: r = m; g = b; bl = k; break;
case 3: r = m; g = n; bl = b; break;
case 4: r = k; g = m; bl = b; break;
case 5: r = b; g = m; bl = n; break;
}
}
}
{
double diff, x, r, g, b;
if (value != 0.0) {
if (diff != 0.0) {
}
}
}
static void UpdateColorSpaces(
{
switch (masterSpace) {
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
/* ARGSUSED */
static void Slider1Callback(
Widget w,
{
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
/* ARGSUSED */
static void Slider2Callback(
Widget w,
{
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
/* ARGSUSED */
static void Slider3Callback(
Widget w,
{
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
/* ARGSUSED */
static void Slider4Callback(
Widget w,
{
}
{
Colormap c;
return;
}
/* All we have to do is set the background; the expose event will
do the rest */
} else {
}
} else {
}
}
/* ARGSUSED */
static void FillPatchCallback(
Widget w,
{
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
case CSBDisplayDPS:
break;
case CSBDisplayX:
break;
case CSBDisplayBoth:
break;
}
}
/* The following function Copyright 1987, 1988 by Digital Equipment
Corporation, Maynard, Massachusetts, and the Massachusetts Institute of
Technology, Cambridge, Massachusetts. */
{
#ifndef X_NOT_POSIX
#else
int uid;
extern int getuid();
#ifndef SYSV386
#endif
#endif
} else {
}
else {
*buf = '\0';
}
}
}
if (ptr)
*buf = '/';
buf++;
*buf = '\0';
return buf;
}
{
int entry;
}
}
{
int entry;
(void) GetRootDirName(homeDir);
}
}
while (1) {
return;
}
}
}
}
}
{
int i;
(void) GetRootDirName(homeDir);
}
}
}
}
/* ARGSUSED */
static void DrawDockCallback(
Widget w,
{
}
{
float w, h;
int lines;
}
}
static void StoreColorInDock(
int x_offset,
int y_offset,
{
}
/* ARGSUSED */
static void DockPress(
Widget w,
{
}
{
int k;
for (k = 0; k < PALETTE_MAX; k++) {
"/palette%dfunc%d { %s } bind def\n", k, (int) csb,
}
}
}
{
int len;
char *buf;
Widget w;
}
static void DoPalette(
float w,
float h)
{
int steps;
int success;
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
} else {
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
if (!success) {
}
}
{
}
/* ARGSUSED */
static void DrawPaletteCallback(
{
int depth;
float w, h;
}
}
/* ARGSUSED */
static void PalettePress(
Widget w,
{
float pct;
int success;
case CSBSpaceRGB:
if (success) {
}
break;
case CSBSpaceCMYK:
if (success) {
}
break;
case CSBSpaceHSB:
if (success) {
}
break;
case CSBSpaceGray:
break;
}
} else {
case CSBSpaceRGB:
if (success) {
}
break;
case CSBSpaceCMYK:
if (success) {
}
break;
case CSBSpaceHSB:
if (success) {
}
break;
case CSBSpaceGray:
break;
}
}
else {
}
}
/* ARGSUSED */
static void DoEyedropCallback(
Widget w,
{
unsigned int x, y;
&x, &y);
if (x >= 32 && y >= 32) {
(char *) eyedrop32_bits,
(char *) eyedropmask32_bits,
} else {
(char *) eyedrop16_bits,
(char *) eyedropmask16_bits,
}
} else {
}
(void) XtGrabPointer(w, False,
}
/* ARGSUSED */
static void EyedropPointer(
Widget w,
{
unsigned int mask;
} else {
}
else {
}
}
}
}
}
/* ARGSUSED */
static void PatchPress(
Widget w,
{
(char *) squaremask_bits,
} else {
}
}
/* ARGSUSED */
static void PatchRelease(
Widget w,
{
}
}
static void GetVisualInfo(
{
int n;
if (n != 1) {
} else {
}
}
{
Colormap c;
int status;
unsigned long pix;
unsigned long mask;
} else {
}
else {
}
} else {
} else {
&pix, 1);
}
else {
}
}
}
/* ARGSUSED */
static void Initialize(
{
int i;
}
}
}
}
}
}
}
for (i = 0; i < PALETTE_MAX; i++) {
}
}
/* Get the context */
}
dps_init_bit_csb, &inited) ==
}
if (!inited) {
}
}
/* Initialize non-resource fields */
}
{
int i;
/* Lots of stuff to destroy! */
}
}
}
}
}
for (i = 0; i < PALETTE_MAX; i++) {
}
}
}
{
}
/* ARGSUSED */
Widget w,
{
if (WANTS(CWBorderWidth)) {
}
return XtGeometryYes;
}
{
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
{
Widget w;
default:
case CSBDisplayDPS:
break;
case CSBDisplayX:
break;
case CSBDisplayBoth:
break;
}
}
}
{
Widget w;
}
static void SetBaseGState(
{
int match;
/* If the context's colormap matches the widget's colormap, assume that
everything is already set up right in the color cube department. This
allows an application to supply us with a custom color cube by
installing it in the context before calling us */
if (match) {
} else {
(XDPSStandardColormap *) &grayRamp,
}
}
/* ARGSUSED */
{
Widget w = 0;
int i;
if (NE(rgb_labels)) {
}
if (NE(cmyk_labels)) {
}
if (NE(hsb_labels)) {
}
if (NE(gray_labels)) {
}
}
dps_init_bit_csb, &inited) ==
}
if (!inited) {
}
if (XtIsRealized(newcsb)) {
}
}
}
if (NE(broken_palette_label)) {
}
if (NE(broken_palette_message)) {
}
int i, min;
for (i = 0; i < min; i++) {
}
}
for (i = 0; i < PALETTE_MAX; i++) {
}
if (NE(palette_function[i])) {
"/palette%dfunc%d { %s } bind def\n", i,
/* Assume the best... */
XtManageChild(w);
} else {
XtUnmanageChild(w);
}
}
}
XtSetSensitive(w, True);
}
}
if (NE(current_palette)) {
}
}
if (NE(current_palette) ||
}
return False;
}
static void Realize(
Widget w,
{
Visual *v;
GetVisualInfo(csb, &v);
SetBaseGState(csb, v);
}
{
}
Widget w,
{
switch (space) {
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
return True;
}
Widget w,
{
return (*((ColorSelectionBoxWidgetClass) XtClass(w))->
}
static void GetColor(
Widget w,
{
switch (space) {
case CSBSpaceRGB:
break;
case CSBSpaceCMYK:
break;
case CSBSpaceHSB:
break;
case CSBSpaceGray:
break;
}
}
void CSBGetColor(
Widget w,
{
(*((ColorSelectionBoxWidgetClass) XtClass(w))->
}