Commit c6191b85 authored by hrchilds's avatar hrchilds
Browse files

Update from October 10, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@339 18c085ea-50e0-402c-830e-de6fd14e8384
parent f2027067
......@@ -729,10 +729,21 @@ Expression::FieldsEqual(int index_, const AttributeGroup *rhs) const
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: Expression::GetNumTypes
//
// Programmer: ?
// Creation: ?
//
// Modifications:
// Jeremy Meredith, Sun Oct 10 22:58:21 PDT 2004
// Changed it to 8 to reflect the current number of actual expressions.
//
// ****************************************************************************
const int
Expression::GetNumTypes()
{
return 6;
return 8;
}
const char *
......
Function: GetNumTypes
Declaration: static const int GetNumTypes();
Definition:
// ****************************************************************************
// Method: Expression::GetNumTypes
//
// Programmer: ?
// Creation: ?
//
// Modifications:
// Jeremy Meredith, Sun Oct 10 22:58:21 PDT 2004
// Changed it to 8 to reflect the current number of actual expressions.
//
// ****************************************************************************
const int
Expression::GetNumTypes()
{
return 6;
return 8;
}
Function: GetTypeString
......
#include <ExprDeleteButton.h>
// ****************************************************************************
// Method: ExprDeleteButton::ExprDeleteButton
//
// Purpose:
// This is the constructor for the ExprDeleteButton class.
//
// Arguments:
//
// Programmer: Sean Ahern
// Creation: Fri Sep 14 13:34:45 PDT 2001
//
// ****************************************************************************
ExprDeleteButton::ExprDeleteButton(int _row, const QString & text,
QWidget *parent,
const char *name):
QPushButton(text, parent, name )
{
row = _row;
connect(this, SIGNAL(clicked()),
this, SLOT(sendDelete()));
}
// ****************************************************************************
// Method: ExprDeleteButton::sendDelete
//
// Purpose:
// This slot just emits the "deleted" signal, containing the row
// information we were given at startup.
//
// Arguments:
//
// Programmer: Sean Ahern
// Creation: Fri Sep 28 15:06:13 PDT 2001
//
// ****************************************************************************
void
ExprDeleteButton::sendDelete()
{
emit deleted(row);
}
#ifndef EXPR_DELETE_BUTTON_H
#define EXPR_DELETE_BUTTON_H
#include <gui_exports.h>
#include <qpushbutton.h>
// ****************************************************************************
// Class: ExprDeleteButton
//
// Purpose:
// This class overrides QPushButton in one small way. It takes a "row"
// that's passed back in the "delete" signal. That way, many of these
// can be hooked to the same slot and have the slot differentiate between
// the widgets.
//
// Notes:
//
// Programmer: Sean Ahern
// Creation: Fri Sep 28 15:07:39 PDT 2001
//
// Modifications:
//
// ****************************************************************************
class GUI_API ExprDeleteButton : public QPushButton
{
Q_OBJECT
public:
ExprDeleteButton(int row, const QString & text,
QWidget *parent = 0, const char *name = 0);
signals:
void deleted(int);
protected slots:
void sendDelete();
private:
int row;
};
#endif
#include <stdio.h>
#include <qcombobox.h>
#include <qtable.h>
#include <Expression.h>
#include <ExprTypeItem.h>
//
// Most of this code was stolen from the Qt examples from Trolltech, from
// the file examples/statistics/statistics.cpp.
//
// ****************************************************************************
// Method: ExprTypeItem::ExprTypeItem
//
// Purpose:
// Constructor for an ExprTypeItem.
//
// Arguments:
// t The table that this table item is associated with
// et The way that this item should be edited (see Qt docs)
// _which Which type is selected by default
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:01:11 PDT 2001
//
// ****************************************************************************
ExprTypeItem::ExprTypeItem(QTable *t, EditType et,
Expression::ExprType _which):
QTableItem(t, et, "unset")
{
which = _which;
menu = NULL;
// We do not want this item to be replaced
setReplaceable(false);
setText(Expression::GetTypeString(which));
}
// ****************************************************************************
// Method: ExprTypeItem::createEditor
//
// Purpose:
// Creates a QComboBox to edit the type.
//
// Note:
// This method is required to be const to override the virtual function
// correctly.
//
// Note:
// This function is only called internally by Qt.
//
// Arguments:
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:01:11 PDT 2001
//
// ****************************************************************************
QWidget *
ExprTypeItem::createEditor() const
{
// Create a comboBox editor.
//
// The funky stuff with (ExirTypeItem*)this is to get around the fact
// that we have to put "const" in our prototype.
((ExprTypeItem*)this)->menu = new QComboBox(table()->viewport());
// Build up the menu so that it contains the list of all possible types.
for(int i=0;i<Expression::GetNumTypes()-1;i++)
menu->insertItem(Expression::GetTypeString((Expression::ExprType)i));
menu->setCurrentItem(int(which));
return menu;
}
// ****************************************************************************
// Method: ExprTypeItem::setContentFromEditor
//
// Purpose:
// Takes the editor that was created in ExprTypeItem::createEditor and
// figures out what type is chosen. It then sets the text to be the
// string representation of that type.
//
// Note:
// This function is only called internally by Qt.
//
// Arguments:
// w The editor widget.
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:01:11 PDT 2001
//
// ****************************************************************************
void
ExprTypeItem::setContentFromEditor(QWidget *w)
{
// The user changed the value of the menu, so synchronize the value of
// the item (text) with the value of the menu.
if (w->inherits("QComboBox"))
setText(((QComboBox*)w)->currentText());
else
QTableItem::setContentFromEditor(w);
}
// ****************************************************************************
// Method: ExprTypeItem::setText
//
// Purpose:
// Sets the displayed content of the ExprTypeItem. We also update the
// menu editor while we're at it.
//
// Arguments:
// s The string to set.
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:01:11 PDT 2001
//
// ****************************************************************************
void
ExprTypeItem::setText(const QString &s)
{
if (menu)
menu->setCurrentItem(Expression::GetTypeId(s.ascii()));
QTableItem::setText(s);
}
#ifndef EXPR_TYPE_ITEM_H
#define EXPR_TYPE_ITEM_H
#include <gui_exports.h>
#include <qtable.h>
#include <Expression.h>
// Forward declarations
class QComboBox;
// ****************************************************************************
// Class: ExprTypeItem
//
// Purpose:
// This class overrides QTableItem to display expression types. It
// understands how to create a QComboBox to edit the expression types.
// The list of types is queried from the Expression object.
//
// Notes:
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:02:51 PDT 2001
//
// Modifications:
//
// ****************************************************************************
class GUI_API ExprTypeItem : public QObject, public QTableItem
{
Q_OBJECT
public:
ExprTypeItem(QTable *t, EditType et, Expression::ExprType which);
QWidget *createEditor() const;
void setContentFromEditor(QWidget *w);
void setText(const QString &s);
private:
QComboBox *menu;
Expression::ExprType which;
};
#endif
#include <qtable.h>
#include <ExpressionTable.h>
// ****************************************************************************
// Method: ExpressionTable::ExpressionTable
//
// Purpose:
// This is the constructor for the ExpressionTable class.
//
// Arguments:
// numRows The number of rows in the table initially
// numCols The number of columns in the table initially
// parent The parent widget
// name The name of the table
//
// Programmer: Sean Ahern
// Creation: Fri Sep 14 13:34:45 PDT 2001
//
// ****************************************************************************
ExpressionTable::ExpressionTable(int numRows, int numCols,
QWidget * parent, const char * name):
QTable(numRows, numCols, parent, name)
{
}
// ****************************************************************************
// Method: ExpressionTable::StopEditing
//
// Purpose:
// Walks through all of the cells that could have editors working for
// them currently and tells them to stop. The contents of cell are then
// updated with whatever the current contents of the editor are.
//
// Arguments:
//
// Programmer: Sean Ahern
// Creation: Wed Oct 10 17:01:11 PDT 2001
//
// ****************************************************************************
void
ExpressionTable::StopEditing()
{
for (int row = 0; row < numRows(); row++)
{
endEdit(row, 0, true, false);
endEdit(row, 1, true, false);
endEdit(row, 2, true, false);
}
}
#ifndef EXPRESSION_TABLE_H
#define EXPRESSION_TABLE_H
#include <gui_exports.h>
#include <qtable.h>
// ****************************************************************************
// Class: ExpressionsTable
//
// Purpose:
// This class overrides QTable in one way. It allows us to easily stop
// the editing of cells so that we can update the pertinent subject.
//
// Notes:
//
// Programmer: Sean Ahern
// Creation: Fri Sep 14 13:59:13 PDT 2001
//
// Modifications:
//
// ****************************************************************************
class GUI_API ExpressionTable : public QTable
{
Q_OBJECT
public:
ExpressionTable(int numRows, int numCols, QWidget * parent = 0,
const char * name = 0);
void StopEditing();
};
#endif
......@@ -280,6 +280,10 @@
# Kathleen Bonnell, Mon Aug 16 17:54:35 PDT 2004
# Added QvisInteractorWindow.
#
# Jeremy Meredith, Sun Oct 10 23:38:57 PDT 2004
# Removed ExprTableItem, ExpressionTable, and ExprDeleteButton;
# redesigned expressions window.
#
##############################################################################
##
......@@ -306,9 +310,6 @@ MOC=@QT_MOC@
# First, all of the header files that define Qt objects.
HDRMOC = \
ExprDeleteButton.h \
ExpressionTable.h \
ExprTypeItem.h \
KFListView.h \
KFTimeSlider.h \
QvisAbstractOpacityBar.h \
......
This diff is collapsed.
......@@ -6,14 +6,16 @@
// Forward declarations
class ExpressionList;
class QPoint;
class QVBoxLayout;
class QHBoxLayout;
class QPushButton;
class QCheckBox;
class QGroupBox;
class QLineEdit;
class QListView;
class ExpressionTable;
class QMultiLineEdit;
class QLabel;
class QListBox;
class QComboBox;
// ****************************************************************************
// Class: QvisExpressionsWindow
......@@ -23,8 +25,8 @@ class ExpressionTable;
//
// Notes:
//
// Programmer: Sean Ahern
// Creation: Fri Sep 14 13:59:13 PDT 2001
// Programmer: Jeremy Meredith
// Creation: October 10, 2004
//
// Modifications:
//
......@@ -46,24 +48,43 @@ class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
protected:
void UpdateWindow(bool doAll);
void Apply(bool forceUpdate = false);
void BlockAllSignals(bool);
private slots:
void addExpression();
void deleteExpression(int);
private:
ExpressionList *exprList;
void delExpression();
void nameTextChanged(const QString&);
void definitionTextChanged();
void typeChanged(int);
void hiddenChanged();
void displayAllVarsChanged();
void insertFunction(int);
void UpdateWindowSingleItem();
void UpdateWindowSensitivity();
private:
// Widgets and layouts.
QGroupBox *listGroup;
QButton *newButton;
QButton *editButton;
QButton *deleteButton;
ExpressionTable *table;
QGroupBox *editGroup;
QLineEdit *nameLineEdit;
QLineEdit *defLineEdit;
QCheckBox *hiddenToggle;
QListBox *exprListBox;
QLabel *nameEditLabel;
QLabel *definitionEditLabel;
QLabel *typeLabel;
QLineEdit *nameEdit;
QComboBox *typeList;
QCheckBox *hidden;
QMultiLineEdit *definitionEdit;
QPushButton *newButton;
QPushButton *delButton;
QPushButton *insertFunctionButton;
QPopupMenu *insertFunctionMenu;
QCheckBox *displayAllVars;
// State information
ExpressionList *exprList;
};
#endif
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