xcolorsel-1.1a.orig/ 40755 1750 1750 0 5673421124 13537 5ustar vizzievizziexcolorsel-1.1a.orig/xcslicon100644 1750 1750 4666 5661510467 15423 0ustar vizzievizzie#define xcslicon_width 64 #define xcslicon_height 48 static char xcslicon_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x00, 0x42, 0x00, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x21, 0x00, 0x00, 0x00, 0x60, 0xe0, 0x43, 0x80, 0x20, 0x00, 0x00, 0x00, 0x20, 0xf0, 0x47, 0x80, 0x20, 0x00, 0x00, 0x00, 0x10, 0xf8, 0x8f, 0x80, 0x10, 0x00, 0x00, 0x00, 0x10, 0xfc, 0x8f, 0x40, 0x08, 0x00, 0x00, 0x00, 0x08, 0xfc, 0x8f, 0xe0, 0x06, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x8f, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x04, 0xc0, 0x87, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x2f, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x22, 0x40, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x22, 0x80, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x71, 0x04, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x49, 0x0e, 0xf8, 0x01, 0x00, 0x00, 0x41, 0x00, 0x29, 0xf2, 0x07, 0x06, 0x00, 0x00, 0x81, 0x80, 0x18, 0x05, 0x00, 0x08, 0x00, 0x00, 0x01, 0x7f, 0x88, 0x04, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x48, 0x04, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0xf0, 0x03, 0xe0, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf8, 0x41, 0x00, 0x00, 0x01, 0x30, 0x00, 0x00, 0xf8, 0x43, 0x00, 0x00, 0x01, 0xcc, 0x01, 0x00, 0xfc, 0x47, 0x00, 0x00, 0x02, 0x03, 0x02, 0x00, 0xfe, 0x4f, 0x00, 0x00, 0x02, 0x01, 0x02, 0x38, 0xfe, 0x4f, 0x00, 0x00, 0x82, 0x00, 0x04, 0x7c, 0xfc, 0x4f, 0x00, 0x00, 0x84, 0x00, 0x04, 0xfe, 0xfc, 0x2f, 0x00, 0x00, 0x08, 0x01, 0x04, 0xff, 0xf9, 0x27, 0x00, 0x00, 0x08, 0x01, 0x04, 0xff, 0xe1, 0x23, 0x00, 0x00, 0x10, 0x02, 0x02, 0xff, 0xc3, 0x21, 0x00, 0x00, 0x10, 0x0c, 0x82, 0xff, 0x03, 0x10, 0x00, 0x00, 0x20, 0xf0, 0x81, 0xff, 0x03, 0x10, 0x00, 0x00, 0x40, 0x00, 0x80, 0xff, 0x03, 0x10, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; xcolorsel-1.1a.orig/RgbSrc.c100644 1750 1750 22715 5661507707 15222 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSrc Object. This is a subclass of an AsciiSrc. It is designed to * * to be used by an RgbText Object. The only difference to an AsciiSrc is a special scan * * function. * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.c,v 1.4 91/02/17 16:18:42 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include #include #include "RgbSrcP.h" /* No resources */ /* No actions */ /* Both are in RgbText! */ /* No actions no translations */ static void initialize(Widget request, Widget new, ArgList args, Cardinal *numargs); static XawTextPosition myscan(Widget w, XawTextPosition position, XawTextScanType type, XawTextScanDirection dir, int count, Boolean include); RgbSrcClassRec rgbSrcClassRec = { { /* object fields */ /* ====== */ /* superclass */ (WidgetClass) &asciiSrcClassRec, /* class_name */ "RgbSrc", /* widget_size */ sizeof(RgbSrcRec), /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ initialize, /* initialize_hook */ NULL, /* realize */ NULL, /* actions */ NULL, /* num_actions */ 0, /* resources */ NULL, /* num_resources */ 0, /* xrm_class */ NULLQUARK, /* compress_motion */ 0, /* compress_exposure */ 0, /* compress_enterleave */ 0, /* visible_interest */ 0, /* destroy */ NULL, /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ NULL, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ NULL, /* display_accelerator */ NULL, /* extension */ NULL }, { /* text_src fields */ /* Read */ XtInheritRead, /* Replace */ XtInheritReplace, /* Scan */ (_XawTextPositionFunc)myscan, /* Search */ XtInheritSearch, /* SetSelection */ XtInheritSetSelection, /* ConvertSelection */ XtInheritConvertSelection, }, { /* ascii_src fields */ /* empty */ 0 }, { /* rgb_src fields */ /* empty */ 0 } }; WidgetClass rgbSrcObjectClass = (WidgetClass)&rgbSrcClassRec; #define rgbparent(widget) (*(RgbTextRec *)XtParent(widget)) #define myself(widget) (*(RgbSrcRec *)(widget)) static void initialize(Widget request, Widget new, ArgList args, Cardinal *numargs) { XtCheckSubclass(XtParent(new),rgbTextWidgetClass, "rgbSrc: Didn't I say that my parent has to be a subclass of RgbText?\n"); } static XawTextPosition myscan(Widget w, XawTextPosition position, XawTextScanType type, XawTextScanDirection dir, int count, Boolean include) { char *ptr,*start,*end; XawTextPosition offset; if(type!=XawstWhiteSpace) return (*(((AsciiSrcClassRec *)(rgbSrcClassRec.object_class.superclass))->text_src_class.Scan)) (w, position, type, dir, count, include); start=rgbparent(w).rgb_text.asciirep; while(count--) { /* find position in line: */ ptr=start+position; while(ptr>start) { if(*(ptr-1)=='\n')break; ptr--; } offset=position-(ptr-start); if(dir==XawsdLeft) { if(offset=rgbparent(w).rgb_text.endofrgb+3) { position=(end-ptr); if(include==True) position++; } else if(offset>=rgbparent(w).rgb_text.endofrgb) { position=rgbparent(w).rgb_text.endofrgb+3; position=0; } else if(offset>=rgbparent(w).rgb_text.startofrgb) { position=rgbparent(w).rgb_text.endofrgb; if(include==True) position=rgbparent(w).rgb_text.endofrgb+3; } else position=0; } position=((ptr+position)-start); } /*printf("%lu\n",(unsigned long)position);*/ return position; } xcolorsel-1.1a.orig/RgbTextP.h100644 1750 1750 21430 5662465436 15540 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /* This was inspirated from: */ /* $XConsortium: TemplateP.h,v 1.6 91/03/13 20:12:07 rws Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _RgbTextP_h #define _RgbTextP_h #include "RgbText.h" #include "config.h" #include #include typedef struct _colordef { unsigned short red, green, blue; /*Theoretic RGB*/ unsigned short r_red, r_green, r_blue; /* Realized on Screen */ unsigned short o_red, o_green, o_blue; /* Read in (non scaled) */ unsigned long flags; char *startofline; char *colorname; unsigned long pixtouse; struct _colordef *prev,*next; } colordef; /* Table of displayFormats : */ typedef struct { char *format_name; XcmsColorFormat format; } format_table; #define XcmsRGB4 0x10000000UL #define XcmsRGB8 0x10000001UL #define XcmsRGB12 0x10000002UL #define XcmsRGB16 0x10000003UL #define Xcmshash4 0x10000004UL #define Xcmshash8 0x10000005UL #define Xcmshash12 0x10000006UL #define Xcmshash16 0x10000007UL #define Xcmsinput 0x10000008UL typedef String (*RgbTextGetColorNameProc)( Widget w ); typedef int (*RgbTextGetColorSpecProc)( Widget w, XColor *color ); typedef void (*RgbTextFindColorProc)( Widget w, XColor *color, RgbTextAnswer *answer ); typedef void (*RgbTextGrabColorProc)( Widget w, RgbTextAnswerProc answer_proc ); typedef int (*RgbTextPrintColorProc)( Widget w, String destination, colordef *color, Boolean packed ); #define RgbTextInheritGetColorName ((RgbTextGetColorNameProc)_XtInherit) #define RgbTextInheritGetColorSpec ((RgbTextGetColorSpecProc)_XtInherit) #define RgbTextInheritFindColor ((RgbTextFindColorProc)_XtInherit) #define RgbTextInheritGrabColor ((RgbTextGrabColorProc)_XtInherit) #define RgbTextInheritPrintColor ((RgbTextPrintColorProc)_XtInherit) typedef struct { RgbTextGetColorNameProc get_color_name; RgbTextGetColorSpecProc get_color_spec; RgbTextFindColorProc find_color; RgbTextGrabColorProc grab_color; RgbTextPrintColorProc print_color; } RgbTextClassPart; typedef struct _RgbTextClassRec { CoreClassPart core_class; SimpleClassPart simple_class; TextClassPart text_class; RgbTextClassPart rgb_text_class; } RgbTextClassRec; extern RgbTextClassRec rgbTextClassRec; typedef struct { /* resources */ Dimension max_rows; Dimension rows; Dimension columns; Dimension tile_width; String file; String display_format; unsigned short max_red; unsigned short max_green; unsigned short max_blue; unsigned short max_intensity; unsigned short break_percentage; Boolean realized; Boolean comma; /* private state */ Boolean fileisin; Boolean grab_catched; Boolean ro_colors; unsigned short scale_red; unsigned short scale_green; unsigned short scale_blue; unsigned short c_red; unsigned short c_green; unsigned short c_blue; Dimension max_pixels; Dimension preferred_width; Dimension preferred_height; Dimension startofrgb; Dimension endofrgb; int saved_colormaps; Cardinal asciisize; Cardinal numcols; Cardinal diffcols; Cardinal realcols; Cardinal colsalloc; Cardinal numhits; Cardinal numexact; Cardinal offset; unsigned long break_value; XawTextPosition lasthead; XcmsColorFormat colformat; String asciirep; String origfile; String repres; colordef *colorlist; colordef *actual; colordef *first; Time grabtime; XColor grabcol; XColor *xcolors; Cursor grabcursor; GC colorgc; XcmsCCC myCCC; RgbTextAnswer answer; RgbTextAnswerProc grab_callback; Colormap *saved_maps; } RgbTextPart; typedef struct _RgbTextRec { CorePart core; SimplePart simple; TextPart text; RgbTextPart rgb_text; } RgbTextRec; #endif /* _RgbTextP_h */ xcolorsel-1.1a.orig/RgbText.h100644 1750 1750 27367 5661507731 15431 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /***************************************************************************************** * This defines a RgbText Widget. This is a subclass of an AsciiTextWidget. It displays * * the contents of an rgb.txt in a standard read-only AsciiTextWidget together with * * little tiles of color probes. Since it needs to allocate ReadWrite Colorcells at the * * Xserver often, this is done at initialization time. So a maximum number of displayed * * lines is needed. This is written in the max resource for correct interaction with * * constraint widgets. * * If the maximum Row number is exceeded, incorrect color values will be displayed. * * * *****************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* Additional Resources compared to the AsciiTextWidget are: Name Class RepType Default ---- ----- ------- ------- maxRows MaxRows Dimension 30 This is the number of writeable colorcells this widget allocates! Use with care! rows Rows Dimension 10 This is converted to pixels and returned as the preferred height of this widget columns Columns Dimension 30 Same as above but for columns. file File String "/usr/lib/X11/rgb.txt" The file to display tileWidth TileWidth Dimension 3 The width of the displayed colortiles measured in space characters grabCursor Cursor Cursor None The cursor to use for grabbing of colors. maxRed MaxRed Short 0 |The Maximum of these values and maxGreen MaxGreen Short 0 |the values in file is scaled to the maxBlue MaxBlue Short 0 |highest R/G/B-value on the screen (65535). maxIntensity MaxIntensity Short 255 Same as above, but applies to all R/G/B values. Note that since scaling from zero is impossible this value has to be at least 1. breakPercentage BreakPercentage Short 9500 The maximum percentage a color may differ from the selected color to be still found. displayFormat DisplayFormat String input The format in which the colors are printed. Allowed values are: rgb4, rgb8, rgb12, rgb16, rgb, rgbi, ciexyz, cieuvy, ciexyy, cielab, cieluv, tekhvc, #rgb, #rrggbb, #rrrgggbbb, #rrrrggggbbbb, input (These are the dezimal values out of file). (The value is not case sensitiv. However it is return be getvalue in same case as it was set) realized Realized Boolean True Show values the Xserver can actual display instead of the theoretic values. Has no effect for displayFormat: input comma Comma Boolean False Colorvalues are seperated by ", " instead of / Has no effect for displayFormat: #rgb,... Also C-style numberformats are used. string, type, editType are forced to the needed values. No resizes are made when rows or columns is changed! */ #ifndef _RgbText_h #define _RgbText_h #include #define XtNmaxRows "maxRows" #define XtNrows "rows" #define XtNcolumns "columns" #define XtNtileWidth "tileWidth" #define XtNmaxRed "maxRed" #define XtNmaxGreen "maxGreen" #define XtNmaxBlue "maxBlue" #define XtNmaxIntensity "maxIntensity" #define XtNbreakPercentage "breakPercentage" #define XtNgrabCursor "grabCursor" #define XtNdisplayFormat "displayFormat" #define XtNrealized "realized" #define XtNcomma "comma" #define XtCMaxRows "MaxRows" #define XtCRows "Rows" #define XtCColumns "Columns" #define XtCTileWidth "TileWidth" #define XtCMaxRed "MaxRed" #define XtCMaxGreen "MaxGreen" #define XtCMaxBlue "MaxBlue" #define XtCMaxIntensity "MaxIntensity" #define XtCBreakPercentage "BreakPercentage" #define XtCDisplayFormat "DisplayFormat" #define XtCRealized "Realized" #define XtCComma "Comma" /* All Values in Pixels! */ typedef struct { Cardinal offset; /* Number of selected hit (1..numhits), 0 if no hit exists. */ /* (One is best hit) */ Cardinal numhits; /* number of all hits */ Cardinal numexact; /* number of exact hits */ Dimension percentage; /* Exactness of hit in percents*100 (for example 4235 = 42.35% ) */ String repres; /* Pointer to READ-ONLY! ascii repres of searched color */ } RgbTextAnswer; typedef void (* RgbTextAnswerProc)(Widget w, XColor *color, RgbTextAnswer *answer); extern String GetRgbFile(Widget w); /* get the pointer to the name of the file that was read in (read only) valid until widget is destroyed, NULL is returned if none is defined */ extern Cardinal GetNumEntries(Widget w); /* get the number of lines read in */ extern Cardinal GetNumDifferent(Widget w); /* number of different colors defined */ extern Cardinal GetNumRealisable(Widget w); /* get the number of different colors when realised on the screen */ extern Dimension GetMaxPixels(Widget w); /* get the maximum height allowed in pixels. */ extern String GetColorName(Widget w); /* Gets the name of the Color in the line in which the selection starts, or if there is no selection in which the cursor (caret) is positioned. If there is no caret shown, NULL is returned. The pointer points to read only data!!! It is valid until a new rgb-file via set-value file is set or the widget is deleted. */ extern int GetColorSpec(Widget w, XColor *color); /* Same as above, but returns the color itself. The index value is set to 0; flags to DoRed|DoGreen|DoBlue; If 0 is returned, there is no color selected and black was returned. */ extern void FindColor(Widget w, XColor *color, RgbTextAnswer *answer); /* if color == NULL, the offset-th hit is found. If color != NULL then the given color is searched. In both cases all fields of answer are set to the actual values. */ extern void GrabColor(Widget w, RgbTextAnswerProc answer_proc); /* same as FindColor, but a pointer grab is done, and the user can select any point on the screen, which is then given to FindColor. FindColor's answer is then returned by calling answer_proc(w,color,answer). The grabbed color is copied to color (with flags set to DoRed|DoBlue|DoGreen). answer and color are returned in read-only buffers, that are changed in the next call to GrabColor on this widget. These buffers remain valid and are the same until the rgbTextWidget is destroyed. */ /* Miscanellous */ typedef struct _RgbTextClassRec * RgbTextWidgetClass; typedef struct _RgbTextRec * RgbTextWidget; extern WidgetClass rgbTextWidgetClass; #endif /* _RgbText_h */ xcolorsel-1.1a.orig/RgbSrcP.h100644 1750 1750 14770 5661507722 15346 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSrc Object. This is a subclass of an AsciiSrc. It is designed to * * to be used by an RgbText Object. The only difference to an AsciiSrc is a special scan * * function. * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _RgbSrcP_h #define _RgbSrcP_h #include "RgbSrc.h" #include "config.h" /* include superclass private header file */ #include /* This is closely related to and uses parts of: */ #include "RgbTextP.h" /* define unique representation types not found in */ typedef struct { int empty; } RgbSrcClassPart; typedef struct _RgbSrcClassRec { ObjectClassPart object_class; TextSrcClassPart text_src_class; AsciiSrcClassPart ascii_src_class; RgbSrcClassPart rgb_src_class; } RgbSrcClassRec; extern RgbSrcClassRec rgbSrcClassRec; typedef struct { /* resources */ /* None!*/ /* private state */ /* none too! */ int empty; } RgbSrcPart; typedef struct _RgbSrcRec { ObjectPart object; TextSrcPart text_src; AsciiSrcPart ascii_src; RgbSrcPart rgb_src; } RgbSrcRec; #endif /* _RgbSrcP_h */ xcolorsel-1.1a.orig/RgbText.c100644 1750 1750 145777 5673416207 15452 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /* WARNING! This code depends from unsigned long being at least 32 bit long!!!!!! */ /* This was inspirated from: */ /* $XConsortium: Template.c,v 1.4 91/02/17 16:18:42 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include #include /* And here we have a special gift for all SUN's outside >;-> */ #include #include #include #include #include #include #include #include "RgbTextP.h" #include "RgbSinkP.h" #include "RgbSrc.h" #ifndef max #define max(a,b) (((a)>(b))?(a):(b)) #endif /* Find current Xrelease number */ #ifndef LIB_X11R6 #ifndef LIB_X11R5 #if XlibSpecificationRelease == 6 #define LIB_X11R6 #else #if XlibSpecificationRelease == 5 #define LIB_X11R5 #else #error Could not determine which Xlib is used, define LIB_X11R5 or LIB_X11R6. #endif /* XLibSpecificationRelease==5 */ #endif /* XLibSpecificationRelease==6 */ #endif /* LIB_X11R5 */ #endif /* LIB_X11R6 */ /* The maximal length of all ascii representation of color values in all color spaces:*/ #define MAXCOLORLEN 40 format_table formats[]={ {"rgb", XcmsRGB16}, {"rgb4", XcmsRGB4}, {"rgb8", XcmsRGB8}, {"rgb12", XcmsRGB12}, {"rgb16", XcmsRGB16}, {"#rgb", Xcmshash4}, {"#rrggbb", Xcmshash8}, {"#rrrgggbbb", Xcmshash12}, {"#rrrrggggbbbb", Xcmshash16}, {"input", Xcmsinput}, {"ciexyz", XcmsCIEXYZFormat}, {"cieuvy", XcmsCIEuvYFormat}, {"ciexyy", XcmsCIExyYFormat}, {"cielab", XcmsCIELabFormat}, {"cieluv", XcmsCIELuvFormat}, {"tekhvc", XcmsTekHVCFormat}, {"rgbi", XcmsRGBiFormat}, {NULL, XcmsUndefinedFormat}, }; #define THIRDPART +(~0UL/3UL) /* Maximum number an unsigned long can hold divided by 3 */ Cursor defaultcursor=None; static XtResource resources[] = { #define offset(field) XtOffsetOf(RgbTextRec, rgb_text.field) /* {name, class, type, size, offset, default_type, default_addr}, */ { XtNmaxRows, XtCMaxRows, XtRDimension, sizeof(Dimension), offset(max_rows), XtRString, (XtPointer) "30" }, { XtNrows, XtCRows, XtRDimension, sizeof(Dimension), offset(rows), XtRString, (XtPointer) "10" }, { XtNcolumns, XtCColumns, XtRDimension, sizeof(Dimension), offset(columns), XtRString, (XtPointer) "30" }, { XtNfile, XtCFile, XtRString, sizeof(String), offset(file), XtRString, (XtPointer) "/usr/lib/X11/rgb.txt" }, { XtNtileWidth, XtCTileWidth, XtRDimension, sizeof(Dimension), offset(tile_width), XtRString, (XtPointer) "3" }, { XtNmaxRed, XtCMaxRed, XtRShort, sizeof(unsigned short), offset(max_red), XtRString, (XtPointer) "0" }, { XtNmaxGreen, XtCMaxGreen, XtRShort, sizeof(unsigned short), offset(max_green), XtRString, (XtPointer) "0" }, { XtNmaxBlue, XtCMaxBlue, XtRShort, sizeof(unsigned short), offset(max_blue), XtRString, (XtPointer) "0" }, { XtNmaxIntensity, XtCMaxIntensity, XtRShort, sizeof(unsigned short), offset(max_intensity), XtRString, (XtPointer) "255" }, { XtNbreakPercentage, XtCBreakPercentage, XtRShort, sizeof(unsigned short), offset(break_percentage), XtRString, (XtPointer) "9500" }, { XtNgrabCursor, XtCCursor, XtRCursor, sizeof(Cursor), offset(grabcursor), XtRCursor, &defaultcursor }, { XtNdisplayFormat, XtCDisplayFormat, XtRString, sizeof(String), offset(display_format), XtRString, (XtPointer) "input" }, { XtNrealized, XtCRealized, XtRBoolean, sizeof(Boolean), offset(realized), XtRString, (XtPointer) "True"}, { XtNcomma, XtCComma, XtRBoolean, sizeof(Boolean), offset(comma), XtRString, (XtPointer) "False"}, #undef offset }; static unsigned long abssqr(unsigned short a,unsigned short b); static void checknhang(Widget w,colordef *owncolor,colordef *colorli); static void EventHandler(Widget w, XtPointer dummy, XEvent *event, Boolean *cont); static void class_part_init(WidgetClass wc); static void init(Widget request, Widget new, ArgList args, Cardinal *num_args); static String color_name(Widget w); static int color_spec(Widget w,XColor *color); static void find_color(Widget w, XColor *color, RgbTextAnswer *answer); static void grab_color(Widget w, RgbTextAnswerProc answer); static Boolean set_values(Widget current, Widget request, Widget new, ArgList arg, Cardinal *numargs); static XtGeometryResult query_geometry(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *preferred); static void set_values_almost(Widget old, Widget new, XtWidgetGeometry *request, XtWidgetGeometry *reply); static void destroy(Widget w); static void destroyfile(Widget w); static Boolean getfile(Widget current, Widget new); static void printfile(Widget current, Widget new, Boolean force); static int cmp_cols(colordef *a,colordef *b); static colordef *get_selection(Widget w); static colordef *get_cdef(Widget w, XawTextPosition pos); static int print_color(Widget w, String destination, colordef *color, Boolean packed); static int c_needed(unsigned int value); RgbTextClassRec rgbTextClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &textClassRec, /* class_name */ "RgbText", /* widget_size */ sizeof(RgbTextRec), /* class_initialize */ NULL, /* class_part_initialize */ class_part_init, /* class_inited */ FALSE, /* initialize */ init, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ TRUE, /* destroy */ destroy, /* resize */ XtInheritResize, /* expose */ XtInheritExpose, /* set_values */ set_values, /* set_values_hook */ NULL, /* set_values_almost */ set_values_almost, /* get_values_hook */ NULL, /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ XtInheritTranslations, /* query_geometry */ query_geometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* simple fields */ /* change_sensitive */ XtInheritChangeSensitive }, { /* text fields */ /* empty */ 0 }, { /* rgb_text fields */ /* get_color_name */ color_name, /* get_color_spec */ color_spec, /* find_color */ find_color, /* grab_color */ grab_color, /* print_color */ print_color, } }; WidgetClass rgbTextWidgetClass = (WidgetClass)&rgbTextClassRec; #define myself(widget) (*(RgbTextRec *)(widget)) #define mysink(widget) (*(RgbSinkRec *)(*(RgbTextRec *)(widget)).text.sink) #define myprint(w,d,c,p) ((*(((RgbTextClassRec *)XtClass(w))->rgb_text_class.print_color))(w,d,c,p)) static void class_part_init(WidgetClass wc) { register RgbTextClassRec *classptr,*loopptr; ((RgbTextClassRec *)wc)->core_class.compress_motion= ((TextClassRec *)(rgbTextClassRec.core_class.superclass))->core_class.compress_motion; ((RgbTextClassRec *)wc)->core_class.compress_exposure= ((TextClassRec *)(rgbTextClassRec.core_class.superclass))->core_class.compress_exposure; ((RgbTextClassRec *)wc)->core_class.compress_enterleave= ((TextClassRec *)(rgbTextClassRec.core_class.superclass))->core_class.compress_enterleave; ((RgbTextClassRec *)wc)->core_class.visible_interest= ((TextClassRec *)(rgbTextClassRec.core_class.superclass))->core_class.visible_interest; /* Enter inheriting here: */ classptr=(RgbTextClassRec *)wc; loopptr=classptr; while(loopptr->rgb_text_class.get_color_name==RgbTextInheritGetColorName) { loopptr=(RgbTextClassRec *)classptr->core_class.superclass; } classptr->rgb_text_class.get_color_name=loopptr->rgb_text_class.get_color_name; loopptr=classptr; while(loopptr->rgb_text_class.get_color_spec==RgbTextInheritGetColorSpec) { loopptr=(RgbTextClassRec *)classptr->core_class.superclass; } classptr->rgb_text_class.get_color_spec=loopptr->rgb_text_class.get_color_spec; loopptr=classptr; while(loopptr->rgb_text_class.find_color==RgbTextInheritFindColor) { loopptr=(RgbTextClassRec *)classptr->core_class.superclass; } classptr->rgb_text_class.find_color=loopptr->rgb_text_class.find_color; loopptr=classptr; while(loopptr->rgb_text_class.grab_color==RgbTextInheritGrabColor) { loopptr=(RgbTextClassRec *)classptr->core_class.superclass; } classptr->rgb_text_class.grab_color=loopptr->rgb_text_class.grab_color; } String GetColorName(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetColorName on non RgbTextWidget\n"); return (*((RgbTextClassRec *)XtClass(w))->rgb_text_class.get_color_name)(w); } int GetColorSpec(Widget w, XColor *color) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetColorSpec on non RgbTextWidget\n"); return (*((RgbTextClassRec *)XtClass(w))->rgb_text_class.get_color_spec)(w,color); } static Boolean getfile(Widget current, Widget new) { unsigned short mred,mgreen,mblue; long retval; register size_t i,j; register char *ptr,*ptn; Cardinal dummy; size_t origsize; char *tailptr; FILE *fd; if( (myself(current).rgb_text.file==myself(new).rgb_text.file) && (myself(new).rgb_text.fileisin==True) ) return False; mred=myself(new).rgb_text.max_red; mgreen=myself(new).rgb_text.max_green; mblue=myself(new).rgb_text.max_blue; mred=max(mred,myself(new).rgb_text.max_intensity); mblue=max(mblue,myself(new).rgb_text.max_intensity); mgreen=max(mgreen,myself(new).rgb_text.max_intensity); destroyfile(new); myself(new).rgb_text.fileisin=True; if(!(fd=fopen(((RgbTextRec *)new)->rgb_text.file,"r"))) { dummy=1; XtErrorMsg("nofile","nofile","Fileio","Cannot open RgbTxtFile \"%s\".", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } /* find out the size of the file */ if(fseek(fd,0L,SEEK_END)) { seker: dummy=0; XtErrorMsg("seeker","seeker","Fileio","Seek error on RgbTxtFile.", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } retval=ftell(fd); if(retval<0) { dummy=0; XtErrorMsg("teller","seeker","Fileio","Cannot tell RgbTxtFile position.", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } if(fseek(fd,0L,SEEK_SET)) goto seker; origsize=retval; origsize++; /* Just for convenience */ if(!(((RgbTextRec *)new)->rgb_text.origfile=malloc(origsize))) { nomem: dummy=1; XtErrorMsg("nomem","nomem","Memory","Not enough memory to scan \"%s\".", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } if(1!=fread(((RgbTextRec *)new)->rgb_text.origfile,origsize-1,1L,fd)) { dummy=1; XtErrorMsg("reader","reader","Fileio","Read error on \"%s\".", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } *(((RgbTextRec *)new)->rgb_text.origfile+origsize-1)='\n'; fclose(fd); /*Pass one, count input lines */ ((RgbTextRec *)new)->rgb_text.numcols=0; ptr=((RgbTextRec *)new)->rgb_text.origfile; while(ptr<(((RgbTextRec *)new)->rgb_text.origfile+origsize-1)) { /*skip leading whitespace, watch EOF! */ while(isspace(*ptr)) { ptr++; if(ptr>=(((RgbTextRec *)new)->rgb_text.origfile+origsize-1)) goto breakout; } if(isdigit(*ptr))((RgbTextRec *)new)->rgb_text.numcols++; ptn=strchr(ptr,'\n'); if(!ptn){ ptn=strchr(ptr,0); while(!*ptn)ptn++; } ptr=ptn; } breakout: /*Pass two, setup colordef array*/ if(!(((RgbTextRec *)new)->rgb_text.colorlist=malloc((((RgbTextRec *)new)->rgb_text.numcols+1)*sizeof(colordef)))) goto nomem; i=0; ptr=((RgbTextRec *)new)->rgb_text.origfile; ((RgbTextRec *)new)->rgb_text.asciisize=0; while(i<((RgbTextRec *)new)->rgb_text.numcols) { /*skip leading whitespace */ while(!*ptr)ptr++; while(isspace(*ptr))ptr++; if(isdigit(*ptr)) { /*Accept this line as colordef*/ retval=strtol(ptr,&tailptr,0); if((tailptr==ptr)||(retval<0)||(retval>255)) { invalid: ((RgbTextRec *)new)->rgb_text.numcols--; goto skiptoend; } ((RgbTextRec *)new)->rgb_text.colorlist[i].red= ((RgbTextRec *)new)->rgb_text.colorlist[i].o_red=retval; mred=max(mred,((RgbTextRec *)new)->rgb_text.colorlist[i].o_red); ptr=tailptr; retval=strtol(ptr,&tailptr,0); if((tailptr==ptr)||(retval<0)||(retval>255)) goto invalid; ((RgbTextRec *)new)->rgb_text.colorlist[i].green= ((RgbTextRec *)new)->rgb_text.colorlist[i].o_green=retval; mgreen=max(mgreen,((RgbTextRec *)new)->rgb_text.colorlist[i].o_green); ptr=tailptr; retval=strtol(ptr,&tailptr,0); if((tailptr==ptr)||(retval<0)||(retval>255)) goto invalid; ((RgbTextRec *)new)->rgb_text.colorlist[i].blue= ((RgbTextRec *)new)->rgb_text.colorlist[i].o_blue=retval; mblue=max(mblue,((RgbTextRec *)new)->rgb_text.colorlist[i].o_blue); ptr=tailptr; while((*ptr!='\n')&&isspace(*ptr))ptr++; ((RgbTextRec *)new)->rgb_text.colorlist[i].colorname=ptr; ptn=strchr(ptr,'\n'); if(ptn)*ptn=0; ((RgbTextRec *)new)->rgb_text.asciisize+=strlen(ptr); ptr=ptn; i++; continue; } skiptoend: ptn=strchr(ptr,'\n'); if(!ptn) ptn=strchr(ptr,0); ptr=ptn; } myself(new).rgb_text.scale_red=(65535L/mred); myself(new).rgb_text.scale_green=(65535L/mgreen); myself(new).rgb_text.scale_blue=(65535L/mblue); myself(new).rgb_text.c_red=c_needed(mred); myself(new).rgb_text.c_green=c_needed(mgreen); myself(new).rgb_text.c_blue=c_needed(mblue); if(!myself(new).rgb_text.ro_colors) { /* Find colors in a r/w colormap and arrange pixelvalues.. */ for(i=0;irgb_text.endofrgb=((RgbTextRec *)new)->rgb_text.tile_width+retval+1; mysize=((RgbTextRec *)new)->rgb_text.asciisize+((RgbTextRec *)new)->rgb_text.numcols* (retval+5L+((RgbTextRec *)new)->rgb_text.tile_width)+1; if(!(((RgbTextRec *)new)->rgb_text.asciirep=malloc(mysize))) { dummy=0; XtErrorMsg("nomem","nomem","Memory","Not enough memory to scan RgbTxtFile.", &(((RgbTextRec *)new)->rgb_text.file),&dummy); } ptr=((RgbTextRec *)new)->rgb_text.asciirep; /* Ensure empty string when numcols == 0 */ *ptr=0; for(i=0;i<((RgbTextRec *)new)->rgb_text.numcols;i++) { ((RgbTextRec *)new)->rgb_text.colorlist[i].startofline=ptr; for(j=0;j<=((RgbTextRec *)new)->rgb_text.tile_width;j++) *ptr++ = ' '; ptr+=myprint(new,ptr,((RgbTextRec *)new)->rgb_text.colorlist+i,False); sprintf(ptr," - %s\n",((RgbTextRec *)new)->rgb_text.colorlist[i].colorname); ptr=strchr(ptr,0); } if(myself(new).rgb_text.numcols && (myself(new).rgb_text.comma!=False)) { ptr=myself(new).rgb_text.colorlist[i-1].startofline; tailptr=strchr(ptr,':'); if(tailptr) ((RgbTextRec *)new)->rgb_text.startofrgb=(tailptr-ptr)+2; else ((RgbTextRec *)new)->rgb_text.startofrgb=((RgbTextRec *)new)->rgb_text.tile_width+1; } else myself(new).rgb_text.startofrgb=myself(new).rgb_text.tile_width+1; ((RgbTextRec *)new)->rgb_text.colorlist[i].startofline=ptr; XtSetArg(largs[0], XtNstring, ((RgbTextRec *)new)->rgb_text.asciirep ); XtSetValues(new, largs, 1); } static void init(Widget request, Widget new, ArgList args, Cardinal *num_args) { Widget sink,source; Arg largs[10]; ArgList newargs; Cardinal dummy=1; int idummy=0; XGCValues GCdummy; XVisualInfo vis_info, *vis_ptr; unsigned long *pixvals; register size_t i; format_table *form_ptr; ((RgbTextRec *)new)->rgb_text.asciirep=""; ((RgbTextRec *)new)->rgb_text.actual=NULL; ((RgbTextRec *)new)->rgb_text.first=NULL; ((RgbTextRec *)new)->rgb_text.fileisin=False; ((RgbTextRec *)new)->rgb_text.actual=NULL; ((RgbTextRec *)new)->rgb_text.numhits=0; ((RgbTextRec *)new)->rgb_text.numexact=0; ((RgbTextRec *)new)->rgb_text.repres=XtMalloc((size_t)(MAXCOLORLEN+1)); ((RgbTextRec *)new)->rgb_text.grab_callback=NULL; /* Set colorformat: */ myself(new).rgb_text.colformat=Xcmsinput; for(form_ptr=formats;(form_ptr->format_name); form_ptr++) { if(!strcasecmp(form_ptr->format_name,myself(new).rgb_text.display_format)) { myself(new).rgb_text.colformat=form_ptr->format; break; } } XtInsertEventHandler(new, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, False, EventHandler, NULL, XtListHead); XtSetArg (largs[0], XtNstring, ((RgbTextRec *)new)->rgb_text.asciirep); XtSetArg (largs[1], XtNuseStringInPlace, True); XtSetArg (largs[2], XtNeditType, XawtextRead); newargs=XtMergeArgLists(args,*num_args,largs,3); source=XtCreateWidget("source",rgbSrcObjectClass,new,newargs,*num_args+3); sink=XtCreateWidget("sink",rgbSinkObjectClass,new,newargs,*num_args+3); /* Idiotic prototype of XtFree(char *) requires casting: */ XtFree((void *)newargs); ((RgbTextRec *)new)->rgb_text.colorgc=XtAllocateGC( new,0,0,&GCdummy,GCForeground, GCLineWidth|GCLineStyle|GCFillRule|GCFont|GCGraphicsExposures| GCDashOffset|GCDashList|GCArcMode); myself(new).rgb_text.myCCC=XcmsCCCOfColormap(XtDisplay(new),myself(new).core.colormap); vis_info.visualid=XVisualIDFromVisual(VisualOfCCC(myself(new).rgb_text.myCCC)); vis_ptr=XGetVisualInfo(XtDisplay(new),VisualIDMask,&vis_info,&idummy); if(!vis_ptr) { char tmpc[20],*tmpptr=tmpc; sprintf(tmpc,"0x%lx",vis_info.visualid); dummy=1; XtErrorMsg("novisual","nocol","ColorAlloc","Cannot get visual info for ID %s.", &tmpptr,&dummy); } switch(vis_ptr->class) { case PseudoColor: case GrayScale: case DirectColor: ((RgbTextRec *)new)->rgb_text.ro_colors=False; break; case StaticColor: case StaticGray: case TrueColor: ((RgbTextRec *)new)->rgb_text.ro_colors=True; break; default: { char tmpc[20],*tmpptr=tmpc; sprintf(tmpc,"0x%x",vis_ptr->class); dummy=1; XtErrorMsg("visual","nocol","ColorAlloc","Unknown/Unsupported Visual %s.", &tmpptr,&dummy); } } if(!((RgbTextRec *)new)->rgb_text.ro_colors) { ((RgbTextRec *)new)->rgb_text.colsalloc=((RgbTextRec *)new)->rgb_text.max_rows; pixvals=malloc(((size_t)(((RgbTextRec *)new)->rgb_text.colsalloc))*sizeof(unsigned long)); ((RgbTextRec *)new)->rgb_text.xcolors= malloc(((size_t)(((RgbTextRec *)new)->rgb_text.colsalloc))*sizeof(XColor)); if((!pixvals)||(!((RgbTextRec *)new)->rgb_text.xcolors)) { dummy=0; XtErrorMsg("nomemcol","nomem","ColorAlloc","Not enough memory for colortable.\nReduce maxRows!.", &(((RgbTextRec *)request)->rgb_text.file),&dummy); } for(;;) { if(XAllocColorCells(XtDisplay(new), ((RgbTextRec *)new)->core.colormap,FALSE, NULL,0,pixvals,((RgbTextRec *)new)->rgb_text.colsalloc)) break; if(((RgbTextRec *)new)->rgb_text.colsalloc==1) { dummy=0; XtErrorMsg("nocol","nocol","ColorAlloc","Cannot allocate any color.", &(((RgbTextRec *)request)->rgb_text.file),&dummy); } ((RgbTextRec *)new)->rgb_text.colsalloc--; } for(i=0;i<((RgbTextRec *)new)->rgb_text.colsalloc;i++) { ((RgbTextRec *)new)->rgb_text.xcolors[i].flags=DoRed|DoGreen|DoBlue; ((RgbTextRec *)new)->rgb_text.xcolors[i].pixel=pixvals[i]; } if(((RgbTextRec *)new)->rgb_text.max_rows!=((RgbTextRec *)new)->rgb_text.colsalloc) { char tmpc[2][20]; char *(tmpptr)[3]; tmpptr[0]=tmpc[0]; tmpptr[1]=tmpc[0]; tmpptr[2]=tmpc[1]; sprintf(tmpc[0],"%lu",(unsigned long)((RgbTextRec *)new)->rgb_text.colsalloc); sprintf(tmpc[1],"%lu",(unsigned long)((RgbTextRec *)new)->rgb_text.max_rows); dummy=3; XtWarningMsg("somecol","somecol","ColorAlloc", "Warning: Only %s colors available.\n" "Setting maxRows to %s instead of %s!", tmpptr,&dummy); } ((RgbTextRec *)new)->rgb_text.max_rows=((RgbTextRec *)new)->rgb_text.colsalloc; free(pixvals); } else myself(new).rgb_text.colsalloc=0; XtSetArg (largs[0], XtNtextSink, sink); XtSetArg (largs[1], XtNtextSource, source); XtSetValues(new, largs, 2); XtSetArg (largs[0], XtNwidth, myself(new).rgb_text.preferred_width); XtSetArg (largs[1], XtNheight, myself(new).rgb_text.preferred_height); XtSetValues(new, largs, 2); } static void destroy(Widget w) { XtReleaseGC(w,((RgbTextRec *)w)->rgb_text.colorgc); XcmsFreeCCC(myself(w).rgb_text.myCCC); free(((RgbTextRec *)w)->rgb_text.xcolors); destroyfile(w); XtRemoveEventHandler(w, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, False, EventHandler, NULL); } static void destroyfile(Widget w) { if(myself(w).rgb_text.fileisin==True) { if(((RgbTextRec *)w)->rgb_text.asciirep) free(((RgbTextRec *)w)->rgb_text.asciirep); free(((RgbTextRec *)w)->rgb_text.origfile); if(myself(w).rgb_text.ro_colors) { int i; for(i=0;irgb_text.colorlist); ((RgbTextRec *)w)->rgb_text.asciirep=NULL; myself(w).rgb_text.fileisin=False; } } static String color_name(Widget w) { colordef *ptr; ptr=get_selection(w); if(!ptr) return NULL; return ptr->colorname; } static int color_spec(Widget w,XColor *color) { colordef *ptr; color->pixel=0; color->flags=DoRed|DoGreen|DoBlue; ptr=get_selection(w); if(!ptr) { color->red=color->green=color->blue=0; return 0; } color->red=ptr->red; color->green=ptr->green; color->blue=ptr->blue; return 0; } static Boolean set_values(Widget current, Widget request, Widget new, ArgList arg, Cardinal *numargs) { unsigned int lineheight,cellwidth; format_table *form_ptr; Arg largs[1]; if(myself(new).rgb_text.max_intensity<1) myself(new).rgb_text.max_intensity=1; if(myself(new).rgb_text.break_percentage>=10000) { myself(new).rgb_text.break_percentage=10000; myself(new).rgb_text.break_value=0; } else { if(myself(new).rgb_text.break_percentage<=3333) myself(new).rgb_text.break_percentage=3334; myself(new).rgb_text.break_value= (10000L-myself(new).rgb_text.break_percentage)*0x65535L+5000L; myself(new).rgb_text.break_value/=10000; myself(new).rgb_text.break_value*=0x10001UL; } #ifdef LIB_X11R6 lineheight=mysink(new).ascii_sink.font->ascent+mysink(new).ascii_sink.font->descent; cellwidth=XTextWidth(mysink(new).ascii_sink.font," ",1); #else lineheight=mysink(new).text_sink.font->ascent+mysink(new).text_sink.font->descent; cellwidth=XTextWidth(mysink(new).text_sink.font," ",1); #endif if(myself(new).rgb_text.colsalloc) { if(myself(new).rgb_text.colsallocformat_name); form_ptr++) { if(!strcasecmp(form_ptr->format_name,myself(new).rgb_text.display_format)) { myself(new).rgb_text.colformat=form_ptr->format; break; } } printfile(current, new, getfile(current, new)); return False; } static XtGeometryResult query_geometry(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *preferred) { XtGeometryMask requested; XtGeometryResult result=XtGeometryYes; if((myself(w).core.height==myself(w).rgb_text.preferred_height)&& (myself(w).core.width==myself(w).rgb_text.preferred_width)) return XtGeometryNo; if(request->request_mode&CWWidth) { if(request->width!=myself(w).rgb_text.preferred_width) preferred->width=myself(w).rgb_text.preferred_width; result=XtGeometryAlmost; } if(request->request_mode&CWHeight) { if(request->height!=myself(w).rgb_text.preferred_height) preferred->height=myself(w).rgb_text.preferred_height; result=XtGeometryAlmost; } preferred->request_mode=request->request_mode&(CWWidth|CWHeight); return result; } static void set_values_almost(Widget old, Widget new, XtWidgetGeometry *request, XtWidgetGeometry *reply) { reply=request; if(request->request_mode&CWHeight) { if(request->height>myself(new).rgb_text.max_pixels) reply->height=myself(new).rgb_text.max_pixels; } } String GetRgbFile(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetRgbFile on non RgbTextWidget\n"); return myself(w).rgb_text.file; } Cardinal GetNumEntries(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetNumEntries on non RgbTextWidget\n"); if( myself(w).rgb_text.fileisin != True ) return 0; return myself(w).rgb_text.numcols; } Cardinal GetNumDifferent(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetNumDifferent on non RgbTextWidget\n"); if( myself(w).rgb_text.fileisin != True ) return 0; return myself(w).rgb_text.diffcols; } Cardinal GetNumRealisable(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetNumRealisable on non RgbTextWidget\n"); if( myself(w).rgb_text.fileisin != True ) return 0; return myself(w).rgb_text.realcols; } Dimension GetMaxPixels(Widget w) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GetMaxPixels on non RgbTextWidget\n"); return myself(w).rgb_text.max_pixels; } static int cmp_cols(colordef *a,colordef *b) { int retval=0; if((a->red==b->red)&&(a->green==b->green)&&(a->blue==b->blue)) retval|=1; if((a->r_red==b->r_red)&&(a->r_green==b->r_green)&&(a->r_blue==b->r_blue)) retval|=2; return retval; } static colordef *get_cdef(Widget w, XawTextPosition pos) { char * liptr; size_t first,last,new; liptr=myself(w).rgb_text.asciirep+pos; first=0; last=myself(w).rgb_text.numcols-1; while(last-first>1) { new=(first+last)/2; if(myself(w).rgb_text.colorlist[new].startofline<=liptr) first=new; else last=new; } if(myself(w).rgb_text.colorlist[last].startofline<=liptr) new=last; else new=first; return myself(w).rgb_text.colorlist+new; } static colordef *get_selection(Widget w) { XawTextPosition begin,end; XawTextGetSelectionPos(w,&begin,&end); if(begin==end) { if(myself(w).text.display_caret!=True) return NULL; begin=XawTextGetInsertionPoint(w); } return get_cdef(w,begin); } void FindColor(Widget w, XColor *color, RgbTextAnswer *answer) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply FindColor on non RgbTextWidget\n"); (*((RgbTextClassRec *)XtClass(w))->rgb_text_class.find_color)(w,color,answer); } void GrabColor(Widget w, RgbTextAnswerProc answer_proc) { XtCheckSubclass(w, rgbTextWidgetClass, "Cannot apply GrabColor on non RgbTextWidget\n"); (*((RgbTextClassRec *)XtClass(w))->rgb_text_class.grab_color)(w,answer_proc); } static void find_color(Widget w, XColor *color, RgbTextAnswer *answer) { colordef owncolor; answer->repres=myself(w).rgb_text.repres; if(color) { register size_t i; colordef *colorli; myself(w).rgb_text.numhits=0; myself(w).rgb_text.numexact=0; myself(w).rgb_text.first=NULL; owncolor.red=owncolor.r_red=owncolor.o_red=color->red; owncolor.green=owncolor.r_green=owncolor.o_green=color->green; owncolor.blue=owncolor.r_blue=owncolor.o_blue=color->blue; myprint(w,answer->repres,&owncolor,True); /* do the search here */ for(i=0,colorli=myself(w).rgb_text.colorlist; iflags+=0x10001L/2; colorli->flags/=0x10001L; colorli->flags*=10000; colorli->flags+=0xffffL/2; colorli->flags/=0xffffL; colorli->flags=10000-colorli->flags; if(colorli->flags>=10000L) { if((owncolor.red==colorli->r_red) &&(owncolor.green==colorli->r_green) &&(owncolor.blue==colorli->r_blue)) colorli->flags=10000L; else colorli->flags=9999L; } if(colorli->flagsprev) colorli->prev->next=NULL; else myself(w).rgb_text.first=NULL; break; } myself(w).rgb_text.numhits++; colorli=colorli->next; } if(myself(w).rgb_text.first) { answer->offset=1; myself(w).rgb_text.actual=myself(w).rgb_text.first; } else { answer->offset=0; } } else { if(answer->offset>=myself(w).rgb_text.numhits) answer->offset=myself(w).rgb_text.numhits; /* Now find the line: */ if(!answer->offset) { ; /* do nothing, could jump also */ } else if(answer->offset>myself(w).rgb_text.offset) { /*Go on from actual:*/ go_on_actual: while(answer->offset>myself(w).rgb_text.offset) { myself(w).rgb_text.actual=myself(w).rgb_text.actual->next; myself(w).rgb_text.offset++; } } else if((myself(w).rgb_text.offset-answer->offset)offset) { /* Is nearer to actual than to start of list, go backwards.. */ while(answer->offsetprev; myself(w).rgb_text.offset--; } } else { /*search from start*/ myself(w).rgb_text.actual=myself(w).rgb_text.first; myself(w).rgb_text.offset=1; goto go_on_actual; } } myself(w).rgb_text.offset=answer->offset; if(answer->offset) { register char *ptr; register XawTextPosition start,end; answer->percentage=myself(w).rgb_text.actual->flags; ptr=myself(w).rgb_text.actual->startofline; start=(ptr-myself(w).rgb_text.asciirep); start+=1+myself(w).rgb_text.tile_width; end=(strchr(ptr,'\n')-myself(w).rgb_text.asciirep); /*Display selection:*/ XawTextSetSelection(w, start, end); XawTextSetInsertionPoint(w, end); /*Set cursor*/ } else { /* deselect any selection */ XawTextSetSelection(w, 0l, 0l); answer->percentage=0; } answer->numhits=myself(w).rgb_text.numhits; answer->numexact=myself(w).rgb_text.numexact; } static void grab_color(Widget w, RgbTextAnswerProc answer) { XColor mycolor; /* Grab pointer here: */ myself(w).rgb_text.grabtime=XtLastTimestampProcessed(XtDisplay(w)); #ifdef GRABSERVER XGrabServer(XtDisplay(w)); #endif #ifdef NOCOLORMAPINSTALL #define GRABEVENTS (ButtonPressMask|ButtonReleaseMask) #else #define GRABEVENTS (ButtonPressMask|ButtonReleaseMask|PointerMotionMask) #endif XtGrabPointer(w, False, GRABEVENTS, GrabModeAsync, GrabModeAsync, None, myself(w).rgb_text.grabcursor, myself(w).rgb_text.grabtime); #undef GRABEVENTS myself(w).rgb_text.grab_callback=answer; myself(w).rgb_text.grab_catched=False; /* save actual installed colormaps: */ #ifndef NOCOLORMAPINSTALL myself(w).rgb_text.saved_maps=XListInstalledColormaps(XtDisplay(w),XtWindow(w), &(myself(w).rgb_text.saved_colormaps)); #else myself(w).rgb_text.saved_maps=0; #endif } static void EventHandler(Widget w, XtPointer dummy, XEvent *event, Boolean *cont) { #ifdef REINSTALLCOLORMAPS int i; #endif /* Grab in process? */ if(!(myself(w).rgb_text.grab_callback)) return; /* Is button already grabbed ? */ if( ((XButtonEvent *)event)->time < myself(w).rgb_text.grabtime ) return; #ifndef NOCOLORMAPINSTALL if(event->type == MotionNotify) { int destx,desty; Window destw,sourcew,subw; XWindowAttributes attrib; /* Now find the window that was entered: */ destw=subw=((XMotionEvent *)event)->root; destx=((XMotionEvent *)event)->x_root; desty=((XMotionEvent *)event)->y_root; do { sourcew=destw; destw=subw; XTranslateCoordinates(((XMotionEvent *)event)->display,sourcew,destw, destx,desty, &destx, &desty, &subw); } while(subw!=None); /* Get its colormap: */ XGetWindowAttributes(((XMotionEvent *)event)->display,destw,&attrib); /* and install it... */ XInstallColormap(((XMotionEvent *)event)->display,attrib.colormap); } else #endif /* Yes this is not nice.. but most efficient. */ if(event->type == ButtonRelease) { if( ((XButtonEvent *)event)->button != Button1 ) { *cont=False; return; /* Ignore it */ } if(myself(w).rgb_text.grab_catched!=False) { /* End grab: */ myself(w).rgb_text.grab_callback=NULL; XtUngrabPointer(w, ((XButtonEvent *)event)->time); #ifndef NOCOLORMAPINSTALL #ifdef REINSTALLCOLORMAPS for(i=myself(w).rgb_text.saved_colormaps-1;i>=0;i--) XInstallColormap(((XButtonEvent *)event)->display, myself(w).rgb_text.saved_maps[i]); #endif #endif XFree(myself(w).rgb_text.saved_maps); #ifdef GRABSERVER XUngrabServer(XtDisplay(w)); #endif } } else if(event->type == ButtonPress) { int destx,desty; Window destw,sourcew,subw; XImage *image; XWindowAttributes attrib; if( ((XButtonEvent *)event)->button != Button1 ) { /* actively reject event: */ error: XBell(XtDisplay(w), 50); *cont=False; return; } /* The grab was catched:*/ myself(w).rgb_text.grab_catched=True; /* Now find the color value: */ /* First the window the pointer was in: */ destw=subw=((XButtonEvent *)event)->root; destx=((XButtonEvent *)event)->x_root; desty=((XButtonEvent *)event)->y_root; do { sourcew=destw; destw=subw; XTranslateCoordinates(((XButtonEvent *)event)->display,sourcew,destw, destx,desty, &destx, &desty, &subw); } while(subw!=None); /* Get the pixel value under pointer: */ image=XGetImage(((XButtonEvent *)event)->display,destw,destx,desty,1,1,~0L,XYPixmap); if(!image) goto error; myself(w).rgb_text.grabcol.pixel=XGetPixel(image,0,0); XDestroyImage(image); /* Get the colormap: */ XGetWindowAttributes(((XButtonEvent *)event)->display,destw,&attrib); /* Look up the color */ XQueryColor(XtDisplay(w),attrib.colormap,&(myself(w).rgb_text.grabcol)); FindColor(w, &(myself(w).rgb_text.grabcol), &(myself(w).rgb_text.answer)); myself(w).rgb_text.grabcol.flags=DoRed|DoGreen|DoBlue; (*(myself(w).rgb_text.grab_callback)) (w, &(myself(w).rgb_text.grabcol), &(myself(w).rgb_text.answer)); } *cont=False; return; } static int c_needed(unsigned int value) { if(value>9999) return 5; else if(value>999) return 4; else if(value>99) return 3; else if(value>9) return 2; return 1; } static int print_color(Widget w, String destination, colordef *color, Boolean packed) { char *format,*comma=", "; int fieldsize,stringsize; XcmsColor cmscolin; /* for Lab,Luv,HVC */ if(packed==True) fieldsize=1; else fieldsize=6; /* Prepare cmscolin: */ cmscolin.format=XcmsRGBFormat; if(myself(w).rgb_text.comma==False) comma="/"; if(color) { if(myself(w).rgb_text.realized!=False) { cmscolin.spec.RGB.red=color->r_red; cmscolin.spec.RGB.green=color->r_green; cmscolin.spec.RGB.blue=color->r_blue; } else { cmscolin.spec.RGB.red=color->red; cmscolin.spec.RGB.green=color->green; cmscolin.spec.RGB.blue=color->blue; } } switch(myself(w).rgb_text.colformat) { case XcmsRGB4: cmscolin.spec.RGB.red=(cmscolin.spec.RGB.red*0xfUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.green=(cmscolin.spec.RGB.green*0xfUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.blue=(cmscolin.spec.RGB.blue*0xfUL+0x7fffUL)/0xffffUL; fieldsize=1; goto prin_rgb; case XcmsRGB8: cmscolin.spec.RGB.red=(cmscolin.spec.RGB.red*0xffUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.green=(cmscolin.spec.RGB.green*0xffUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.blue=(cmscolin.spec.RGB.blue*0xffUL+0x7fffUL)/0xffffUL; fieldsize=2; goto prin_rgb; case XcmsRGB12: cmscolin.spec.RGB.red=(cmscolin.spec.RGB.red*0xfffUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.green=(cmscolin.spec.RGB.green*0xfffUL+0x7fffUL)/0xffffUL; cmscolin.spec.RGB.blue=(cmscolin.spec.RGB.blue*0xfffUL+0x7fffUL)/0xffffUL; fieldsize=3; goto prin_rgb; case XcmsRGB16: fieldsize=4; prin_rgb: if(myself(w).rgb_text.comma!=False) { format="rgb: %#*x%s%#*x%s%#*x"; fieldsize+=2; } else format="rgb: %*x%s%*x%s%*x"; stringsize=7+3*fieldsize; if(myself(w).rgb_text.comma!=False) { stringsize+=2; } if(packed==True) fieldsize=1; if(destination) sprintf(destination,format,fieldsize,cmscolin.spec.RGB.red,comma, fieldsize,cmscolin.spec.RGB.green,comma,fieldsize,cmscolin.spec.RGB.blue); break; case Xcmshash4: cmscolin.spec.RGB.red>>=12; cmscolin.spec.RGB.green>>=12; cmscolin.spec.RGB.blue>>=12; format="#%01x%01x%01x"; stringsize=4; goto prin_hash; case Xcmshash8: cmscolin.spec.RGB.red>>=8; cmscolin.spec.RGB.green>>=8; cmscolin.spec.RGB.blue>>=8; format="#%02x%02x%02x"; stringsize=7; goto prin_hash; case Xcmshash12: cmscolin.spec.RGB.red>>=4; cmscolin.spec.RGB.green>>=4; cmscolin.spec.RGB.blue>>=4; format="#%03x%03x%03x"; stringsize=10; goto prin_hash; case Xcmshash16: format="#%04x%04x%04x"; stringsize=13; prin_hash: if(destination) sprintf(destination,format,cmscolin.spec.RGB.red, cmscolin.spec.RGB.green,cmscolin.spec.RGB.blue); break; default: case Xcmsinput: stringsize=myself(w).rgb_text.c_red+ myself(w).rgb_text.c_green+ myself(w).rgb_text.c_blue+4+7; if(destination) { if(packed==False) sprintf(destination,"input: %*d, %*d, %*d", myself(w).rgb_text.c_red,color->o_red, myself(w).rgb_text.c_green,color->o_green, myself(w).rgb_text.c_blue,color->o_blue); else sprintf(destination,"%d, %d, %d", color->o_red, color->o_green, color->o_blue); } break; case XcmsCIEXYZFormat: stringsize=8+6+1+6+1+6; format="CIEXYZ: %6.4f%s%6.4f%s%6.4f"; if(myself(w).rgb_text.comma!=False) { stringsize+=2; } if(destination) { if(XcmsConvertColors(myself(w).rgb_text.myCCC,&cmscolin,1,myself(w).rgb_text.colformat,NULL) ==XcmsFailure) { format="CIEXYZ: "; converr: strcpy(destination,format); fieldsize=strlen(destination); format=strchr(format,0); while(fieldsizeTHIRDPART) tmp=THIRDPART; return tmp; } static void checknhang(Widget w,colordef *owncolor,colordef *colorli) { unsigned long diff; colordef *cptr; diff =abssqr(owncolor->r_red,colorli->r_red); diff+=abssqr(owncolor->r_green,colorli->r_green); diff+=abssqr(owncolor->r_blue,colorli->r_blue); if((diff<=myself(w).rgb_text.break_value)&&(diff<=3*THIRDPART)) { myself(w).rgb_text.numhits++; if((owncolor->r_red==colorli->r_red)&& (owncolor->r_green==colorli->r_green)&& (owncolor->r_blue==colorli->r_blue)) { myself(w).rgb_text.numexact++; colorli->flags=0; } else { colorli->flags=diff?diff:1; } /* sortin */ if(!myself(w).rgb_text.first) { /*create list with one element*/ myself(w).rgb_text.first=colorli; colorli->prev=NULL; colorli->next=NULL; } else { for(cptr=myself(w).rgb_text.first;;cptr=cptr->next) { /* color is less good? */ if(cptr->flags>diff) { /* insert before */ colorli->next=cptr; colorli->prev=cptr->prev; if(cptr->prev) { (cptr->prev)->next=colorli; } else myself(w).rgb_text.first=colorli; cptr->prev=colorli; return; } /*There will be no next/aka append*/ if(!(cptr->next)) { cptr->next=colorli; colorli->next=NULL; colorli->prev=cptr; return; } } } } } xcolorsel-1.1a.orig/RgbSink.c100644 1750 1750 26610 5673411365 15372 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSink Object. This is a subclass of an AsciiSink. It is designed to * * to be used by an RgbText Object. The only difference to an AsciiSink is a special scan * * function. * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.c,v 1.4 91/02/17 16:18:42 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include #include #include "RgbSinkP.h" /* Find current Xrelease number */ #ifndef LIB_X11R6 #ifndef LIB_X11R5 #if XlibSpecificationRelease == 6 #define LIB_X11R6 #else #if XlibSpecificationRelease == 5 #define LIB_X11R5 #else #error Could not determine which Xlib is used, define LIB_X11R5 or LIB_X11R6. #endif /* XLibSpecificationRelease==5 */ #endif /* XLibSpecificationRelease==6 */ #endif /* LIB_X11R5 */ #endif /* LIB_X11R6 */ /* No resources */ /* No actions */ /* Both are in RgbText! */ /* No actions no translations */ static void initialize(Widget request, Widget new, ArgList args, Cardinal *numargs); static void mydisp(Widget w, Position x, Position y, XawTextPosition pos1, XawTextPosition pos2, Boolean highlight); RgbSinkClassRec rgbSinkClassRec = { { /* object fields */ /* ====== */ /* superclass */ (WidgetClass) &asciiSinkClassRec, /* class_name */ "RgbSink", /* widget_size */ sizeof(RgbSinkRec), /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ initialize, /* initialize_hook */ NULL, /* realize */ NULL, /* actions */ NULL, /* num_actions */ 0, /* resources */ NULL, /* num_resources */ 0, /* xrm_class */ NULLQUARK, /* compress_motion */ 0, /* compress_exposure */ 0, /* compress_enterleave */ 0, /* visible_interest */ 0, /* destroy */ NULL, /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ NULL, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ NULL, /* display_accelerator */ NULL, /* extension */ NULL }, { /* text_sink fields */ /* DisplayText */ (_XawSinkVoidFunc) mydisp, /* InsertCursor */ XtInheritInsertCursor, /* ClearToBackground */ XtInheritClearToBackground, /* FindPosition */ XtInheritFindPosition, /* FindDistance */ XtInheritFindDistance, /* Resolve */ XtInheritResolve, /* MaxLines */ XtInheritMaxLines, /* MaxHeight */ XtInheritMaxHeight, /* SetTabs */ XtInheritSetTabs, /* GetCursorBounds */ XtInheritGetCursorBounds, }, { /* ascii_sink fields */ /* empty */ 0 }, { /* rgb_sink fields */ /* empty */ 0 } }; WidgetClass rgbSinkObjectClass = (WidgetClass)&rgbSinkClassRec; #define rgbparent(widget) (*(RgbTextRec *)XtParent(widget)) #define myself(widget) (*(RgbSinkRec *)(widget)) static void initialize(Widget request, Widget new, ArgList args, Cardinal *numargs) { XtCheckSubclass(XtParent(new),rgbTextWidgetClass, "rgbSink: Didn't I say that my parent has to be a subclass of RgbText?\n"); rgbparent(new).rgb_text.lasthead=~0l; } static void mydisp(Widget w, Position x, Position y, XawTextPosition pos1, XawTextPosition pos2, Boolean highlight) { int tile,linum; char *liptr; size_t first,last,new; XawTextPosition fipos; unsigned int cellwidth,tileheight; (*((AsciiSinkClassRec *)(rgbSinkClassRec.object_class.superclass))->text_sink_class.DisplayText) (w, x, y, pos1, pos2, highlight); /* Find last headline.. actually not really needed with r/o colors */ if(rgbparent(w).rgb_text.lasthead!=XawTextTopPosition(XtParent(w))) { register size_t i,des; rgbparent(w).rgb_text.lasthead=XawTextTopPosition(XtParent(w)); liptr=rgbparent(w).rgb_text.asciirep+rgbparent(w).rgb_text.lasthead; first=0; last=rgbparent(w).rgb_text.numcols; if(last) last--; while(last-first>1) { new=(first+last)/2; if(rgbparent(w).rgb_text.colorlist[new].startofline<=liptr) first=new; else last=new; } if(rgbparent(w).rgb_text.colorlist[last].startofline<=liptr) new=last; else new=first; myself(w).rgb_sink.headline=rgbparent(w).rgb_text.colorlist+new; if(!(rgbparent(w).rgb_text.ro_colors)) { /* Store actual color values in to the Server */ for(i=0;((i+new)ascent+myself(w).ascii_sink.font->descent; cellwidth=XTextWidth(myself(w).ascii_sink.font," ",1); #else tileheight=myself(w).text_sink.font->ascent+myself(w).text_sink.font->descent; cellwidth=XTextWidth(myself(w).text_sink.font," ",1); #endif linum=(y-rgbparent(w).text.margin.top)/tileheight; fipos=myself(w).rgb_sink.headline[linum].startofline-rgbparent(w).rgb_text.asciirep; fipos+=rgbparent(w).rgb_text.tile_width; /*printf("DispText(*,%ld,%ld,%ld,%ld,*)%ld,%ld\n",(long)x,(long)y,(long)pos1,(long)pos2, (long)linum,(long)fipos);*/ if(pos1core.parent->core.screen), rgbparent(w).rgb_text.colorgc, myself(w).rgb_sink.headline[linum].pixtouse); } else { /* pixtouse is just an index into xcolors */ XSetForeground(XDisplayOfScreen(w->core.parent->core.screen), rgbparent(w).rgb_text.colorgc, rgbparent(w).rgb_text.xcolors[myself(w).rgb_sink.headline[linum].pixtouse].pixel ); } XFillRectangle(XDisplayOfScreen(w->core.parent->core.screen), w->core.parent->core.window,rgbparent(w).rgb_text.colorgc,x,y, (unsigned int)(cellwidth*(fipos-pos1)),(tileheight-1)); } } xcolorsel-1.1a.orig/RgbSrc.h100644 1750 1750 14637 5661507713 15230 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSrc Object. This is a subclass of an AsciiSrc. It is designed to * * to be used by an RgbText Object. The only difference to an AsciiSrc is a special scan * * function. * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _RgbSrc_h #define _RgbSrc_h /*The Parent:*/ #include "RgbText.h" /* The superclass: */ #include /**************************************************************** * * RgbSrc object * ****************************************************************/ /* Resources: None more than AsciiSrc. But uses resources and widgetparts of its parent and therefor checks that it is a subclass of RgbText. */ /* define any special resource names here that are not in */ /* None (didn't I say that ?) */ /* declare specific RgbSrcObject class and instance datatypes */ typedef struct _RgbSrcClassRec* RgbSrcObjectClass; typedef struct _RgbSrcRec* RgbSrcObject; /* declare the class constant */ extern WidgetClass rgbSrcObjectClass; #endif /* _RgbSrc_h */ xcolorsel-1.1a.orig/Xcolorsel.ad100644 1750 1750 5213 5661507144 16121 0ustar vizzievizzie! Standard layout: *.text.scrollHorizontal: WhenNeeded *.text.scrollVertical: WhenNeeded *.text.displayCaret: False *.left: ChainLeft *.right: ChainRight *.top: ChainTop *.bottom: ChainBottom *.internalBorderWidth: 0 *.helpshell.rootpane.textform.text.height: 300 *.helpshell.rootpane.textform.text.width: 560 *.about.label: About me *.fileinfo.label: Fileinfo *.grab.label: Grab color *.reverse.label: Reverse *.defaults.label: Default colors *.quit.label: Quit *.display.label: Display format *.comma.label: C-Style *.realized.label: Show real server values *.best.label: Best match *.prev.label: Previous *.next.label: Next *.setfore.label: Set foreground *.setback.label: Set background *.close.label: Dismiss *.input.label: Values from input file *.rgb4.label: 4 bit scaled rgb *.rgb8.label: 8 bit scaled rgb *.rgb12.label: 12 bit scaled rgb *.rgb16.label: 16 bit scaled rgb *.rgbi.label: Float scaled rgb *.ciexyz.label: CIEXYZ *.cieuvy.label: CIEuvY *.ciexyy.label: CIExyY *.cielab.label: CIELab *.cieluv.label: CIELuv *.tekhvc.label: TekHVC (converts slowly) *.srgb4.label: 4 bit truncated rgb *.srgb8.label: 8 bit truncated rgb *.srgb12.label: 12 bit truncated rgb *.srgb16.label: 16 bit truncated rgb *.helpshell.title: About Xcolorsel ! The following defaults are already set in xcolorsel.c, so they are commented out here. ! Be very careful when changing the info entries, as you can easily crash the program ! because these values are directly given to printf and friends. ! In the distribution the internal defaults are just reprinted here: ! (Play with xcolorsel to see when these info-strings are printed out) !*.infoFile: " %lu entries: %lu different, %lu different on screen. " !*.infoDefaults: "Fore- and background returned to defaults." !*.infoForeground: "Foreground set to `%s'." !*.infoBackground: "Background set to `%s'." !*.infoNoColo: "Please select a color out of the list first!" ! Used when fore or back cannot be set because pool of color cells in Server is exceeded: !*.infoOutOfColors:"Sorry, out of colors... Defaults restored." !*.infoReverse: "Fore- and background exchanged." !*.infoGrab: "%s: %lu matches (%lu exact). Best %d.%02d%%." !*.infoGrabInit: "Select a color to find with the left mouse button." !*.infoNext: "Match %lu (%d.%02d%%) out of %lu (%lu exact)." !*.infoNoHit: "%s: No match better %d.%02d%% found." ! Cursor to display when converting between color spaces... !*.busyCursor: pointer ! You can set an explicit helpfile location here ("" switches this off) !*.helpFile: "" xcolorsel-1.1a.orig/biglens100644 1750 1750 1646 5661507144 15215 0ustar vizzievizzie#define biglens_width 32 #define biglens_height 32 #define biglens_x_hot 10 #define biglens_y_hot 11 static char biglens_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0xc0, 0x71, 0x00, 0x00, 0x20, 0x8e, 0x00, 0x00, 0xd0, 0x75, 0x01, 0x00, 0x28, 0x84, 0x02, 0x00, 0x14, 0x04, 0x05, 0x00, 0x0c, 0x04, 0x06, 0x00, 0x04, 0x04, 0x04, 0x00, 0x06, 0x04, 0x0c, 0x00, 0x06, 0x00, 0x0c, 0x00, 0xfe, 0xf1, 0x0f, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x06, 0x04, 0x0c, 0x00, 0x04, 0x04, 0x04, 0x00, 0x0c, 0x04, 0x06, 0x00, 0x14, 0x04, 0x07, 0x00, 0x28, 0x84, 0x04, 0x00, 0xd0, 0x75, 0x08, 0x00, 0x20, 0x8e, 0x10, 0x00, 0xc0, 0x71, 0x21, 0x00, 0x00, 0x0e, 0x42, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x80, 0x18, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00}; xcolorsel-1.1a.orig/RgbSink.h100644 1750 1750 15007 5661507677 15406 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSink Object. This is a subclass of an AsciiSink. It is designed to * * to be used by an RgbText Object. * * It has a special display function to display little color tiles. If the number of max * * rows is exceeded wrong colors will be displayed! * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _RgbSink_h #define _RgbSink_h /*The Parent:*/ #include "RgbText.h" /* The superclass: */ #include /**************************************************************** * * RgbSink object * ****************************************************************/ /* Resources: None more than AsciiSink. But uses resources and widgetparts of its parent and therefor checks that it is a subclass of RgbText. */ /* define any special resource names here that are not in */ /* None (didn't I say that ?) */ /* declare specific RgbSinkObject class and instance datatypes */ typedef struct _RgbSinkClassRec* RgbSinkObjectClass; typedef struct _RgbSinkRec* RgbSinkObject; /* declare the class constant */ extern WidgetClass rgbSinkObjectClass; #endif /* _RgbSink_h */ xcolorsel-1.1a.orig/RgbSinkP.h100644 1750 1750 15026 5661507703 15515 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /****************************************************************************************** * This defines an RgbSink Object. This is a subclass of an AsciiSink. It is designed to * * to be used by an RgbText Object. * * It has a special display function to display little color tiles. If the number of max * * rows is exceeded wrong colors will be displayed! * ******************************************************************************************/ /* This was inspirated from: */ /* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ /* Copyright Massachusetts Institute of Technology 1987, 1988 * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _RgbSinkP_h #define _RgbSinkP_h #include "RgbSink.h" #include "config.h" /* include superclass private header file */ #include /* This is closely related to and uses parts of: */ #include "RgbTextP.h" typedef struct { int empty; } RgbSinkClassPart; typedef struct _RgbSinkClassRec { ObjectClassPart object_class; TextSinkClassPart text_sink_class; AsciiSinkClassPart ascii_sink_class; RgbSinkClassPart rgb_sink_class; } RgbSinkClassRec; extern RgbSinkClassRec rgbSinkClassRec; typedef struct { /* resources */ /* None!*/ /* private state */ colordef *headline; } RgbSinkPart; typedef struct _RgbSinkRec { ObjectPart object; TextSinkPart text_sink; AsciiSinkPart ascii_sink; RgbSinkPart rgb_sink; } RgbSinkRec; #endif /* _RgbSinkP_h */ xcolorsel-1.1a.orig/biglensMask100644 1750 1750 1600 5661507144 16017 0ustar vizzievizzie#define biglensMask_width 32 #define biglensMask_height 32 static char biglensMask_bits[] = { 0x00, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x07, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x7e, 0xce, 0x0f, 0x00, 0x3e, 0x8e, 0x0f, 0x00, 0x1e, 0x0e, 0x1f, 0x00, 0x0f, 0x0e, 0x1e, 0x00, 0xff, 0xf1, 0x1f, 0x00, 0xff, 0xf1, 0x1f, 0x00, 0xff, 0xf1, 0x1f, 0x00, 0x0f, 0x0e, 0x1e, 0x00, 0x1e, 0x0e, 0x1f, 0x00, 0x3e, 0x8e, 0x0f, 0x00, 0x7e, 0xce, 0x0f, 0x00, 0xfe, 0xff, 0x1f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff, 0x01, 0x00, 0x1f, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e}; xcolorsel-1.1a.orig/lensMask100644 1750 1750 521 5662003262 15307 0ustar vizzievizzie#define lensMask_width 16 #define lensMask_height 16 #define lensMask_x_hot 5 #define lensMask_y_hot 5 static char lensMask_bits[] = { 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0x77, 0x07, 0x8f, 0x07, 0x8f, 0x07, 0x8f, 0x07, 0x77, 0x07, 0xfe, 0x0f, 0xfc, 0x1f, 0xf8, 0x3f, 0x00, 0x7f, 0x00, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10}; xcolorsel-1.1a.orig/lens100644 1750 1750 475 5661507145 14513 0ustar vizzievizzie#define lens_width 16 #define lens_height 16 #define lens_x_hot 5 #define lens_y_hot 5 static char lens_bits[] = { 0x00, 0x00, 0xf8, 0x00, 0x24, 0x01, 0x22, 0x02, 0x02, 0x02, 0x8e, 0x03, 0x02, 0x02, 0x22, 0x02, 0x24, 0x07, 0xf8, 0x0d, 0x00, 0x13, 0x00, 0x22, 0x00, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00}; xcolorsel-1.1a.orig/01-CHANGELOG100644 1750 1750 3132 5673416611 15270 0ustar vizzievizzie1.0 - 1.0a: Include several patches provided by R.K.Lloyd@csc.liv.ac.uk (Sorry, no RL-name known) for higher ANSI-compliance and that are needed to allow compilation under HP-UX. Changed Imakefile to use double :: (Ooops.. Why did my make not complain?) Added #include in RgbText.c for all these funny SUN's outside. I have only limited access to SUN's. It compiles now clean on a Sun w/o any warnings. However, on the Sun I used, it crashes now somewhere internally in the Xlib. Hmm.. Well, you wanted a Sun so you get one.. If anyone can send me a patch s.t. it runs on a Sun.. I'll grateful accept it. No new features! (See end of man-page!) 1.0a - 1.1: Change name from xpalette to xcolorsel. Autodetect in source for X11 release. font is in ascii_sink instead of text_sink for R6, changed in RgbSrc.c, RgbSink.c Two makefile.generic's due to different linkage. Support for read-only colormaps (TrueColor). Several patches in the RgbText-Widget. NOINSTALLCOLORMAPS flag for AIX added. 1.1 - 1.1a: Fixed illegal initialization of asciirep in RgbText.c:init. Wrong number of arguments was given to XtCreateWidget in RgbText.c:init. Cured unimportant memory leak in RgbText.c:init Reversed names of generic makefile, to distinguish them on 13 char per filename only machines. Added debug makefile (for my own convenience) Several patches in RgbText.c that allow to handle files that do not contain any colors. xcolorsel-1.1a.orig/rgb.txt100644 1750 1750 176 5673406526 15144 0ustar vizzievizzie255 0 0 red 1 1 1 Not really black but damn pretty close to it 245 255 250 MintCream 255 0 255 magenta 108 123 139 SlateGray4 xcolorsel-1.1a.orig/defhelp.h100644 1750 1750 16716 5673414116 15452 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ String default_help= "This is Xcolorsel, a multipurpose viewer for X11 rgb.txt files.\n" "Copyright (C) 1993, 1994 Michael Weller\n" "\n" "This program is free software; you can redistribute it and/or modify it under\n" "the terms of the GNU General Public License as published be the Free Software\n" "Foundation; either version 2 of the License, or (at your opinion) any later\n" "version.\n" "\n" "This program is distributed in the hope that it will be useful, but WITHOUT\n" "ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS\n" "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n" "details.\n" "\n" "You should have received a copy of the GNU General Public License along with\n" "this program; if not, write to the Free Software Foundation, Inc., 675 Mass\n" "Ave, Cambridge, MA 02139, USA.\n" "\n" "The author can be reached by means of email as eowmob@exp-math.uni-essen.de\n" "or eowmob@pollux.exp-math.uni-essen.de or mat42b@aixrs1.hrz.uni-essen.de.\n" "Or as: Michael Weller, Heiderhoefen 116b, D 46049 Oberhausen, Germany.\n" "\n" "Part of the files are derived from the Template Widget of the Athena Widgets\n" "as published by the Massachusetts Institute of Technology. Actually these\n" "files do not contain any code by the M.I.T but only variable declarations.\n" "Nevertheless these parts of these files are still distributed under the terms\n" "of the M.I.T copyright which are here repeated:\n" "\n" "Copyright Massachusetts Institute of Technology 1987, 1988\n" "\n" "Permission to use, copy, modify, distribute, and sell this software and its\n" "documentation for any purpose is hereby granted without fee, provided that\n" "the above copyright notice appear in all copies and that both that\n" "copyright notice and this permission notice appear in supporting\n" "documentation, and that the name of M.I.T. not be used in advertising or\n" "publicity pertaining to distribution of the software without specific,\n" "written prior permission. M.I.T. makes no representations about the\n" "suitability of this software for any purpose. It is provided \"as is\"\n" "without express or implied warranty.\n" "\n" "M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.\n" "BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n" "WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION\n" "OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" "CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n" "\n" "When you see this default message, Xcolorsel could not load its helpfile.\n" "Set the helpfile Resource of Xcolorsel to the absolut filename of the\n" "helpfile.\n" "You can also use the -helpfile >name< command line parameter to do this or\n" "put Xcolorsel.help in the current directory.\n" "\n" "To skip searching for an explicit file you may set the absolut filename to\n" "the empty string.\n" "\n" "But before looking in the current directory, Xcolorsel searches its helpfile\n" "with XtResolvePathname and a file type of \"help\" or a suffix \".help\".\n" "Also --- between these two possibilities --- it looks for type \"help\" AND\n" "suffix \".help\".\n" "\n" "Although this is implementation specific it will probably result in a search\n" "path like:\n" " /usr/lib/X11/help/Xcolorsel:/usr/lib/X11/help/Xcolorsel.help:\\\n" " /usr/lib/X11/Xcolorsel.help\n" "\n" "The actual absolut setting where to find the help file is:\n" " %s\n"; xcolorsel-1.1a.orig/00-README100644 1750 1750 12420 5673404425 14755 0ustar vizzievizzieThis file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. Copyright (C) 1993, 1994 Michael Weller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published be the Free Software Foundation; either version 2 of the License, or (at your opinion) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be reached by means of email as eowmob@exp-math.uni-essen.de or eowmob@pollux.exp-math.uni-essen.de or mat42b@aixrs1.hrz.uni-essen.de. Michael Weller, Heiderhoefen 116b, D 46049 Oberhausen, Germany. Part of the files are derived from the Template Widget of the Athena Widgets as published by the Massachusetts Institute of Technology. Actually these files do not contain any code by the M.I.T but only variable declarations. Nevertheless these parts of these files are still distributed under the terms of the M.I.T copyright which are here repeated: Copyright Massachusetts Institute of Technology 1987, 1988 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of M.I.T. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ----------------------------------------------------------------------------- Notice: This release does not contain new feature above version 1.1, however a few bug fixes are included that should cure the segfaults on several machines and actually also recent Linux QMAGIC executables. ----------------------------------------------------------------------------- This program is dedicated to all X11-users that don't use english as their native tongue. Actually it was started coz' I was unable to imagine what a color like goldenrod would look like. Based on the Athena Widget Set it builts an RgbText Widget that inherits all capabilities from the AsciiTextWidget, but interprets each line as line out of /usr/lib/X11/rgb.txt aka as a color nickname and an RGB specification. Functionality to display these values in different color formats together with a color probe tile and hooks to "grab" colors from the screen and search similar colors is provided. xcolorsel is a X-Utility based on this widget that allows you to display such files ( /usr/lib/X11/rgb.txt by default ) together with tiles showing how the color looks on your screen. Also a programmer may (like with xfontsel) cut the color names/definitions in various formats (Colorformats and formats for resourcefiles or C-sources) und paste them directly in his source codes. xcolorsel has also proven his usefulness for finding nice color sets for setup of colors for my favorite X-tools. This version does now work on Xservers with read-only colormaps (like TrueColor) as well. Be warned!!! I did this as an exercise to learn Xaw programming. I consider this tool as finished. No further extensions, bug fixes are planned. (But feel free to mail me your comments or suggestions anyway. If serious bugs occur or patches to support your machine are needed send me your patches. If they are context diffs and use some preprocessor defines to select the patches (either self select a symbol name or (better) use one put in by your imake automatically (and please put any #define's in config.h) ). I will put them in and redistribute a newer version, s.t. only one consistent version is floating around in the net. But remember: My priority of this project is low. Notes how to install can be found in 01-INSTALL, a copy of the GNU Copyright under which this software is distributed is in 01-COPYING. An ASCII-Version of the supplied manpage (xcolorsel.man) is in Xcolorsel.help. Please note that this software was developed in ANSI-C (using GNU-cc) under X11R5. It won't compile under "standard" K&R C and I don't know if it will compile under X11R4 or earlier (if your computer vendor can't provide X11R5 and an ANSI-C compiler kick his ass and order real workstations next time ;-)) xcolorsel-1.1a.orig/config.h100644 1750 1750 14575 5673404112 15304 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /* Please insert C-Options here instead of specifying them in the Makefiles */ /* To activate the options shown here, remove the surrounding / * * / around the */ /* #define lines. To disable the options surround them with / * * / (But omit */ /* the spaces between * and / that I inserted here to not to confuse some */ /* compilers with nested comments. */ #ifndef MYCONFIG_H #define MYCONFIG_H /* Define BIGLENS if you want to have a bigger magnifying glass cursor compiled */ /* in as default. You may need to undefine this if your server doesn't support */ /* such large cursors (or my drawing makes you puke on the server ;-) ) */ /* You may define an absolute Helpfile name here that will be searched first. */ /* #define HELPFILE "/usr/lib/X11/Xcolorsel.help" */ /* When grabbing the Cursor, RgbText itself ensures that the colors of windows with own colormaps are displayed when the cursor goes in. If you want to have it to reinstall the colormaps when the grab started at the end of the grab define REINSTALLCOLORMAPS. However any normal window manager will set the colormap to the one that RgbText/Xcolorsel has choosen immediately when it gets control of the mouse back. So this will lead to some flicker. So define REINSTALLCOLORMAPS only as a try when your colormaps get confused otherwise (But probably definition of this flag will even raise the confusion.) */ /* #define REINSTALLCOLORMAPS */ /* Some Windowmanagers (read fvwm) intercept ColormapInstall events and decide to reinstall what they think. This gives annoying flicker when Xcolorsel installs a colormap during color grabbing and then fvwm decides to reinstall the colormap of Xcolorsel's window. #defining GRABSERVER grabs the server during colorgrabbing and gives fvwm no chance to do dirty things. However it blocks all windows as well and is very risky. Thus it is also only done for Xservers that need colormaps, that is no direct color servers. Still when the grab finishes fvwm switches colors around and gives a short flicker. Since fvwm has the same problems with xmag, someone should just fix fvwm. Use this flag only as a last resort. */ #define GRABSERVER /* Some systems (AIX) seem to have problems with Xpalette installing colormaps during color grabbing (For details see the BUGS section in the man page or Xcolorsel.help). So here is way for you do disable this: */ /*#define NOCOLORMAPINSTALL*/ #endif /*MYCONFIG_H*/ xcolorsel-1.1a.orig/01-COPYING100644 1750 1750 43076 5661507142 15141 0ustar vizzievizzie GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xcolorsel-1.1a.orig/Imakefile100644 1750 1750 13111 5673402227 15465 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ /* Please add any preprocessor defines in config.h */ #ifdef HPArchitecture CCOPTIONS = -Aa -D_HPUX_SOURCE #endif XPALDIR = $(LIBDIR)/xcolorsel HELPFILE = $(XPALDIR)/Xcolorsel.help EXTRA_DEFINES = -DHELPFILE=\"$(HELPFILE)\" SRCS = RgbText.c RgbSink.c RgbSrc.c xcolorsel.c OBJS = RgbText.o RgbSink.o RgbSrc.o xcolorsel.o AllTarget(xcolorsel) /* Dependencies needed in under any circumstances: */ xcolorsel.o: appdef-c.h appdef.h depend:: appdef-c.h appdef.h /* Other Rules: */ all:: Xcolorsel.help install:: Xcolorsel.help NormalProgramTarget(xcolorsel,$(OBJS),,XawClientLibs,) InstallProgram(xcolorsel,$(BINDIR)) InstallManPage(xcolorsel,$(MANDIR)) InstallAppDefaults(Xcolorsel) InstallAppDefaultsLong(Xcolorsel-color,Xcolorsel-color) InstallNonExecFile(Xcolorsel.help,$(XPALDIR)) DependTarget() appdef-c.h: Xcolorsel-color.ad app2head Xcolorsel-color.ad > appdef-c.h appdef.h: Xcolorsel.ad app2head Xcolorsel.ad > appdef.h purge: $(RM) xcolorsel *.o appdef.h appdef-c.h Xcolorsel.help *.tar.Z Makefile Makefile.bak makefile *.tar *.tar.gz Xcolorsel.help: xcolorsel.man nroff -man xcolorsel.man | col -b > Xcolorsel.help package: purge xcolorsel Xcolorsel.help strip xcolorsel $(RM) *.o *.tar.Z *.tar *.tgz tar -cvf ../xcolorsel-1.1a.tar -C .. xcolorsel $(RM) xcolorsel tar -cvf ../xcolorsel-1.1a-src.tar -C .. xcolorsel $(MV) ../xcolorsel-1.1a.tar ../xcolorsel-1.1a-src.tar . compress xcolorsel-1.1a.tar.Z gzip xcolorsel-1.1a.tar.gz $(RM) xcolorsel-1.1a.tar compress xcolorsel-1.1a-src.tar.Z gzip xcolorsel-1.1a-src.tar.gz $(RM) xcolorsel-1.1a-src.tar xcolorsel-1.1a.orig/app2head100755 1750 1750 1035 5661507144 15251 0ustar vizzievizzie#!/bin/sh # create a header file for xcolorsel.c to compile in the choosen Application defaults # No I don't wanna to copyright this trash. # First version Sat Sep 4 18:04:35 GMT 1993, Michael Weller sed ' #kill comments /^\!/d #and preprocessor commands /^\#/d #and empty or blank lines (There is a Tab and a blank between the brackets!) /^[ ]*$/d #escape embedded \ s/\\/\\\\/g #escape embedded " s/"/\\"/g #insert leading " s/^/"/ #append ", s/$/",/ #if it was a continued line erase the , and let ANSI C do the magic: s/\\\\",/"/' $* xcolorsel-1.1a.orig/01-INSTALL100644 1750 1750 11240 5673414010 15115 0ustar vizzievizzieThis file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. Copyright (C) 1993, 1994 Michael Weller Please note that this software was developed in ANSI-C (using GNU-cc) under X11R5. It won't compile under "standard" K&R C and I don't know if it will compile under X11R4 or earlier (if your computer vendor can't provide X11R5 and an ANSI-C compiler kick his ass and order real workstations next time ;-)) Further patches were done under X11R6. Thus it should work under X11R5 and X11R6 with out problems. Also note that it is distributed under the GNU-Copyright. See 00-Readme and 01-COPYING for details. The color compare code assumes that long integers are of 32 bit size. If this doesn't hold on your machine color searching will probably not work correctly. The native environment for this tool is linux together with Xfree86-3.1. However it should easily run on any X11R5/R6 with ANSI-C. Installation is as easy as it could be: 1 - Make a makefile for your system out of the Imakefile. This is usually done by calling "xmkmf" out of the xcolorsel directory. Actually you should do a "make depend" to add all dependencies afterwards. 2 - A few options can be set/changed in config.h. So have a look at it. You won't need to change anything herein usually. 3 - If you use the Xaw3d Widgets you may like to change Xcolorsel-color.ad as suggested by the comments in it. The changes are only for better appearance of xcolorsel. There is no real need to change this file. 4 - Compile everything with a simple "make". (If you are using linux with Xfree86-3.1 (or higher) and libc4.5.26 (or higher) you can omit this step as there is already a Xcolorsel binary supplied (compiled with gcc-2.5.8). If you are doing something special and want only partial recompiles after you changed something, or want ensure clean recompiles without make clean, make depend after xmkmf but before the other makes will be handy. Note: some distributions that are not primarily intended for linux users do not include a precompiled binary. 5 - If you have superuser access a "make install" will put every file in the appropriate directories. An additional "make install.man" will also install the provided online manual page. Warning! If you use a Sun, set a CC to gcc before trying to compile anything. Either putting this into the Imakefile or a make CC=gcc should be sufficient. Exceptions / Comments: - If you don't have xmkmf, imake, etc. and can't use Imakefile, then cp R?.generic.makefile to Makefile and give it a try. Note that there is no make install at all in this generic makefile. Choose the generic makefile suited for your X11 release. - If make install fails, you don't trust me, or have to use the generic makefile, put xcolorsel in any directory in your executable search path (I prefer /usr/bin/X11), xcolorsel.man as xcolorsel.1 in /usr/man/man1 (or maybe as xcolorsel.l in /usr/man/manl). Place Xcolorsel-color.ad and Xcolorsel.ad w/o the ".ad" extension in your app-defaults directory (usually /usr/lib/X11/app-defaults and (if you want to have the online help in a window too) Xcolorsel.help in /usr/lib/X11) - If Xcolorsel has problems finding its helpfile set the Xcolorsel.helpFile resource in Xcolorsel.ad or #define HELPFILE in config.h - The Xcolorsel-color app-default is choosen when the *Customization resource is set to -color. It contains (UGLY!!) color definitions and then includes the definitions from Xcolorsel. Usually *Customization is set in /usr/lib/X11/xinit/.Xresources, s.t. that all applications of all users know if this server supports color or not. - The resource definitions from Xcolorsel-color.ad and Xcolorsel.ad are compiled into the executable and are used when no app-default can be loaded. The definitions from Xcolorsel-color.ad are used only when -color is given as a parameter to xcolorsel. So there is no need to use/install the application default files or use an own .Xdefaults at all (maybe helpful if you aren't root!) - The icon/cursor definitions in biglens & biglensMask, lens & lensMask, and xcslicon are only needed at compile time, s.t. there is no need to install them anywhere. Of course if you want to use/set them via the resource files of Xcolorsel (or any other Xapplication) you will have to copy them into /usr/include/X11/bitmaps. Also note the BUGS section in xcolorsel's man-page or Xcolorsel.help. - rgb.txt is a silly example rgb.txt file that can of course be displayed with Xcolorsel. xcolorsel-1.1a.orig/Xcolorsel-color.ad100644 1750 1750 3230 5661507144 17232 0ustar vizzievizzie! Herein are additional settings for color setup: ! Please note that regardless of any #include Statements herein ! these settings will be executed before any other compiled in resources ! if and only if -color is specified as a runtime parameter of xcolorsel ! (Or Xcolorsel.customization is set to -color by any other means) ! All preprocessor Statements herein are ignored in the compiled in settings!!!! ! The following is useful only if you use the Xaw3dWidgets: *.beNiceToColormap: False *.shadowWidth: 2 ! If this is the case you may also want to include the following ! (by removing the leading !) !*.message.borderWidth:0 ! and to exclude (by inserting ! as the first character) the next lines: *.message.borderWidth:2 *.Scrollbar.background: Chocolate2 *.Scrollbar.foreground: Chocolate4 ! Other (generic) color settings: *.borderColor: LightSalmon4 *.pointerColor: Black *.pointerColorBackground: White *.Background: SandyBrown *.Foreground: Salmon4 *.text.borderWidth: 2 *.displayMenu.borderWidth: 2 *.Command.background: Chocolate1 *.Command.foreground: Chocolate4 *.Toggle.background: Chocolate2 *.Toggle.foreground: Chocolate4 *.quit.background: OrangeRed2 *.quit.foreground: OrangeRed4 *.close.background: OrangeRed2 *.close.foreground: OrangeRed4 *.about.background: OliveDrab2 *.about.foreground: OliveDrab4 *.defaults.background: OliveDrab2 *.defaults.foreground: OliveDrab4 *.grab.background: Gold1 *.grab.foreground: Gold4 *.display.background: Gold1 *.display.foreground: Gold4 *.fileinfo.background: Gold2 *.fileinfo.foreground: Gold4 *.reverse.background: Gold2 *.reverse.foreground: Gold4 ! Include standard settings: #include "Xcolorsel" xcolorsel-1.1a.orig/00-ANNOUNCE100644 1750 1750 5415 5673402340 15206 0ustar vizzievizzieThis program is dedicated to all X11-users that don't use english as their native tongue. Actually it was started coz' I was unable to imagine what a color like goldenrod would look like. Based on the Athena Widget Set it builts an RgbText Widget that inherits all capabilities from the AsciiTextWidget, but interprets each line as line out of /usr/lib/X11/rgb.txt aka as a color nickname and an RGB specification. Functionality to display these values in different color formats together with a color probe tile and hooks to "grab" colors from the screen and search similar colors is provided. xcolorsel is a X-Utility based on this widget that allows you to display such files ( /usr/lib/X11/rgb.txt by default ) together with tiles showing how the color looks on your screen. Also a programmer may (like with xfontsel) cut the color names/definitions in various formats (Colorformats and formats for resourcefiles or C-sources) und paste them directly in his source codes. xcolorsel has also proven his usefulness for finding nice color sets for setup of colors for my favorite X-tools. Be warned!!! I did this as an exercise to learn Xaw programming. I consider this tool as finished. No further extensions, bug fixes are planned. (But feel free to mail me your comments or suggestions anyway. If serious bugs occur or patches to support your machine are needed send me your patches. If they are context diffs and use some preprocessor defines to select the patches (either self select a symbol name or (better) use one put in by your imake automatically (and please put any #define's in config.h) ). I will put them in and redistribute a newer version, s.t. only one consistent version is floating around in the net. But remember: My priority of this project is low. This program is released under the GNU public license. Please note that this software was developed in ANSI-C (using GNU-cc) under X11R5. It won't compile under "standard" K&R C and I don't know if it will compile under X11R4 or earlier (if your computer vendor can't provide X11R5 and an ANSI-C compiler kick his ass and order real workstations next time ;-)) A port (very simple) to X11R6 was done.. xcolorsel should still compile under X11R5. This program was called xpalette before, however there existed so many xpalette's that I was asked to change it's name. Apart from the port xcolorsel does now work under Xservers with read only colormaps (true color) as well. xcolorsel.tar.gz has already been released on ftp.x.org:contrib and the incoming directories for Linux on sunsite.unc.edu (intended for pub/Linux/X11/xutils) and tsx-11.mit.edu(maybe later in pub/linux/sources/usr.bin.X11). A precompiled binary (libc4.6.25 and Xfree3.1) is included in some distributions. xcolorsel-1.1a.orig/xcolorsel-1.1a.lsm100644 1750 1750 2006 5673421015 17016 0ustar vizzievizzieBegin3 Title: Xcolorsel, a rgb.txt color display X-tool Version: 1.1a Entered-date: 13DEC94 Description: Xcolorsel displays colors defined in rgb.txt on the Xserver as an example colortile and in all X-supported color spaces. You can also search colors used in other applications and select color definitions to paste into your sources. Keywords: X11, Xaw, colors, rgb, rgb.txt, tools Author: eowmob@exp-math.uni-essen.de (Michael Weller) Maintained-by: eowmob@exp-math.uni-essen.de (Michael Weller) Primary-site: sunsite.unc.edu /pub/Linux/X11/xutils 85KB xcolorsel-1.1a.tar.gz Alternate-site: ftp.x.org /contrib/utilities 67KB xcolorsel-1.1a-src.tar.gz Platform: Any X11R5 or R6 and ANSI-C should be sufficient. However a linux binary for Xfree86-3.1 and libc4.6.26 is included in the non source only package. Known to work on several systems now. Copying-policy: GPL End xcolorsel-1.1a.orig/xcolorsel.c100644 1750 1750 101524 5661510133 16051 0ustar vizzievizzie/*********************************************************************************/ /* This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. */ /* Copyright (C) 1993, 1994 Michael Weller */ /* */ /* This program is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published be the Free Software */ /* Foundation; either version 2 of the License, or (at your opinion) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT */ /* ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS */ /* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU General Public License along with */ /* this program; if not, write to the Free Software Foundation, Inc., 675 Mass */ /* Ave, Cambridge, MA 02139, USA. */ /* */ /* The author can be reached by means of email as eowmob@exp-math.uni-essen.de */ /* or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or */ /* mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 */ /* Oberhausen, Germany. */ /* */ /* Part of the files are derived from the Template Widget of the Athena Widgets */ /* as published by the Massachusetts Institute of Technology. Actually these */ /* files do not contain any code by the M.I.T but only variable declarations. */ /* Nevertheless these parts of these files are still distributed under the terms */ /* of the M.I.T copyright which are here repeated: */ /* */ /* Copyright Massachusetts Institute of Technology 1987, 1988 */ /* */ /* Permission to use, copy, modify, distribute, and sell this software and its */ /* documentation for any purpose is hereby granted without fee, provided that */ /* the above copyright notice appear in all copies and that both that */ /* copyright notice and this permission notice appear in supporting */ /* documentation, and that the name of M.I.T. not be used in advertising or */ /* publicity pertaining to distribution of the software without specific, */ /* written prior permission. M.I.T. makes no representations about the */ /* suitability of this software for any purpose. It is provided "as is" */ /* without express or implied warranty. */ /* */ /* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. */ /* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */ /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /*********************************************************************************/ #include #include /* And here we have a special gift for all SUN's outside >;-> */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" #include "RgbText.h" #include "defhelp.h" #include "xcslicon" #ifdef BIGLENS /* Warning: we have to deal later with this case too... */ #include "biglens" #include "biglensMask" #else /* BIGLENS */ #include "lens" #include "lensMask" #endif /* BIGLENS */ #ifndef HELPFILE /* No default setting*/ #define HELPFILE "" #endif #define DEFAULTCLASS "Xcolorsel" /* Do not edit the following by Hand... it is intended to be used with patch. */ #define VERSION "1.0a" char *myname; Widget myshell,pane,box,fileinfo,quitbutton,text,message,commandbox,dispbox,defbutt,comma,realized, setback,setfore,reverse,next,prev,grab,best,textform,messageform,menub,menu,help, help_close,help_shell=NULL,help_pane,help_form,help_text,help_buttonbox; typedef struct { Widget sme; char *name; char *value; } entrytype; entrytype entry[]= { { NULL, "input", "input"}, { NULL, "rgb4", "rgb4"}, { NULL, "rgb8", "rgb8"}, { NULL, "rgb12", "rgb12"}, { NULL, "rgb16", "rgb16"}, { NULL, "rgbi", "rgbi"}, { NULL, "ciexyz", "ciexyz"}, { NULL, "cieuvy", "cieuvy"}, { NULL, "ciexyy", "ciexyy"}, { NULL, "cielab", "cielab"}, { NULL, "cieluv", "cieluv"}, { NULL, "tekhvc", "tekhvc"}, { NULL, "srgb4", "#rgb"}, { NULL, "srgb8", "#rrggbb"}, { NULL, "srgb12", "#rrrgggbbb"}, { NULL, "srgb16", "#rrrrggggbbbb"} }; String MyName,MyClass,headline; XtAppContext mycontext; Arg args[10]; Cursor mycursor = None; Pixel defback,deffore; RgbTextAnswer answer; String messbuf=NULL; size_t messlen=0; String my_fallbacks[]={ #include "appdef-c.h" NULL, /* Marker, do not remove */ #include "appdef.h" NULL}; String *fallbacks; XrmOptionDescRec options[]={ {"-color", "*.customization", XrmoptionNoArg, (XtPointer)"-color"}, {"-nocolor", "*.customization", XrmoptionNoArg, (XtPointer)""}, {"-busycursor", "*.busyCursor", XrmoptionSepArg, (XtPointer)NULL}, {"-helpfile", "*.helpfile", XrmoptionSepArg, (XtPointer)NULL}, {"-maxrows", "*.maxRows", XrmoptionSepArg, (XtPointer)NULL}, {"-rows", "*.rows", XrmoptionSepArg, (XtPointer)NULL}, {"-columns", "*.columns", XrmoptionSepArg, (XtPointer)NULL}, {"-tilewidth", "*.tileWidth", XrmoptionSepArg, (XtPointer)NULL}, {"-file", "*.file", XrmoptionSepArg, (XtPointer)NULL}, {"-grabcursor", "*.grabCursor", XrmoptionSepArg, (XtPointer)NULL}, {"-maxred", "*.maxRed", XrmoptionSepArg, (XtPointer)NULL}, {"-maxgreen", "*.maxGreen", XrmoptionSepArg, (XtPointer)NULL}, {"-maxblue", "*.maxBlue", XrmoptionSepArg, (XtPointer)NULL}, {"-maxintensity", "*.maxIntensity", XrmoptionSepArg, (XtPointer)NULL}, {"-breakpercentage", "*.breakPercentage", XrmoptionSepArg, (XtPointer)NULL}, {"-cstyle", "*.comma", XrmoptionNoArg, (XtPointer)"True"}, {"-resourcestyle", "*.comma", XrmoptionNoArg, (XtPointer)"False"}, {"-internal", "*.realized", XrmoptionNoArg, (XtPointer)"False"}, {"-realized", "*.realized", XrmoptionNoArg, (XtPointer)"True"}, {"-input", "*.displayFormat",XrmoptionNoArg, (XtPointer)"input"}, {"-rgb4", "*.displayFormat",XrmoptionNoArg, (XtPointer)"rgb4"}, {"-rgb8", "*.displayFormat",XrmoptionNoArg, (XtPointer)"rgb8"}, {"-rgb12", "*.displayFormat",XrmoptionNoArg, (XtPointer)"rgb12"}, {"-rgb16", "*.displayFormat",XrmoptionNoArg, (XtPointer)"rgb16"}, {"-rgbi", "*.displayFormat",XrmoptionNoArg, (XtPointer)"rgbi"}, {"-ciexyz", "*.displayFormat",XrmoptionNoArg, (XtPointer)"ciexyz"}, {"-cieuvy", "*.displayFormat",XrmoptionNoArg, (XtPointer)"cieuvy"}, {"-ciexyy", "*.displayFormat",XrmoptionNoArg, (XtPointer)"ciexyy"}, {"-cielab", "*.displayFormat",XrmoptionNoArg, (XtPointer)"cielab"}, {"-cieluv", "*.displayFormat",XrmoptionNoArg, (XtPointer)"cieluv"}, {"-tekhvc", "*.displayFormat",XrmoptionNoArg, (XtPointer)"tekhvc"}, {"-#4", "*.displayFormat",XrmoptionNoArg, (XtPointer)"#rgb"}, {"-#8", "*.displayFormat",XrmoptionNoArg, (XtPointer)"#rrggbb"}, {"-#12", "*.displayFormat",XrmoptionNoArg, (XtPointer)"#rrrgggbbb"}, {"-#16", "*.displayFormat",XrmoptionNoArg, (XtPointer)"#rrrrggggbbbb"}, }; typedef struct { String info_message; String info_default; String info_fore; String info_back; String info_nocol; String info_outof; String info_reverse; String info_grab; String info_grabinit; String info_next; String info_nohit; Cursor busy_cursor; String help_file; } appres_type; appres_type appres; XtResource appreslist[]={ {"infoFile","InfoFile",XtRString,sizeof(String),XtOffsetOf(appres_type,info_message), XtRString," %lu entries: %lu different, %lu different on screen. "}, {"infoDefaults","InfoDefaults",XtRString,sizeof(String),XtOffsetOf(appres_type,info_default), XtRString,"Fore- and background returned to defaults."}, {"infoForeground","InfoForeground",XtRString,sizeof(String),XtOffsetOf(appres_type,info_fore), XtRString,"Foreground set to `%s'."}, {"infoBackground","InfoBackground",XtRString,sizeof(String),XtOffsetOf(appres_type,info_back), XtRString,"Background set to `%s'."}, {"infoNoColor","InfoNoColor",XtRString,sizeof(String),XtOffsetOf(appres_type,info_nocol), XtRString,"Please select a color out of the list first!"}, {"infoOutOfColors","InfoNoColor",XtRString,sizeof(String),XtOffsetOf(appres_type,info_outof), XtRString,"Sorry, out of colors... Defaults restored."}, {"infoReverse","InfoReverse",XtRString,sizeof(String),XtOffsetOf(appres_type,info_reverse), XtRString,"Fore- and background exchanged."}, {"infoGrab","InfoGrab",XtRString,sizeof(String),XtOffsetOf(appres_type,info_grab), XtRString,"%s: %lu matches (%lu exact). Best %d.%02d%%."}, {"infoGrabInit","InfoGrabInit",XtRString,sizeof(String),XtOffsetOf(appres_type,info_grabinit), XtRString,"Select a color to find with the left mouse button."}, {"infoNext","InfoNext",XtRString,sizeof(String),XtOffsetOf(appres_type,info_next), XtRString,"Match %lu (%d.%02d%%) out of %lu (%lu exact)."}, {"infoNoHit","InfoNoHit",XtRString,sizeof(String),XtOffsetOf(appres_type,info_nohit), XtRString,"%s: No match better %d.%02d%% found."}, {"busyCursor","BusyCursor",XtRCursor,sizeof(Cursor),XtOffsetOf(appres_type,busy_cursor), XtRString,"watch"}, {"helpfile","Helpfile",XtRString,sizeof(String),XtOffsetOf(appres_type,help_file), XtRString, HELPFILE} }; Atom wm_delete_window; void usage(int argc,char *argv[]); void getfile(void); void exerr(char *mess); void quit(Widget w, XtPointer a, XtPointer b); void wm_protocols(Widget w, XEvent *event , String *params, Cardinal *num_params); void info(Widget w, XtPointer a, XtPointer b); void dispsel(Widget w, XtPointer a, XtPointer b); void show_help(Widget w, XtPointer a, XtPointer b); void close_help(Widget w, XtPointer a, XtPointer b); void set_color(Widget w, XtPointer a, XtPointer b); void grabcolor(Widget w, XtPointer a, XtPointer b); void nexthit(Widget w, XtPointer a, XtPointer b); void allocmess(size_t len); XtActionsRec actions[] = { { "wm_protocols", wm_protocols }, }; String translations="WM_PROTOCOLS: wm_protocols()"; void main(int argc,char *argv[]) { size_t i; register char *(*ptr); Dimension maxpixels,actheight; Pixel curfore, curback; Boolean state; Pixmap icon_pixmap = None; myname=strrchr(argv[0],'/'); if(myname) myname++; else myname=argv[0]; /* /* Select normal fallbacks: */ fallbacks= my_fallbacks; for(i=0;*fallbacks;i++,fallbacks++); /* NOTE: i is needed later!!!! */ fallbacks++; /* Scan for -color parameter: */ ptr=(argv+1); while(*ptr) { if(!strcmp(*ptr,"-color")) { /* Reinclude color settings and erase the first marking NULL: */ /* fallbacks points to one behind NULL */ while(i--) { fallbacks--; /* Get previous elt: */ *fallbacks = *(fallbacks-1); } break; } ptr++; } myshell=XtAppInitialize(&mycontext,DEFAULTCLASS,options,XtNumber(options),&argc,argv, fallbacks,NULL,0); if(argc>2) { if(argv[1][0]=='-') usage(argc,argv); usage(argc-1,argv+1); } if(argc==2) { if(argv[1][0]=='-') usage(argc,argv); } wm_delete_window=XInternAtom(XtDisplay(myshell),"WM_DELETE_WINDOW",False); XtAppAddActions(mycontext,actions,XtNumber(actions)); XtOverrideTranslations(myshell,XtParseTranslationTable(translations)); XtGetApplicationResources(myshell,&appres,appreslist,XtNumber(appreslist),NULL,0); XtGetApplicationNameAndClass(XtDisplay(myshell),&MyName,&MyClass); XtSetArg (args[0], XtNiconPixmap, &icon_pixmap); XtGetValues(myshell, args, 1); if (icon_pixmap == None) { XtSetArg(args[0], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(myshell), XtScreen(myshell)->root, (char *)xcslicon_bits, xcslicon_width, xcslicon_height)); XtSetValues (myshell, args, 1); } pane=XtCreateManagedWidget("rootpane",panedWidgetClass,myshell,NULL,0); XtSetArg (args[0], XtNresizeToPreferred, True); XtSetArg (args[1], XtNskipAdjust, True); XtSetArg (args[2], XtNshowGrip, False); commandbox=XtCreateManagedWidget("commandbox", boxWidgetClass,pane,args,3); dispbox=XtCreateManagedWidget("dispbox", boxWidgetClass,pane,args,3); XtSetArg (args[0], XtNshowGrip, False); textform=XtCreateManagedWidget("textform", formWidgetClass,pane,args,1); XtSetArg (args[0], XtNfile, argv[1]); text=XtCreateManagedWidget("text",rgbTextWidgetClass,textform,args,(argc>1)?1:0); XtSetArg (args[0], XtNfile, &MyClass); XtSetArg (args[1], XtNforeground, &deffore); XtSetArg (args[2], XtNbackground, &defback); XtSetArg (args[3], XtNgrabCursor, &mycursor); XtSetArg (args[4], XtNpointerColor, &curfore); XtSetArg (args[5], XtNpointerColorBackground, &curback); XtGetValues(text, args, 6); if (mycursor == None) { Pixmap cursor,mask; XColor cfor,cbak; XrmValue colorval,pixel; pixel.addr= (XPointer)&curfore; pixel.size= sizeof(Pixel); colorval.addr= (XPointer)&cfor; colorval.size= sizeof(XColor); XtConvertAndStore(text, XtRPixel, &pixel, XtRColor, &colorval); pixel.addr= (XPointer)&curback; pixel.size= sizeof(Pixel); colorval.addr= (XPointer)&cbak; colorval.size= sizeof(XColor); XtConvertAndStore(text, XtRPixel, &pixel, XtRColor, &colorval); #ifdef BIGLENS cursor=XCreateBitmapFromData(XtDisplay(text),XRootWindowOfScreen(XtScreen(text)), biglens_bits,biglens_width,biglens_height); mask=XCreateBitmapFromData(XtDisplay(text),XRootWindowOfScreen(XtScreen(text)), biglensMask_bits,biglensMask_width,biglensMask_height); mycursor=XCreatePixmapCursor(XtDisplay(text),cursor,mask,&cfor,&cbak, biglens_x_hot,biglens_y_hot); #else /* BIGLENS */ cursor=XCreateBitmapFromData(XtDisplay(text),XRootWindowOfScreen(XtScreen(text)), lens_bits,lens_width,lens_height); mask=XCreateBitmapFromData(XtDisplay(text),XRootWindowOfScreen(XtScreen(text)), lensMask_bits,lensMask_width,lensMask_height); mycursor=XCreatePixmapCursor(XtDisplay(text),cursor,mask,&cfor,&cbak,lens_x_hot,lens_y_hot); #endif /* BIGLENS */ XtSetArg (args[0], XtNgrabCursor, mycursor); XtSetValues (text, args, 1); XFreePixmap(XtDisplay(text), cursor); XFreePixmap(XtDisplay(text), mask); } headline=XtMalloc(strlen(MyClass)+strlen(MyName)+3l); sprintf(headline,"%s: %s",MyName,MyClass); XtSetArg (args[0], XtNtitle, headline); XtSetValues(myshell, args, 1); XtSetArg (args[0], XtNresizeToPreferred, True); XtSetArg (args[1], XtNshowGrip, False); XtSetArg (args[2], XtNskipAdjust, True); messageform=XtCreateManagedWidget("messageform", formWidgetClass,pane,args,3); message=XtCreateManagedWidget("message", labelWidgetClass,messageform,args,0); XtSetArg (args[0], XtNresizeToPreferred, True); XtSetArg (args[1], XtNskipAdjust, True); box=XtCreateManagedWidget("buttonbox", boxWidgetClass,pane,args,2); help=XtCreateManagedWidget("about", commandWidgetClass,commandbox,NULL,0); XtAddCallback(help,XtNcallback,show_help,NULL); fileinfo=XtCreateManagedWidget("fileinfo", commandWidgetClass,commandbox,NULL,0); XtAddCallback(fileinfo,XtNcallback,info,NULL); grab=XtCreateManagedWidget("grab", commandWidgetClass,commandbox,NULL,0); XtAddCallback(grab,XtNcallback,grabcolor,NULL); reverse=XtCreateManagedWidget("reverse", commandWidgetClass,commandbox,NULL,0); XtAddCallback(reverse,XtNcallback,set_color,NULL); defbutt=XtCreateManagedWidget("defaults", commandWidgetClass,commandbox,NULL,0); XtAddCallback(defbutt,XtNcallback,set_color,NULL); quitbutton=XtCreateManagedWidget("quit", commandWidgetClass,commandbox,NULL,0); XtAddCallback(quitbutton,XtNcallback,quit,NULL); XtSetArg (args[0], XtNmenuName, "displayMenu"); menub=XtCreateManagedWidget("display", menuButtonWidgetClass,dispbox,args,1); menu=XtCreatePopupShell("displayMenu", simpleMenuWidgetClass,menub,NULL,0); for(i=0;i<(sizeof(entry)/sizeof(entrytype));i++) { entry[i].sme=XtCreateManagedWidget(entry[i].name, smeBSBObjectClass,menu,NULL,0); XtAddCallback(entry[i].sme, XtNcallback, dispsel, NULL); } XtSetArg(args[0], XtNcomma, &state); XtGetValues(text, args, 1); XtSetArg(args[0], XtNstate, state); comma=XtCreateManagedWidget("comma", toggleWidgetClass,dispbox,args,1); XtAddCallback(comma,XtNcallback,dispsel,NULL); XtSetArg(args[0], XtNrealized, &state); XtGetValues(text, args, 1); XtSetArg(args[0], XtNstate, state); realized=XtCreateManagedWidget("realized", toggleWidgetClass,dispbox,args,1); XtAddCallback(realized,XtNcallback,dispsel,NULL); XtSetArg(args[0],XtNsensitive,False); best=XtCreateManagedWidget("best", commandWidgetClass,box,args,1); XtAddCallback(best,XtNcallback,grabcolor,NULL); XtSetArg(args[0],XtNsensitive,False); prev=XtCreateManagedWidget("prev", commandWidgetClass,box,args,1); XtAddCallback(prev,XtNcallback,nexthit,NULL); XtSetArg(args[0],XtNsensitive,False); next=XtCreateManagedWidget("next", commandWidgetClass,box,args,1); XtAddCallback(next,XtNcallback,nexthit,NULL); setfore=XtCreateManagedWidget("setfore", commandWidgetClass,box,NULL,0); XtAddCallback(setfore,XtNcallback,set_color,NULL); setback=XtCreateManagedWidget("setback", commandWidgetClass,box,NULL,0); XtAddCallback(setback,XtNcallback,set_color,NULL); info(NULL,NULL,NULL); XtRealizeWidget(myshell); XSetWMProtocols(XtDisplay(myshell),XtWindow(myshell),&wm_delete_window,1); /* Make sure that the maximum height of the rgb_text widget is not exceeded: */ maxpixels=GetMaxPixels(text); XtSetArg (args[0], XtNheight, &actheight); XtGetValues(text, args, 1); maxpixels-=actheight; XtSetArg (args[0], XtNheight, &actheight); XtGetValues(textform, args, 1); actheight+=maxpixels; XtSetArg (args[0], XtNmax, actheight); XtSetValues(textform, args, 1); XtSetArg (args[0], XtNheight, &actheight); XtGetValues(myshell, args, 1); actheight+=maxpixels; XtSetArg (args[0], XtNmaxHeight, actheight); XtSetValues(myshell, args, 1); XtAppMainLoop(mycontext); } void usage(int argc,char *argv[]) { int i; if(argc!=1) { fprintf(stderr,"%s: Invalid options/additional parameters\nOffending arguments are:\n%s", myname,myname); for(i=1;i=2)?True:False); XtSetValues(prev, args, 1); XtSetArg(args[0],XtNsensitive,(answer.offset>=2)?True:False); XtSetValues(best, args, 1); allocmess(strlen(answer.repres)+strlen(appres.info_next)+30L); sprintf(messbuf,appres.info_next,(unsigned long)answer.offset, ((int)(answer.percentage))/100, ((int)(answer.percentage))%100, (unsigned long)(answer.numhits), (unsigned long)(answer.numexact)); XtSetArg (args[0], XtNlabel, messbuf); XtSetValues(message, args, 1); } void allocmess(size_t needed) { if(messlen=0) close(fd); /* Was just a try... */ else { /* Now look in the Database... */ fname=XtResolvePathname(XtDisplay(myshell),"help",NULL,"",NULL,NULL,0,NULL); if(!fname) fname=XtResolvePathname(XtDisplay(myshell),"help",NULL,".help",NULL,NULL,0,NULL); if(!fname) fname=XtResolvePathname(XtDisplay(myshell),"",NULL,".help",NULL,NULL,0,NULL); if(!fname) { /* Search working directory too... */ fd=open(fname="Xcolorsel.help",O_RDONLY,0); if(fd<0) { /* create default message.. */ fname=XtMalloc(strlen(default_help)+strlen(appres.help_file)+10); sprintf(fname,default_help,strlen(appres.help_file)?appres.help_file:""); XtSetArg (args[0], XtNtype, XawAsciiString); } else close(fd); /* Was just a try (again)... */ } } XtSetArg (args[1], XtNstring,fname); XtSetArg (args[2], XtNeditType,XawtextRead); help_text=XtCreateManagedWidget("text",asciiTextWidgetClass,help_form,args,3); XtPopup(help_shell,XtGrabNone); XSetWMProtocols(XtDisplay(help_shell),XtWindow(help_shell),&wm_delete_window,1); } void close_help(Widget w, XtPointer a, XtPointer b) { if(help_shell) { XtPopdown(help_shell); } XtSetArg(args[0],XtNsensitive,True); XtSetValues(help, args, 1); } void wm_protocols(Widget w, XEvent *event , String *params, Cardinal *num_params) { if(event->type != ClientMessage) return; if(event->xclient.data.l[0]==wm_delete_window) { if(w==help_shell) close_help(NULL, NULL, NULL); else if(w==myshell) quit(NULL, NULL, NULL); } } xcolorsel-1.1a.orig/xcolorsel.man100644 1750 1750 63537 5673406244 16407 0ustar vizzievizzie.\"This file is part of Xcolorsel, a multipurpose viewer for X11 rgb.txt files. .\" Copyright (C) 1993, 1994 Michael Weller .\" .\"This program is free software; you can redistribute it and/or modify it under .\"the terms of the GNU General Public License as published be the Free Software .\"Foundation; either version 2 of the License, or (at your opinion) any later .\"version. .\" .\"This program is distributed in the hope that it will be useful, but WITHOUT .\"ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS .\"FOR A PARTICULAR PURPOSE. See the GNU General Public License for more .\"details. .\" .\"You should have received a copy of the GNU General Public License along with .\"this program; if not, write to the Free Software Foundation, Inc., 675 Mass .\"Ave, Cambridge, MA 02139, USA. .\" .\"The author can be reached by means of email as eowmob@exp-math.uni-essen.de .\"or eowmob@pollux.exp-math.uni-essen.de or mat42b@vm.hrz.uni-essen.de or .\"mat42b@de0hrz1a.bitnet. Or as: Michael Weller, Heiderhoefen 116b, D 46049 .\"Oberhausen, Germany. .\"(See other source files or 01-COPYING or later in this file for additional .\" info!) .TH Xcolorsel 1 "27th December 1993" "" "Xcolorsel User's Guide" .SH NAME xcolorsel \- display contents of rgb.txt files together with color probes. .SH SYNOPSIS .B xcolorsel [options] .BI [ RgbTxtFile ] .SH DESCRIPTION This utility displays the contents of the .I rgb.txt file (usually found as .IR /usr/lib/X11/rgb.txt ) or a file with this format specified as the optional .BI [ RgbTxtFile ] parameter. Each line of this file consists of 3 integers (usually 0-255) representing the RGB values and a nickname for this color separated by spaces. The RGB values can be displayed in every color representation X11R5/6 supports. Also it is possible to show the values in either resource definition or .BR C -style. An additional option to display the RGB values the current server would be able to actually display is also implemented. The main feature of Xcolorsel is that a small example tile of each color is also shown. I will describe each button/X11-control in Xcolorsel's window in the next section. .LP This version has now also support for servers with read only colormaps (That is StaticColor, StaticGray, TrueColor). Actually I did not realize that this would be needed before I got a TrueColor server myself. However since colors have to be allocated one by one in these modes, the startup time of xcolorsel has reduced dramatically. .SH USAGE Xcolorsel's window is divided into four main parts: .HP (Usually) two rows of command buttons. .HP The RgbText Widget displaying the input file and (if needed) vertical and/or horizontal scrollbars. .HP A message line displaying help messages, comments, or results of commands or actions. .HP (Usually) one row of action buttons. The main (or better intended) difference between commands and actions is that action operate on colors selected in the display area and commands perform general tasks. .LP The title bar of Xcolorsel's window should (if supported by the window manager) show the name of the current displayed file. .LP Depending from the window size the actual layout may differ. Also the names of the buttons may differ (if for example a german application default file is used). However the position and order of the buttons and other elements should be the same, s.t. you may rely on the order in which the controls are described in this file. .SS Command Buttons (first row) .B About me opens a new window displaying an ASCII-Version of this manual page. When this window is open the .B About me is inactive. In the lower left edge of this window a .B Dismiss button can be seen. Press this button to dismiss the help window. If the window is to small to display the whole file vertical and/or horizontal scrollbars are provided. The text is displayed in a standard Xaw AsciiText Widget. Text selection and -S (search) work as usual. For a full description of the capabilities of this Widget see the Athena Widget Reference Manual. If the help window is dismissed the .B About me button is reactivated. .LP .B Fileinfo displays the number of entries in the input file. Also the number of different RGB triples is displayed. Furthermore the Xserver is queried to see how many different colors the current server will show if given all these values. .LP The last value will differ depending on the color depth of the colormaps on the server. Xfree86 Servers usually use 6 bit for each RGB value yielding to a lower number of different colors on the server than different colors are given in the input file where RGB values are usually 8 bit each. .LP .BR "Grab color" . When you press this button, the cursor changes into a magnification glass with a transparent hole at its hot spot. Move this hole over any colored pixel in any window you are interested in and press the left button. While the cursor is a magnifying glass Xcolorsel takes over the whole mouse. Xcolorsel itself ensures that each window the cursor is in is displayed with its correct colormap. .LP After you pressed the left button the color selected is searched in the input file. The color definition in the current .B display format is given in the message line. Also the number of acceptable colors, exact matches and percentage of equality of the best match are given (if any). (Exception: If .B display format is .I "values from input file" each of the 16 bit RGB values is given like with .I "16 bit scaled rgb" but in decimal.) .LP Also the line containing the best match found is selected in the RgbText Widget, and the text is scrolled, s.t. the line can be seen. The .BR "Best match" ", " "Previous" ", and " Next actions are appropriately activated. .LP The algorithm to compare colors is (too!) simple. Two colors .B R1 G1 B1 and .B R2 G2 B2 are compared by calculating .BR "(R1-R2)*(R1-R2) + (G1-G2)*(G1-G2) + (B1-B2)*(B1-B2)" . The result is scaled to 0-100%, where 100% means equivalence and 0% is the difference between black and white (aka between (0,0,0) and (255,255,255)). It is ensured that even almost equal colors compare only up to 99.99%. 100% is only possible for exact equivalence. The value above which colors are acceptable equal can be changed and defaults to 95%. .LP Grabbed colors are compared against the color values as they can be realized on the current server not the theoretic values from the input file. .LP .B Reverse exchanges the text fore- and background color in the RgbText Widget. .LP .B Default colors returns the text fore- and background color in the RgbText Widget to the values at the start of Xcolorsel. This is (together with .BR Reverse ) useful to return to readable text after you changed to colors with the .BR "Set foreground" " and " "Set background" actions to values making it impossible to read anything in the RgbText Widget. .LP .B Quit quits Xcolorsel and closes all its windows. .SS Command Buttons (second row) .B Display format displays a submenu that allows you to define the format in which color RGB values are displayed (Press and hold left button down over .B Display format button and release the button over the desired format. .LP The possible color values are the color formats that X11R5/6 supports. .I Values from input file displays the RGB values like given in the input file (see also comment in .BR "Grab color" . .LP Note that conversion to .I TekHVC is slow for not trivially short input files. .LP While the color conversion calculation takes place the cursor in the xcolorsel windows (except scrollbars) is changed to a busy cursor and all controls are inactive. .LP Note the difference between scaled and truncated rgb formats: Scaled scales the internal 16 bit RGB integer values to 4/8/12 bits whereas truncated means the most significant 4/8/12 bits. Truncated RGB values are only supported for compatibility. Their use in new programs is discouraged. .LP .B C-Style is a toggle control switching .B C support on/off. With .B C support RGB values are separated with , instead of the / used in X-Windows resource definitions. Also Hex-Numbers are given in the format that is needed in .B C source codes. Together with the selection capabilities of the RgbText widget this allows inclusion of color definitions in programs or Application Default Files. See next sub section. .LP This option is meaningless with the .I Values from input file .BR "display format" . .LP .B Show real server values is again a toggle control. If enabled the server is queried which RGB values for each color it is actually able to display. Then these values are displayed instead of the theoretic values calculated by Xcolorsel and Xlib itself. .LP Note the when searching/grabbing colors Xcolorsel always compares with the color values like they would be used by the server, because the searched color is also only known by its actually realized values. .LP This option is meaningless with the .I Values from input file .BR "display format" . .LP .SS The RgbText Widget Display area In this box (part of) the input file is displayed. Depending of the length and width of the displayed information scrollbars are provided. Each line consists of an example tile of the color, the defining color values in the selected output format, and the nickname of the color. .LP The RgbText Widget inherits all capabilities of the AsciiText Widget, s.t. scrollbars, -S (searching) and selection work as usual. There is only one exception: .LP Double clicking with the left button does not select words separated by white space but here senseful subparts. That is double clicking in the nickname selects the whole nickname regardless of included whitespace. Double clicking on the color definitions selects the whole color definition. If .B C-Style is selected the color format prefix is not selected, because it would not be useful to paste this into a .BR C -source file. .LP This is done to make cutting and pasting color definitions into source codes or Application Default Files as convenient as possible. .SS The message line This line contains one line messages informing you about the state and results of Xcolorsel's actions. .SS Action buttons .B Best match selects and scrolls the display to the best match found during the last .BR "Grab color" , if one was found and is not currently selected. .LP .B Previous selects and scrolls the display to the previous (next better) match, if there is one. .LP .B Next selects and scrolls the display to the next (next worse) match, if there is one. .LP .B Set foreground sets the text foreground color in the display window to the color currently selected in it (actually the color defined in the line where the first selected character resides). .LP .B Set background sets the text background color in the display window to the color currently selected in it (actually the color defined in the line where the first selected character resides). .SH OPTIONS As a standard Xaw application Xcolorsel accepts all standard toolkit options .RB "(see " X (1)). .LP Additional options for Xcolorsel that can also be set via Xresources (mentioned in parentheses) in the application default file (or with general resource manager facilities) are: .HP .BI "-breakpercentage" " n" .RI ( "*.breakPercentage: n" ) sets the break percentage to .IR n "/100 (" n " integer)." Colors with equivalence equal to or above this value are found and displayed when grabbing colors. (see .B Grab color above). This option defaults to 9500. .HP .BI "-busycursor" " cursor" .RI ( "*.busyCursor: cursor" ) allows you to specify the cursor shown while calculating color conversions. .HP .B -color .RI ( "*.customization: -color" ) sets the customization resource to force use of the Xcolorsel-color application default file. If no application resource file can be found at all, the compiled in Xcolorsel-color defaults are used. .HP .BI "-columns" " n" .RI ( "*.columns: n" ) sets the number of character columns initially displayed. This option usually defaults to 30. .HP .BI "-cstyle" .RI ( "*.comma: True" ) lets Xcolorsel startup with .B C-Style selected. .HP .BI "-file" " filename" .RI ( "*.file: filename" ) sets the file to be read in and displayed. Default is usually .RI "" /usr/lib/X11/rgb.txt . You can specify the filename as command parameter without the prefixing .BR -file . .HP .BI "-grabcursor" " cursor" .RI ( "*.grabCursor: cursor" ) allows you to specify the cursor shown while grabbing colors. .HP .BI "-helpfile" " filename" .RI ( "*.helpfile: filename ) sets the path to the helpfile. (can also be done at compile time in config.h). If set to the empty string ("", the default). Xcolorsel tries to locate the file with standard X techniques. This usually leads to filenames like .IR /usr/lib/X11/Xcolorsel.help " or " /usr/lib/X11/app-defaults/Xcolorsel.help . Just trust the make install created by imake. It should know where to put the file. However people (read: vendor specific X11 releases) had problems with this so .I /usr/lib/X11/xcolorsel/Xcolorsel.help is now hardcoded in the Imakefile. .HP .BR -input ", " -rgb4 ", " -rgb8 ", " .BR -rgb12 ", " -rgb16 ", " -rgbi ", " .BR -ciexyz ", " -cieuvy ", " -ciexyy ", " .BR -cielab ", " -cieluv ", " -tekhvc ", " .BR -#4 ", " -#8 ", " -#12 ", and " .B -#16 .RI ( "*.displayFormat: format" ", where " format is one of .RI "" input ", " rgb4 ", " rgb8 .RI ", " rgb12 ", " rgb16 ", " rgbi .RI ", " ciexyz ", " cieuvy ", " ciexyy .RI ", " cielab ", " cieluv ", " tekhvc .RI ", " #rgb ", " #rrggbb ", " #rrrgggbbb .RI ", or " #rrrrggggbbbb ) lets Xcolorsel startup displaying in the specified color format. The default and value chosen if set to an undefined string value is .RI "" input . .HP .BI "-internal" .RI ( "*.realized: False" ) lets Xcolorsel startup showing the internal theoretic color values. This is the default. .HP .BI "-maxred" " n" .RI ( "*.maxRed: n" ) .HP .BI "-maxgreen" " n" .RI ( "*.maxGreen: n" ) .HP .BI "-maxblue" " n" .RI ( "*.maxBlue: n" ) When reading in the input file Xcolorsel calculates the maximum of each of the input RGB values and uses this as the maximum (white) value for this component. Each of these option values is incorporated in this calculation for the appropriate color component as if such a color would have been read from the input file. This is implemented to allow input file with more (or less) than 8 bit for each RGB value. This options default to 0 but note the next option: .HP .BI "-maxintensity" " n" .RI ( "*.maxIntensity: n" ) is comparable to the last three options but is incorporated into each of the color components. This value usually defaults to 255. .HP .BI "-maxrows" " n" .RI ( "*.maxRows: n" ) sets the maximum number of rows to be displayed at the same time. This restriction is needed because this many color cells have to be allocated at the Xserver and the number of colorcells is usually limited (usually to 256). If Xcolorsel can't allocate this much colorcells a lower number is chosen and the user is informed via stderr. Only if not a single color can be allocated Xcolorsel gives up. Xcolorsel instructs the window manager not to allow resizes yielding to more lines getting displayed. If more lines are displayed in the display RgbText Widget area the displayed color examples will be wrong. This option usually defaults to 30. .HP .B -nocolor .RI ( "*.customization: ''" ) sets the customization resource to force use of the non-color Xcolorsel application default file. If no application resource file can be found at all, the compiled in non-color Xcolorsel defaults are used. BTW, actually you have to use " to specify this in resource files. .HP .BI "-realized" .RI ( "*.realized: True" ) lets Xcolorsel startup showing color values how they are displayed on the server. .HP .BI "-resourcestyle" .RI ( "*.comma: False" ) lets Xcolorsel startup with .B C-Style deselected. This is the default. .HP .BI "-rows" " n" .RI ( "*.rows: n" ) sets the number of character rows initially displayed. This option usually defaults to 10. .HP .BI "-tilewidth" " n" .RI ( "*.tilewidth: n" ) sets the width of the example color tiles measured in spaces. This option usually defaults to 3. .SH HISTORY Xcolorsel was named xpalette when I wrote it. However there were so many xpalettes that I was asked to change its name. Since xpalette is somehow comparable to xfontsel, that is it shows you the available colors and lets you select one, I call it xcolorsel now and hope that there will be no more confusion. So when you see a .IR xpalette.tgz , or .IR xpalette-1.0.tar.gz , or .IR xpalette-1.0a.tar.gz it is probably a previous version of xcolorsel. .SH INTERNALS Most of the functionality of Xcolorsel is defined in an RgbText Widget. This is a child of a TextWidget linking an RgbSrc and RgbSink Widget together, which are childs of AsciiSrc and AsciiSink, resp. Feel free to use these Widgets in your own programs. Most of Xcolorsel's resources are resources of these Widgets. Interested programmers should be able to find all needed information about the programming interface of these Widgets in the corresponding .I .h .RI "files (" RgbSink.h ", " RgbSinkP.h .RI ", " RgbSrc.h ", " RgbSrcP.h .RI ", " RgbText.h ", " RgbTextP.h ")." .LP Anyway, I would love to hear if anyone finds a general purpose of any of those widgets. (I can't think of any ;-) ). .LP If you want to know about the internal structure and names of the Widget tree use .BR editres (1), which is part of X11R5/6 and shows this information in a more convenient way than I could ever put in the manual page. .SH RESTRICTIONS/MISFEATURES .HP Installing the colormaps of windows the cursor is in during grab of colors is slow. This is because the Athena Widgets intercept .B ENTER/LEAVE notifications send to Xcolorsel during a pointer grab. As a work around Xcolorsel asks for notification of all cursor motions during a pointer grab and explicitly queries the X-Window the pointer is in, thus causing ex(t/p)ensive server/client communication. .HP Color conversion calculations are even performed when there is no need to, that is when just the .B C-Style is toggled. This is really annoying when using the .I TekHVC .BR "display format" . .HP When .BR "Display format" ", " "C-Style" ", or " "Show real server values" are changed the current selection is unselected and the display scrolls up to the first line. .HP .RB "The " "Best match" ", " "Previous" ", and " "Next" action buttons are not appropriately (de-)activated when the selection is either changed manually in the display with the mouse or automatically (see above misfeature). .HP The icons and cursors (especially the bigger magnifying glass) are extremely ugly. Suggestions for nice bitmaps are welcome. .HP The color application default is even more ugly. It is an example of what not to do with Xcolorsel. Actually the intention was to classify operations with colors. (Negative commands like .B Quit in red, positive commands like .B Default colors in bright or not that bright .RB ( "About me" ) green. Commands requiring user intervention bright yellow. Other commands in standard yellow. And the remaining toggles and actions in orange.) However the result just makes me puke. Suggestions for nice colors are also welcome. .HP If the help window is displayed .B About me should not be inactive but instead allow to raise the window. .HP The color compare formula (see .B Grab color above) is (at least) not very sophisticated. .HP When showing the busy cursor during color conversions the standard cursor is still shown when over scrollbars. This is because I didn't find a way to change the cursor over Athena scrollbars. Later I saw that one can of course hide all windows under an invisible input only window that changes the cursor when it enters it. (I got this from Mumail, where unfortunately only part of the window is hidden under the invisible window). .HP You will notice that my programming style changed while coding Xcolorsel, thus the look a like of the sources is not as consistent as it should be. .SH BUGS Under AIX (IBM RS/6000) at least when using 16 color monochrom monitors and the Motif window manager, searching the window tree sometimes finds windows with invalid colormaps and that are not drawable. There is a flag to not to try to install colormaps during color grabbing. However if you click on a window border Xcolorsel will crash. I assume that this is caused by mwm placing an invisible input only window over the borders it draws. I did not find a way to make Xcolorsel smart enough to not fall in this trap. Even if Xcolorsel would see that this is an input only window, there is no way to get the data it actually needs (colormap and pixelvalue at the location you are clicking on). Just do not click on Mwm borders. Or better do not use Mwm at all. Motif is no free software. Boycott it! Fvwm is much better anyway. .SH AUTHOR Michael Weller .br Heiderhoefen 116b .br D 46049 Oberhausen .br Germany .LP reachable by means of Email as one of: .LP eowmob@exp-math.uni-essen.de .br eowmob@pollux.exp-math.uni-essen.de .br mat42b@aixrs1.hrz.uni-essen.de .LP Please note that I did this as an exercise to improve my understanding of the Athena Widgets and X. I consider this project as (almost) finished. The priority of this project is as low as possible for me. No further extensions are planned so far. However I will put in patches to support other systems (please make them controllable with #define's either out of config.h or provided by your imake) and bug fixes and redistribute them to ensure that only one consistent version floats through the net. . .SH ACKNOWLEDGEMENTS This work and much more would not have been possible without the Linux project initiated by Linus Torvalds (and of course all other people contributing their work to this project). This project together with the GNU project made it possible for capable computer users of my generation to choose a free, reliable and state of the art operating system and to get rid of the arbitrariness of commercial software vendors and business people squeezing just money out of people that have to rely on them instead of supplying working and useful software. .LP I have much experience with different home computer OS's and workstation UNIX implementations. You can trust me. Just use linux and get rid of all your problems (What a pity it runs only on PCs and not on higher performance workstations) .LP Thanx go also to Nils Rennebarth who convinced me I should implement the colormap install feature during color grabbing and made me develop a way to accomplish this in a fruitful discussion. .LP Even more thanx to R.K.Lloyd@csc.liv.ac.uk (no RL name known) for his patches that are needed to allow compilation under HP-UX (but changed two of his patches that disabled grabbing of colors by accident ;-) and Chris Olson (chris@Sterling.COM) for pointing me at the compilation problems on SUN's (but who would use a Sun? >;-> ). .LP Thanks and greetings go to Chris Rouch (chris@wg.estec.esa.nl). He was the first person that could provide a patch to make xcolorsel run on a Sun. Actually the patch had a bug as well, however it did show where to look at, so the problem could be solved in seconds. Many other people (far too many to list here) sent me detailed debug sessions from their machines that approved the detected bug. Thanks to all these as well. .LP Maybe I should have announced xcolorsel louder when it still was called xpalette. This way the long existing segmentation fault problem would have been found earlier. Many people searching for a bug on several machines are obviously more succesful than a single one. .LP Thus once again the power of the Internet community was shown. .SH COPYRIGHTS As I strongly believe in the usefulness of free software this program is released under the GNU general public license: .LP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published be the Free Software Foundation; either version 2 of the License, or (at your opinion) any later version. .LP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .LP You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .LP Part of the files are derived from the Template Widget of the Athena Widgets as published by the Massachusetts Institute of Technology. Actually these files do not contain any code by the M.I.T but only variable declarations. Nevertheless these parts of these files are still distributed under the terms of the M.I.T copyright which are here repeated: .LP Copyright Massachusetts Institute of Technology 1987, 1988 .LP Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of M.I.T. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. .LP M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .SH FILES .I /usr/lib/X11/rgb.txt .br .I /usr/lib/X11/xcolorsel/Xcolorsel.help .br .I /usr/lib/X11/app-defaults/Xcolorsel .br .I /usr/lib/X11/app-defaults/Xcolorsel-color .SH SEE ALSO .BR X "(1), " xcolormap "(1), " xfontsel (1), .BR editres (1) xcolorsel-1.1a.orig/R6.generic.makefile100644 1750 1750 1646 5662004211 17234 0ustar vizzievizziexcolorsel: xcolorsel.o RgbText.o RgbSink.o RgbSrc.o cc -s -o xcolorsel xcolorsel.o RgbText.o RgbSrc.o RgbSink.o -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 RgbText.o: RgbTextP.h RgbText.h RgbSink.h RgbSrc.h config.h RgbText.c cc -O2 -c RgbText.c RgbSink.o: RgbSinkP.h RgbSink.h RgbTextP.h RgbText.h config.h RgbSink.c cc -O2 -c RgbSink.c RgbSrc.o: RgbSrcP.h RgbSrc.h RgbTextP.h RgbText.h config.h RgbSrc.c config.h cc -O2 -c RgbSrc.c xcolorsel.o: xcolorsel.c xcslicon RgbText.h lens lensMask biglens biglensMask defhelp.h config.h appdef-c.h appdef.h cc -O2 -c xcolorsel.c appdef-c.h: Xcolorsel-color.ad app2head Xcolorsel-color.ad > appdef-c.h appdef.h: Xcolorsel.ad app2head Xcolorsel.ad > appdef.h clean: rm -f *.o *.tar.Z *.tar *.tgz purge: rm -f xcolorsel *.o appdef.h appdef-c.h Xcolorsel.help *.tar.Z Makefile makefile *.tar *.tgz Xcolorsel.help: xcolorsel.man nroff -Tascii -man xcolorsel.man | col -b > Xcolorsel.help xcolorsel-1.1a.orig/appdef-c.h100644 1750 1750 1767 5673421076 15505 0ustar vizzievizzie"*.beNiceToColormap: False", "*.shadowWidth: 2", "*.message.borderWidth:2", "*.Scrollbar.background: Chocolate2", "*.Scrollbar.foreground: Chocolate4", "*.borderColor: LightSalmon4", "*.pointerColor: Black", "*.pointerColorBackground: White", "*.Background: SandyBrown", "*.Foreground: Salmon4", "*.text.borderWidth: 2", "*.displayMenu.borderWidth: 2", "*.Command.background: Chocolate1", "*.Command.foreground: Chocolate4", "*.Toggle.background: Chocolate2", "*.Toggle.foreground: Chocolate4", "*.quit.background: OrangeRed2", "*.quit.foreground: OrangeRed4", "*.close.background: OrangeRed2", "*.close.foreground: OrangeRed4", "*.about.background: OliveDrab2", "*.about.foreground: OliveDrab4", "*.defaults.background: OliveDrab2", "*.defaults.foreground: OliveDrab4", "*.grab.background: Gold1", "*.grab.foreground: Gold4", "*.display.background: Gold1", "*.display.foreground: Gold4", "*.fileinfo.background: Gold2", "*.fileinfo.foreground: Gold4", "*.reverse.background: Gold2", "*.reverse.foreground: Gold4", xcolorsel-1.1a.orig/appdef.h100644 1750 1750 2736 5673421076 15262 0ustar vizzievizzie"*.text.scrollHorizontal: WhenNeeded", "*.text.scrollVertical: WhenNeeded", "*.text.displayCaret: False", "*.left: ChainLeft", "*.right: ChainRight", "*.top: ChainTop", "*.bottom: ChainBottom", "*.internalBorderWidth: 0", "*.helpshell.rootpane.textform.text.height: 300", "*.helpshell.rootpane.textform.text.width: 560", "*.about.label: About me", "*.fileinfo.label: Fileinfo", "*.grab.label: Grab color", "*.reverse.label: Reverse", "*.defaults.label: Default colors", "*.quit.label: Quit", "*.display.label: Display format", "*.comma.label: C-Style", "*.realized.label: Show real server values", "*.best.label: Best match", "*.prev.label: Previous", "*.next.label: Next", "*.setfore.label: Set foreground", "*.setback.label: Set background", "*.close.label: Dismiss", "*.input.label: Values from input file", "*.rgb4.label: 4 bit scaled rgb", "*.rgb8.label: 8 bit scaled rgb", "*.rgb12.label: 12 bit scaled rgb", "*.rgb16.label: 16 bit scaled rgb", "*.rgbi.label: Float scaled rgb", "*.ciexyz.label: CIEXYZ", "*.cieuvy.label: CIEuvY", "*.ciexyy.label: CIExyY", "*.cielab.label: CIELab", "*.cieluv.label: CIELuv", "*.tekhvc.label: TekHVC (converts slowly)", "*.srgb4.label: 4 bit truncated rgb", "*.srgb8.label: 8 bit truncated rgb", "*.srgb12.label: 12 bit truncated rgb", "*.srgb16.label: 16 bit truncated rgb", "*.helpshell.title: About Xcolorsel", xcolorsel-1.1a.orig/Xcolorsel.help100644 1750 1750 71451 5673421123 16507 0ustar vizzievizzie Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) NAME xcolorsel - display contents of rgb.txt files together with color probes. SYNOPSIS xcolorsel [options] [RgbTxtFile] DESCRIPTION This utility displays the contents of the rgb.txt file (usually found as /usr/lib/X11/rgb.txt) or a file with this format specified as the optional [RgbTxtFile] parame- ter. Each line of this file consists of 3 integers (usu- ally 0-255) representing the RGB values and a nickname for this color separated by spaces. The RGB values can be dis- played in every color representation X11R5/6 supports. Also it is possible to show the values in either resource definition or C-style. An additional option to display the RGB values the current server would be able to actu- ally display is also implemented. The main feature of Xcolorsel is that a small example tile of each color is also shown. I will describe each button/X11-control in Xcolorsel's window in the next section. This version has now also support for servers with read only colormaps (That is StaticColor, StaticGray, True- Color). Actually I did not realize that this would be needed before I got a TrueColor server myself. However since colors have to be allocated one by one in these modes, the startup time of xcolorsel has reduced dramati- cally. USAGE Xcolorsel's window is divided into four main parts: (Usually) two rows of command buttons. The RgbText Widget displaying the input file and (if needed) vertical and/or horizontal scrollbars. A message line displaying help messages, comments, or results of commands or actions. (Usually) one row of action buttons. The main (or better intended) difference between commands and actions is that action operate on colors selected in the display area and commands perform general tasks. The title bar of Xcolorsel's window should (if supported by the window manager) show the name of the current dis- played file. Depending from the window size the actual layout may dif- fer. Also the names of the buttons may differ (if for example a german application default file is used). 27th December 1993 1 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) However the position and order of the buttons and other elements should be the same, s.t. you may rely on the order in which the controls are described in this file. Command Buttons (first row) About me opens a new window displaying an ASCII-Version of this manual page. When this window is open the About me is inactive. In the lower left edge of this window a Dismiss button can be seen. Press this button to dismiss the help window. If the window is to small to display the whole file vertical and/or horizontal scrollbars are provided. The text is displayed in a standard Xaw AsciiText Widget. Text selection and -S (search) work as usual. For a full description of the capabilities of this Widget see the Athena Widget Reference Manual. If the help window is dismissed the About me button is reactivated. Fileinfo displays the number of entries in the input file. Also the number of different RGB triples is displayed. Furthermore the Xserver is queried to see how many differ- ent colors the current server will show if given all these values. The last value will differ depending on the color depth of the colormaps on the server. Xfree86 Servers usually use 6 bit for each RGB value yielding to a lower number of different colors on the server than different colors are given in the input file where RGB values are usually 8 bit each. Grab color. When you press this button, the cursor changes into a magnification glass with a transparent hole at its hot spot. Move this hole over any colored pixel in any window you are interested in and press the left but- ton. While the cursor is a magnifying glass Xcolorsel takes over the whole mouse. Xcolorsel itself ensures that each window the cursor is in is displayed with its correct colormap. After you pressed the left button the color selected is searched in the input file. The color definition in the current display format is given in the message line. Also the number of acceptable colors, exact matches and per- centage of equality of the best match are given (if any). (Exception: If display format is values from input file each of the 16 bit RGB values is given like with 16 bit scaled rgb but in decimal.) Also the line containing the best match found is selected in the RgbText Widget, and the text is scrolled, s.t. the line can be seen. The Best match, Previous, and Next actions are appropriately activated. The algorithm to compare colors is (too!) simple. Two 27th December 1993 2 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) colors R1 G1 B1 and R2 G2 B2 are compared by calculating (R1-R2)*(R1-R2) + (G1-G2)*(G1-G2) + (B1-B2)*(B1-B2). The result is scaled to 0-100%, where 100% means equivalence and 0% is the difference between black and white (aka between (0,0,0) and (255,255,255)). It is ensured that even almost equal colors compare only up to 99.99%. 100% is only possible for exact equivalence. The value above which colors are acceptable equal can be changed and defaults to 95%. Grabbed colors are compared against the color values as they can be realized on the current server not the theo- retic values from the input file. Reverse exchanges the text fore- and background color in the RgbText Widget. Default colors returns the text fore- and background color in the RgbText Widget to the values at the start of Xcol- orsel. This is (together with Reverse) useful to return to readable text after you changed to colors with the Set foreground and Set background actions to values making it impossible to read anything in the RgbText Widget. Quit quits Xcolorsel and closes all its windows. Command Buttons (second row) Display format displays a submenu that allows you to define the format in which color RGB values are displayed (Press and hold left button down over Display format but- ton and release the button over the desired format. The possible color values are the color formats that X11R5/6 supports. Values from input file displays the RGB values like given in the input file (see also comment in Grab color. Note that conversion to TekHVC is slow for not trivially short input files. While the color conversion calculation takes place the cursor in the xcolorsel windows (except scrollbars) is changed to a busy cursor and all controls are inactive. Note the difference between scaled and truncated rgb for- mats: Scaled scales the internal 16 bit RGB integer values to 4/8/12 bits whereas truncated means the most signifi- cant 4/8/12 bits. Truncated RGB values are only supported for compatibility. Their use in new programs is discour- aged. C-Style is a toggle control switching C support on/off. With C support RGB values are separated with , instead of the / used in X-Windows resource definitions. Also Hex- 27th December 1993 3 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) Numbers are given in the format that is needed in C source codes. Together with the selection capabilities of the RgbText widget this allows inclusion of color definitions in programs or Application Default Files. See next sub section. This option is meaningless with the Values from input file display format. Show real server values is again a toggle control. If enabled the server is queried which RGB values for each color it is actually able to display. Then these values are displayed instead of the theoretic values calculated by Xcolorsel and Xlib itself. Note the when searching/grabbing colors Xcolorsel always compares with the color values like they would be used by the server, because the searched color is also only known by its actually realized values. This option is meaningless with the Values from input file display format. The RgbText Widget Display area In this box (part of) the input file is displayed. Depend- ing of the length and width of the displayed information scrollbars are provided. Each line consists of an example tile of the color, the defining color values in the selected output format, and the nickname of the color. The RgbText Widget inherits all capabilities of the Asci- iText Widget, s.t. scrollbars, -S (searching) and selection work as usual. There is only one exception: Double clicking with the left button does not select words separated by white space but here senseful subparts. That is double clicking in the nickname selects the whole nick- name regardless of included whitespace. Double clicking on the color definitions selects the whole color defini- tion. If C-Style is selected the color format prefix is not selected, because it would not be useful to paste this into a C-source file. This is done to make cutting and pasting color definitions into source codes or Application Default Files as conve- nient as possible. The message line This line contains one line messages informing you about the state and results of Xcolorsel's actions. Action buttons Best match selects and scrolls the display to the best 27th December 1993 4 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) match found during the last Grab color, if one was found and is not currently selected. Previous selects and scrolls the display to the previous (next better) match, if there is one. Next selects and scrolls the display to the next (next worse) match, if there is one. Set foreground sets the text foreground color in the dis- play window to the color currently selected in it (actu- ally the color defined in the line where the first selected character resides). Set background sets the text background color in the dis- play window to the color currently selected in it (actu- ally the color defined in the line where the first selected character resides). OPTIONS As a standard Xaw application Xcolorsel accepts all stan- dard toolkit options (see X(1)). Additional options for Xcolorsel that can also be set via Xresources (mentioned in parentheses) in the application default file (or with general resource manager facilities) are: -breakpercentage n (*.breakPercentage: n) sets the break percentage to n/100 (n integer). Colors with equivalence equal to or above this value are found and displayed when grabbing colors. (see Grab color above). This option defaults to 9500. -busycursor cursor (*.busyCursor: cursor) allows you to specify the cursor shown while calculating color conversions. -color (*.customization: -color) sets the customization resource to force use of the Xcolorsel-color appli- cation default file. If no application resource file can be found at all, the compiled in Xcol- orsel-color defaults are used. -columns n (*.columns: n) sets the number of character columns initially displayed. This option usually defaults to 30. -cstyle (*.comma: True) lets Xcolorsel startup with C- Style selected. -file filename (*.file: filename) sets the file to be read in and displayed. Default is usually /usr/lib/X11/rgb.txt. You can specify the filename 27th December 1993 5 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) as command parameter without the prefixing -file. -grabcursor cursor (*.grabCursor: cursor) allows you to specify the cursor shown while grabbing colors. -helpfile filename (*.helpfile: filename ) sets the path to the helpfile. (can also be done at compile time in config.h). If set to the empty string ("", the default). Xcolorsel tries to locate the file with standard X techniques. This usually leads to file- names like /usr/lib/X11/Xcolorsel.help or /usr/lib/X11/app-defaults/Xcolorsel.help. Just trust the make install created by imake. It should know where to put the file. However people (read: vendor specific X11 releases) had problems with this so /usr/lib/X11/xcolorsel/Xcolorsel.help is now hardcoded in the Imakefile. -input, -rgb4, -rgb8, -rgb12, -rgb16, -rgbi, -ciexyz, -cieuvy, -ciexyy, -cielab, -cieluv, -tekhvc, -#4, -#8, -#12, and -#16 (*.displayFormat: format, where format is one of input, rgb4, rgb8 , rgb12, rgb16, rgbi , ciexyz, cieuvy, ciexyy , cielab, cieluv, tekhvc , #rgb, #rrggbb, #rrrgggbbb , or #rrrrgggg- bbbb) lets Xcolorsel startup displaying in the specified color format. The default and value cho- sen if set to an undefined string value is input. -internal (*.realized: False) lets Xcolorsel startup show- ing the internal theoretic color values. This is the default. -maxred n (*.maxRed: n) -maxgreen n (*.maxGreen: n) -maxblue n (*.maxBlue: n) When reading in the input file Xcolorsel calculates the maximum of each of the input RGB values and uses this as the maximum (white) value for this component. Each of these option values is incorporated in this calculation for the appropriate color component as if such a color would have been read from the input file. This is implemented to allow input file with more (or less) than 8 bit for each RGB value. This options default to 0 but note the next option: -maxintensity n (*.maxIntensity: n) is comparable to the last three options but is incorporated into each of the color components. This value usually defaults to 255. -maxrows n (*.maxRows: n) sets the maximum number of rows to be displayed at the same time. This restriction 27th December 1993 6 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) is needed because this many color cells have to be allocated at the Xserver and the number of color- cells is usually limited (usually to 256). If Xcol- orsel can't allocate this much colorcells a lower number is chosen and the user is informed via stderr. Only if not a single color can be allocated Xcolorsel gives up. Xcolorsel instructs the window manager not to allow resizes yielding to more lines getting displayed. If more lines are displayed in the display RgbText Widget area the displayed color examples will be wrong. This option usually defaults to 30. -nocolor (*.customization: '') sets the customization resource to force use of the non-color Xcolorsel application default file. If no application resource file can be found at all, the compiled in non-color Xcolorsel defaults are used. BTW, actu- ally you have to use " to specify this in resource files. -realized (*.realized: True) lets Xcolorsel startup show- ing color values how they are displayed on the server. -resourcestyle (*.comma: False) lets Xcolorsel startup with C-Style deselected. This is the default. -rows n (*.rows: n) sets the number of character rows ini- tially displayed. This option usually defaults to 10. -tilewidth n (*.tilewidth: n) sets the width of the exam- ple color tiles measured in spaces. This option usually defaults to 3. HISTORY Xcolorsel was named xpalette when I wrote it. However there were so many xpalettes that I was asked to change its name. Since xpalette is somehow comparable to xfontsel, that is it shows you the available colors and lets you select one, I call it xcolorsel now and hope that there will be no more confusion. So when you see a xpalette.tgz, or xpalette-1.0.tar.gz, or xpalette-1.0a.tar.gz it is probably a previous version of xcolorsel. INTERNALS Most of the functionality of Xcolorsel is defined in an RgbText Widget. This is a child of a TextWidget linking an RgbSrc and RgbSink Widget together, which are childs of AsciiSrc and AsciiSink, resp. Feel free to use these Wid- gets in your own programs. Most of Xcolorsel's resources are resources of these Widgets. Interested programmers 27th December 1993 7 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) should be able to find all needed information about the programming interface of these Widgets in the correspond- ing .h files (RgbSink.h, RgbSinkP.h , RgbSrc.h, RgbSrcP.h , RgbText.h, RgbTextP.h). Anyway, I would love to hear if anyone finds a general purpose of any of those widgets. (I can't think of any ;-) ). If you want to know about the internal structure and names of the Widget tree use editres(1), which is part of X11R5/6 and shows this information in a more convenient way than I could ever put in the manual page. RESTRICTIONS/MISFEATURES Installing the colormaps of windows the cursor is in dur- ing grab of colors is slow. This is because the Athena Widgets intercept ENTER/LEAVE notifications send to Xcolorsel during a pointer grab. As a work around Xcolorsel asks for notification of all cur- sor motions during a pointer grab and explicitly queries the X-Window the pointer is in, thus caus- ing ex(t/p)ensive server/client communication. Color conversion calculations are even performed when there is no need to, that is when just the C-Style is toggled. This is really annoying when using the TekHVC display format. When Display format, C-Style, or Show real server values are changed the current selection is unselected and the display scrolls up to the first line. The Best match, Previous, and Next action buttons are not appropriately (de-)activated when the selection is either changed manually in the display with the mouse or automatically (see above misfeature). The icons and cursors (especially the bigger magnifying glass) are extremely ugly. Suggestions for nice bitmaps are welcome. The color application default is even more ugly. It is an example of what not to do with Xcolorsel. Actually the intention was to classify operations with col- ors. (Negative commands like Quit in red, positive commands like Default colors in bright or not that bright (About me) green. Commands requiring user intervention bright yellow. Other commands in stan- dard yellow. And the remaining toggles and actions in orange.) However the result just makes me puke. Suggestions for nice colors are also welcome. If the help window is displayed About me should not be 27th December 1993 8 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) inactive but instead allow to raise the window. The color compare formula (see Grab color above) is (at least) not very sophisticated. When showing the busy cursor during color conversions the standard cursor is still shown when over scroll- bars. This is because I didn't find a way to change the cursor over Athena scrollbars. Later I saw that one can of course hide all windows under an invisi- ble input only window that changes the cursor when it enters it. (I got this from Mumail, where unfor- tunately only part of the window is hidden under the invisible window). You will notice that my programming style changed while coding Xcolorsel, thus the look a like of the sources is not as consistent as it should be. BUGS Under AIX (IBM RS/6000) at least when using 16 color monochrom monitors and the Motif window manager, searching the window tree sometimes finds windows with invalid col- ormaps and that are not drawable. There is a flag to not to try to install colormaps during color grabbing. However if you click on a window border Xcolorsel will crash. I assume that this is caused by mwm placing an invisible input only window over the borders it draws. I did not find a way to make Xcolorsel smart enough to not fall in this trap. Even if Xcolorsel would see that this is an input only window, there is no way to get the data it actually needs (colormap and pixelvalue at the location you are clicking on). Just do not click on Mwm borders. Or better do not use Mwm at all. Motif is no free soft- ware. Boycott it! Fvwm is much better anyway. AUTHOR Michael Weller Heiderhoefen 116b D 46049 Oberhausen Germany reachable by means of Email as one of: eowmob@exp-math.uni-essen.de eowmob@pollux.exp-math.uni-essen.de mat42b@aixrs1.hrz.uni-essen.de Please note that I did this as an exercise to improve my understanding of the Athena Widgets and X. I consider this project as (almost) finished. The priority of this project is as low as possible for me. No further extensions are planned so far. However I will put in patches to support other systems (please make them controllable with 27th December 1993 9 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) #define's either out of config.h or provided by your imake) and bug fixes and redistribute them to ensure that only one consistent version floats through the net. ACKNOWLEDGEMENTS This work and much more would not have been possible with- out the Linux project initiated by Linus Torvalds (and of course all other people contributing their work to this project). This project together with the GNU project made it possible for capable computer users of my generation to choose a free, reliable and state of the art operating system and to get rid of the arbitrariness of commercial software vendors and business people squeezing just money out of people that have to rely on them instead of supply- ing working and useful software. I have much experience with different home computer OS's and workstation UNIX implementations. You can trust me. Just use linux and get rid of all your problems (What a pity it runs only on PCs and not on higher performance workstations) Thanx go also to Nils Rennebarth who convinced me I should implement the colormap install feature during color grab- bing and made me develop a way to accomplish this in a fruitful discussion. Even more thanx to R.K.Lloyd@csc.liv.ac.uk (no RL name known) for his patches that are needed to allow compila- tion under HP-UX (but changed two of his patches that dis- abled grabbing of colors by accident ;-) and Chris Olson (chris@Sterling.COM) for pointing me at the compilation problems on SUN's (but who would use a Sun? >;-> ). Thanks and greetings go to Chris Rouch (chris@wg.estec.esa.nl). He was the first person that could provide a patch to make xcolorsel run on a Sun. Actually the patch had a bug as well, however it did show where to look at, so the problem could be solved in sec- onds. Many other people (far too many to list here) sent me detailed debug sessions from their machines that approved the detected bug. Thanks to all these as well. Maybe I should have announced xcolorsel louder when it still was called xpalette. This way the long existing seg- mentation fault problem would have been found earlier. Many people searching for a bug on several machines are obviously more succesful than a single one. Thus once again the power of the Internet community was shown. COPYRIGHTS As I strongly believe in the usefulness of free software 27th December 1993 10 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) this program is released under the GNU general public license: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published be the Free Software Foundation; either version 2 of the License, or (at your opinion) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANBILITY or FITNESS FOR A PAR- TICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Part of the files are derived from the Template Widget of the Athena Widgets as published by the Massachusetts Institute of Technology. Actually these files do not contain any code by the M.I.T but only variable decla- rations. Nevertheless these parts of these files are still distributed under the terms of the M.I.T copyright which are here repeated: Copyright Massachusetts Institute of Technology 1987, 1988 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of M.I.T. not be used in advertising or pub- licity pertaining to distribution of the software without specific, written prior permission. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER- CHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLI- GENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 27th December 1993 11 Xcolorsel(1) Xcolorsel User's Guide Xcolorsel(1) FILES /usr/lib/X11/rgb.txt /usr/lib/X11/xcolorsel/Xcolorsel.help /usr/lib/X11/app-defaults/Xcolorsel /usr/lib/X11/app-defaults/Xcolorsel-color SEE ALSO X(1), xcolormap(1), xfontsel(1), editres(1) 27th December 1993 12 xcolorsel-1.1a.orig/R5.generic.makefile100644 1750 1750 1633 5662003225 17233 0ustar vizzievizziexcolorsel: xcolorsel.o RgbText.o RgbSink.o RgbSrc.o cc -s -o xcolorsel xcolorsel.o RgbText.o RgbSrc.o RgbSink.o -lXaw -lXmu -lXt -lXext -lX11 RgbText.o: RgbTextP.h RgbText.h RgbSink.h RgbSrc.h config.h RgbText.c cc -O2 -c RgbText.c RgbSink.o: RgbSinkP.h RgbSink.h RgbTextP.h RgbText.h config.h RgbSink.c cc -O2 -c RgbSink.c RgbSrc.o: RgbSrcP.h RgbSrc.h RgbTextP.h RgbText.h config.h RgbSrc.c config.h cc -O2 -c RgbSrc.c xcolorsel.o: xcolorsel.c xcslicon RgbText.h lens lensMask biglens biglensMask defhelp.h config.h appdef-c.h appdef.h cc -O2 -c xcolorsel.c appdef-c.h: Xcolorsel-color.ad app2head Xcolorsel-color.ad > appdef-c.h appdef.h: Xcolorsel.ad app2head Xcolorsel.ad > appdef.h clean: rm -f *.o *.tar.Z *.tar *.tgz purge: rm -f xcolorsel *.o appdef.h appdef-c.h Xcolorsel.help *.tar.Z Makefile makefile *.tar *.tgz Xcolorsel.help: xcolorsel.man nroff -Tascii -man xcolorsel.man | col -b > Xcolorsel.help xcolorsel-1.1a.orig/debug-R6.generic.makefile100644 1750 1750 1662 5673414027 20332 0ustar vizzievizziexcolorsel: xcolorsel.o RgbText.o RgbSink.o RgbSrc.o cc -g -o xcolorsel xcolorsel.o RgbText.o RgbSrc.o RgbSink.o -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 RgbText.o: RgbTextP.h RgbText.h RgbSink.h RgbSrc.h config.h RgbText.c cc -O2 -g -c RgbText.c RgbSink.o: RgbSinkP.h RgbSink.h RgbTextP.h RgbText.h config.h RgbSink.c cc -O2 -g -c RgbSink.c RgbSrc.o: RgbSrcP.h RgbSrc.h RgbTextP.h RgbText.h config.h RgbSrc.c config.h cc -O2 -g -c RgbSrc.c xcolorsel.o: xcolorsel.c xcslicon RgbText.h lens lensMask biglens biglensMask defhelp.h config.h appdef-c.h appdef.h cc -O2 -g -c xcolorsel.c appdef-c.h: Xcolorsel-color.ad app2head Xcolorsel-color.ad > appdef-c.h appdef.h: Xcolorsel.ad app2head Xcolorsel.ad > appdef.h clean: rm -f *.o *.tar.Z *.tar *.tgz purge: rm -f xcolorsel *.o appdef.h appdef-c.h Xcolorsel.help *.tar.Z Makefile makefile *.tar *.tgz Xcolorsel.help: xcolorsel.man nroff -Tascii -man xcolorsel.man | col -b > Xcolorsel.help