File: RgbTextP.h

package info (click to toggle)
xcolorsel 1.1a-20
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 712 kB
  • ctags: 677
  • sloc: ansic: 5,732; makefile: 76; sh: 9
file content (232 lines) | stat: -rw-r--r-- 8,986 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*********************************************************************************/
/* 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 <X11/Xaw3d/TextP.h>
#include <X11/Xcms.h>

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 */