Commit e41f36f6 authored by hrchilds's avatar hrchilds

Update from March 6, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@630 18c085ea-50e0-402c-830e-de6fd14e8384
parent f7b3f8f3
......@@ -952,6 +952,13 @@ LEOSFileReader::ReadVariableInfo(const char *matDirName,
// Programmer: Mark C. Miller
// Creation: February 10, 2004
//
// Modifications:
//
// Mark C. Miller, Mon Mar 6 17:31:21 PST 2006
// Pre-pended matDirName with "L" to force correct directory match. The
// previous code would match "40" with "L140" and wind up reading data from
// wrong directory
//
// ****************************************************************************
bool
......@@ -998,6 +1005,7 @@ LEOSFileReader::ParseContentsAndPopulateMetaData(avtDatabaseMetaData *md,
return false;
string matDirName = RemoveSpaces(dirDigits);
matDirName = "L" + matDirName;
// the matDirName doesn't contain the full directory name, so try to find it
// in the topDirs list
......
......@@ -2,6 +2,8 @@
#include <QvisAnnotationObjectInterface.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qtimer.h>
#include <QvisScreenPositionEdit.h>
#include <AnnotationObject.h>
......@@ -322,3 +324,79 @@ QvisAnnotationObjectInterface::GetScreenPosition(QvisScreenPositionEdit *spe,
}
}
}
// ****************************************************************************
// Method: QvisAnnotationObjectInterface::GetScreenPosition2
//
// Purpose:
// Gets the position2 coordinate from a screen position edit and sets it into
// the annotation object.
//
// Arguments:
// spe : The screen position edit that we're checking.
// name : The name to use in the error message.
//
// Programmer: Brad Whitlock
// Creation: Mon Mar 6 11:14:41 PDT 2006
//
// Modifications:
//
// ****************************************************************************
void
QvisAnnotationObjectInterface::GetScreenPosition2(QvisScreenPositionEdit *spe,
const QString &name)
{
if(annot)
{
float coord[3] = {0.f, 0.f, 0.f};
if(spe->getPosition(coord[0], coord[1]))
{
annot->SetPosition2(coord);
}
else
{
QString msg; msg.sprintf("The %s value was invalid. "
"Resetting to the last good value.", name.latin1());
Error(msg);
annot->SetPosition2(annot->GetPosition2());
}
}
}
// ****************************************************************************
// Method: QvisAnnotationObjectInterface::ForceSpinBoxUpdate
//
// Purpose:
// Utility method that lets us trick a spin box into thinking it has new
// text.
//
// Arguments:
// sb : The spin box to update.
//
// Programmer: Brad Whitlock
// Creation: Mon Mar 6 14:21:40 PST 2006
//
// Modifications:
//
// ****************************************************************************
void
QvisAnnotationObjectInterface::ForceSpinBoxUpdate(QSpinBox *sb)
{
// Block signals.
sb->blockSignals(true);
// textChanged is protected and the compiler does not let us call
// it directly so call it as a slot. We do this to make the spin box
// think that it has new text input so it will parse it again when
// we call value().
QTimer::singleShot(0, sb, SLOT(textChanged()));
// Call the value function to make the spin box parse the new value.
sb->value();
// Let the spinbox emit signals again.
sb->blockSignals(false);
}
......@@ -6,6 +6,7 @@
class AnnotationObject;
class QLineEdit;
class QSpinBox;
class QVBoxLayout;
class QvisScreenPositionEdit;
......@@ -21,7 +22,9 @@ class QvisScreenPositionEdit;
// Creation: Fri Oct 31 10:24:32 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Mon Mar 6 11:14:15 PDT 2006
// Added a new helper method.
//
// ****************************************************************************
class GUI_API QvisAnnotationObjectInterface : public QGroupBox, public GUIBase
......@@ -48,6 +51,8 @@ protected:
void GetPosition(QLineEdit *le, const QString &name);
void GetScreenPosition(QvisScreenPositionEdit *spe, const QString &name);
void GetPosition2(QLineEdit *le, const QString &name);
void GetScreenPosition2(QvisScreenPositionEdit *spe, const QString &name);
void ForceSpinBoxUpdate(QSpinBox *sb);
QVBoxLayout *topLayout;
......
......@@ -19,6 +19,7 @@
#include <QvisColorGridWidget.h>
#include <ColorControlPoint.h>
#include <ColorControlPointList.h>
#include <DataNode.h>
#include <ViewerProxy.h>
// Defines. Make these part of ColorTableAttributes sometime.
......@@ -335,6 +336,71 @@ QvisColorTableWindow::CreateWindowContents()
this, SLOT(selectedColor(const QColor &)));
}
// ****************************************************************************
// Method: QvisColorTableWindow::CreateNode
//
// Purpose:
// Saves the windows settings.
//
// Arguments:
// parentNode : The node that will contain the settings.
//
// Programmer: Brad Whitlock
// Creation: Mon Mar 6 09:18:09 PDT 2006
//
// Modifications:
//
// ****************************************************************************
void
QvisColorTableWindow::CreateNode(DataNode *parentNode)
{
// Call the base class's method to save the generic window attributes.
QvisPostableWindowSimpleObserver::CreateNode(parentNode);
if(saveWindowDefaults &&
!currentColorTable.isEmpty() &&
currentColorTable != "none")
{
DataNode *node = parentNode->GetNode(std::string(caption().latin1()));
// Save the current color table.
std::string ct(currentColorTable.latin1());
node->AddNode(new DataNode("currentColorTable", ct));
}
}
// ****************************************************************************
// Method: QvisColorTableWindow::SetFromNode
//
// Purpose:
// Gets the window's settings.
//
// Programmer: Brad Whitlock
// Creation: Mon Mar 6 09:18:41 PDT 2006
//
// Modifications:
//
// ****************************************************************************
void
QvisColorTableWindow::SetFromNode(DataNode *parentNode, const int *borders)
{
DataNode *winNode = parentNode->GetNode(std::string(caption().latin1()));
if(winNode == 0)
return;
// Get the active tab and show it.
DataNode *node;
if((node = winNode->GetNode("currentColorTable")) != 0)
{
currentColorTable = QString(node->AsString().c_str());
}
// Call the base class's function.
QvisPostableWindowSimpleObserver::SetFromNode(parentNode, borders);
}
// ****************************************************************************
// Method: QvisColorTableWindow::UpdateWindow
//
......@@ -358,6 +424,10 @@ QvisColorTableWindow::CreateWindowContents()
// Brad Whitlock, Wed Nov 20 16:11:25 PST 2002
// I added support for discrete color tables.
//
// Brad Whitlock, Mon Mar 6 10:18:18 PDT 2006
// I changed the code so it only uses the first colortable name as a last
// resort if the active color table is set to something invalid.
//
// ****************************************************************************
void
......@@ -366,26 +436,36 @@ QvisColorTableWindow::UpdateWindow(bool doAll)
bool updateNames = false;
bool updateColorPoints = false;
// If we have never set the currentColorTable variable then set it to the
// name of the first applicable color table.
if(currentColorTable == "none")
{
currentColorTable = QString(colorAtts->GetActiveContinuous().c_str());
if(currentColorTable == "")
currentColorTable = QString(colorAtts->GetActiveDiscrete().c_str());
updateColorPoints = true;
}
//
// If our active color table, for some reason, does not appear in the
// list of color tables then we should choose a new colortable.
// list of color tables then we should choose a new colortable. Note that
// if we've not set the color table yet, it will be "none" and it will get
// set here, if possible.
//
if(colorAtts->GetColorTableIndex(currentColorTable.latin1()) == -1)
int nct = 3;
bool invalidCt = true;
const char *ctNames[4] = {0,0,0,0};
ctNames[0] = currentColorTable.latin1();
ctNames[1] = colorAtts->GetActiveContinuous().c_str();
ctNames[2] = colorAtts->GetActiveDiscrete().c_str();
if(colorAtts->GetNames().size() > 0)
{
ctNames[3] = colorAtts->GetNames()[0].c_str();
++nct;
}
for(int c = 0; c < nct && invalidCt; ++c)
{
if(colorAtts->GetNames().size() > 0)
currentColorTable = QString(colorAtts->GetNames()[0].c_str());
if(colorAtts->GetColorTableIndex(ctNames[c]) != -1)
{
currentColorTable = QString(ctNames[c]);
invalidCt = false;
}
else
currentColorTable = "none";
updateColorPoints = true;
}
if(invalidCt)
{
currentColorTable = "none";
updateColorPoints = true;
}
......
......@@ -8,6 +8,7 @@
// Forward declarations
class ColorControlPointList;
class ColorTableAttributes;
class DataNode;
class QVBoxLayout;
class QPushButton;
class QButtonGroup;
......@@ -48,6 +49,9 @@ class QvisColorGridWidget;
// Brad Whitlock, Tue Jul 1 16:37:41 PST 2003
// I added an Export button.
//
// Brad Whitlock, Mon Mar 6 09:09:46 PDT 2006
// I added code to save the current color table to the settings.
//
// ****************************************************************************
class GUI_API QvisColorTableWindow : public QvisPostableWindowObserver
......@@ -60,6 +64,9 @@ public:
QvisNotepadArea *notepad = 0);
virtual ~QvisColorTableWindow();
virtual void CreateWindowContents();
virtual void CreateNode(DataNode *);
virtual void SetFromNode(DataNode *, const int *borders);
public slots:
virtual void apply();
protected:
......
......@@ -268,13 +268,43 @@ QvisImageAnnotationInterface::UpdateControls()
// Creation: Wed Nov 5 11:49:08 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Mon Mar 6 11:05:02 PDT 2006
// I added code to make sure that the screen position is recorded.
//
// ****************************************************************************
void
QvisImageAnnotationInterface::GetCurrentValues(int which_widget)
{
bool doAll = (which_widget == -1);
if(which_widget == 0 || doAll)
{
// Get the new position
GetScreenPosition(positionStartEdit, "Lower left");
}
if(which_widget == 1 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(widthSpinBox);
int w = widthSpinBox->value();
float pos[] = {w, annot->GetPosition2()[1], 0};
annot->SetPosition2(pos);
if(linkedWH->isOn())
heightSpinBox->setValue(w);
}
if(which_widget == 2 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(heightSpinBox);
int h = heightSpinBox->value();
float pos[] = {annot->GetPosition2()[0], h, 0};
annot->SetPosition2(pos);
if(linkedWH->isOn())
widthSpinBox->setValue(h);
}
}
//
......
......@@ -228,12 +228,38 @@ QvisLine2DInterface::UpdateControls()
// Creation: Fri Sep 03 09:32:04 PDT 2004
//
// Modifications:
//
// Brad Whitlock, Mon Mar 6 11:08:06 PDT 2006
// I added code to make sure that the end points get recorded.
//
// ****************************************************************************
void
QvisLine2DInterface::GetCurrentValues(int which_widget)
{
bool doAll = (which_widget == -1);
if(which_widget == 0 || doAll)
{
// Get the new position
GetScreenPosition(positionStartEdit, "Start");
}
if(which_widget == 1 || doAll)
{
// Get the new position
GetScreenPosition2(positionEndEdit, "End");
}
if(which_widget == 2 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(widthSpinBox);
ColorAttribute ca;
ca.SetRgb(widthSpinBox->value(),
annot->GetColor2().Green(),
annot->GetColor2().Blue());
annot->SetColor2(ca);
}
}
//
......
......@@ -288,7 +288,9 @@ QvisText2DInterface::UpdateControls()
// Creation: Wed Nov 5 11:49:08 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Mon Mar 6 14:36:03 PST 2006
// Added code to grab the width.
//
// ****************************************************************************
void
......@@ -308,6 +310,18 @@ QvisText2DInterface::GetCurrentValues(int which_widget)
sv.push_back(textLineEdit->text().latin1());
annot->SetText(sv);
}
if(which_widget == 2 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(widthSpinBox);
int w = widthSpinBox->value();
float pos2[3];
pos2[0] = float(w) * 0.01f;
pos2[1] = annot->GetPosition2()[1];
pos2[2] = annot->GetPosition2()[2];
annot->SetPosition2(pos2);
}
}
//
......
......@@ -323,6 +323,9 @@ QvisTimeSliderInterface::UpdateControls()
// Brad Whitlock, Thu Feb 24 16:37:01 PST 2005
// I changed how time format gets put into the object.
//
// Brad Whitlock, Mon Mar 6 14:38:21 PST 2006
// I adde code to make sure that width and height are saved.
//
// ****************************************************************************
void
......@@ -353,6 +356,30 @@ QvisTimeSliderInterface::GetCurrentValues(int which_widget)
annot->SetText(sv);
}
if(which_widget == 2 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(widthSpinBox);
int w = widthSpinBox->value();
float pos2[3];
pos2[0] = float(w) * 0.01f;
pos2[1] = annot->GetPosition2()[1];
pos2[2] = annot->GetPosition2()[2];
annot->SetPosition2(pos2);
}
if(which_widget == 3 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(heightSpinBox);
int h = heightSpinBox->value();
float pos2[3];
pos2[0] = annot->GetPosition2()[0];
pos2[1] = float(h) * 0.01f;
pos2[2] = annot->GetPosition2()[2];
annot->SetPosition2(pos2);
}
}
//
......
......@@ -55,14 +55,14 @@ QvisTurnDownButton::~QvisTurnDownButton()
// Creation: Tue Dec 2 13:58:19 PST 2003
//
// Modifications:
//
// Brad Whitlock, Mon Mar 6 14:52:07 PST 2006
// Added Qt 3 implementation.
//
// ****************************************************************************
void
QvisTurnDownButton::drawButtonLabel(QPainter *painter)
{
#if QT_VERSION >= 300
#else
int x = 0;
int y = 0;
int w = width();
......@@ -75,6 +75,10 @@ QvisTurnDownButton::drawButtonLabel(QPainter *painter)
h -= 4;
}
#if QT_VERSION >= 300
QRect r(x,y,w,h);
style().drawPrimitive(QStyle::PE_ArrowDown, painter, r, colorGroup(), QStyle::Style_Enabled);
#else
style().drawArrow(painter, Qt::DownArrow, isDown(),
x, y, w, h,
colorGroup(), isEnabled());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment