QvisRenderingWindow.C 60.9 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
brugger's avatar
 
brugger committed
3
* Copyright (c) 2000 - 2011, Lawrence Livermore National Security, LLC
hrchilds's avatar
hrchilds committed
4
* Produced at the Lawrence Livermore National Laboratory
brugger's avatar
 
brugger committed
5
* LLNL-CODE-442911
hrchilds's avatar
hrchilds committed
6 7
* All rights reserved.
*
brugger's avatar
 
brugger committed
8
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
hrchilds's avatar
hrchilds committed
9 10 11 12 13 14 15 16 17 18
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
brugger's avatar
 
brugger committed
19 20 21
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
hrchilds's avatar
hrchilds committed
22 23 24 25 26
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
brugger's avatar
 
brugger committed
27 28 29
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
hrchilds's avatar
hrchilds committed
30 31 32 33 34 35 36 37 38
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

hrchilds's avatar
hrchilds committed
39 40
#include <QvisRenderingWindow.h>
#include <float.h>
hrchilds's avatar
hrchilds committed
41
#include <limits.h>
hrchilds's avatar
hrchilds committed
42

whitlocb's avatar
whitlocb committed
43 44 45 46 47 48 49 50 51 52
#include <QButtonGroup>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QLayout>
#include <QRadioButton>
#include <QSlider>
#include <QSpinBox>
#include <QLineEdit>
#include <QTabWidget>
hrchilds's avatar
hrchilds committed
53 54 55 56

#include <RenderingAttributes.h>
#include <ViewerProxy.h>
#include <WindowInformation.h>
hrchilds's avatar
hrchilds committed
57
#include <QvisOpacitySlider.h>
hrchilds's avatar
hrchilds committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73

// ****************************************************************************
// Method: QvisRenderingWindow::QvisRenderingWindow
//
// Purpose: 
//   Constructor for the QvisRenderingWindow class.
//
// Arguments:
//   caption : The window caption.
//   shortName : The name shown in the notepad.
//   n         : The notepad area.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:46:40 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
74 75 76
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
77
//   
hrchilds's avatar
hrchilds committed
78 79 80
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Initialize dlMode.
//
hrchilds's avatar
hrchilds committed
81 82
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
83 84 85 86
//
//   Brad Whitlock, Wed Apr  9 11:52:02 PDT 2008
//   QString for caption, shortName.
//
87 88 89
//   Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//   Added an automatic start/end setting capability for depth cueing.
//
90 91 92
//    Dave Pugmire, Tue Aug 24 11:32:12 EDT 2010
//    Add compact domain options.
//
hrchilds's avatar
hrchilds committed
93 94
// ****************************************************************************

95 96
QvisRenderingWindow::QvisRenderingWindow(const QString &caption,
    const QString &shortName, QvisNotepadArea *n) :
hrchilds's avatar
hrchilds committed
97
    QvisPostableWindowSimpleObserver(caption, shortName, n, ApplyButton)
hrchilds's avatar
hrchilds committed
98 99 100 101 102
{
    renderAtts = 0;
    windowInfo = 0;

    objectRepresentation = 0;
hrchilds's avatar
hrchilds committed
103
    dlMode = 0;
hrchilds's avatar
hrchilds committed
104
    stereoType = 0;
hrchilds's avatar
hrchilds committed
105
    scalrenActivationMode = 0;
hrchilds's avatar
hrchilds committed
106
    scalrenCompressMode = 0;
107
    compactDomainsActivationMode = 0;
hrchilds's avatar
hrchilds committed
108 109 110 111 112 113 114 115 116 117 118 119 120
}

// ****************************************************************************
// Method: QvisRenderingWindow::~QvisRenderingWindow
//
// Purpose: 
//   This is the destructor for the QvisRenderingWindow class.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:29 PST 2002
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
121 122
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
123 124 125 126
//
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Delete dlMode.
//
hrchilds's avatar
hrchilds committed
127 128
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
whitlocb's avatar
whitlocb committed
129
//
hrchilds's avatar
hrchilds committed
130 131 132 133 134 135 136 137 138 139 140 141
// ****************************************************************************

QvisRenderingWindow::~QvisRenderingWindow()
{
    if(renderAtts)
        renderAtts->Detach(this);

    if(windowInfo)
        windowInfo->Detach(this);
}

// ****************************************************************************
whitlocb's avatar
whitlocb committed
142
// Method: QvisRenderingWindow::CreateBasicPage
hrchilds's avatar
hrchilds committed
143 144
//
// Purpose: 
whitlocb's avatar
whitlocb committed
145
//   Creates the widgets on the basic page.
hrchilds's avatar
hrchilds committed
146
//
whitlocb's avatar
whitlocb committed
147
// Arguments:
hrchilds's avatar
hrchilds committed
148
//
whitlocb's avatar
whitlocb committed
149
// Returns:    The basic page widget.
hrchilds's avatar
hrchilds committed
150
//
whitlocb's avatar
whitlocb committed
151
// Note:       
152
//
whitlocb's avatar
whitlocb committed
153 154
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 12:10:45 PDT 2008
155
//
whitlocb's avatar
whitlocb committed
156 157
// Modifications:
//   
hrchilds's avatar
hrchilds committed
158
// ****************************************************************************
159

whitlocb's avatar
whitlocb committed
160 161 162 163 164 165 166 167
QWidget *
QvisRenderingWindow::CreateBasicPage()
{
    int row = 0;
    QWidget *basicOptions = new QWidget(central);
    QGridLayout *basicLayout = new QGridLayout(basicOptions);
    basicLayout->setSpacing(5);
    basicLayout->setMargin(10);
hrchilds's avatar
hrchilds committed
168 169

    // Create the antialiasing widgets.
whitlocb's avatar
whitlocb committed
170
    antialiasingToggle = new QCheckBox(tr("Antialiasing"), basicOptions);
hrchilds's avatar
hrchilds committed
171 172
    connect(antialiasingToggle, SIGNAL(toggled(bool)),
            this, SLOT(antialiasingToggled(bool)));
whitlocb's avatar
whitlocb committed
173
    basicLayout->addWidget(antialiasingToggle, row, 0, 1, 3);
174
    row++;
hrchilds's avatar
hrchilds committed
175 176

    // Create the surface rep widgets.
whitlocb's avatar
whitlocb committed
177 178 179 180
    QLabel *drawObjLabel = new QLabel(tr("Draw objects as"), basicOptions);
    basicLayout->addWidget(drawObjLabel, row, 0, 1, 3);
    objectRepresentation = new QButtonGroup(basicOptions);
    connect(objectRepresentation, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
181
            this, SLOT(objectRepresentationChanged(int)));
182 183
    row++;

whitlocb's avatar
whitlocb committed
184 185 186 187 188 189 190 191 192
    QRadioButton *surfaces = new QRadioButton(tr("Surfaces"), basicOptions);
    objectRepresentation->addButton(surfaces, 0);
    basicLayout->addWidget(surfaces, row, 1);
    QRadioButton *wires = new QRadioButton(tr("Wireframe"), basicOptions);
    objectRepresentation->addButton(wires, 1);
    basicLayout->addWidget(wires, row, 2);
    QRadioButton *points = new QRadioButton(tr("Points"), basicOptions);
    objectRepresentation->addButton(points, 2);
    basicLayout->addWidget(points, row, 3);
193
    row++;
hrchilds's avatar
hrchilds committed
194

hrchilds's avatar
hrchilds committed
195
    // Create the display list widgets.
whitlocb's avatar
whitlocb committed
196 197 198 199
    QLabel *displayListLabel = new QLabel(tr("Use display lists"), basicOptions);
    basicLayout->addWidget(displayListLabel, row, 0, 1, 3);
    dlMode = new QButtonGroup(basicOptions);
    connect(dlMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
200
            this, SLOT(displayListModeChanged(int)));
201 202
    row++;

whitlocb's avatar
whitlocb committed
203 204 205 206 207 208 209 210 211
    QRadioButton *dl_auto = new QRadioButton(tr("Auto"), basicOptions);
    dlMode->addButton(dl_auto, 0);
    basicLayout->addWidget(dl_auto, row, 1);
    QRadioButton *dl_always = new QRadioButton(tr("Always"), basicOptions);
    dlMode->addButton(dl_always, 1);
    basicLayout->addWidget(dl_always, row, 2);
    QRadioButton *dl_never = new QRadioButton(tr("Never"), basicOptions);
    dlMode->addButton(dl_never, 2);
    basicLayout->addWidget(dl_never, row, 3);
212
    row++;
hrchilds's avatar
hrchilds committed
213 214

    // Create the stereo widgets.
whitlocb's avatar
whitlocb committed
215
    stereoToggle = new QCheckBox(tr("Stereo"), basicOptions);
hrchilds's avatar
hrchilds committed
216 217
    connect(stereoToggle, SIGNAL(toggled(bool)),
            this, SLOT(stereoToggled(bool)));
whitlocb's avatar
whitlocb committed
218
    basicLayout->addWidget(stereoToggle, row, 0, 1, 3);
219 220
    row++;

whitlocb's avatar
whitlocb committed
221 222
    stereoType = new QButtonGroup(basicOptions);
    connect(stereoType, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
223
            this, SLOT(stereoTypeChanged(int)));
whitlocb's avatar
whitlocb committed
224 225 226 227 228 229
    redblue = new QRadioButton(tr("Red/Blue"), basicOptions);
    stereoType->addButton(redblue, 0);
    basicLayout->addWidget(redblue, row, 1);
    interlace = new QRadioButton(tr("Interlace"), basicOptions);
    stereoType->addButton(interlace, 1);
    basicLayout->addWidget(interlace, row, 2);
230
    row++;
whitlocb's avatar
whitlocb committed
231 232 233 234 235 236
    crystalEyes = new QRadioButton(tr("Crystal Eyes"), basicOptions);
    stereoType->addButton(crystalEyes, 2);
    basicLayout->addWidget(crystalEyes, row, 1);
    redgreen = new QRadioButton(tr("Red/Green"), basicOptions);
    stereoType->addButton(redgreen, 3);
    basicLayout->addWidget(redgreen, row, 2);
237 238 239
    row++;

    // Create the specular lighting options
whitlocb's avatar
whitlocb committed
240
    specularToggle = new QCheckBox(tr("Specular lighting"), basicOptions);
241 242
    connect(specularToggle, SIGNAL(toggled(bool)),
            this, SLOT(specularToggled(bool)));
whitlocb's avatar
whitlocb committed
243
    basicLayout->addWidget(specularToggle, row, 0, 1, 3);
244 245
    row++;

whitlocb's avatar
whitlocb committed
246
    specularStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, basicOptions);
