Commit 94ee2697 authored by js9's avatar js9
Browse files

fixing bug where gui lost track of plugin used to open file

also small visual gui tweaks (operator icon, source icon labels)



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@10435 18c085ea-50e0-402c-830e-de6fd14e8384
parent a511ff0d
/* XPM */
static const char * oper_add4_xpm[] = {
"32 32 57 1",
" c None",
". c #000000",
"+ c #28CD41",
"@ c #44CC25",
"# c #5BCD10",
"$ c #72CC02",
"% c #8ECC00",
"& c #A4CC00",
"* c #BBCC00",
"= c #2BB159",
"- c #45B13E",
"; c #5DB128",
"> c #72B211",
", c #8DB201",
"' c #A4B200",
") c #BBB200",
"! c #2B9C6D",
"~ c #449C55",
"{ c #5C9D3B",
"] c #729B27",
"^ c #8E9C0C",
"/ c #A49A03",
"( c #BB9A00",
"_ c #2B8583",
": c #448669",
"< c #5D8551",
"[ c #72853D",
"} c #8F861F",
"| c #A5870B",
"1 c #BB8602",
"2 c #296C9E",
"3 c #446B85",
"4 c #5C6C6B",
"5 c #716B58",
"6 c #8C6E39",
"7 c #A36C25",
"8 c #BB6B10",
"9 c #2A56B4",
"0 c #435898",
"a c #5B5782",
"b c #72586A",
"c c #8D574E",
"d c #A35739",
"e c #BA5722",
"f c #2941C8",
"g c #4241AF",
"h c #5A4296",
"i c #6F4182",
"j c #8E4064",
"k c #A4414C",
"l c #B94138",
"m c #22FF32",
"n c #6AE073",
"o c #28762D",
"p c #FF4141",
"q c #FF9A9A",
"r c #AE0000",
" ",
" .. .. ",
" .. .. ",
" .. .. ",
" .... .. ... .. .. ",
" ...... ....... .. +@#$%&* ..",
"... ... ... ... .. =-;>,') ..",
".. .. .. .. .. !~{]^/( ..",
".. .. .. .. .. _:<[}|1 ..",
".. .. .. .. .. 2345678 ..",
"... ... ... ... .. 90abcde ..",
" ...... ....... .. fghijkl ..",
" .... .. ... .. .. ",
" .. .. .. ",
" .. .. .. ",
" .. .. .. ",
" ",
" ",
" mnnnn .. ",
" ommmn .. ",
" ommmn .. ",
" ommmn .. ",
" mnnnmmmmnnnnn .. pqqqqqqqqqqq ",
" ommmmmmmmmmmn .. rppppppppppq ",
" ommmmmmmmmmmn .. rppppppppppq ",
" ommmmmmmmmmmn .. rppppppppppq ",
" ooooommmmooom .. rrrrrrrrrrrp ",
" ommmn .. ",
" ommmn .. ",
" ommmn .. ",
" oooom .. ",
" "};
......@@ -215,6 +215,10 @@ FileServerList::FileServerList() : AttributeSubject("bbbbbibbbb"), servers(),
//
// Mark C. Miller, Wed Aug 2 19:58:44 PDT 2006
// Made fileMetaData and SILData MRUCache's
//
// Jeremy Meredith, Fri Mar 19 13:25:47 EDT 2010
// Clear the cache of which plugins opened which files.
//
// ****************************************************************************
FileServerList::~FileServerList()
......@@ -234,6 +238,7 @@ FileServerList::~FileServerList()
fileMetaData.clear();
SILData.clear();
filePlugins.clear();
// delete the message attributes.
delete messageAtts;
......@@ -1093,6 +1098,10 @@ FileServerList::SetFilter(const string &newFilter)
// Added a work-around for bad indexing into timeStates. This fixes a crash
// on windows, but the use of timeStates here should be reworked.
//
// Jeremy Meredith, Fri Mar 19 13:22:13 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. Here, we don't.
//
// ****************************************************************************
void
......@@ -1136,7 +1145,7 @@ FileServerList::SetAppliedFileList(const QualifiedFilenameVector &newFiles,
}
// Free the metadata and SIL for the file.
ClearFile(appliedFileList[i]);
ClearFile(appliedFileList[i], false);
// If the file happens to be the open file, reopen it so we
// get new cached metadata for later.
......@@ -1642,10 +1651,16 @@ FileServerList::OpenAndGetMetaData(const QualifiedFilename &filename,
// Mark C. Miller, Mon Sep 18 16:24:12 PDT 2006
// Changed to build list of keys to remove beforing removing keyed values.
// Because gnu's compare(0,n,string) is buggy, use compare(0,n,string,0,n)
//
// Jeremy Meredith, Fri Mar 19 13:23:00 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. (E.g. on ReOpen, we don't.)
//
// ****************************************************************************
void
FileServerList::ClearFile(const QualifiedFilename &filename)
FileServerList::ClearFile(const QualifiedFilename &filename,
bool forgetPlugin)
{
const string& fullName = filename.FullName();
const int n = fullName.size();
......@@ -1670,6 +1685,9 @@ FileServerList::ClearFile(const QualifiedFilename &filename)
}
for (i = 0; i < keysToRemove.size(); i++)
SILData.remove(keysToRemove[i]);
if (forgetPlugin)
filePlugins.erase(fullName);
}
// ****************************************************************************
......@@ -2478,6 +2496,11 @@ FileServerList::GetOpenFile() const
// Send flags for creation of MeshQuality and TimeDerivative expressions
// in GetMetaData call.
//
// Jeremy Meredith, Fri Mar 19 13:27:07 EDT 2010
// Replicate the logic already in the viewer, where we keep a cache
// of which plugin we used to open a given file. So when we re-open
// it, we don't get it wrong.
//
// ****************************************************************************
const avtDatabaseMetaData *
......@@ -2525,10 +2548,16 @@ FileServerList::GetMetaData(const QualifiedFilename &filename,
if (svit == servers.end())
return 0;
// get and clear the cached plugin type for this file
std::string forcedFileType("");
if (filePlugins.count(mdKeys[0]) > 0)
forcedFileType = filePlugins[mdKeys[0]];
filePlugins.erase(mdKeys[0]);
MDServerProxy *mds = svit->second->server;
const avtDatabaseMetaData *md =
mds->GetMetaData(filename.PathAndFile(), timeState,
forceReadAllCyclesTimes, "",
forceReadAllCyclesTimes, forcedFileType,
treatAllDBsAsTimeVarying,
createMeshQualityExpressions,
createTimeDerivativeExpressions,
......@@ -2537,6 +2566,9 @@ FileServerList::GetMetaData(const QualifiedFilename &filename,
// cache what we got
if (md)
{
// store the plugin we used
filePlugins[mdKeys[0]] = md->GetFileFormat();
// make a copy to cache
avtDatabaseMetaData *newmd = new avtDatabaseMetaData;
*newmd = *md;
......
......@@ -205,6 +205,11 @@ class MessageAttributes;
// Brad Whitlock, Fri Dec 14 17:16:51 PST 2007
// Added ids for the fields that make up the object.
//
// Jeremy Meredith, Fri Mar 19 13:27:07 EDT 2010
// Replicate the logic already in the viewer, where we keep a cache
// of which plugin we used to open a given file. So when we re-open
// it, we don't get it wrong.
//
// ****************************************************************************
class GUI_API FileServerList : public AttributeSubject
......@@ -257,7 +262,7 @@ public:
void ReplaceFile(const QualifiedFilename &filename);
void OverlayFile(const QualifiedFilename &filename);
void CloseFile();
void ClearFile(const QualifiedFilename &filename);
void ClearFile(const QualifiedFilename &filename, bool forgetPlugin);
void CreateGroupList(const string &filename,
const stringVector &groupList);
......@@ -390,6 +395,7 @@ private:
// MRU caches for MetaData and SIL
FileMetaDataMap fileMetaData;
StringStringMap filePlugins;
SILMap SILData;
StringStringVectorMap recentPaths;
......
......@@ -571,6 +571,10 @@ GUIBase::RestoreCursor()
// Do not issue an error if you can't open a file ... the viewer will do this
// for us.
//
// Jeremy Meredith, Fri Mar 19 13:22:13 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. Here, we don't.
//
// ****************************************************************************
bool
......@@ -586,7 +590,7 @@ GUIBase::SetOpenDataFile(const QualifiedFilename &qf, int timeState,
//
if(reOpen)
{
fileServer->ClearFile(qf);
fileServer->ClearFile(qf, false);
fileServer->CloseFile();
if(sob)
sob->SetUpdate(false);
......
......@@ -2840,6 +2840,9 @@ QvisFilePanel::overlayFile()
//
// Modifications:
//
// Jeremy Meredith, Fri Mar 19 13:22:13 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. Here, we do.
//
// ****************************************************************************
......@@ -2849,7 +2852,7 @@ QvisFilePanel::closeFile()
QvisFilePanelItem *fileItem = (QvisFilePanelItem *) fileTree->currentItem();
if((fileItem != 0) && fileItem ->isFile() && (!fileItem->file.Empty()))
{
fileServer->ClearFile(fileItem->file.FullName());
fileServer->ClearFile(fileItem->file.FullName(), true);
GetViewerMethods()->CloseDatabase(fileItem->file.FullName());
UpdateOpenButtonState();
}
......
......@@ -2285,6 +2285,10 @@ QvisMainWindow::reopenFile(QAction *action)
// Brad Whitlock, Mon Apr 6 15:18:46 PDT 2009
// I added code to translate the action id to a file index.
//
// Jeremy Meredith, Fri Mar 19 13:22:13 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. Here, we do.
//
// ****************************************************************************
void
......@@ -2298,7 +2302,7 @@ QvisMainWindow::closeFile(QAction *action)
//
// Clear out the metadata and SIL for the file.
//
fileServer->ClearFile(sources[fileIndex]);
fileServer->ClearFile(sources[fileIndex], true);
//
// Tell the viewer to replace close the specified database. If the
......
......@@ -86,7 +86,7 @@
#include <icons/plot_atts.xpm>
#include <icons/plot_hide.xpm>
#include <icons/plot_draw.xpm>
#include <icons/oper_add3.xpm>
#include <icons/oper_add4.xpm>
#include <icons/db_replace.xpm>
#include <icons/db_overlay.xpm>
#include <icons/db_open2.xpm>
......@@ -250,7 +250,7 @@ QvisPlotManagerWidget::QvisPlotManagerWidget(QMenuBar *menuBar,QWidget *parent)
add_button->setPopupMode(QToolButton::InstantPopup);
// add operators menu action
operMenuAction = plotActionsToolbar->addAction(QIcon(oper_add3_xpm),tr("Operators"));
operMenuAction = plotActionsToolbar->addAction(QIcon(oper_add4_xpm),tr("Operators"));
QToolButton *oper_button = (QToolButton*) plotActionsToolbar->widgetForAction(operMenuAction);
oper_button->setPopupMode(QToolButton::InstantPopup);
......
......@@ -146,9 +146,9 @@ QvisSourceManagerWidget::QvisSourceManagerWidget(QWidget *parent)
dbCloseAction = dbActionsToolbar->addAction(QIcon(db_reopen_xpm),tr("Reopen"),
this, SLOT(reOpenCurrentSource()));
dbActionsToolbar->addSeparator();
dbReplaceAction = dbActionsToolbar->addAction(QIcon(db_replace_xpm),tr("Replace Plots"),
dbReplaceAction = dbActionsToolbar->addAction(QIcon(db_replace_xpm),tr("Replace"),
this, SLOT(replaceWithCurrentSource()));
dbOverlayAction = dbActionsToolbar->addAction(QIcon(db_overlay_xpm),tr("Overlay Plots"),
dbOverlayAction = dbActionsToolbar->addAction(QIcon(db_overlay_xpm),tr("Overlay"),
this, SLOT(overlayWithCurrentSource()));
sourceLabel = new QLabel(tr("Active source"), this);
......@@ -510,6 +510,10 @@ QvisSourceManagerWidget::reOpenCurrentSource()
//
// Note: Taken/Refactored from QvisPlotManager.
//
// Jeremy Meredith, Fri Mar 19 13:37:35 EDT 2010
// Added extra parameter telling ClearFile whether or not we want it
// to forget about which plugin opened a file. Here, we do.
//
// ****************************************************************************
void
QvisSourceManagerWidget::closeCurrentSource()
......@@ -521,7 +525,7 @@ QvisSourceManagerWidget::closeCurrentSource()
//
// Clear out the metadata and SIL for the file.
//
fileServer->ClearFile(sources[index]);
fileServer->ClearFile(sources[index], true);
//
// Tell the viewer to replace close the specified database. If the
......
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