| 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.5 $ |
| 44 | | |
| 45 | | Classes: |
| 46 | | _SoXtColorWheel |
| 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 | #if DEBUG |
| 55 | #include <iostream> |
| 56 | #endif |
| 57 | #include <inttypes.h> |
| 58 | #include <Inventor/Xt/devices/SoXtMouse.h>cxx . . $ `<file>/libSoXt/include/Inventor/Xt/devices/SoXtMouse.h`/ |
| 59 | #include "_SoXtColorWheel.h"cxx . . $ `<file>/libSoXt/include/_SoXtColorWheel.h`/ |
| 60 | #include "_SoXtUIRegion.h"cxx . . $ `<file>/libSoXt/include/_SoXtUIRegion.h`/ |
| 61 | |
| 62 | #include <cstdlib> |
| 63 | #include <cmath> |
| 64 | |
| 65 | #include <GL/gl.h> |
| 66 | |
| 67 | /* |
| 68 | * Defines |
| 69 | */ |
| 70 | |
| 71 | #define CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`! 5 |
| 72 | #define STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`! 32 |
| 73 | #define SPACEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:73:9`! 3 |
| 74 | #define MARKER_SLOTcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:74:9`! 3 |
| 75 | |
| 76 | #define myMapcolorcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:76:9`!(i, r, g, b) \ |
| 77 | XColor col; \ |
| 78 | col.red = r << 8; \ |
| 79 | col.green = g << 8; \ |
| 80 | col.blue = b << 8; \ |
| 81 | col.flags = DoRedcxx . . $ `<external>/1208737181511191802/X.h:622:9`! | DoGreencxx . . $ `<external>/1208737181511191802/X.h:623:9`! | DoBluecxx . . $ `<external>/1208737181511191802/X.h:624:9`!; \ |
| 82 | col.pixel = i; \ |
| 83 | XStoreColor(getDisplay(), overlayColorMap, &col); |
| 84 | |
| 85 | |
| 86 | //////////////////////////////////////////////////////////////////////// |
| 87 | // |
| 88 | // Public constructor - build the widget right now |
| 89 | // |
| 90 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::_SoXtColorWheelcxx . . $ _SoXtColorWheel#_SoXtColorWheel(13a1a66a4f5d094a).( |
| 91 | Widgetcxx . . $ Widget# parent, |
| 92 | const char *name, |
| 93 | SbBoolcxx . . $ SbBool# buildInsideParent) |
| 94 | : SoXtGLWidgetcxx . . $ SoXtGLWidget#( |
| 95 | parent, |
| 96 | name, |
| 97 | buildInsideParent, |
| 98 | SO_GLX_RGBcxx . . $ `libSoXt/include/Inventor/Xt/SoXtGLWidget.h:68:9`! | SO_GLX_OVERLAYcxx . . $ `libSoXt/include/Inventor/Xt/SoXtGLWidget.h:71:9`!, |
| 99 | FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!) // tell GLWidget not to build just yet |
| 100 | // |
| 101 | //////////////////////////////////////////////////////////////////////// |
| 102 | { |
| 103 | // In this case, this component is what the app wants, so buildNow = TRUE |
| 104 | constructorCommoncxx . . $ _SoXtColorWheel#constructorCommon(d4f767463ce0a6b3).(TRUEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:111:9`!); |
| 105 | } |
| 106 | |
| 107 | //////////////////////////////////////////////////////////////////////// |
| 108 | // |
| 109 | // SoEXTENDER constructor - the subclass tells us whether to build or not |
| 110 | // |
| 111 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::_SoXtColorWheelcxx . . $ _SoXtColorWheel#_SoXtColorWheel(d778020db9c00467).( |
| 112 | Widgetcxx . . $ Widget# parent, |
| 113 | const char *name, |
| 114 | SbBoolcxx . . $ SbBool# buildInsideParent, |
| 115 | SbBoolcxx . . $ SbBool# buildNow) |
| 116 | : SoXtGLWidgetcxx . . $ SoXtGLWidget#( |
| 117 | parent, |
| 118 | name, |
| 119 | buildInsideParent, |
| 120 | SO_GLX_RGBcxx . . $ `libSoXt/include/Inventor/Xt/SoXtGLWidget.h:68:9`! | SO_GLX_OVERLAYcxx . . $ `libSoXt/include/Inventor/Xt/SoXtGLWidget.h:71:9`!, |
| 121 | FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!) // tell GLWidget not to build just yet |
| 122 | // |
| 123 | //////////////////////////////////////////////////////////////////////// |
| 124 | { |
| 125 | // In this case, this component may be what the app wants, |
| 126 | // or it may want a subclass of this component. Pass along buildNow |
| 127 | // as it was passed to us. |
| 128 | constructorCommoncxx . . $ _SoXtColorWheel#constructorCommon(d4f767463ce0a6b3).(buildNow); |
| 129 | } |
| 130 | |
| 131 | //////////////////////////////////////////////////////////////////////// |
| 132 | // |
| 133 | // Called by the constructors |
| 134 | // |
| 135 | // private |
| 136 | // |
| 137 | void |
| 138 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::constructorCommoncxx . . $ _SoXtColorWheel#constructorCommon(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# buildNow) |
| 139 | // |
| 140 | ////////////////////////////////////////////////////////////////////// |
| 141 | { |
| 142 | mousecxx . . $ _SoXtColorWheel#mouse. = new SoXtMousecxx . . $ SoXtMouse#(ButtonPressMaskcxx . . $ `<external>/1208737181511191802/X.h:153:9`! | ButtonMotionMaskcxx . . $ `<external>/1208737181511191802/X.h:164:9`! | ButtonReleaseMaskcxx . . $ `<external>/1208737181511191802/X.h:154:9`!); |
| 143 | |
| 144 | // init local vars |
| 145 | WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode. = FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!; |
| 146 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0] = hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1] = 0.0; |
| 147 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2] = 1.0; |
| 148 | setGlxSizecxx . . $ SoXtGLWidget#setGlxSize(edd509d4d7dd9f6).( SbVec2scxx . . $ SbVec2s#SbVec2s(af780a7c10c7990f).(100, 100) ); // default size |
| 149 | |
| 150 | // callback lists |
| 151 | startCallbackscxx . . $ _SoXtColorWheel#startCallbacks. = new SoCallbackListcxx . . $ SoCallbackList#; |
| 152 | changedCallbackscxx . . $ _SoXtColorWheel#changedCallbacks. = new SoCallbackListcxx . . $ SoCallbackList#; |
| 153 | finishCallbackscxx . . $ _SoXtColorWheel#finishCallbacks. = new SoCallbackListcxx . . $ SoCallbackList#; |
| 154 | interactivecxx . . $ _SoXtColorWheel#interactive. = FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!; |
| 155 | |
| 156 | // allocate memory for the geometry/colors |
| 157 | int num = 1 + CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`! * (STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`! + 1); |
| 158 | geometrycxx . . $ _SoXtColorWheel#geometry. = (SbVec2fcxx . . $ SbVec2f# *)malloc(num * sizeof(SbVec2fcxx . . $ SbVec2f#)); |
| 159 | defaultColorscxx . . $ _SoXtColorWheel#defaultColors. = (SbColorcxx . . $ SbColor# *)malloc(num * sizeof(SbColorcxx . . $ SbColor#)); |
| 160 | colorscxx . . $ _SoXtColorWheel#colors. = (SbColorcxx . . $ SbColor# *)malloc(num * sizeof(SbColorcxx . . $ SbColor#)); |
| 161 | |
| 162 | // ??? reset the geometry to prevent the window manager under PI a362 |
| 163 | // ??? to be killed (redrawing occurs even when window hasn't been |
| 164 | // ??? mapped yet so those values would be bogus) |
| 165 | for (int i=0; i<num; i++) |
| 166 | geometrycxx . . $ _SoXtColorWheel#geometry.[i].setValuecxx . . $ SbVec2f#setValue(c49b0fdbc63185b4).(0,0); |
| 167 | |
| 168 | // make the full intensity colors |
| 169 | makeWheelColorscxx . . $ _SoXtColorWheel#makeWheelColors(7c85f03d1e7f7825).(defaultColorscxx . . $ _SoXtColorWheel#defaultColors., 1.0); |
| 170 | |
| 171 | // Build the widget tree, and let SoXtComponent know about our base widget. |
| 172 | if (buildNow) { |
| 173 | Widgetcxx . . $ Widget# w = buildWidgetcxx . . $ _SoXtColorWheel#buildWidget(a686be44a4028679).(getParentWidgetcxx . . $ SoXtComponent#getParentWidget(24ba213de9f943e3).()); |
| 174 | setBaseWidgetcxx . . $ SoXtComponent#setBaseWidget(cfa999c5a14729dd).(w); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 179 | //////////////////////////////////////////////////////////////////////// |
| 180 | // |
| 181 | // Destructor. |
| 182 | // |
| 183 | |
| 184 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::~cxx . . $ _SoXtColorWheel#`~_SoXtColorWheel`(49f6e7a06ebc5aa8)._SoXtColorWheelcxx . . $ _SoXtColorWheel#() |
| 185 | // |
| 186 | //////////////////////////////////////////////////////////////////////// |
| 187 | { |
| 188 | if (geometrycxx . . $ _SoXtColorWheel#geometry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 189 | free(geometrycxx . . $ _SoXtColorWheel#geometry.); |
| 190 | if (defaultColorscxx . . $ _SoXtColorWheel#defaultColors. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 191 | free(defaultColorscxx . . $ _SoXtColorWheel#defaultColors.); |
| 192 | if (colorscxx . . $ _SoXtColorWheel#colors. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 193 | free(colorscxx . . $ _SoXtColorWheel#colors.); |
| 194 | |
| 195 | delete startCallbackscxx . . $ _SoXtColorWheel#startCallbacks.; |
| 196 | delete changedCallbackscxx . . $ _SoXtColorWheel#changedCallbacks.; |
| 197 | delete finishCallbackscxx . . $ _SoXtColorWheel#finishCallbacks.; |
| 198 | |
| 199 | delete mousecxx . . $ _SoXtColorWheel#mouse.; |
| 200 | } |
| 201 | |
| 202 | |
| 203 | //////////////////////////////////////////////////////////////////////// |
| 204 | // |
| 205 | // This routine redraws the normal plane color wheel region. |
| 206 | // |
| 207 | // Use: virtual public |
| 208 | |
| 209 | void |
| 210 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::redrawcxx . . $ _SoXtColorWheel#redraw(49f6e7a06ebc5aa8).() |
| 211 | // |
| 212 | //////////////////////////////////////////////////////////////////////// |
| 213 | { |
| 214 | if (! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).()) |
| 215 | return; |
| 216 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).()); |
| 217 | |
| 218 | // make a complete drawing |
| 219 | drawWheelSurroundingcxx . . $ _SoXtColorWheel#drawWheelSurrounding(49f6e7a06ebc5aa8).(); |
| 220 | drawWheelColorscxx . . $ _SoXtColorWheel#drawWheelColors(49f6e7a06ebc5aa8).(); |
| 221 | |
| 222 | if (isDoubleBuffercxx . . $ SoXtGLWidget#isDoubleBuffer(b126dc7c1de90089).()) |
| 223 | glXSwapBuffers(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).()); |
| 224 | else |
| 225 | glFlush(); |
| 226 | } |
| 227 | |
| 228 | |
| 229 | //////////////////////////////////////////////////////////////////////// |
| 230 | // |
| 231 | // This routine redraws the color wheel overlay region (marker). |
| 232 | // |
| 233 | // Use: virtual public |
| 234 | |
| 235 | void |
| 236 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::redrawOverlaycxx . . $ _SoXtColorWheel#redrawOverlay(49f6e7a06ebc5aa8).() |
| 237 | // |
| 238 | //////////////////////////////////////////////////////////////////////// |
| 239 | { |
| 240 | drawWheelMarkercxx . . $ _SoXtColorWheel#drawWheelMarker(49f6e7a06ebc5aa8).(); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | //////////////////////////////////////////////////////////////////////// |
| 245 | // |
| 246 | // Process the passed X event. |
| 247 | // |
| 248 | // Use: virtual public |
| 249 | |
| 250 | void |
| 251 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::processEventcxx . . $ _SoXtColorWheel#processEvent(63113e41a3ee5b9d).(XAnyEventcxx . . $ XAnyEvent# *xe) |
| 252 | // |
| 253 | //////////////////////////////////////////////////////////////////////// |
| 254 | { |
| 255 | short x, y; |
| 256 | XButtonEventcxx . . $ XButtonEvent# *be; |
| 257 | XMotionEventcxx . . $ XMotionEvent# *me; |
| 258 | SbVec2scxx . . $ SbVec2s# size = getGlxSizecxx . . $ SoXtGLWidget#getGlxSize(f469ede4e6b056fc).(); |
| 259 | |
| 260 | switch (xe->typecxx . . $ $anonymous_type_17d7f07cf933eea7_53#type.) { |
| 261 | case ButtonPresscxx . . $ `<external>/1208737181511191802/X.h:183:9`!: |
| 262 | be = (XButtonEventcxx . . $ XButtonEvent# *) xe; |
| 263 | if (be->buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == Button1cxx . . $ `<external>/1208737181511191802/X.h:259:9`!) { |
| 264 | |
| 265 | // check if click is in color wheel |
| 266 | x = short(be->xcxx . . $ $anonymous_type_17d7f07cf933eea7_23#x.) - cxcxx . . $ _SoXtColorWheel#cx.; |
| 267 | y = short(size[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] - be->ycxx . . $ $anonymous_type_17d7f07cf933eea7_23#y.) - cycxx . . $ _SoXtColorWheel#cy.; |
| 268 | if ((x*x + y*y) < ((radiuscxx . . $ _SoXtColorWheel#radius.+5)*(radiuscxx . . $ _SoXtColorWheel#radius.+5))) { |
| 269 | startCallbackscxx . . $ _SoXtColorWheel#startCallbacks.->invokeCallbackscxx . . $ SoCallbackList#invokeCallbacks(5d22bdacc48458e8).(hsvColorcxx . . $ _SoXtColorWheel#hsvColor.); |
| 270 | interactivecxx . . $ _SoXtColorWheel#interactive. = TRUEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:111:9`!; |
| 271 | moveWheelMarkercxx . . $ _SoXtColorWheel#moveWheelMarker(af780a7c10c7990f).(x, y); |
| 272 | } |
| 273 | } |
| 274 | break; |
| 275 | |
| 276 | case ButtonReleasecxx . . $ `<external>/1208737181511191802/X.h:184:9`!: |
| 277 | be = (XButtonEventcxx . . $ XButtonEvent# *) xe; |
| 278 | if (be->buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == Button1cxx . . $ `<external>/1208737181511191802/X.h:259:9`! && interactivecxx . . $ _SoXtColorWheel#interactive.) { |
| 279 | interactivecxx . . $ _SoXtColorWheel#interactive. = FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!; |
| 280 | finishCallbackscxx . . $ _SoXtColorWheel#finishCallbacks.->invokeCallbackscxx . . $ SoCallbackList#invokeCallbacks(5d22bdacc48458e8).(hsvColorcxx . . $ _SoXtColorWheel#hsvColor.); |
| 281 | } |
| 282 | break; |
| 283 | |
| 284 | case MotionNotifycxx . . $ `<external>/1208737181511191802/X.h:185:9`!: |
| 285 | me = (XMotionEventcxx . . $ XMotionEvent# *) xe; |
| 286 | if (me->statecxx . . $ $anonymous_type_17d7f07cf933eea7_24#state. & Button1Maskcxx . . $ `<external>/1208737181511191802/X.h:246:9`!) |
| 287 | moveWheelMarkercxx . . $ _SoXtColorWheel#moveWheelMarker(af780a7c10c7990f).(short(me->xcxx . . $ $anonymous_type_17d7f07cf933eea7_24#x.) - cxcxx . . $ _SoXtColorWheel#cx., short(size[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1] - me->ycxx . . $ $anonymous_type_17d7f07cf933eea7_24#y.) - cycxx . . $ _SoXtColorWheel#cy.); |
| 288 | break; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | |
| 293 | //////////////////////////////////////////////////////////////////////// |
| 294 | // |
| 295 | // This routine sets the color wheel current color. |
| 296 | // |
| 297 | // usage: public |
| 298 | |
| 299 | void |
| 300 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::setBaseColorcxx . . $ _SoXtColorWheel#setBaseColor(de58861cad56015a).( |
| 301 | const float hsv[3]) |
| 302 | // |
| 303 | //////////////////////////////////////////////////////////////////////// |
| 304 | { |
| 305 | // check for redraw needs first |
| 306 | SbBoolcxx . . $ SbBool# valueChanged = (hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2] != hsv[2]); |
| 307 | SbBoolcxx . . $ SbBool# redrawColors = (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode. && valueChanged); |
| 308 | SbBoolcxx . . $ SbBool# redrawMarker = (hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0]!=hsv[0] || hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1]!=hsv[1]); |
| 309 | |
| 310 | // assign new color |
| 311 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0] = hsv[0]; |
| 312 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1] = hsv[1]; |
| 313 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2] = hsv[2]; |
| 314 | |
| 315 | // do wheel colors redraw |
| 316 | if (redrawColors) { |
| 317 | makeWheelColorscxx . . $ _SoXtColorWheel#makeWheelColors(7c85f03d1e7f7825).(colorscxx . . $ _SoXtColorWheel#colors., hsv[2]); |
| 318 | |
| 319 | if (! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).()) |
| 320 | return; |
| 321 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).()); |
| 322 | drawWheelColorscxx . . $ _SoXtColorWheel#drawWheelColors(49f6e7a06ebc5aa8).(); |
| 323 | if (isDoubleBuffercxx . . $ SoXtGLWidget#isDoubleBuffer(b126dc7c1de90089).()) |
| 324 | glXSwapBuffers(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).()); |
| 325 | else |
| 326 | glFlush(); |
| 327 | checkMarkerColorcxx . . $ _SoXtColorWheel#checkMarkerColor(49f6e7a06ebc5aa8).(); |
| 328 | } |
| 329 | |
| 330 | // do marker redraw |
| 331 | if (redrawMarker) |
| 332 | drawWheelMarkercxx . . $ _SoXtColorWheel#drawWheelMarker(49f6e7a06ebc5aa8).(); |
| 333 | |
| 334 | if (redrawMarker || valueChanged) |
| 335 | changedCallbackscxx . . $ _SoXtColorWheel#changedCallbacks.->invokeCallbackscxx . . $ SoCallbackList#invokeCallbacks(5d22bdacc48458e8).(hsvColorcxx . . $ _SoXtColorWheel#hsvColor.); |
| 336 | } |
| 337 | |
| 338 | |
| 339 | //////////////////////////////////////////////////////////////////////// |
| 340 | // |
| 341 | // This routine sets the WYSIWYG mode. |
| 342 | // |
| 343 | // usage: public |
| 344 | |
| 345 | void |
| 346 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::setWYSIWYGcxx . . $ _SoXtColorWheel#setWYSIWYG(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# flag) |
| 347 | // |
| 348 | //////////////////////////////////////////////////////////////////////// |
| 349 | { |
| 350 | if (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode. == flag) |
| 351 | return; |
| 352 | |
| 353 | WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode. = flag; |
| 354 | |
| 355 | // build WYSIWYG colors |
| 356 | if (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode.) |
| 357 | makeWheelColorscxx . . $ _SoXtColorWheel#makeWheelColors(7c85f03d1e7f7825).(colorscxx . . $ _SoXtColorWheel#colors., hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2]); |
| 358 | |
| 359 | // now check if a redraw is needed |
| 360 | if (hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2] != 1.0) { |
| 361 | |
| 362 | if (! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).()) |
| 363 | return; |
| 364 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).()); |
| 365 | drawWheelColorscxx . . $ _SoXtColorWheel#drawWheelColors(49f6e7a06ebc5aa8).(); |
| 366 | if (isDoubleBuffercxx . . $ SoXtGLWidget#isDoubleBuffer(b126dc7c1de90089).()) |
| 367 | glXSwapBuffers(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).()); |
| 368 | else |
| 369 | glFlush(); |
| 370 | checkMarkerColorcxx . . $ _SoXtColorWheel#checkMarkerColor(49f6e7a06ebc5aa8).(); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | |
| 375 | //////////////////////////////////////////////////////////////////////// |
| 376 | // |
| 377 | // Description: |
| 378 | // This builds the parent Glx widget, then registers interest |
| 379 | // in mouse events. |
| 380 | // |
| 381 | // Use: protected |
| 382 | Widgetcxx . . $ Widget# |
| 383 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::buildWidgetcxx . . $ _SoXtColorWheel#buildWidget(a686be44a4028679).(Widgetcxx . . $ Widget# parent) |
| 384 | // |
| 385 | //////////////////////////////////////////////////////////////////////// |
| 386 | { |
| 387 | Widgetcxx . . $ Widget# mgr = SoXtGLWidgetcxx . . $ SoXtGLWidget#::buildWidgetcxx . . $ SoXtGLWidget#buildWidget(a686be44a4028679).(parent); |
| 388 | |
| 389 | Widgetcxx . . $ Widget# w = getOverlayWidgetcxx . . $ SoXtGLWidget#getOverlayWidget(5908e39d78662822).() ? getOverlayWidgetcxx . . $ SoXtGLWidget#getOverlayWidget(5908e39d78662822).() : getNormalWidgetcxx . . $ SoXtGLWidget#getNormalWidget(5908e39d78662822).(); |
| 390 | mousecxx . . $ _SoXtColorWheel#mouse.->enablecxx . . $ SoXtMouse#enable(9c674ea9982a9afc).(w, |
| 391 | (XtEventHandlercxx . . $ XtEventHandler#) SoXtGLWidgetcxx . . $ SoXtGLWidget#::eventHandlercxx . . $ SoXtGLWidget#eventHandler(928be7aa92927306)., |
| 392 | (XtPointercxx . . $ XtPointer#) this); |
| 393 | |
| 394 | return mgr; |
| 395 | } |
| 396 | |
| 397 | |
| 398 | //////////////////////////////////////////////////////////////////////// |
| 399 | // |
| 400 | // This routine is called at window creation time to init the GL state |
| 401 | // |
| 402 | // Use: virtual protected |
| 403 | |
| 404 | void |
| 405 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::initOverlayGraphiccxx . . $ _SoXtColorWheel#initOverlayGraphic(49f6e7a06ebc5aa8).() |
| 406 | // |
| 407 | //////////////////////////////////////////////////////////////////////// |
| 408 | { |
| 409 | myMapcolorcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:76:9`!(MARKER_SLOTcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:74:9`!, 0, 0, 0); |
| 410 | blackMarkercxx . . $ _SoXtColorWheel#blackMarker. = TRUEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:111:9`!; |
| 411 | } |
| 412 | |
| 413 | |
| 414 | //////////////////////////////////////////////////////////////////////// |
| 415 | // |
| 416 | // This routine is called when window changed size. |
| 417 | // |
| 418 | // Use: virtual private |
| 419 | |
| 420 | void |
| 421 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::sizeChangedcxx . . $ _SoXtColorWheel#sizeChanged(8bc400dc8eb33072).(const SbVec2scxx . . $ SbVec2s# &newSize) |
| 422 | // |
| 423 | //////////////////////////////////////////////////////////////////////// |
| 424 | { |
| 425 | // |
| 426 | // recompute things that depend on window size |
| 427 | // |
| 428 | short min = (newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0] < newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1]) ? newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0] : newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1]; |
| 429 | radiuscxx . . $ _SoXtColorWheel#radius. = (min - (4*UI_THICKcxx . . $ `libSoXt/include/_SoXtUIRegion.h:79:9`! + 2*SPACEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:73:9`!)) / 2; |
| 430 | cxcxx . . $ _SoXtColorWheel#cx. = newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0] / 2; |
| 431 | cycxx . . $ _SoXtColorWheel#cy. = newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1] / 2; |
| 432 | |
| 433 | makeWheelGeometrycxx . . $ _SoXtColorWheel#makeWheelGeometry(49f6e7a06ebc5aa8).(); |
| 434 | |
| 435 | // reset projection |
| 436 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getNormalWindowcxx . . $ SoXtGLWidget#getNormalWindow(f708dce9a8856c70).(), getNormalContextcxx . . $ SoXtGLWidget#getNormalContext(de005d43f0a9bab4).()); |
| 437 | glViewport(0, 0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0], newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1]); |
| 438 | glMatrixMode(GL_PROJECTIONcxx . . $ `<external>/11565930711847777359/gl.h:212:9`!); |
| 439 | glLoadIdentity(); |
| 440 | glOrtho(0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0], 0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1], -1, 1); |
| 441 | |
| 442 | if (getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).() != 0) { |
| 443 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).(), getOverlayContextcxx . . $ SoXtGLWidget#getOverlayContext(de005d43f0a9bab4).()); |
| 444 | glViewport(0, 0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0], newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1]); |
| 445 | glMatrixMode(GL_PROJECTIONcxx . . $ `<external>/11565930711847777359/gl.h:212:9`!); |
| 446 | glLoadIdentity(); |
| 447 | glOrtho(0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).0], 0, newSize[cxx . . $ SbVec2s#`operator[]`(1e601d28ecbc4f85).1], -1, 1); |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | |
| 452 | //////////////////////////////////////////////////////////////////////// |
| 453 | // |
| 454 | // This routine computes the color wheel geometry. |
| 455 | // |
| 456 | // Use: private |
| 457 | |
| 458 | void |
| 459 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::makeWheelGeometrycxx . . $ _SoXtColorWheel#makeWheelGeometry(49f6e7a06ebc5aa8).() |
| 460 | // |
| 461 | //////////////////////////////////////////////////////////////////////// |
| 462 | { |
| 463 | SbVec2fcxx . . $ SbVec2f# *v = geometrycxx . . $ _SoXtColorWheel#geometry.; |
| 464 | float c[STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!+1][2]; |
| 465 | int i, j; |
| 466 | |
| 467 | // makes the master circle |
| 468 | float r = radiuscxx . . $ _SoXtColorWheel#radius. / float(CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`!); |
| 469 | float angle = 2.0 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / float(STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!); |
| 470 | c[0][0] = c[STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!][0] = r; |
| 471 | c[0][1] = c[STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!][1] = 0.0; |
| 472 | for (i=1; i<STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!; i++) { |
| 473 | c[i][0] = r * cosf(i*angle); |
| 474 | c[i][1] = r * sinf(i*angle); |
| 475 | } |
| 476 | |
| 477 | // |
| 478 | // now build the color wheel geometry |
| 479 | // |
| 480 | |
| 481 | // center point |
| 482 | (*v)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = cxcxx . . $ _SoXtColorWheel#cx.; |
| 483 | (*v++)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = cycxx . . $ _SoXtColorWheel#cy.; |
| 484 | |
| 485 | for (j=1; j<=CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`!; j++) { |
| 486 | for (i=0; i<=STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!; i++) { |
| 487 | (*v)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0] = cxcxx . . $ _SoXtColorWheel#cx. + j * c[i][0]; |
| 488 | (*v++)[cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1] = cycxx . . $ _SoXtColorWheel#cy. + j * c[i][1]; |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | |
| 494 | //////////////////////////////////////////////////////////////////////// |
| 495 | // |
| 496 | // This routine computes the color wheel colors given a color |
| 497 | // intensity. |
| 498 | // |
| 499 | // Use: private |
| 500 | |
| 501 | void |
| 502 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::makeWheelColorscxx . . $ _SoXtColorWheel#makeWheelColors(7c85f03d1e7f7825).( |
| 503 | SbColorcxx . . $ SbColor# *c, |
| 504 | float intensity) |
| 505 | // |
| 506 | //////////////////////////////////////////////////////////////////////// |
| 507 | { |
| 508 | float hsv[3]; |
| 509 | float Hinc, Sinc; |
| 510 | int i, j; |
| 511 | |
| 512 | hsv[2] = intensity; |
| 513 | Hinc = 1.0 / float(STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!); |
| 514 | Sinc = 1.0 / float(CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`!); |
| 515 | |
| 516 | // center color |
| 517 | (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = intensity; c++; |
| 518 | |
| 519 | // |
| 520 | // now make the wheel colors |
| 521 | // |
| 522 | for (j=1; j<=CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`!; j++) { |
| 523 | |
| 524 | hsv[1] = j * Sinc; |
| 525 | for (i=0; i<STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!; i++) { |
| 526 | |
| 527 | hsv[0] = i * Hinc; |
| 528 | (c++)->setHSVValuecxx . . $ SbColor#setHSVValue(c2cf48f1aba92178).(hsv); |
| 529 | } |
| 530 | |
| 531 | // last color is same as first color |
| 532 | (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0] = (*(c-STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0]; |
| 533 | (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1] = (*(c-STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1]; |
| 534 | (*c)[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2] = (*(c-STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!))[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]; |
| 535 | c++; |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | |
| 540 | //////////////////////////////////////////////////////////////////////// |
| 541 | // |
| 542 | // This routine draws the color wheel surroundings. |
| 543 | // |
| 544 | // Use: private |
| 545 | |
| 546 | void |
| 547 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::drawWheelSurroundingcxx . . $ _SoXtColorWheel#drawWheelSurrounding(49f6e7a06ebc5aa8).() |
| 548 | // |
| 549 | //////////////////////////////////////////////////////////////////////// |
| 550 | { |
| 551 | glClearColor(.66, .66, .66, 1.0); |
| 552 | glClear(GL_COLOR_BUFFER_BITcxx . . $ `<external>/11565930711847777359/gl.h:682:9`!); |
| 553 | |
| 554 | // draw outer border |
| 555 | SbVec2scxx . . $ SbVec2s# size = getGlxSizecxx . . $ SoXtGLWidget#getGlxSize(f469ede4e6b056fc).(); |
| 556 | SoDrawDownUIBorderscxx . . $ SoDrawDownUIBorders(55453a9d75a8e401).(0, 0, size[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).0]-1, size[cxx . . $ SbVec2s#`operator[]`(3a1bfc038f5ec6).1]-1); |
| 557 | } |
| 558 | |
| 559 | |
| 560 | //////////////////////////////////////////////////////////////////////// |
| 561 | // |
| 562 | // This routine draws the color wheel top part (colors). |
| 563 | // |
| 564 | // Use: private |
| 565 | |
| 566 | void |
| 567 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::drawWheelColorscxx . . $ _SoXtColorWheel#drawWheelColors(49f6e7a06ebc5aa8).() |
| 568 | // |
| 569 | //////////////////////////////////////////////////////////////////////// |
| 570 | { |
| 571 | SbColorcxx . . $ SbColor# *c1, *c2; |
| 572 | SbVec2fcxx . . $ SbVec2f# *v1, *v2; |
| 573 | int i, j; |
| 574 | |
| 575 | // |
| 576 | // draw center circle as triangle fan |
| 577 | // |
| 578 | c1 = (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode.) ? colorscxx . . $ _SoXtColorWheel#colors. : defaultColorscxx . . $ _SoXtColorWheel#defaultColors.; |
| 579 | v1 = geometrycxx . . $ _SoXtColorWheel#geometry.; |
| 580 | |
| 581 | glBegin(GL_TRIANGLE_FANcxx . . $ `<external>/11565930711847777359/gl.h:162:9`!); |
| 582 | for (i=0; i<(STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!+2); i++) { |
| 583 | glColor3fv((c1++)->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).()); |
| 584 | glVertex2fv((v1++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).()); |
| 585 | } |
| 586 | glEnd(); |
| 587 | |
| 588 | // |
| 589 | // draw the remaining stripes as quad meshes |
| 590 | // |
| 591 | c1 = (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode.) ? colorscxx . . $ _SoXtColorWheel#colors. : defaultColorscxx . . $ _SoXtColorWheel#defaultColors.; |
| 592 | v1 = geometrycxx . . $ _SoXtColorWheel#geometry.; |
| 593 | c1++; v1++; |
| 594 | c2 = c1 + STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`! + 1; |
| 595 | v2 = v1 + STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`! + 1; |
| 596 | |
| 597 | for (j=1; j<CIRCLEcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:71:9`!; j++) { |
| 598 | |
| 599 | glBegin(GL_QUAD_STRIPcxx . . $ `<external>/11565930711847777359/gl.h:164:9`!); |
| 600 | for (i=0; i<=STRIPEScxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:72:9`!; i++) { |
| 601 | glColor3fv((c1++)->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).()); |
| 602 | glVertex2fv((v1++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).()); |
| 603 | glColor3fv((c2++)->getValuecxx . . $ SbVec3f#getValue(d64004c6a662f6a6).()); |
| 604 | glVertex2fv((v2++)->getValuecxx . . $ SbVec2f#getValue(d64004c6a662f6a6).()); |
| 605 | } |
| 606 | glEnd(); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | |
| 611 | //////////////////////////////////////////////////////////////////////// |
| 612 | // |
| 613 | // This routine checks the marker color and changes it if needed. |
| 614 | // |
| 615 | // Use: private |
| 616 | |
| 617 | void |
| 618 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::checkMarkerColorcxx . . $ _SoXtColorWheel#checkMarkerColor(49f6e7a06ebc5aa8).() |
| 619 | // |
| 620 | //////////////////////////////////////////////////////////////////////// |
| 621 | { |
| 622 | if (getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).() == 0) |
| 623 | return; |
| 624 | |
| 625 | // map a black or white color depending on background |
| 626 | |
| 627 | if (WYSIWYGmodecxx . . $ _SoXtColorWheel#WYSIWYGmode. && hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[2]<0.6) { // should be white |
| 628 | if (blackMarkercxx . . $ _SoXtColorWheel#blackMarker.) { |
| 629 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).(), getOverlayContextcxx . . $ SoXtGLWidget#getOverlayContext(de005d43f0a9bab4).()); |
| 630 | myMapcolorcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:76:9`!(MARKER_SLOTcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:74:9`!, 255, 255, 255); |
| 631 | blackMarkercxx . . $ _SoXtColorWheel#blackMarker. = FALSEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:110:9`!; |
| 632 | } |
| 633 | } |
| 634 | else { // should be black |
| 635 | if (!blackMarkercxx . . $ _SoXtColorWheel#blackMarker.) { |
| 636 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).(), getOverlayContextcxx . . $ SoXtGLWidget#getOverlayContext(de005d43f0a9bab4).()); |
| 637 | myMapcolorcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:76:9`!(MARKER_SLOTcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:74:9`!, 0, 0, 0); |
| 638 | blackMarkercxx . . $ _SoXtColorWheel#blackMarker. = TRUEcxx . . $ `<external>/3673480128541058774/Intrinsic.h:111:9`!; |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | //////////////////////////////////////////////////////////////////////// |
| 644 | // |
| 645 | // This routine draws the color marker feedback (in overlay). |
| 646 | // |
| 647 | // Use: private |
| 648 | |
| 649 | void |
| 650 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::drawWheelMarkercxx . . $ _SoXtColorWheel#drawWheelMarker(49f6e7a06ebc5aa8).() |
| 651 | // |
| 652 | //////////////////////////////////////////////////////////////////////// |
| 653 | { |
| 654 | if (getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).() == 0 || ! isVisiblecxx . . $ SoXtComponent#isVisible(b126dc7c1de90089).()) |
| 655 | return; |
| 656 | glXMakeCurrent(getDisplaycxx . . $ SoXtComponent#getDisplay(17eb9fe335efbb88).(), getOverlayWindowcxx . . $ SoXtGLWidget#getOverlayWindow(f708dce9a8856c70).(), getOverlayContextcxx . . $ SoXtGLWidget#getOverlayContext(de005d43f0a9bab4).()); |
| 657 | |
| 658 | // find radius and angle from hsv color, from which position is determined. |
| 659 | short x, y; |
| 660 | float rad = hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1] * radiuscxx . . $ _SoXtColorWheel#radius.; |
| 661 | float angle = 2.0 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! * hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0]; |
| 662 | x = cxcxx . . $ _SoXtColorWheel#cx. + short(rad * cosf(angle)); |
| 663 | y = cycxx . . $ _SoXtColorWheel#cy. + short(rad * sinf(angle)); |
| 664 | |
| 665 | // |
| 666 | // now draw dot in overlay plane |
| 667 | // |
| 668 | glClearIndex(0); |
| 669 | glClear(GL_COLOR_BUFFER_BITcxx . . $ `<external>/11565930711847777359/gl.h:682:9`!); |
| 670 | glIndexi(MARKER_SLOTcxx . . $ `libSoXt/src/mixedMode/SoXtColWheel.c++:74:9`!); |
| 671 | |
| 672 | // ??? doing a GL_LINE_LOOP seems to be missing the top right |
| 673 | // ??? pixel due to subpixel == TRUE in openGL. |
| 674 | glBegin(GL_LINE_STRIPcxx . . $ `<external>/11565930711847777359/gl.h:159:9`!); |
| 675 | glVertex2s(x+3, y+3); glVertex2s(x+3, y-3); |
| 676 | glVertex2s(x-3, y-3); glVertex2s(x-3, y+3); |
| 677 | glVertex2s(x+3+1, y+3); |
| 678 | glEnd(); |
| 679 | |
| 680 | glFlush(); |
| 681 | } |
| 682 | |
| 683 | //////////////////////////////////////////////////////////////////////// |
| 684 | // |
| 685 | // This routine moves the color maker based of mouse position. |
| 686 | // |
| 687 | // Use: private |
| 688 | // |
| 689 | void |
| 690 | _SoXtColorWheelcxx . . $ _SoXtColorWheel#::moveWheelMarkercxx . . $ _SoXtColorWheel#moveWheelMarker(af780a7c10c7990f).( |
| 691 | short x, short y) // wheel center relative coordinates |
| 692 | // |
| 693 | //////////////////////////////////////////////////////////////////////// |
| 694 | { |
| 695 | // find the saturation based on distance |
| 696 | float s = sqrtf(x*x + y*y) / float(radiuscxx . . $ _SoXtColorWheel#radius.); |
| 697 | if (s > 1.0) |
| 698 | s = 1.0; |
| 699 | |
| 700 | // now find the hue based on the angle |
| 701 | float angle = atan2(float(y), float(x)); |
| 702 | if (angle < 0.0) |
| 703 | angle += 2.0 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!; |
| 704 | float h = angle / (2.0 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!); |
| 705 | |
| 706 | // check if redraw and callback are needed |
| 707 | if (hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0] != h || hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1] != s) { |
| 708 | |
| 709 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[0] = h; |
| 710 | hsvColorcxx . . $ _SoXtColorWheel#hsvColor.[1] = s; |
| 711 | |
| 712 | drawWheelMarkercxx . . $ _SoXtColorWheel#drawWheelMarker(49f6e7a06ebc5aa8).(); |
| 713 | changedCallbackscxx . . $ _SoXtColorWheel#changedCallbacks.->invokeCallbackscxx . . $ SoCallbackList#invokeCallbacks(5d22bdacc48458e8).(hsvColorcxx . . $ _SoXtColorWheel#hsvColor.); |
| 714 | } |
| 715 | } |