247 248 249
    specularStrengthSlider->setTickInterval(25);
    connect(specularStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularStrengthChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
250 251 252 253
    specularStrengthLabel = new QLabel(tr("Strength"), basicOptions);
    specularStrengthLabel->setBuddy(specularStrengthSlider);
    basicLayout->addWidget(specularStrengthLabel, row, 1);
    basicLayout->addWidget(specularStrengthSlider, row, 2, 1, 2);
254 255
    row++;

whitlocb's avatar
whitlocb committed
256
    specularPowerSlider = new QvisOpacitySlider(0, 1000, 100, 100, basicOptions);
257 258 259
    specularPowerSlider->setTickInterval(100);
    connect(specularPowerSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularPowerChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
260 261 262 263
    specularPowerLabel = new QLabel(tr("Sharpness"), basicOptions);
    specularPowerLabel->setBuddy(specularPowerSlider);
    basicLayout->addWidget(specularPowerLabel, row,1);
    basicLayout->addWidget(specularPowerSlider, row, 2, 1, 2);
264 265
    row++;

whitlocb's avatar
whitlocb committed
266 267
    return basicOptions;
}
268

whitlocb's avatar
whitlocb committed
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
// ****************************************************************************
// Method: QvisRenderingWindow::CreateAdvancedPage
//
// Purpose: 
//   Creates the advanced page widgets
//
// Arguments:
//
// Returns:    
//
// Note:       Moved from CreateWindowContents.
//
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 13:18:25 PDT 2008
//
// Modifications:
//   
// ****************************************************************************

QWidget *
QvisRenderingWindow::CreateAdvancedPage()
{
    int row = 0;

    QWidget *advancedOptions = new QWidget(central);
    QGridLayout *advLayout = new QGridLayout(advancedOptions);
    advLayout->setSpacing(5);
    advLayout->setMargin(10);
hrchilds's avatar
hrchilds committed
297 298

    // Create the scalable rendering widgets.
whitlocb's avatar
whitlocb committed
299 300 301 302
    QLabel *scalrenLabel = new QLabel(tr("Use scalable rendering"), advancedOptions);
    advLayout->addWidget(scalrenLabel, row, 0, 1, 3);
    scalrenActivationMode = new QButtonGroup(advancedOptions);
    connect(scalrenActivationMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
303
            this, SLOT(scalrenActivationModeChanged(int)));
304 305
    row++;

whitlocb's avatar
whitlocb committed
306 307 308 309 310 311 312 313 314
    scalrenAuto = new QRadioButton(tr("Auto"), advancedOptions);
    scalrenActivationMode->addButton(scalrenAuto, 0);
    advLayout->addWidget(scalrenAuto, row, 1);
    scalrenAlways = new QRadioButton(tr("Always"), advancedOptions);
    scalrenActivationMode->addButton(scalrenAlways, 1);
    advLayout->addWidget(scalrenAlways, row, 2);
    scalrenNever = new QRadioButton(tr("Never"), advancedOptions);
    scalrenActivationMode->addButton(scalrenNever, 2);
    advLayout->addWidget(scalrenNever, row, 3);
315
    row++;
hrchilds's avatar
hrchilds committed
316

hrchilds's avatar
hrchilds committed
317
    // Create the polygon count spin box for scalable rendering threshold
whitlocb's avatar
whitlocb committed
318 319 320 321 322
    scalrenGeometryLabel =  new QLabel(tr("When polygon count exceeds"), advancedOptions);
    advLayout->addWidget(scalrenGeometryLabel, row, 1, 1, 2);
    scalrenAutoThreshold = new QSpinBox(advancedOptions);
    scalrenAutoThreshold->setMinimum(0);
    scalrenAutoThreshold->setMaximum(10000);
hrchilds's avatar
hrchilds committed
323 324
    scalrenAutoThreshold->setValue(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
    scalrenAutoThresholdChanged(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
hrchilds's avatar
hrchilds committed
325 326
    connect(scalrenAutoThreshold, SIGNAL(valueChanged(int)),
            this, SLOT(scalrenAutoThresholdChanged(int)));
whitlocb's avatar
whitlocb committed
327
    advLayout->addWidget(scalrenAutoThreshold, row, 3);
328
    row++;
hrchilds's avatar
hrchilds committed
329

hrchilds's avatar
hrchilds committed
330
    // Create the compress mode widgets.
whitlocb's avatar
whitlocb committed
331 332 333 334 335
    scalrenCompressLabel = new QLabel(tr("Compress images (geometry too) from engine"),
                                      advancedOptions);
    advLayout->addWidget(scalrenCompressLabel, row, 0, 1, 3);
    scalrenCompressMode = new QButtonGroup(advancedOptions);
    connect(scalrenCompressMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
336
            this, SLOT(scalrenCompressModeChanged(int)));
337 338
    row++;

whitlocb's avatar
whitlocb committed
339
    QRadioButton *cmp_auto = new QRadioButton(tr("Auto"), advancedOptions);
hrchilds's avatar
hrchilds committed
340
    cmp_auto->setEnabled(0); // disabled until implemented
whitlocb's avatar
whitlocb committed
341 342 343 344 345 346 347 348
    scalrenCompressMode->addButton(cmp_auto, 0);
    advLayout->addWidget(cmp_auto, row, 1);
    QRadioButton *cmp_always = new QRadioButton(tr("Always"), advancedOptions);
    scalrenCompressMode->addButton(cmp_always, 1);
    advLayout->addWidget(cmp_always, row, 2);
    QRadioButton *cmp_never = new QRadioButton(tr("Never"), advancedOptions);
    scalrenCompressMode->addButton(cmp_never, 2);
    advLayout->addWidget(cmp_never, row, 3);
349
    row++;
hrchilds's avatar
hrchilds committed
350

351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
    // Create the compact domains widgets.
    QLabel *compactDomainsLabel = new QLabel(tr("Compact domains on engine"), advancedOptions);
    advLayout->addWidget(compactDomainsLabel, row, 0, 1, 3);
    compactDomainsActivationMode = new QButtonGroup(advancedOptions);
    connect(compactDomainsActivationMode, SIGNAL(buttonClicked(int)),
            this, SLOT(compactDomainsActivationModeChanged(int)));
    row++;

    compactDomainsAuto = new QRadioButton(tr("Auto"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsAuto, 0);
    advLayout->addWidget(compactDomainsAuto, row, 1);
    compactDomainsAlways = new QRadioButton(tr("Always"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsAlways, 1);
    advLayout->addWidget(compactDomainsAlways, row, 2);
    compactDomainsNever = new QRadioButton(tr("Never"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsNever, 2);
    advLayout->addWidget(compactDomainsNever, row, 3);
    row++;

    // Create the polygon count spin box for scalable rendering threshold
    compactDomainsGeometryLabel =  new QLabel(tr("When domains per process exceeds"), advancedOptions);
    advLayout->addWidget(compactDomainsGeometryLabel, row, 1, 1, 2);
    compactDomainsAutoThreshold = new QSpinBox(advancedOptions);
    compactDomainsAutoThreshold->setMinimum(0);
    compactDomainsAutoThreshold->setMaximum(100000);
    compactDomainsAutoThreshold->setValue(RenderingAttributes::DEFAULT_COMPACT_DOMAINS_AUTO_THRESHOLD);
    compactDomainsAutoThresholdChanged(RenderingAttributes::DEFAULT_COMPACT_DOMAINS_AUTO_THRESHOLD);
    connect(compactDomainsAutoThreshold, SIGNAL(valueChanged(int)),
            this, SLOT(compactDomainsAutoThresholdChanged(int)));
    advLayout->addWidget(compactDomainsAutoThreshold, row, 3);
    row++;

hrchilds's avatar
hrchilds committed
383
    // Create the shadow lighting options
whitlocb's avatar
whitlocb committed
384
    shadowToggle = new QCheckBox(tr("Shadows (scalable rendering only)"), advancedOptions);
hrchilds's avatar
hrchilds committed
385 386
    connect(shadowToggle, SIGNAL(toggled(bool)),
            this, SLOT(shadowToggled(bool)));
whitlocb's avatar
whitlocb committed
387
    advLayout->addWidget(shadowToggle, row, 0, 1, 3);
388
    row++;
hrchilds's avatar
hrchilds committed
389

whitlocb's avatar
whitlocb committed
390
    shadowStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, advancedOptions);
hrchilds's avatar
hrchilds committed
391 392 393
    shadowStrengthSlider->setTickInterval(25);
    connect(shadowStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(shadowStrengthChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
394 395 396 397
    shadowStrengthLabel = new QLabel(tr("Strength"), advancedOptions);
    shadowStrengthLabel->setBuddy(shadowStrengthSlider);
    advLayout->addWidget(shadowStrengthLabel, row,1);
    advLayout->addWidget(shadowStrengthSlider, row, 2, 1, 2);
398 399 400
    row++;

    // Create the depth cueing options
whitlocb's avatar
whitlocb committed
401
    depthCueingToggle = new QCheckBox(tr("Depth Cueing (scalable rendering only)"), advancedOptions);
402 403
    connect(depthCueingToggle, SIGNAL(toggled(bool)),
            this, SLOT(depthCueingToggled(bool)));
whitlocb's avatar
whitlocb committed
404
    advLayout->addWidget(depthCueingToggle, row, 0, 1, 3);
405 406
    row++;

407 408 409 410 411 412 413
    depthCueingAutoToggle = new QCheckBox(tr("Cue automatically along camera depth"), advancedOptions);
    connect(depthCueingAutoToggle, SIGNAL(toggled(bool)),
            this, SLOT(depthCueingAutoToggled(bool)));
    advLayout->addWidget(depthCueingAutoToggle, row, 1, 1, 3);
    row++;

    depthCueingStartLabel = new QLabel(tr("Manual start point"));
whitlocb's avatar
whitlocb committed
414 415 416
    advLayout->addWidget(depthCueingStartLabel, row, 1);
    depthCueingStartEdit = new QLineEdit(advancedOptions);
    advLayout->addWidget(depthCueingStartEdit, row, 2, 1, 2);
417 418 419 420
    connect(depthCueingStartEdit, SIGNAL(returnPressed()),
            this, SLOT(depthCueingStartChanged()));
    row++;

421
    depthCueingEndLabel = new QLabel(tr("Manual end point"));
whitlocb's avatar
whitlocb committed
422 423 424
    advLayout->addWidget(depthCueingEndLabel, row, 1);
    depthCueingEndEdit = new QLineEdit(advancedOptions);
    advLayout->addWidget(depthCueingEndEdit, row, 2, 1, 2);
425 426 427 428
    connect(depthCueingEndEdit, SIGNAL(returnPressed()),
            this, SLOT(depthCueingEndChanged()));
    row++;
    
hrchilds's avatar
hrchilds committed
429
    // Create color texturing options.
whitlocb's avatar
whitlocb committed
430
    colorTexturingToggle = new QCheckBox(tr("Apply color using textures"), advancedOptions);
hrchilds's avatar
hrchilds committed
431 432
    connect(colorTexturingToggle, SIGNAL(toggled(bool)),
            this, SLOT(colorTexturingToggled(bool)));
whitlocb's avatar
whitlocb committed
433
    advLayout->addWidget(colorTexturingToggle, row, 0, 1, 3);
434
    row++;
hrchilds's avatar
hrchilds committed
435

whitlocb's avatar
whitlocb committed
436 437
    return advancedOptions;
}
hrchilds's avatar
hrchilds committed
438

whitlocb's avatar
whitlocb committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
// ****************************************************************************
// Method: QvisRenderingWindow::CreateInformationPage
//
// Purpose: 
//   Creates the information page.
//
// Arguments:
//
// Returns:    The information page.
//
// Note:       
//
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 13:18:51 PDT 2008
//
// Modifications:
//   
// ****************************************************************************

QWidget *
QvisRenderingWindow::CreateInformationPage()
{
    QWidget *info = new QWidget(central);
hrchilds's avatar
hrchilds committed
462 463 464 465
    QVBoxLayout *vLayout = new QVBoxLayout(info);
    vLayout->addSpacing(10);
    vLayout->setMargin(10);

whitlocb's avatar
whitlocb committed
466
    renderNotifyToggle = new QCheckBox(tr("Query after each render"), info);
hrchilds's avatar
hrchilds committed
467 468 469 470 471
    connect(renderNotifyToggle, SIGNAL(toggled(bool)),
            this, SLOT(renderNotifyToggled(bool)));
    vLayout->addWidget(renderNotifyToggle);
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
472 473 474 475 476 477 478
    QGridLayout *iLayout = new QGridLayout(0);
    iLayout->setSpacing(5);
    vLayout->addLayout(iLayout);
    QLabel *scalrenLabel2 = new QLabel(tr("Using Scalable Rendering: "), info);
    iLayout->addWidget(scalrenLabel2, 0, 0);
    scalrenUsingLabel = new QLabel(tr("N/A"), info);
    iLayout->addWidget(scalrenUsingLabel, 0, 1, 1, 3);
hrchilds's avatar
hrchilds committed
479 480
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
481 482 483 484 485 486 487 488 489 490 491 492 493
    fpsLabel = new QLabel(tr("Frames per second:"), info);
    iLayout->addWidget(fpsLabel, 1, 0);
    fpsMinLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsMinLabel, 1, 1);
    fpsAvgLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsAvgLabel, 1, 2);
    fpsMaxLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsMaxLabel, 1, 3);

    QLabel *ntri = new QLabel(tr("Approximate polygon count:"), info);
    iLayout->addWidget(ntri, 2, 0);
    approxNumPrimitives = new QLabel("0.", info);
    iLayout->addWidget(approxNumPrimitives, 2, 1);
hrchilds's avatar
hrchilds committed
494 495
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
496
    QGridLayout *eLayout = new QGridLayout(0);
hrchilds's avatar
hrchilds committed
497
    eLayout->setSpacing(5);
whitlocb's avatar
whitlocb committed
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
    vLayout->addLayout(eLayout);
    QLabel *xExtentsLabel = new QLabel(tr("X Extents:"), info);
    eLayout->addWidget(xExtentsLabel, 0, 0);
    extents[0] = new QLabel("0.", info);
    eLayout->addWidget(extents[0], 0, 1);
    extents[1] = new QLabel("0.", info);
    eLayout->addWidget(extents[1], 0, 2);

    QLabel *yExtentsLabel = new QLabel(tr("Y Extents:"), info);
    eLayout->addWidget(yExtentsLabel, 1, 0);
    extents[2] = new QLabel("0.", info);
    eLayout->addWidget(extents[2], 1, 1);
    extents[3] = new QLabel("0.", info);
    eLayout->addWidget(extents[3], 1, 2);

    QLabel *zExtentsLabel = new QLabel(tr("Z Extents:"), info);
    eLayout->addWidget(zExtentsLabel, 2, 0);
    extents[4] = new QLabel("0.", info);
    eLayout->addWidget(extents[4], 2, 1);
    extents[5] = new QLabel("0.", info);
    eLayout->addWidget(extents[5], 2, 2);
519
    vLayout->addStretch(1000);
whitlocb's avatar
whitlocb committed
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561

    return info;
}

// ****************************************************************************
// Method: QvisRenderingWindow::CreateWindowContents
//
// Purpose: 
//   This method creates all of the window's widgets.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:57 PST 2002
//
// Modifications:
//   Brad Whitlock, Thu Jun 19 11:57:46 PDT 2008
//   Moved code to helper functions.
//
// ****************************************************************************

void
QvisRenderingWindow::CreateWindowContents()
{
    int row = 0;

    QTabWidget *topTab = new QTabWidget(central);
    topLayout->addWidget(topTab);

    //
    // Create the basic renderer options page.
    //
    topTab->addTab(CreateBasicPage(), tr("Basic"));


    //
    // Create the advanced renderer options group.
    //
    topTab->addTab(CreateAdvancedPage(), tr("Advanced"));

    //
    // Create the renderer information group.
    //
    topTab->addTab(CreateInformationPage(), tr("Information"));
hrchilds's avatar
hrchilds committed
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateWindow
//
// Purpose: 
//   This method updates the window's widgets when its subjects update.
//
// Arguments:
//   doAll : Whether or not to ignore field selection.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:48:24 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
577
//
hrchilds's avatar
hrchilds committed
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607
// ****************************************************************************

void
QvisRenderingWindow::UpdateWindow(bool doAll)
{
    if(SelectedSubject() == renderAtts || doAll)
        UpdateOptions(doAll);
    if(SelectedSubject() == windowInfo || doAll)
        UpdateInformation(doAll);
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateOptions
//
// Purpose: 
//   Updates the widgets that control the rendering options.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:28:53 PDT 2002
//
// Modifications:
//   Brad Whitlock, Thu Oct 24 13:35:22 PST 2002
//   I added code to enable/disable the stereo rendering buttons.
//
//   Kathleen Bonnell, Wed Dec  4 18:42:48 PST 2002 
//   Renumber switch cases, to reflect antialisingFrames removed from atts. 
//
hrchilds's avatar
hrchilds committed
608 609 610
//   Jeremy Meredith, Fri Nov 14 17:44:35 PST 2003
//   Added specular options.
//
hrchilds's avatar
hrchilds committed
611 612 613
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshld to scalrenActivationMode
//
hrchilds's avatar
hrchilds committed
614 615 616
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Add support for multiple display list modes.
//
hrchilds's avatar
hrchilds committed
617 618 619 620
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
621 622 623
//   Hank Childs, Sun Oct 24 07:36:18 PDT 2004
//   Added shadow options.
//
hrchilds's avatar
hrchilds committed
624 625 626
//   Mark C. Miller, Tue Jan  4 10:23:19 PST 2005
//   Fixed problem with updating scalable auto threshold
//
hrchilds's avatar
hrchilds committed
627 628 629
//   Kathleen Bonnell, Thu Jun 30 15:29:55 PDT 2005 
//   Added redgreen radiobutton.
//
hrchilds's avatar
hrchilds committed
630 631
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
hrchilds's avatar
hrchilds committed
632 633 634 635
//
//   Brad Whitlock, Mon Sep 18 10:49:51 PDT 2006
//   Added colorTexturingFlag.
//
636 637 638
//   Jeremy Meredith, Wed Aug 29 15:27:16 EDT 2007
//   Added depth cueing.  Simplified and corrected window sensitivity.
//
whitlocb's avatar
whitlocb committed
639 640 641
//   Brad Whitlock, Mon Dec 17 10:25:23 PST 2007
//   Made it use ids.
//
whitlocb's avatar
whitlocb committed
642 643 644
//   Brad Whitlock, Thu Jun 19 13:26:50 PDT 2008
//   Qt 4.
//
645 646 647
//   Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//   Added an automatic start/end setting capability for depth cueing.
//
hrchilds's avatar
hrchilds committed
648 649 650 651 652 653
// ****************************************************************************

void
QvisRenderingWindow::UpdateOptions(bool doAll)
{
    QString tmp;
hrchilds's avatar
hrchilds committed
654
    int itmp, itmp2;
hrchilds's avatar
hrchilds committed
655 656 657 658 659 660 661 662 663 664 665 666 667 668

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < renderAtts->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!renderAtts->IsSelected(i))
            continue;
        }

        switch(i)
        {
whitlocb's avatar
whitlocb committed
669
        case RenderingAttributes::ID_antialiasing:
hrchilds's avatar
hrchilds committed
670 671 672 673
            antialiasingToggle->blockSignals(true);
            antialiasingToggle->setChecked(renderAtts->GetAntialiasing());
            antialiasingToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
674
        case RenderingAttributes::ID_geometryRepresentation:
hrchilds's avatar
hrchilds committed
675 676
            itmp = (int)renderAtts->GetGeometryRepresentation();
            objectRepresentation->blockSignals(true);
whitlocb's avatar
whitlocb committed
677
            objectRepresentation->button(itmp)->setChecked(true);
hrchilds's avatar
hrchilds committed
678 679
            objectRepresentation->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
680
        case RenderingAttributes::ID_displayListMode:
hrchilds's avatar
hrchilds committed
681 682 683 684 685 686 687 688
            itmp = (int) renderAtts->GetDisplayListMode();
            if (itmp == 2) // Auto for atts's enum type order
                itmp2 = 0; // Order of Auto in window
            else if (itmp == 1) // Always for atts' enum type order
                itmp2 = 1; // Order of Always in window.
            else           // Never for atts' enum type order
                itmp2 = 2; // Order of Never in window.
            dlMode->blockSignals(true);
whitlocb's avatar
whitlocb committed
689
            dlMode->button(itmp2)->setChecked(true);
hrchilds's avatar
hrchilds committed
690
            dlMode->blockSignals(false);
hrchilds's avatar
hrchilds committed
691
            break;
whitlocb's avatar
whitlocb committed
692
        case RenderingAttributes::ID_stereoRendering:
hrchilds's avatar
hrchilds committed
693 694 695 696
            stereoToggle->blockSignals(true);
            stereoToggle->setChecked(renderAtts->GetStereoRendering());
            stereoToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
697
        case RenderingAttributes::ID_stereoType:
hrchilds's avatar
hrchilds committed
698
            stereoType->blockSignals(true);
whitlocb's avatar
whitlocb committed
699
            stereoType->button((int)renderAtts->GetStereoType())->setChecked(true);
hrchilds's avatar
hrchilds committed
700 701
            stereoType->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
702
        case RenderingAttributes::ID_notifyForEachRender:
hrchilds's avatar
hrchilds committed
703 704 705 706
            renderNotifyToggle->blockSignals(true);
            renderNotifyToggle->setChecked(renderAtts->GetNotifyForEachRender());
            renderNotifyToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
707
        case RenderingAttributes::ID_scalableActivationMode:
whitlocb's avatar
whitlocb committed
708
            { // new scope
hrchilds's avatar
hrchilds committed
709 710
            RenderingAttributes::TriStateMode rtmp;
            rtmp = renderAtts->GetScalableActivationMode();
hrchilds's avatar
hrchilds committed
711
            scalrenActivationMode->blockSignals(true);
hrchilds's avatar
hrchilds committed
712
            if (rtmp == RenderingAttributes::Always)
whitlocb's avatar
whitlocb committed
713
               scalrenActivationMode->button(1)->setChecked(true);
hrchilds's avatar
hrchilds committed
714
            else if (rtmp == RenderingAttributes::Never)
whitlocb's avatar
whitlocb committed
715
               scalrenActivationMode->button(2)->setChecked(true);
hrchilds's avatar
hrchilds committed
716
            else
whitlocb's avatar
whitlocb committed
717
               scalrenActivationMode->button(0)->setChecked(true);
hrchilds's avatar
hrchilds committed
718
            scalrenActivationMode->blockSignals(false);
whitlocb's avatar
whitlocb committed
719
            }
hrchilds's avatar
hrchilds committed
720
            break;
whitlocb's avatar
whitlocb committed
721
        case RenderingAttributes::ID_scalableAutoThreshold:
whitlocb's avatar
whitlocb committed
722
            { // new scope
hrchilds's avatar
hrchilds committed
723 724 725 726 727 728
            QString suffix;           
            int step, widgetVal;
            int actualVal = renderAtts->GetScalableAutoThreshold();
            InterpretScalableAutoThreshold(actualVal, &step, &suffix, &widgetVal);
            scalrenAutoThreshold->blockSignals(true);
            scalrenAutoThreshold->setSuffix(suffix);
whitlocb's avatar
whitlocb committed
729
            scalrenAutoThreshold->setSingleStep(step);
hrchilds's avatar
hrchilds committed
730 731 732
            scalrenAutoThreshold->setValue(widgetVal);
            scalrenAutoThreshold->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
733
            }
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
        case RenderingAttributes::ID_compactDomainsActivationMode:
            {
            RenderingAttributes::TriStateMode rtmp;
            rtmp = renderAtts->GetCompactDomainsActivationMode();
            compactDomainsActivationMode->blockSignals(true);
            if (rtmp == RenderingAttributes::Always)
                compactDomainsActivationMode->button(1)->setChecked(true);
            else if (rtmp == RenderingAttributes::Never)
                compactDomainsActivationMode->button(2)->setChecked(true);
            else
                compactDomainsActivationMode->button(0)->setChecked(true);
            compactDomainsActivationMode->blockSignals(false);
            }
          break;
        case RenderingAttributes::ID_compactDomainsAutoThreshold:
            { // new scope
            compactDomainsAutoThreshold->blockSignals(true);
            int val = renderAtts->GetCompactDomainsAutoThreshold();
            compactDomainsAutoThreshold->setValue(val);
            compactDomainsAutoThreshold->blockSignals(false);
            break;
            }

whitlocb's avatar
whitlocb committed
757
        case RenderingAttributes::ID_specularFlag:
hrchilds's avatar
hrchilds committed
758 759 760 761
            specularToggle->blockSignals(true);
            specularToggle->setChecked(renderAtts->GetSpecularFlag());
            specularToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
762
        case RenderingAttributes::ID_specularCoeff:
hrchilds's avatar
hrchilds committed
763 764 765 766
            specularStrengthSlider->blockSignals(true);
            specularStrengthSlider->setValue(int(renderAtts->GetSpecularCoeff()*100.));
            specularStrengthSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
767
        case RenderingAttributes::ID_specularPower:
hrchilds's avatar
hrchilds committed
768 769 770 771
            specularPowerSlider->blockSignals(true);
            specularPowerSlider->setValue(int(renderAtts->GetSpecularPower()*10.));
            specularPowerSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
772
        case RenderingAttributes::ID_specularColor:
hrchilds's avatar
hrchilds committed
773 774
            // Not user-modifiable at this time
            break;
whitlocb's avatar
whitlocb committed
775
        case RenderingAttributes::ID_doShadowing:
hrchilds's avatar
hrchilds committed
776 777 778 779
            shadowToggle->blockSignals(true);
            shadowToggle->setChecked(renderAtts->GetDoShadowing());
            shadowToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
780
        case RenderingAttributes::ID_shadowStrength:
hrchilds's avatar
hrchilds committed
781 782 783 784
            shadowStrengthSlider->blockSignals(true);
            shadowStrengthSlider->setValue(int(renderAtts->GetShadowStrength()*100.));
            shadowStrengthSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
785
        case RenderingAttributes::ID_doDepthCueing:
786 787 788 789
            depthCueingToggle->blockSignals(true);
            depthCueingToggle->setChecked(renderAtts->GetDoDepthCueing());
            depthCueingToggle->blockSignals(false);
            break;
790 791 792 793 794
        case RenderingAttributes::ID_depthCueingAutomatic:
            depthCueingAutoToggle->blockSignals(true);
            depthCueingAutoToggle->setChecked(renderAtts->GetDepthCueingAutomatic());
            depthCueingAutoToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
795
        case RenderingAttributes::ID_startCuePoint:
796
            depthCueingStartEdit->blockSignals(true);
whitlocb's avatar
whitlocb committed
797
            tmp = DoublesToQString(renderAtts->GetStartCuePoint(), 3);
798 799 800
            depthCueingStartEdit->setText(tmp);
            depthCueingStartEdit->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
801
        case RenderingAttributes::ID_endCuePoint:
802
            depthCueingEndEdit->blockSignals(true);
whitlocb's avatar
whitlocb committed
803
            tmp = DoublesToQString(renderAtts->GetEndCuePoint(), 3);
804 805 806
            depthCueingEndEdit->setText(tmp);
            depthCueingEndEdit->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
807
        case RenderingAttributes::ID_compressionActivationMode:
hrchilds's avatar
hrchilds committed
808 809 810 811 812 813 814 815
            itmp = (int) renderAtts->GetCompressionActivationMode();
            if (itmp == 2) // Auto for atts's enum type order
                itmp2 = 0; // Order of Auto in window
            else if (itmp == 1) // Always for atts' enum type order
                itmp2 = 1; // Order of Always in window.
            else           // Never for atts' enum type order
                itmp2 = 2; // Order of Never in window.
            scalrenCompressMode->blockSignals(true);
whitlocb's avatar
whitlocb committed
816
            scalrenCompressMode->button(itmp2)->setChecked(true);
hrchilds's avatar
hrchilds committed
817 818
            scalrenCompressMode->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
819
        case RenderingAttributes::ID_colorTexturingFlag:
hrchilds's avatar
hrchilds committed
820 821 822 823
            colorTexturingToggle->blockSignals(true);
            colorTexturingToggle->setChecked(renderAtts->GetColorTexturingFlag());
            colorTexturingToggle->blockSignals(false);
            break;
hrchilds's avatar
hrchilds committed
824 825
        }
    }
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843

    UpdateWindowSensitivity();
}


// ****************************************************************************
//  Method:  QvisRenderingWindow::UpdateWindowSensitivity
//
//  Purpose:
//    Set the sensitivity of all widgets in this window based on
//    values in the attributes.
//
//  Arguments:
//    none
//
//  Programmer:  Jeremy Meredith
//  Creation:    August 29, 2007
//
whitlocb's avatar
whitlocb committed
844 845 846 847 848 849 850
//  Modifications:
//    Brad Whitlock, Thu Jun 19 13:44:11 PDT 2008
//    Qt 4.
//
//    Cyrus Harrison, Mon Jul 28 15:23:05 PDT 2008
//    I added code to enable/disable the scalable auto threshold spin box based
//    on the scalable rendering mode. 
851
//
852 853 854
//    Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//    Added an automatic start/end setting capability for depth cueing.
//
855 856 857
//    Dave Pugmire, Tue Aug 24 11:32:12 EDT 2010
//    Add compact domain options.
//
858
// ****************************************************************************
whitlocb's avatar
whitlocb committed
859

860 861 862 863 864
void
QvisRenderingWindow::UpdateWindowSensitivity()
{
    bool scalableAlways =
        renderAtts->GetScalableActivationMode() == RenderingAttributes::Always;
865 866
    bool scalableAuto =
        renderAtts->GetScalableActivationMode() == RenderingAttributes::Auto;
867 868
    bool compactAuto =
        renderAtts->GetCompactDomainsActivationMode() == RenderingAttributes::Auto;
869 870
    bool shadowOn = renderAtts->GetDoShadowing();
    bool depthCueingOn = renderAtts->GetDoDepthCueing();
871
    bool depthCueingAuto = renderAtts->GetDepthCueingAutomatic();
872 873 874
    bool stereoOn = renderAtts->GetStereoRendering();
    bool specularOn = renderAtts->GetSpecularFlag();

875
    scalrenAutoThreshold->setEnabled(scalableAuto);
876
    compactDomainsAutoThreshold->setEnabled(compactAuto);
877 878 879 880 881
    shadowToggle->setEnabled(scalableAlways);
    shadowStrengthSlider->setEnabled(scalableAlways && shadowOn);
    shadowStrengthLabel->setEnabled(scalableAlways && shadowOn);

    depthCueingToggle->setEnabled(scalableAlways);
882 883 884 885 886
    depthCueingAutoToggle->setEnabled(scalableAlways && depthCueingOn);
    depthCueingStartEdit->setEnabled(scalableAlways && depthCueingOn && !depthCueingAuto);
    depthCueingStartLabel->setEnabled(scalableAlways && depthCueingOn && !depthCueingAuto);
    depthCueingEndEdit->setEnabled(scalableAlways && depthCueingOn && !depthCueingAuto);
    depthCueingEndLabel->setEnabled(scalableAlways && depthCueingOn && !depthCueingAuto);
887 888 889 890 891 892 893 894 895 896

    redblue->setEnabled(stereoOn);
    interlace->setEnabled(stereoOn);
    crystalEyes->setEnabled(stereoOn);
    redgreen->setEnabled(stereoOn);

    specularStrengthSlider->setEnabled(specularOn);
    specularPowerSlider->setEnabled(specularOn);
    specularStrengthLabel->setEnabled(specularOn);
    specularPowerLabel->setEnabled(specularOn);
hrchilds's avatar
hrchilds committed
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateInformation
//
// Purpose: 
//   Updates the information labels with statistics from the viewer.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:29:35 PDT 2002
//
// Modifications:
//   Eric Brugger, Fri Apr 18 11:52:33 PDT 2003
//   I removed auto center view.
//   
hrchilds's avatar
hrchilds committed
915 916 917 918
//   Jeremy Meredith, Tue Nov 16 11:39:53 PST 2004
//   Replaced simple QString::sprintf's with a setNum because there seems
//   to be a bug causing numbers to be incremented by .00001.  See '5263.
//
hrchilds's avatar
hrchilds committed
919 920 921
//   Mark C. Miller, Wed Jan  5 16:23:01 PST 2005
//   Fixed problem with case lables not matching Select statements
//
hrchilds's avatar
hrchilds committed
922 923 924
//   Mark C. Miller, Fri Mar  4 13:05:02 PST 2005
//   Changed GetNumTriangles to GetNumPrimitives
//
hrchilds's avatar
hrchilds committed
925 926 927
//   Mark C. Miller, Thu Jul 21 20:16:42 PDT 2005
//   Added a break; statement after case label 16
//
hrchilds's avatar
hrchilds committed
928 929
//   Mark C. Miller, Wed Nov 16 10:46:36 PST 2005
//   Added seconds per frame for < 1 fps cases 
whitlocb's avatar
whitlocb committed
930 931 932 933
//
//   Brad Whitlock, Mon Dec 17 10:30:33 PST 2007
//   Made it use ids.
//
934 935 936
//   Brad Whitlock, Tue Apr  8 15:26:49 PDT 2008
//   Support for internationalization.
//
hrchilds's avatar
hrchilds committed
937 938 939 940 941 942 943
// ****************************************************************************

void
QvisRenderingWindow::UpdateInformation(bool doAll)
{
    QString tmp;
    float fps;
hrchilds's avatar
hrchilds committed
944
    int j;
hrchilds's avatar
hrchilds committed
945 946 947 948 949 950 951 952 953 954 955 956 957 958

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < windowInfo->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!windowInfo->IsSelected(i))
            continue;
        }

        switch(i)
        {
whitlocb's avatar
whitlocb committed
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975
        case WindowInformation::ID_activeSource:
        case WindowInformation::ID_activeTimeSlider:
        case WindowInformation::ID_timeSliders:
        case WindowInformation::ID_timeSliderCurrentStates:
        case WindowInformation::ID_animationMode:
        case WindowInformation::ID_interactionMode:
        case WindowInformation::ID_boundingBoxNavigate:
        case WindowInformation::ID_spin:
        case WindowInformation::ID_fullFrame:
        case WindowInformation::ID_perspective:
        case WindowInformation::ID_lockView:
        case WindowInformation::ID_lockTools:
        case WindowInformation::ID_lockTime:
        case WindowInformation::ID_viewExtentsType:
        case WindowInformation::ID_viewDimension:
        case WindowInformation::ID_viewKeyframes:
        case WindowInformation::ID_cameraViewMode:
hrchilds's avatar
hrchilds committed
976
            break;
whitlocb's avatar
whitlocb committed
977
        case WindowInformation::ID_usingScalableRendering:
978
            scalrenUsingLabel->setText(windowInfo->GetUsingScalableRendering() ? tr("yes") : tr("no"));
hrchilds's avatar
hrchilds committed
979
            break;
whitlocb's avatar
whitlocb committed
980
        case WindowInformation::ID_lastRenderMin:
hrchilds's avatar
hrchilds committed
981 982 983 984 985 986 987 988 989
            // Determine the fps.
            if(windowInfo->GetLastRenderMin() > 0. &&
               windowInfo->GetLastRenderMin() < 1.e05)
                fps = 1. / windowInfo->GetLastRenderMin();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMaxLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
990
        case WindowInformation::ID_lastRenderAvg:
hrchilds's avatar
hrchilds committed
991 992 993 994 995
            // Determine the fps.
            if(windowInfo->GetLastRenderAvg() > 0.)
                fps = 1. / windowInfo->GetLastRenderAvg();
            else
                fps = 0.;
hrchilds's avatar
hrchilds committed
996 997 998
            if (fps > 0.0 && fps < 1.0)
            {
                fps = 1.0 / fps;
999
                fpsLabel->setText(tr("Seconds per frame:"));
hrchilds's avatar
hrchilds committed
1000 1001 1002
            }
            else
            {
1003
                fpsLabel->setText(tr("Frames per second:"));
hrchilds's avatar
hrchilds committed
1004
            }
hrchilds's avatar
hrchilds committed
1005 1006 1007
            tmp.sprintf("%1.3g", fps);
            fpsAvgLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
1008
        case WindowInformation::ID_lastRenderMax:
hrchilds's avatar
hrchilds committed
1009 1010 1011 1012 1013 1014 1015 1016
            // Determine the fps.
            if(windowInfo->GetLastRenderMax() > 0.)
                fps = 1. / windowInfo->GetLastRenderMax();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMinLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
1017
        case WindowInformation::ID_numPrimitives:
hrchilds's avatar
hrchilds committed
1018 1019
            tmp.sprintf("%d", windowInfo->GetNumPrimitives());
            approxNumPrimitives->setText(tmp);
hrchilds's avatar
hrchilds committed
1020
            break;
whitlocb's avatar
whitlocb committed
1021
        case WindowInformation::ID_extents:
hrchilds's avatar
hrchilds committed
1022
            for(j = 0; j < 6; ++j)
hrchilds's avatar
hrchilds committed
1023 1024 1025
            {
                double d = windowInfo->GetExtents()[j];
                if(d == DBL_MAX || d == -DBL_MAX)
1026
                    tmp = tr("not set");
hrchilds's avatar
hrchilds committed
1027
                else
hrchilds's avatar
hrchilds committed
1028
                    tmp.setNum(windowInfo->GetExtents()[j]);
hrchilds's avatar
hrchilds committed
1029 1030 1031
                extents[j]->setText(tmp);
            }
            break;
whitlocb's avatar
whitlocb committed
1032 1033 1034
        case WindowInformation::ID_windowSize:
        case WindowInformation::ID_winMode:
            break;
hrchilds's avatar
hrchilds committed
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
        }            
    }
}

// ****************************************************************************
// Method: QvisRenderingWindow::Apply
//
// Purpose: 
//   Tells the viewer to apply the rendering attributes.
//
// Arguments:
//   ignore : A flag that causes us to unconditionally apply the
//            rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:49:19 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::Apply(bool ignore)
{
    if(AutoUpdate() || ignore)
    {
        renderAtts->Notify();
hrchilds's avatar
hrchilds committed
1062
        GetViewerMethods()->SetRenderingAttributes();
hrchilds's avatar
hrchilds committed
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
    }
    else
        renderAtts->Notify();
}

// ****************************************************************************
// Method: QvisRenderingWindow::SubjectRemoved
//
// Purpose: 
//   This method makes sure that we don't Detach from the subject if it is
//   destroyed first.
//
// Arguments:
//   TheRemovedSubject : The subject being deleted.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:50:04 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::SubjectRemoved(Subject *TheRemovedSubject)
{
    if(TheRemovedSubject == renderAtts)
        renderAtts = 0;
    else if(TheRemovedSubject == windowInfo)
        windowInfo = 0;
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectRenderingAttributes
//
// Purpose: 
//   Makes this window observe the rendering attributes.
//
// Arguments:
//   w : The rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectRenderingAttributes(RenderingAttributes *w)
{
    renderAtts = w;
    renderAtts->Attach(this);
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectWindowInformation
//
// Purpose: 
//   Makes this window observe the window information.
//
// Arguments:
//   w : The window information.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectWindowInformation(WindowInformation *w)
{
    windowInfo = w;
    windowInfo->Attach(this);
}

//
// Qt slot functions
//

// ****************************************************************************
// Method: QvisRenderingWindow::apply
//
// Purpose: 
//   This Qt slot function is called by clicking the apply button.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:45 PST 2002
//
// Modifications:
1154 1155
//   Jeremy Meredith, Wed Aug 29 15:27:16 EDT 2007
//   Added call to GetCurrentValues.
hrchilds's avatar
hrchilds committed
1156 1157 1158 1159 1160 1161
//   
// ****************************************************************************

void
QvisRenderingWindow::apply()
{
1162
    GetCurrentValues();
hrchilds's avatar
hrchilds committed
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
    Apply(true);
}

// ****************************************************************************
// Method: QvisRenderingWindow::antialiasingToggled
//
// Purpose: 
//   This Qt slot function is called when the antialiasing checkbox is clicked.
//
// Arguments:
//   val : The new AA value.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:52:07 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::antialiasingToggled(bool val)
{
    renderAtts->SetAntialiasing(val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::objectRepresentationChanged
//
// Purpose: 
//   This Qt slot function is called when we change surface representations.
//
// Arguments:
//   val : The new surface representation.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:53:28 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::objectRepresentationChanged(int val)
{
    renderAtts->SetGeometryRepresentation(
        (RenderingAttributes::GeometryRepresentation)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
1216
// Method: QvisRenderingWindow::displayListModeChanged
hrchilds's avatar
hrchilds committed
1217 1218
//
// Purpose: 
hrchilds's avatar
hrchilds committed
1219
//   This Qt slot function is called when we change the display list mode.
hrchilds's avatar
hrchilds committed
1220 1221
//
// Arguments:
hrchilds's avatar
hrchilds committed
1222
//   mode : The new display list mode.
hrchilds's avatar
hrchilds committed
1223
//
hrchilds's avatar
hrchilds committed
1224 1225
// Programmer: Hank Childs
// Creation:   May 9, 2004
hrchilds's avatar
hrchilds committed
1226 1227 1228 1229 1230 1231
//
// Modifications:
//   
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
1232
QvisRenderingWindow::displayListModeChanged(int mode)
hrchilds's avatar
hrchilds committed
1233
{
hrchilds's avatar
hrchilds committed
1234 1235 1236 1237 1238 1239 1240 1241
    int itmp = 0;
    if (mode == 0)      // Auto in Window
        itmp = 2;       // Auto for atts' enum type
    else if (mode == 1) // Always in window
        itmp = 1;       // Always for atts' enum type
    else                // Never in window.
        itmp = 0;       // Never for atts' enum type

hrchilds's avatar
hrchilds committed
1242
    renderAtts->SetDisplayListMode((RenderingAttributes::TriStateMode)itmp);
hrchilds's avatar
hrchilds committed
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoToggled
//
// Purpose: 
//   This Qt slot function is called when we change turn stereo on/off.
//
// Arguments:
//   val : The new stereo enabled mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:54:52 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoToggled(bool val)
{
    renderAtts->SetStereoRendering(val);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoTypeChanged
//
// Purpose: 
//   This Qt slot function is called when the stereo type changes.
//
// Arguments:
//   val : The new stereo type.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:55:32 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoTypeChanged(int val)
{
    renderAtts->SetStereoType((RenderingAttributes::StereoTypes)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::renderNotifyToggled
//
// Purpose: 
//   This Qt slot function is called when the "Query after render" toggle
//   button is clicked.
//
// Arguments:
//   val : The new query mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:56:12 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::renderNotifyToggled(bool val)
{
    renderAtts->SetNotifyForEachRender(val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
1320
// Method: QvisRenderingWindow::scalrenActivationModeChanged
hrchilds's avatar
hrchilds committed
1321 1322
//
// Purpose: 
hrchilds's avatar
hrchilds committed
1323
//   This Qt slot function is called when the scalable activation mode changes.
hrchilds's avatar
hrchilds committed
1324 1325
//
// Arguments:
hrchilds's avatar
hrchilds committed
1326
//   val : The new scalable activation mode flag.
hrchilds's avatar
hrchilds committed
1327
//         0 = Auto, 1 = Always, 2 = Never
hrchilds's avatar
hrchilds committed
1328 1329 1330 1331 1332
//
// Programmer: Mark C. Miller 
// Creation:   Wed Nov 20 17:09:59 PST 2002 
//
// Modifications:
hrchilds's avatar
hrchilds committed
1333 1334 1335
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Added scalrenAutoThreshold spinbox and geometry label
hrchilds's avatar
hrchilds committed
1336
//   
hrchilds's avatar
hrchilds committed
1337 1338 1339 1340
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
1341 1342 1343
//   Hank Childs, Sun Dec  4 18:41:39 PST 2005
//   Automatically update the shadow toggle ['5596].
//
1344 1345 1346
//   Jeremy Meredith, Wed Aug 29 15:28:05 EDT 2007
//   Moved window sensitivity handling to its own function.
//
hrchilds's avatar
hrchilds committed
1347 1348 1349
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
1350
QvisRenderingWindow::scalrenActivationModeChanged(int val)
hrchilds's avatar
hrchilds committed
1351
{
hrchilds's avatar
hrchilds committed
1352
    if (val == 0)
hrchilds's avatar
hrchilds committed
1353
    {
hrchilds's avatar
hrchilds committed
1354
        renderAtts->SetScalableActivationMode(RenderingAttributes::Auto);
hrchilds's avatar
hrchilds committed
1355 1356
        scalrenAutoThresholdChanged(scalrenAutoThreshold->value());
    }
hrchilds's avatar
hrchilds committed
1357
    else if (val == 1)
hrchilds's avatar
hrchilds committed
1358
    {
hrchilds's avatar
hrchilds committed
1359
        renderAtts->SetScalableActivationMode(RenderingAttributes::Always);
hrchilds's avatar
hrchilds committed
1360
    }
hrchilds's avatar
hrchilds committed
1361
    else
hrchilds's avatar
hrchilds committed
1362
    {
hrchilds's avatar
hrchilds committed
1363
        renderAtts->SetScalableActivationMode(RenderingAttributes::Never);
hrchilds's avatar
hrchilds committed
1364 1365 1366
    }
    SetUpdate(false);
    Apply();
1367
    UpdateWindowSensitivity();
hrchilds's avatar
hrchilds committed
1368 1369
}

hrchilds's avatar
hrchilds committed
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
// ****************************************************************************
// Method: QvisRenderingWindow::InterpretScalableAutoThreshold
//
// Purpose: Determine widget controls given scalable auto threshold 
//
// Programmer: Mark C. Miller 
// Creation:   January 4, 2005 
//
// ****************************************************************************
void
QvisRenderingWindow::InterpretScalableAutoThreshold(int actualVal,
    int *step, QString *suffix, int *widgetVal) const
{
    // compute the step size and suffix for the displayed value in the GUI
    if      (actualVal < 1e3) { *step = 50;  *suffix = "  Polys"; }
    else if (actualVal < 1e4) { *step = 500; *suffix = "  Polys"; }
    else if (actualVal < 1e5) { *step = 5;   *suffix = " KPolys"; }
    else if (actualVal < 1e6) { *step = 50;  *suffix = " KPolys"; }
    else if (actualVal < 1e7) { *step = 500; *suffix = " KPolys"; }
    else if (actualVal < 1e8) { *step = 5;   *suffix = " MPolys"; }
    else if (actualVal < 1e9) { *step = 50;  *suffix = " MPolys"; }
    else                      { *step = 1;   *suffix = " GPolys"; }

    // compute the divisor for the displayed value in the GUI
    int div;
    if      (*suffix == " KPolys") div = (int) 1e3;
    else if (*suffix == " MPolys") div = (int) 1e6; 
    else if (*suffix == " GPolys") div = (int) 1e9;
    else                          div = 1;

    *widgetVal = actualVal / div;
}

hrchilds's avatar
hrchilds committed
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
// ****************************************************************************
// Method: QvisRenderingWindow::scalrenAutoThresholdChanged
//
// Purpose: 
//   This Qt slot function is called when the scalable rendering automatic
//   polygon count threshold changes.
//
// Arguments:
//   val : The new polygon count threshold.
//
// Programmer: Mark C. Miller 
// Creation:   Wed Apr 21 22:42:57 PDT 2004 
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
1418 1419 1420 1421
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
1422 1423 1424
//   Mark C. Miller, Tue Jan  4 10:23:19 PST 2005
//   Changed to use InterpretScalableAutoThreshold
//
whitlocb's avatar
whitlocb committed
1425 1426 1427
//   Brad Whitlock, Thu Jun 19 13:45:24 PDT 2008
//   Qt 4.
//
hrchilds's avatar
hrchilds committed
1428
// ****************************************************************************
whitlocb's avatar
whitlocb committed
1429

hrchilds's avatar
hrchilds committed
1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446
void
QvisRenderingWindow::scalrenAutoThresholdChanged(int val)
{
    // determine the actual value from the given value and the current suffix
    int actualVal;
    if (scalrenAutoThreshold->suffix() == " GPolys")
        actualVal = val * (int) 1e9;
    else if (scalrenAutoThreshold->suffix() == " MPolys")
        actualVal = val * (int) 1e6;
    else if (scalrenAutoThreshold->suffix() == " KPolys")
        actualVal = val * (int) 1e3;
    else if (scalrenAutoThreshold->suffix() == "  Polys")
        actualVal = val;
    else
        actualVal = val;

    // deal with stepping backwards
whitlocb's avatar
whitlocb committed
1447
    int step = scalrenAutoThreshold->singleStep();
hrchilds's avatar
hrchilds committed
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462
    if ((val == 500) && (step == 500) && (scalrenAutoThreshold->suffix() == "  Polys"))
        actualVal = 950;
    else if ((val == 5) && (step == 5) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 9500;
    else if ((val == 50) && (step == 50) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 95000;
    else if ((val == 500) && (step == 500) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 950000;
    else if ((val == 5) && (step == 5) && (scalrenAutoThreshold->suffix() == " MPolys"))
        actualVal = 9500000;
    else if ((val == 50) && (step == 50) && (scalrenAutoThreshold->suffix() == " MPolys"))
        actualVal = 95000000;
    else if ((val == 0) && (step == 1) && (scalrenAutoThreshold->suffix() == " GPolys"))
        actualVal = 950000000;

hrchilds's avatar
hrchilds committed
1463
    int widgetVal;
hrchilds's avatar
hrchilds committed
1464
    QString suffix;
hrchilds's avatar
hrchilds committed
1465
    InterpretScalableAutoThreshold(actualVal, &step, &suffix, &widgetVal);
hrchilds's avatar
hrchilds committed
1466 1467

    // set the new GUI value
whitlocb's avatar
whitlocb committed
1468
    scalrenAutoThreshold->setSingleStep(step);
hrchilds's avatar
hrchilds committed
1469
    scalrenAutoThreshold->setSuffix(suffix);
hrchilds's avatar
hrchilds committed
1470 1471
    scalrenAutoThreshold->setValue(widgetVal);

hrchilds's avatar
hrchilds committed
1472
    renderAtts->SetScalableAutoThreshold(actualVal);
hrchilds's avatar
hrchilds committed
1473

hrchilds's avatar
hrchilds committed
1474 1475 1476
    SetUpdate(false);
    Apply();
}
hrchilds's avatar
hrchilds committed
1477

1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522


// ****************************************************************************
// Method:  QvisRenderingWindow::compactDomainsAutoThresholdChanged
//
// Programmer:  Dave Pugmire
// Creation:    August 24, 2010
//
// ****************************************************************************

void
QvisRenderingWindow::compactDomainsAutoThresholdChanged(int val)
{
    renderAtts->SetCompactDomainsAutoThreshold(val);
    SetUpdate(false);
    Apply();
}


// ****************************************************************************
// Method: QvisRenderingWindow::compactDomainsActivationModeChanged
//
// Programmer: Dave Pugmire
// Creation:   August 24, 2010
//
// ****************************************************************************

void
QvisRenderingWindow::compactDomainsActivationModeChanged(int mode)
{
    if (mode == 0)
    {
        renderAtts->SetCompactDomainsActivationMode(RenderingAttributes::Auto);
        compactDomainsAutoThresholdChanged(compactDomainsAutoThreshold->value());
    }
    else if (mode == 1)
        renderAtts->SetCompactDomainsActivationMode(RenderingAttributes::Always);
    else
        renderAtts->SetCompactDomainsActivationMo