Commit f29c2d11 authored by hrchilds's avatar hrchilds

Update from March 22, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@642 18c085ea-50e0-402c-830e-de6fd14e8384
parent 964925ec
......@@ -255,6 +255,39 @@ StringHelpers::GroupStringsFixedAlpha(vector<string> stringList,
}
}
//
// This version does not need to sort the strings since they are already
// sorted because they're in a set. The sort rule for the set is the same
// as that for the other GroupStringsFixedAlpha because IGNORE_CHARS gets
// set to "", which means use the entire string in comparisons.
//
void
StringHelpers::GroupStringsFixedAlpha(
const std::set<std::string> &stringList,
int groupSize, std::vector<std::set<std::string> > &stringGroups)
{
int nStrings = stringList.size();
if (nStrings == 0)
return;
int i = 0;
stringGroups.reserve(stringList.size() / groupSize);
for(std::set<std::string>::const_iterator it = stringList.begin();
it != stringList.end(); ++it, ++i)
{
int groupNum = i / groupSize;
int groupIdx = i % groupSize;
if (groupIdx == 0)
{
std::set<std::string> newGroup;
stringGroups.push_back(newGroup);
}
stringGroups[groupNum].insert(*it);
}
}
int
StringHelpers::FindRE(const char *strToSearch, const char *re)
{
......
......@@ -6,6 +6,7 @@
#define STRINGHELPERS_H
#include <utility_exports.h>
#include <set>
#include <string>
#include <vector>
......@@ -29,6 +30,12 @@ namespace StringHelpers
void UTILITY_API GroupStringsFixedAlpha(vector<string> stringList,
int numGroups,
vector<vector<string> > &stringGroups);
void UTILITY_API GroupStringsFixedAlpha(
const std::set<std::string> &stringList,
int numGroups,
vector<std::set<std::string> > &stringGroups);
int UTILITY_API FindRE(const char *stringToSearch, const char *re);
const char UTILITY_API *Basename(const char *path);
......
......@@ -27,6 +27,7 @@
#include <QvisVariablePopupMenu.h>
#include <PlotPluginInfo.h>
#include <WindowInformation.h>
#include <TimingsManager.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -1120,21 +1121,29 @@ QvisPlotManagerWidget::PopulateVariableLists(VariableMenuPopulator &populator,
// to update variable buttons that use the active source for their
// variable list.
//
// Brad Whitlock, Wed Mar 22 09:08:31 PDT 2006
// I added code to time menu creation.
//
// ****************************************************************************
void
QvisPlotManagerWidget::UpdatePlotVariableMenu()
{
int total = visitTimer->StartTimer();
int id = visitTimer->StartTimer();
//
// Update the menu populator so it uses the current file. If it changed
// then needsUpdate will be true and we need to update the variable menu.
//
bool needsUpdate = PopulateVariableLists(menuPopulator,
fileServer->GetOpenFile());
visitTimer->StopTimer(id, "PopulateVariableLists");
// Update the various menus
if(needsUpdate)
{
id = visitTimer->StartTimer();
this->maxVarCount = 0;
for(int i = 0; i < plotPlugins.size(); ++i)
{
......@@ -1148,6 +1157,7 @@ QvisPlotManagerWidget::UpdatePlotVariableMenu()
if(hasEntries != plotMenu->isItemEnabled(i))
plotMenu->setItemEnabled(i, hasEntries);
}
visitTimer->StopTimer(id, "Updating menus");
//
// Set the flag to indicate that we need to update the enabled
......@@ -1158,15 +1168,21 @@ QvisPlotManagerWidget::UpdatePlotVariableMenu()
//
// Update the variable buttons that use the active source.
//
id = visitTimer->StartTimer();
QvisVariableButton::UpdateActiveSourceButtons(&menuPopulator);
visitTimer->StopTimer(id, "Updating active source buttons");
//
// If there are no plots then update the variable buttons that
// use the plot source with the active source.
//
id = visitTimer->StartTimer();
if(plotList->GetNumPlots() < 1)
QvisVariableButton::UpdatePlotSourceButtons(&menuPopulator);
visitTimer->StopTimer(id, "Updating plot source buttons");
}
visitTimer->StopTimer(total, "QvisPlotManagerWidget::UpdatePlotVariableMenu");
}
// ****************************************************************************
......
This diff is collapsed.
......@@ -62,6 +62,9 @@ class QObject;
// Brad Whitlock, Thu Aug 18 15:07:32 PST 2005
// Removed Split method and made it be a static function in the .C file.
//
// Brad Whitlock, Wed Mar 22 12:05:43 PDT 2006
// I added GroupingInfo and added another argument to UpdateSingleMenu.
//
// ****************************************************************************
class WINUTIL_API VariableMenuPopulator
......@@ -110,13 +113,28 @@ private:
int unsortedVariableIndex;
};
class GroupingInfo
{
public:
GroupingInfo();
GroupingInfo(const GroupingInfo &obj);
~GroupingInfo();
void operator = (const GroupingInfo &obj);
StringStringMap grouping;
bool required;
};
typedef std::map<int, GroupingInfo *> IntGroupingInfoMap;
void UpdateSingleMenu(QvisVariablePopupMenu *, VariableList &vars,
QObject *, const char *slot);
void AddVars(VariableList &to, VariableList &from);
QObject *, const char *slot, const GroupingInfo *);
bool AddVars(VariableList &to, VariableList &from);
void AddExpression(const Expression &);
void GetRelevantExpressions(ExpressionList &newExpressionList,
const avtDatabaseMetaData *md,
const ExpressionList &exprList);
void ClearGroupingInfo();
// Keep track of the name of the database for which we have variables.
std::string cachedDBName;
......@@ -126,6 +144,7 @@ private:
VariableList meshVars, scalarVars, materialVars, vectorVars, subsetVars,
speciesVars, curveVars, tensorVars, symmTensorVars,
labelVars, arrayVars;
IntGroupingInfoMap groupingInfo;
};
#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