Debian Codegraph @

libSoXt/src/mixedMode/SoXtColSlider.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990-93 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.3 $
44 |
45 | Classes:
46 | _SoXtColorSlider
47 |
48 | Author(s) : Alain Dumesny
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #ifdef DEBUG
55 #include <cstdio>
56 #endif
57
58 #include <Inventor/SbLinear.h>cxx . . $ `<file>/lib/database/include/Inventor/SbLinear.h`/
59 #include <Inventor/SbColor.h>cxx . . $ `<file>/lib/database/include/Inventor/SbColor.h`/
60 #include "_SoXtUIRegion.h"cxx . . $ `<file>/libSoXt/include/_SoXtUIRegion.h`/
61 #include "_SoXtColorSlider.h"cxx . . $ `<file>/libSoXt/include/_SoXtColorSlider.h`/
62
63 #include <cstdlib>
64
65 #include <X11/StringDefs.h>
66 #include <X11/Intrinsic.h>
67 #include <Xm/Text.h>
68
69 #include <GL/gl.h>
70
71 ////////////////////////////////////////////////////////////////////////
72 //
73 // Public constructor - build the widget right now
74 //
75 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::_SoXtColorSlidercxx . . $ _SoXtColorSlider#_SoXtColorSlider(d4ec4607eb729426).(
76 Widgetcxx . . $ Widget# parent,
77 const char *name,
78 SbBoolcxx . . $ SbBool# buildInsideParent,
79 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::Typecxx . . $ _SoXtColorSlider#Type# type)
80 : _SoXtSlidercxx . . $ _SoXtSlider#(
81 parent,
82 name,
83 buildInsideParent,
84 FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!) // tell slider not to build just yet
85 //
86 ////////////////////////////////////////////////////////////////////////
87 {
88 // In this case, this component is what the app wants, so buildNow = TRUE
89 constructorCommoncxx . . $ _SoXtColorSlider#constructorCommon(a1a30635db91163).(type, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
90 }
91
92 ////////////////////////////////////////////////////////////////////////
93 //
94 // SoEXTENDER constructor - the subclass tells us whether to build or not
95 //
96 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::_SoXtColorSlidercxx . . $ _SoXtColorSlider#_SoXtColorSlider(65491f0cb261b2f6).(
97 Widgetcxx . . $ Widget# parent,
98 const char *name,
99 SbBoolcxx . . $ SbBool# buildInsideParent,
100 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::Typecxx . . $ _SoXtColorSlider#Type# type,
101 SbBoolcxx . . $ SbBool# buildNow)
102 : _SoXtSlidercxx . . $ _SoXtSlider#(
103 parent,
104 name,
105 buildInsideParent,
106 FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!) // tell slider not to build just yet
107 //
108 ////////////////////////////////////////////////////////////////////////
109 {
110 // In this case, this component may be what the app wants,
111 // or it may want a subclass of this component. Pass along buildNow
112 // as it was passed to us.
113 constructorCommoncxx . . $ _SoXtColorSlider#constructorCommon(a1a30635db91163).(type, buildNow);
114 }
115
116 ////////////////////////////////////////////////////////////////////////
117 //
118 // Called by the constructors
119 //
120 // private
121 //
122 void
123 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::constructorCommoncxx . . $ _SoXtColorSlider#constructorCommon(a1a30635db91163).(_SoXtColorSlidercxx . . $ _SoXtColorSlider#::Typecxx . . $ _SoXtColorSlider#Type# t, SbBoolcxx . . $ SbBool# buildNow)
124 //
125 //////////////////////////////////////////////////////////////////////
126 {
127 // init local vars
128 WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
129 typecxx . . $ _SoXtColorSlider#type. = t;
130 defaultColorscxx . . $ _SoXtColorSlider#defaultColors. = colorscxx . . $ _SoXtColorSlider#colors. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
131 geometrycxx . . $ _SoXtColorSlider#geometry. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
132 colorcxx . . $ _SoXtColorSlider#color.[0] = colorcxx . . $ _SoXtColorSlider#color.[1] = colorcxx . . $ _SoXtColorSlider#color.[2] = 0.0;
133
134 // allocate memory for the color shading and geometry
135 switch(typecxx . . $ _SoXtColorSlider#type.) {
136 case RED_SLIDERcxx . . $ _SoXtColorSlider#RED_SLIDER.:
137 case GREEN_SLIDERcxx . . $ _SoXtColorSlider#GREEN_SLIDER.:
138 case BLUE_SLIDERcxx . . $ _SoXtColorSlider#BLUE_SLIDER.:
139 colorscxx . . $ _SoXtColorSlider#colors. = (SbColorcxx . . $ SbColor# *)malloc(2*sizeof(SbColorcxx . . $ SbColor#));
140 defaultColorscxx . . $ _SoXtColorSlider#defaultColors. = (SbColorcxx . . $ SbColor# *)malloc(2*sizeof(SbColorcxx . . $ SbColor#));
141 geometrycxx . . $ _SoXtColorSlider#geometry. = (SbVec2fcxx . . $ SbVec2f# *)malloc(4 * sizeof(SbVec2fcxx . . $ SbVec2f#));
142 break;
143 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
144 colorscxx . . $ _SoXtColorSlider#colors. = (SbColorcxx . . $ SbColor# *)malloc(7*sizeof(SbColorcxx . . $ SbColor#));
145 defaultColorscxx . . $ _SoXtColorSlider#defaultColors. = (SbColorcxx . . $ SbColor# *)malloc(7*sizeof(SbColorcxx . . $ SbColor#));
146 geometrycxx . . $ _SoXtColorSlider#geometry. = (SbVec2fcxx . . $ SbVec2f# *)malloc(14 * sizeof(SbVec2fcxx . . $ SbVec2f#));
147 break;
148 case SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER.:
149 case VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.:
150 case INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.:
151 colorscxx . . $ _SoXtColorSlider#colors. = (SbColorcxx . . $ SbColor# *)malloc(2*sizeof(SbColorcxx . . $ SbColor#));
152 defaultColorscxx . . $ _SoXtColorSlider#defaultColors. = colorscxx . . $ _SoXtColorSlider#colors.; // since there is no fix default color
153 geometrycxx . . $ _SoXtColorSlider#geometry. = (SbVec2fcxx . . $ SbVec2f# *)malloc(4 * sizeof(SbVec2fcxx . . $ SbVec2f#));
154 break;
155 }
156
157 // ??? reset the geometry to prevent the window manager under PI a362
158 // ??? to be killed (redrawing occurs even when window hasn't been
159 // ??? mapped yet so those values would be bogus)
160 int num = (typecxx . . $ _SoXtColorSlider#type. == HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.) ? 7 : 2;
161 for (int i=0; i<num; i++) {
162 geometrycxx . . $ _SoXtColorSlider#geometry.[2*i].setValuecxx . . $ SbVec2f#setValue(c49b0fdbc63185b4).(0,0);
163 geometrycxx . . $ _SoXtColorSlider#geometry.[2*i+1].setValuecxx . . $ SbVec2f#setValue(c49b0fdbc63185b4).(0,0);
164 }
165
166 // now create the default colors
167 makeDefaultColorscxx . . $ _SoXtColorSlider#makeDefaultColors(49f6e7a06ebc5aa8).();
168
169 // add a callback to update the slider's baseColor whenever the
170 // thumb is moved (unless it is INTENSITY_SLIDER, in which case
171 // the base color is independent).
172 if (typecxx . . $ _SoXtColorSlider#type. != INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.)
173 addValueChangedCallbackcxx . . $ _SoXtSlider#addValueChangedCallback(291e28490367b016).(_SoXtColorSlidercxx . . $ _SoXtColorSlider#::sliderChangedCBcxx . . $ _SoXtColorSlider#sliderChangedCB(314e3af8753aac9e)., this);
174
175 // Build the widget tree, and let SoXtComponent know about our base widget.
176 if (buildNow) {
177 Widgetcxx . . $ Widget# w = buildWidgetcxx . . $ _SoXtSlider#buildWidget(a686be44a4028679).(getParentWidgetcxx . . $ SoXtComponent#getParentWidget(24ba213de9f943e3).());
178 setBaseWidgetcxx . . $ SoXtComponent#setBaseWidget(cfa999c5a14729dd).(w);
179 }
180 }
181
182
183 ////////////////////////////////////////////////////////////////////////
184 //
185 // Destructor.
186 //
187
188 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::~cxx . . $ _SoXtColorSlider#`~_SoXtColorSlider`(49f6e7a06ebc5aa8)._SoXtColorSlidercxx . . $ _SoXtColorSlider#()
189 //
190 ////////////////////////////////////////////////////////////////////////
191 {
192 // check to make sure colors and defaultColors are not the same
193 if (defaultColorscxx . . $ _SoXtColorSlider#defaultColors. != colorscxx . . $ _SoXtColorSlider#colors.)
194 free(defaultColorscxx . . $ _SoXtColorSlider#defaultColors.);
195 free(colorscxx . . $ _SoXtColorSlider#colors.);
196 free(geometrycxx . . $ _SoXtColorSlider#geometry.);
197 }
198
199
200 ////////////////////////////////////////////////////////////////////////
201 //
202 // This routine is used to specify the slider top color, which is
203 // reflected differently depending on the slider type.
204 //
205 // usage: public
206
207 void
208 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::setBaseColorcxx . . $ _SoXtColorSlider#setBaseColor(de58861cad56015a).(
209 const float c[3])
210 //
211 ////////////////////////////////////////////////////////////////////////
212 {
213 SbBoolcxx . . $ SbBool# topChanged; // TRUE if the slider top region colors changed
214 float newVal = getValuecxx . . $ _SoXtSlider#getValue(5036dfe8d4170af2).();
215
216 switch(typecxx . . $ _SoXtColorSlider#type.) {
217
218 case RED_SLIDERcxx . . $ _SoXtColorSlider#RED_SLIDER.:
219 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
220 topChanged = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. && (c[1]!=colorcxx . . $ _SoXtColorSlider#color.[1] || c[2]!=colorcxx . . $ _SoXtColorSlider#color.[2]));
221 newVal = c[0];
222 break;
223
224 case GREEN_SLIDERcxx . . $ _SoXtColorSlider#GREEN_SLIDER.:
225 topChanged = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. && (c[0]!=colorcxx . . $ _SoXtColorSlider#color.[0] || c[2]!=colorcxx . . $ _SoXtColorSlider#color.[2]));
226 newVal = c[1];
227 break;
228
229 case BLUE_SLIDERcxx . . $ _SoXtColorSlider#BLUE_SLIDER.:
230 topChanged = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. && (c[0]!=colorcxx . . $ _SoXtColorSlider#color.[0] || c[1]!=colorcxx . . $ _SoXtColorSlider#color.[1]));
231 newVal = c[2];
232 break;
233
234 case SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER.:
235 topChanged = (c[0]!=colorcxx . . $ _SoXtColorSlider#color.[0] || (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. && c[2]!=colorcxx . . $ _SoXtColorSlider#color.[2]));
236 newVal = c[1];
237 break;
238
239 case VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.:
240 topChanged = (c[0]!=colorcxx . . $ _SoXtColorSlider#color.[0] || (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. && c[1]!=colorcxx . . $ _SoXtColorSlider#color.[1]));
241 newVal = c[2];
242 break;
243
244 case INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.:
245 topChanged = (c[0]!=colorcxx . . $ _SoXtColorSlider#color.[0] || c[1]!=colorcxx . . $ _SoXtColorSlider#color.[1] || c[2]!=colorcxx . . $ _SoXtColorSlider#color.[2]);
246 // thumb is independent of color for intensity sliders
247 break;
248 }
249
250 // assign new color
251 colorcxx . . $ _SoXtColorSlider#color.[0] = c[0];
252 colorcxx . . $ _SoXtColorSlider#color.[1] = c[1];
253 colorcxx . . $ _SoXtColorSlider#color.[2] = c[2];
254
255 if (topChanged)
256 makeWYSIWYGcolorscxx . . $ _SoXtColorSlider#makeWYSIWYGcolors(49f6e7a06ebc5aa8).();
257
258 // check for redraw needs
259 if (newVal != getValuecxx . . $ _SoXtSlider#getValue(5036dfe8d4170af2).())
260 setValuecxx . . $ _SoXtSlider#setValue(9364e6e7bff7660).(newVal);
261 else if (topChanged) {
262
263 // only redraw the top region of the slider
264
265 if (! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).())
266 return;
267 glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).());
268 drawSliderTopRegioncxx . . $ _SoXtColorSlider#drawSliderTopRegion(49f6e7a06ebc5aa8).();
269 }
270 }
271
272
273 ////////////////////////////////////////////////////////////////////////
274 //
275 // This routine sets the WYSIWYG mode
276 //
277 // usage: public
278
279 void
280 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::setWYSIWYGcxx . . $ _SoXtColorSlider#setWYSIWYG(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# flag)
281 //
282 ////////////////////////////////////////////////////////////////////////
283 {
284 if (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. == flag)
285 return;
286
287 WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. = flag;
288
289 // build WYSIWYG colors
290 if (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode. || typecxx . . $ _SoXtColorSlider#type.==SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER. || typecxx . . $ _SoXtColorSlider#type.==VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.)
291 makeWYSIWYGcolorscxx . . $ _SoXtColorSlider#makeWYSIWYGcolors(49f6e7a06ebc5aa8).();
292
293 // only need to redraw top region
294 if (! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).())
295 return;
296 glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).());
297 drawSliderTopRegioncxx . . $ _SoXtColorSlider#drawSliderTopRegion(49f6e7a06ebc5aa8).();
298 }
299
300
301 ////////////////////////////////////////////////////////////////////////
302 //
303 // This routine is called when window has changed size
304 //
305 // usage: virtual protected
306
307 void
308 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::sizeChangedcxx . . $ _SoXtColorSlider#sizeChanged(8bc400dc8eb33072).(const SbVec2scxx . . $ SbVec2s# &newSize)
309 //
310 ////////////////////////////////////////////////////////////////////////
311 {
312 // first call base class routine
313 _SoXtSlidercxx . . $ _SoXtSlider#::sizeChangedcxx . . $ _SoXtSlider#sizeChanged(8bc400dc8eb33072).(newSize);
314
315 SbVec2fcxx . . $ SbVec2f# *v = geometrycxx . . $ _SoXtColorSlider#geometry.;
316
317 // now recompute things that depend on window size
318 switch(typecxx . . $ _SoXtColorSlider#type.) {
319 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
320 {
321 // assign y values
322 int i;
323 for (i=0; i<7; i++) {
324 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = sly1cxx . . $ _SoXtSlider#sly1.;
325 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = sly2cxx . . $ _SoXtSlider#sly2. + 1;
326 }
327
328 // assign x values
329 float l = (slx2cxx . . $ _SoXtSlider#slx2. - slx1cxx . . $ _SoXtSlider#slx1. + 1) / 6.0;
330 v = geometrycxx . . $ _SoXtColorSlider#geometry.;
331 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx1cxx . . $ _SoXtSlider#slx1.;
332 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx1cxx . . $ _SoXtSlider#slx1.;
333 for (i=1; i<6; i++) {
334 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx1cxx . . $ _SoXtSlider#slx1. + i*l;
335 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx1cxx . . $ _SoXtSlider#slx1. + i*l;
336 }
337 (*(v++))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx2cxx . . $ _SoXtSlider#slx2. + 1;
338 (*v)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx2cxx . . $ _SoXtSlider#slx2. + 1;
339 }
340 break;
341
342 default: // everything else
343 (*v)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = (*(v+1))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx1cxx . . $ _SoXtSlider#slx1.;
344 (*(v+2))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = (*(v+3))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = slx2cxx . . $ _SoXtSlider#slx2. + 1;
345 (*v)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = (*(v+3))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = sly1cxx . . $ _SoXtSlider#sly1.;
346 (*(v+1))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = (*(v+2))[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = sly2cxx . . $ _SoXtSlider#sly2. + 1;
347 break;
348 }
349 }
350
351
352 ////////////////////////////////////////////////////////////////////////
353 //
354 // This routine draws the slider top region. It is called by the
355 // _SoXtSlider::redraw routine.
356 //
357 // usage: virtual protected
358
359 void
360 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::drawSliderTopRegioncxx . . $ _SoXtColorSlider#drawSliderTopRegion(49f6e7a06ebc5aa8).()
361 //
362 ////////////////////////////////////////////////////////////////////////
363 {
364 SbColorcxx . . $ SbColor# *c = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode.) ? colorscxx . . $ _SoXtColorSlider#colors. : defaultColorscxx . . $ _SoXtColorSlider#defaultColors.;
365 SbVec2fcxx . . $ SbVec2f# *v = geometrycxx . . $ _SoXtColorSlider#geometry.;
366
367 switch(typecxx . . $ _SoXtColorSlider#type.) {
368 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
369 {
370 glBegin(GL_QUAD_STRIPcxx . . $ `<external>/11565930711847777359/gl.h:164:9`!);
371 for (int i=0; i<7; i++) {
372 glColor3fv((c++)->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).());
373 glVertex2fv((v++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
374 glVertex2fv((v++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
375 }
376 glEnd();
377 }
378 break;
379
380 default: // everything else!
381 glBegin(GL_POLYGONcxx . . $ `<external>/11565930711847777359/gl.h:165:9`!);
382 glColor3fv((c++)->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).());
383 glVertex2fv((v++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
384 glVertex2fv((v++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
385 glColor3fv(c->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).());
386 glVertex2fv((v++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
387 glVertex2fv((v)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).());
388 glEnd();
389 break;
390
391
392 }
393
394 SoDrawThumbUIRegioncxx . . $ SoDrawThumbUIRegion(6f3a90be462c391b).(thumx1cxx . . $ _SoXtSlider#thumx1., thumy1cxx . . $ _SoXtSlider#thumy1., thumx2cxx . . $ _SoXtSlider#thumx2., thumy2cxx . . $ _SoXtSlider#thumy2.);
395
396 if (isDoubleBuffercxx . . $ SoXtGLWidget#isDoubleBuffer(b126dc7c1de90089).())
397 glXSwapBuffers(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).());
398 else
399 glFlush();
400 }
401
402
403 ////////////////////////////////////////////////////////////////////////
404 //
405 // Build the default colors (non WYSIWYG colors)
406 //
407 // usage: private
408
409 void
410 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::makeDefaultColorscxx . . $ _SoXtColorSlider#makeDefaultColors(49f6e7a06ebc5aa8).()
411 //
412 ////////////////////////////////////////////////////////////////////////
413 {
414 SbColorcxx . . $ SbColor# *c = defaultColorscxx . . $ _SoXtColorSlider#defaultColors.;
415
416 switch(typecxx . . $ _SoXtColorSlider#type.) {
417 case RED_SLIDERcxx . . $ _SoXtColorSlider#RED_SLIDER.:
418 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
419 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 1.0;
420 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0;
421 break;
422
423 case GREEN_SLIDERcxx . . $ _SoXtColorSlider#GREEN_SLIDER.:
424 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
425 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0;
426 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 1.0;
427 break;
428
429 case BLUE_SLIDERcxx . . $ _SoXtColorSlider#BLUE_SLIDER.:
430 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
431 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 0.0;
432 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0;
433 break;
434
435 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
436 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 1.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
437 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 1.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
438 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 0.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 1.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; c++;
439 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 0.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0; c++;
440 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 0.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0; c++;
441 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 1.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 0.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0; c++;
442 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 1.0; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0;
443 break;
444
445 case SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER.:
446 case VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.:
447 case INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.:
448 c->setValuecxx . . $ SbVec3f#setValue(4e87f9d875f2d08d).(0., 0., 0.); c++; // black...
449 c->setValuecxx . . $ SbVec3f#setValue(4e87f9d875f2d08d).(0., 0., 0.); // to black (initially)
450 break;
451 }
452 }
453
454
455 ////////////////////////////////////////////////////////////////////////
456 //
457 // builds the WYSIWYG colors.
458 //
459 // usage: private
460
461 void
462 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::makeWYSIWYGcolorscxx . . $ _SoXtColorSlider#makeWYSIWYGcolors(49f6e7a06ebc5aa8).()
463 //
464 ////////////////////////////////////////////////////////////////////////
465 {
466 SbColorcxx . . $ SbColor# *c = colorscxx . . $ _SoXtColorSlider#colors.;
467
468 switch(typecxx . . $ _SoXtColorSlider#type.) {
469 case RED_SLIDERcxx . . $ _SoXtColorSlider#RED_SLIDER.:
470 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 0.0; (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = 1.0;
471 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = colorcxx . . $ _SoXtColorSlider#color.[1];
472 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = colorcxx . . $ _SoXtColorSlider#color.[2];
473 break;
474
475 case GREEN_SLIDERcxx . . $ _SoXtColorSlider#GREEN_SLIDER.:
476 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = colorcxx . . $ _SoXtColorSlider#color.[0];
477 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 0.0; (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = 1.0;
478 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = colorcxx . . $ _SoXtColorSlider#color.[2];
479 break;
480
481 case BLUE_SLIDERcxx . . $ _SoXtColorSlider#BLUE_SLIDER.:
482 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = colorcxx . . $ _SoXtColorSlider#color.[0];
483 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = colorcxx . . $ _SoXtColorSlider#color.[1];
484 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 0.0; (*(c+1))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0;
485 break;
486
487 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
488 {
489 // convert to rgb
490 SbColorcxx . . $ SbColor# rgbcxx . . $ SbColor#SbColor(49f6e7a06ebc5aa8).;
491 rgb.setHSVValuecxx . . $ SbColor#setHSVValue(c2cf48f1aba92178).(colorcxx . . $ _SoXtColorSlider#color.);
492
493 // get max and min values
494 float max = colorcxx . . $ _SoXtColorSlider#color.[2];
495 float min = (rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] < rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1]) ?
496 ((rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] < rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]) ? rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] : rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]) :
497 ((rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] < rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]) ? rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] : rgb[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]);
498
499 // now assign the 7 color ranges
500 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = max; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = min; c++;
501 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = max; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = min; c++;
502 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = min; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = max; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = min; c++;
503 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = min; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = max; c++;
504 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = min; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = max; c++;
505 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = max; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = min; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = max; c++;
506 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = max; (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = min;
507 }
508 break;
509
510 case SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER.:
511 {
512 float val = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode.) ? colorcxx . . $ _SoXtColorSlider#color.[2] : 1.0;
513
514 // find starting color (max value, grey)
515 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = val; c++;
516
517 // find ending color
518 float hsv[3];
519 hsv[0] = colorcxx . . $ _SoXtColorSlider#color.[0];
520 hsv[1] = 1.0;
521 hsv[2] = val;
522 c->setHSVValuecxx . . $ SbColor#setHSVValue(c2cf48f1aba92178).(hsv);
523 }
524 break;
525
526 case VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.:
527 c++; // only change the 2nd color (the 1st is always black)
528
529 // find ending color
530 if (colorcxx . . $ _SoXtColorSlider#color.[1] == 0.0) {
531 (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = 1.0;
532 }
533 else {
534 float hsv[3];
535 hsv[0] = colorcxx . . $ _SoXtColorSlider#color.[0];
536 hsv[1] = (WYSIWYGmodecxx . . $ _SoXtColorSlider#WYSIWYGmode.) ? colorcxx . . $ _SoXtColorSlider#color.[1] : 1.0;
537 hsv[2] = 1.0;
538 c->setHSVValuecxx . . $ SbColor#setHSVValue(c2cf48f1aba92178).(hsv);
539 }
540 break;
541
542 case INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.:
543 c++; // only change the 2nd color (the 1st is always black)
544 *c =cxx . . $ SbColor#`operator=`(44a021c60a83616a). colorcxx . . $ SbColor#SbColor(de58861cad56015a).;
545 break;
546 }
547 }
548
549
550
551 //
552 ////////////////////////////////////////////////////////////////////////
553 // static callbacks stubs
554 ////////////////////////////////////////////////////////////////////////
555 //
556
557
558 //
559 // called whenever the slider value changes. Make sure the
560 // corresponding baseColor factor is also updated to reflect
561 // the new slider position.
562 //
563 void
564 _SoXtColorSlidercxx . . $ _SoXtColorSlider#::sliderChangedCBcxx . . $ _SoXtColorSlider#sliderChangedCB(314e3af8753aac9e).(void *pt, float val)
565 {
566 _SoXtColorSlidercxx . . $ _SoXtColorSlider# *p = (_SoXtColorSlidercxx . . $ _SoXtColorSlider# *)pt;
567
568 switch(p->typecxx . . $ _SoXtColorSlider#type.) {
569 case RED_SLIDERcxx . . $ _SoXtColorSlider#RED_SLIDER.:
570 case HUE_SLIDERcxx . . $ _SoXtColorSlider#HUE_SLIDER.:
571 p->colorcxx . . $ _SoXtColorSlider#color.[0] = val;
572 break;
573 case GREEN_SLIDERcxx . . $ _SoXtColorSlider#GREEN_SLIDER.:
574 case SATURATION_SLIDERcxx . . $ _SoXtColorSlider#SATURATION_SLIDER.:
575 p->colorcxx . . $ _SoXtColorSlider#color.[1] = val;
576 break;
577 case BLUE_SLIDERcxx . . $ _SoXtColorSlider#BLUE_SLIDER.:
578 case VALUE_SLIDERcxx . . $ _SoXtColorSlider#VALUE_SLIDER.:
579 p->colorcxx . . $ _SoXtColorSlider#color.[2] = val;
580 break;
581 case INTENSITY_SLIDERcxx . . $ _SoXtColorSlider#INTENSITY_SLIDER.:
582 break; // nothing to do since thumnb is indep of baseColor
583 }
584 }