Commit 3d1a4c87 authored by hrchilds's avatar hrchilds
Browse files

Update from April 15, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@451 18c085ea-50e0-402c-830e-de6fd14e8384
parent 6d5daa6d
......@@ -572,6 +572,27 @@ Xfer::GetOutputConnection() const
return output;
}
// ****************************************************************************
// Method: Xfer::GetBufferedInputConnection
//
// Purpose:
// Returns a pointer to the buffered input connection.
//
// Returns: Connection*
//
// Programmer: Brad Whitlock
// Creation: Thu Apr 14 16:39:09 PST 2005
//
// Modifications:
//
// ****************************************************************************
Connection *
Xfer::GetBufferedInputConnection()
{
return &bufferedInput;
}
// ****************************************************************************
// Method: Xfer::GetNextGuido
//
......
......@@ -33,7 +33,11 @@ class VisItRPC;
// Brad Whitlock, Thu Feb 27 10:57:26 PDT 2003
// Added support for special opcodes, which are opcodes that the user
// can inject into the command stream to cause immediate effects.
//
//
// Brad Whitlock, Thu Apr 14 16:37:24 PST 2005
// Added a method to give access to the buffered input so we can store
// objects directly in it.
//
// ****************************************************************************
class STATE_API Xfer : public SimpleObserver
......@@ -50,6 +54,7 @@ public:
void SetOutputConnection(Connection *);
Connection *GetInputConnection() const;
Connection *GetOutputConnection() const;
Connection *GetBufferedInputConnection();
virtual void Process();
virtual bool ReadPendingMessages();
......
......@@ -1016,6 +1016,9 @@ QvisMainWindow::UpdateFileMenuPopup(QPopupMenu *m, int menuId)
// Brad Whitlock, Fri Sep 13 15:48:27 PST 2002
// I changed it so it also updates the new Active window menu.
//
// Brad Whitlock, Fri Apr 15 09:42:58 PDT 2005
// I added some code that prevents an update unless it is really needed.
//
// ****************************************************************************
void
......@@ -1027,21 +1030,28 @@ QvisMainWindow::UpdateWindowList(bool doList)
if(doList)
{
intVector oldIndices;
for(i = 0; i < activeWindowComboBox->count(); ++i)
oldIndices.push_back(activeWindowComboBox->text(i).toInt());
// Update the Active window combo box.
activeWindowComboBox->clear();
for(i = 0; i < indices.size(); ++i)
if(oldIndices != indices)
{
QString temp; temp.sprintf("%d", indices[i]);
activeWindowComboBox->insertItem(temp);
}
activeWindowComboBox->clear();
for(i = 0; i < indices.size(); ++i)
{
QString temp; temp.sprintf("%d", indices[i]);
activeWindowComboBox->insertItem(temp);
}
// Update the Active window menu
activeWindowPopup->clear();
for(i = 0; i < indices.size(); ++i)
{
QString str; str.sprintf("Window %d", indices[i]);
activeWindowPopup->insertItem(str, i);
activeWindowPopup->setItemChecked(i, indices[i] == index);
// Update the Active window menu
activeWindowPopup->clear();
for(i = 0; i < indices.size(); ++i)
{
QString str; str.sprintf("Window %d", indices[i]);
activeWindowPopup->insertItem(str, i);
activeWindowPopup->setItemChecked(i, indices[i] == index);
}
}
}
else
......
......@@ -486,9 +486,6 @@ QvisPlotManagerWidget::Update(Subject *TheChangedSubject)
return;
}
// Get whether or not we are allowed to modify things.
bool canChange = !globalAtts->GetExecuting();
//
// Initialize the class members that are used in various methods to tell
// us whether updating the menu enabled state is required.
......@@ -580,13 +577,6 @@ QvisPlotManagerWidget::Update(Subject *TheChangedSubject)
applyOperatorToggle->setChecked(globalAtts->GetApplyOperator());
applyOperatorToggle->blockSignals(false);
// Set the enabled state for the whole widget based on whether
// or not the engine is busy.
activePlots->setEnabled(canChange);
plotListBox->setEnabled(canChange);
UpdateHideDeleteDrawButtonsEnabledState();
applyOperatorToggle->setEnabled(canChange);
//
// When the globalAtts change, we might have to update the
// enabled state for the entire plot and operator menu bar.
......@@ -822,7 +812,10 @@ QvisPlotManagerWidget::UpdateSourceList(bool updateActiveSourceOnly)
// Creation: Wed Sep 10 09:05:26 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Fri Apr 15 09:18:35 PDT 2005
// Removed the code that prevented the controls from being enabled when
// the engine is busy.
//
// ****************************************************************************
void
......@@ -843,10 +836,9 @@ QvisPlotManagerWidget::UpdateHideDeleteDrawButtonsEnabledState() const
++nHideablePlots;
}
bool canChange = !globalAtts->GetExecuting();
hideButton->setEnabled(nHideablePlots > 0 && canChange);
deleteButton->setEnabled(plotList->GetNumPlots() > 0 && canChange);
drawButton->setEnabled(plotList->GetNumPlots() > 0 && canChange);
hideButton->setEnabled(nHideablePlots > 0);
deleteButton->setEnabled(plotList->GetNumPlots() > 0);
drawButton->setEnabled(plotList->GetNumPlots() > 0);
}
// ****************************************************************************
......@@ -1193,6 +1185,9 @@ QvisPlotManagerWidget::UpdatePlotVariableMenu()
// set instead of doing it all over the place. This allows me to set the
// menu state consistently without code duplication.
//
// Brad Whitlock, Fri Apr 15 09:20:00 PDT 2005
// I removed code to disable the widgets when the engine is executing.
//
// ****************************************************************************
void
......@@ -1235,21 +1230,6 @@ QvisPlotManagerWidget::UpdatePlotAndOperatorMenuEnabledState()
varMenuEnabled = (varMenu->count() > 0);
}
//
// If the number of variables is less than the cutoff then we want to
// disable the menus when the viewer is executing. If the number of
// variables is too large then we don't want to change the menu enabled
// states because it is too expensive.
//
if(this->maxVarCount < VARIABLE_CUTOFF)
{
plotMenuEnabled &= !globalAtts->GetExecuting();
operatorMenuEnabled &= !globalAtts->GetExecuting();
varMenuEnabled &= !globalAtts->GetExecuting();
plotAttsMenuEnabled = !globalAtts->GetExecuting();
operatorAttsMenuEnabled = !globalAtts->GetExecuting();
}
//
// Check each menu that we want to update to see if we need to update.
//
......
package llnl.visit;
// ****************************************************************************
// Class: PostponedAction
//
// Purpose:
// This class contains the attributes for controlling the viewer vis a postponed action.
//
// Notes: Autogenerated by xml2java.
//
// Programmer: xml2java
// Creation: Fri Apr 15 10:31:25 PDT 2005
//
// Modifications:
//
// ****************************************************************************
public class PostponedAction extends AttributeSubject
{
public PostponedAction()
{
super(2);
RPC = new ViewerRPC();
window = 0;
}
public PostponedAction(PostponedAction obj)
{
super(2);
RPC = new ViewerRPC(obj.RPC);
window = obj.window;
SelectAll();
}
public boolean equals(PostponedAction obj)
{
// Create the return value
return ((RPC == obj.RPC) &&
(window == obj.window));
}
// Property setting methods
public void SetRPC(ViewerRPC RPC_)
{
RPC = RPC_;
Select(0);
}
public void SetWindow(int window_)
{
window = window_;
Select(1);
}
// Property getting methods
public ViewerRPC GetRPC() { return RPC; }
public int GetWindow() { return window; }
// Write and read methods.
public void WriteAtts(CommunicationBuffer buf)
{
if(WriteSelect(0, buf))
RPC.Write(buf);
if(WriteSelect(1, buf))
buf.WriteInt(window);
}
public void ReadAtts(int n, CommunicationBuffer buf)
{
for(int i = 0; i < n; ++i)
{
int index = (int)buf.ReadByte();
switch(index)
{
case 0:
RPC.Read(buf);
Select(0);
break;
case 1:
SetWindow(buf.ReadInt());
break;
}
}
}
// Attributes
private ViewerRPC RPC;
private int window;
}
......@@ -128,6 +128,9 @@ import java.util.Vector;
// Brad Whitlock, Fri Apr 8 11:57:46 PDT 2005
// Overloaded AddOperator.
//
// Brad Whitlock, Fri Apr 15 10:32:35 PDT 2005
// Added PostponedAction.
//
// ****************************************************************************
public class ViewerProxy implements SimpleObserver
......@@ -149,6 +152,7 @@ public class ViewerProxy implements SimpleObserver
// State objects
rpc = new ViewerRPC();
postponedAction = new PostponedAction();
syncAtts = new SyncAttributes();
appearanceAtts = new AppearanceAttributes();
pluginAtts = new PluginManagerAttributes();
......@@ -220,6 +224,7 @@ public class ViewerProxy implements SimpleObserver
// Set up xfer and the RPC's
xfer.SetRemoteProcess(viewer);
xfer.Add(rpc);
xfer.Add(postponedAction);
xfer.Add(syncAtts);
xfer.Add(appearanceAtts);
xfer.Add(pluginAtts);
......@@ -1674,6 +1679,7 @@ public class ViewerProxy implements SimpleObserver
// State objects
//
private ViewerRPC rpc;
private PostponedAction postponedAction;
private SyncAttributes syncAtts;
private AppearanceAttributes appearanceAtts;
private PluginManagerAttributes pluginAtts;
......
......@@ -477,7 +477,7 @@ BoundaryViewerPluginInfo::ReInitializePlotAtts(AttributeSubject *atts,
int
BoundaryViewerPluginInfo::GetVariableTypes() const
{
return VAR_CATEGORY_SUBSET;
return VAR_CATEGORY_MATERIAL;
}
......
......@@ -492,7 +492,7 @@ FilledBoundaryViewerPluginInfo::ReInitializePlotAtts(AttributeSubject *atts,
int
FilledBoundaryViewerPluginInfo::GetVariableTypes() const
{
return VAR_CATEGORY_SUBSET;
return VAR_CATEGORY_MATERIAL;
}
......
......@@ -737,7 +737,7 @@ SetOperatorOptionsAction::Execute()
// ****************************************************************************
AddPlotAction::AddPlotAction(ViewerWindow *win) : ViewerMultipleAction(win,
"AddPlotAction"), host(), database(), pluginEntries(), menuPopulator()
"AddPlotAction"), pluginEntries(), menuPopulator()
{
SetAllText("Add plot");
SetExclusive(false);
......@@ -843,6 +843,12 @@ AddPlotAction::~AddPlotAction()
// I updated the code to use a new interface to
// VariableMenuPopulator::UpdateSingleVariableMenu.
//
// Brad Whitlock, Fri Apr 15 13:39:32 PST 2005
// Added code to clear the menu since the menu populator no longer does
// menu clearing. I also made the variable menu populator responsible for
// deciding when the menu must be cleared since it does a better overall
// job.
//
// ****************************************************************************
void
......@@ -851,25 +857,11 @@ AddPlotAction::Update()
if(pluginEntries.size() > 0)
{
ViewerPlotList *plotList = window->GetPlotList();
const std::string &newHost = plotList->GetHostName();
const std::string &newDB = plotList->GetDatabaseName();
const std::string &host = plotList->GetHostName();
const std::string &database = plotList->GetDatabaseName();
//
// If the new host and database are valid and they differ from the old values
// then we need to update the variable menu.
//
if(newHost.size() > 0 && newDB.size() > 0 &&
(host != newHost || database != newDB))
if(host.size() > 0 && database.size() > 0)
{
host = newHost;
database = newDB;
// Print to the debug logs.
debug4 << "AddPlotAction::Update: Either the host or the database " << endl
<< "changed so we need to update the variable menu!" << endl
<< "\thost=" << host.c_str() << endl
<< "\tdb=" << database.c_str() << endl;
// Get the metadata and SIL for the file.
ViewerFileServer *fileServer = ViewerFileServer::Instance();
const avtDatabaseMetaData *md = fileServer->GetMetaData(host, database);
......@@ -883,22 +875,31 @@ AddPlotAction::Update()
if(menuPopulator.PopulateVariableLists(plotList->GetHostDatabaseName(),
md, sil, exprList))
{
// Print to the debug logs.
debug4 << "AddPlotAction::Update: Either the host or the database " << endl
<< "changed so we need to update the variable menu!" << endl
<< "\thost=" << host.c_str() << endl
<< "\tdb=" << database.c_str() << endl;
//
// Update the variable menus for the actions.
//
bool menuEnabled = false;
for(int i = 0; i < pluginEntries.size(); ++i)
{
menuPopulator.UpdateSingleVariableMenu(pluginEntries[i].varMenu,
pluginEntries[i].varMenu->clear();
int varCount = menuPopulator.UpdateSingleVariableMenu(
pluginEntries[i].varMenu,
pluginEntries[i].varTypes, this,
SLOT(addPlot(int, const QString &)));
bool enabled = menuPopulator.ItemEnabled(pluginEntries[i].varTypes);
bool hasEntries = (varCount > 0);
// Set the new menu's enabled state based on the variable type.
actionMenu->setItemEnabled(i, enabled);
menu->setItemEnabled(i, enabled);
menuEnabled |= enabled;
if(hasEntries != actionMenu->isItemEnabled(i))
actionMenu->setItemEnabled(i, hasEntries);
if(hasEntries != menu->isItemEnabled(i))
menu->setItemEnabled(i, hasEntries);
menuEnabled |= hasEntries;
}
menu->setEnabled(menuEnabled);
......@@ -1171,7 +1172,9 @@ AddPlotAction::ConstructToolbar(QToolBar *toolbar)
// Creation: Thu Mar 20 12:50:41 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Fri Apr 15 13:37:32 PST 2005
// Changed to the no argument Activate call.
//
// ****************************************************************************
void
......@@ -1186,7 +1189,7 @@ AddPlotAction::addPlot(int index, const QString &var)
args.SetVariable(var.latin1());
// Execute the action.
Activate(false);
Activate();
}
// ****************************************************************************
......
......@@ -195,6 +195,9 @@ public:
// Brad Whitlock, Tue Mar 16 15:35:44 PST 2004
// I added changeMenuIconSize.
//
// Brad Whitlock, Fri Apr 15 13:57:12 PST 2005
// I removed host and database.
//
// ****************************************************************************
class QMenuBar;
......@@ -230,7 +233,6 @@ private slots:
private:
QMenuBar *menu;
int maxPixmapWidth, maxPixmapHeight;
std::string host, database;
PluginEntryVector pluginEntries;
VariableMenuPopulator menuPopulator;
};
......
#include <ViewerActionBase.h>
#include <ViewerActionManager.h>
#include <ViewerSubject.h>
#include <ViewerWindow.h>
#include <ViewerWindowManager.h>
// An external pointer to the ViewerSubject.
extern ViewerSubject *viewerSubject;
// Static members
ViewerRPC ViewerActionBase::args;
ViewerWindowManager *ViewerActionBase::windowMgr = 0;
......@@ -14,16 +18,16 @@ ViewerWindowManager *ViewerActionBase::windowMgr = 0;
// Constructor
//
// Arguments:
//
// Returns:
//
// Note:
// win : The viewer window that owns the action.
// name : The name of the object instance.
//
// Programmer: Brad Whitlock
// Creation: Wed Feb 5 17:16:35 PST 2003
//
// Modifications:
//
// Brad Whitlock, Fri Apr 15 09:06:46 PDT 2005
// Added rpcType initialization.
//
// ****************************************************************************
ViewerActionBase::ViewerActionBase(ViewerWindow *win, const char *name) :
......@@ -32,6 +36,7 @@ ViewerActionBase::ViewerActionBase(ViewerWindow *win, const char *name) :
window = win;
windowId = window->GetWindowId();
allowVisualRepresentation = true;
rpcType = ViewerRPC::CloseRPC;
windowMgr = ViewerWindowManager::Instance();
}
......@@ -76,6 +81,49 @@ ViewerActionBase::SetArgs(const ViewerRPC &a)
args = a;
}
// ****************************************************************************
// Method: ViewerActionBase::GetArgs
//
// Purpose:
// Returns a reference to the args object.
//
// Returns: A reference to the args object.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 15 10:46:22 PDT 2005
//
// Modifications:
//
// ****************************************************************************
const ViewerRPC &
ViewerActionBase::GetArgs()
{
return args;
}
// ****************************************************************************
// Method: ViewerActionBase::SetRPCType
//
// Purpose:
// Lets the action know which RPC it is associated with.
//
// Arguments:
// t : The RPC type that the action handles.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 15 09:09:21 PDT 2005
//
// Modifications:
//
// ****************************************************************************
void
ViewerActionBase::SetRPCType(ViewerRPC::ViewerRPCType t)
{
rpcType = t;
}
// ****************************************************************************
// Method: ViewerActionBase::Activate
//
......@@ -112,23 +160,37 @@ ViewerActionBase::Activate()
// The window's HideMenu method does not seem to always be called so let's
// hide it after executing each action if it needs to be hidden.
//
// Brad Whitlock, Thu Apr 14 16:16:11 PST 2005
// I added code to postpone the action's viewer rpc.
//
// ****************************************************************************
void
ViewerActionBase::Activate(bool setup)
ViewerActionBase::Activate(bool interactive)
{
// Allow the action to store values in the args object.
if(setup)
if(interactive)
{
// Allow the action to store values in the args object.
Setup();
// Before handling the action, do this.
PreExecute();
// Postpone the action until it is safe to execute it by scheduling it
// with the ViewerSubject. By always scheduling interactive actions
// in this way, we make it safe to handle them with other input that
// came in from the client.
args.SetRPCType(rpcType);
viewerSubject->PostponeAction(this);
}
else
{
// Before handling the action, do this.
PreExecute();
// Handle the action
Execute();
// Handle the action
Execute();
// Tell the action manager to update all of the actions.
window->GetActionManager()->Update();
// Tell the action manager to update all of the actions.
window->GetActionManager()->Update();
}
// Hide the menu since we're done with the action.
window->HideMenu();
......
......@@ -28,6 +28,9 @@ class ViewerWindowManager;
// Brad Whitlock, Tue Jul 1 10:17:46 PDT 2003
// I added CreateNode and SetFromNode.
//
// Brad Whitlock, Fri Apr 15 09:10:55 PDT 2005
// I added SetRPCType, GetArgs.
//
// ****************************************************************************
class VIEWER_API ViewerActionBase : public QObject
......@@ -59,7 +62,10 @@ public:
virtual void RemoveFromToolbar(QToolBar *toolbar) = 0;
virtual void UpdateConstruction() { }
void SetRPCType(ViewerRPC::ViewerRPCType);
static void SetArgs(const ViewerRPC &a);
static const ViewerRPC &GetArgs();
public slots:
virtual void Activate();
virtual void Activate(bool setup);
......@@ -77,6 +83,7 @@ protected:
ViewerWindow *window;
int windowId;
bool allowVisualRepresentation;
ViewerRPC::ViewerRPCType rpcType;
static ViewerWindowManager *windowMgr;
static ViewerRPC args;
......