Commit 4c0c99e0 authored by whitlocb's avatar whitlocb
Browse files

Internationalization for operators, viewer, gui fixes, xml tool plugin info enhancements.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@4153 18c085ea-50e0-402c-830e-de6fd14e8384
parent c1b9f0e9
This diff is collapsed.
...@@ -52,6 +52,7 @@ class QvisNotepadArea; ...@@ -52,6 +52,7 @@ class QvisNotepadArea;
class QvisPostableWindowObserver; class QvisPostableWindowObserver;
class QvisWizard; class QvisWizard;
class QWidget; class QWidget;
class QString;
class avtPluginFilter; class avtPluginFilter;
class ViewerPlot; class ViewerPlot;
class ExpressionList; class ExpressionList;
...@@ -110,15 +111,20 @@ class ExpressionList; ...@@ -110,15 +111,20 @@ class ExpressionList;
// definition is intended for intialization; the filter should override // definition is intended for intialization; the filter should override
// the actual values of the variable. // the actual values of the variable.
// //
// Brad Whitlock, Fri Apr 25 10:11:20 PDT 2008
// Made GetMenuName in the GUI info return QString so we can
// internationalize plot names. Added const to strings returned from
// GeneralOperatorPluginInfo.
//
// **************************************************************************** // ****************************************************************************
class PLUGIN_API GeneralOperatorPluginInfo class PLUGIN_API GeneralOperatorPluginInfo
{ {
public: public:
virtual ~GeneralOperatorPluginInfo() {;}; virtual ~GeneralOperatorPluginInfo() {;};
virtual char *GetName() const = 0; virtual const char *GetName() const = 0;
virtual char *GetVersion() const = 0; virtual const char *GetVersion() const = 0;
virtual char *GetID() const = 0; virtual const char *GetID() const = 0;
virtual bool EnabledByDefault() const { return true; } virtual bool EnabledByDefault() const { return true; }
}; };
...@@ -133,9 +139,10 @@ class PLUGIN_API CommonOperatorPluginInfo : public virtual GeneralOperatorPlugin ...@@ -133,9 +139,10 @@ class PLUGIN_API CommonOperatorPluginInfo : public virtual GeneralOperatorPlugin
class PLUGIN_API GUIOperatorPluginInfo : public virtual CommonOperatorPluginInfo class PLUGIN_API GUIOperatorPluginInfo : public virtual CommonOperatorPluginInfo
{ {
public: public:
virtual const char *GetMenuName() const = 0; virtual QString *GetMenuName() const = 0;
virtual QvisPostableWindowObserver *CreatePluginWindow(int type, virtual QvisPostableWindowObserver *CreatePluginWindow(int type,
AttributeSubject *attr, QvisNotepadArea *notepad) = 0; AttributeSubject *attr, const QString &caption, const QString &shortName,
QvisNotepadArea *notepad) = 0;
virtual QvisWizard *CreatePluginWizard(AttributeSubject *attr, virtual QvisWizard *CreatePluginWizard(AttributeSubject *attr,
QWidget *parent, const char *name =0) QWidget *parent, const char *name =0)
{ {
...@@ -158,7 +165,9 @@ class PLUGIN_API ViewerOperatorPluginInfo : public virtual CommonOperatorPluginI ...@@ -158,7 +165,9 @@ class PLUGIN_API ViewerOperatorPluginInfo : public virtual CommonOperatorPluginI
virtual void InitializeOperatorAtts(AttributeSubject *atts, virtual void InitializeOperatorAtts(AttributeSubject *atts,
const ViewerPlot *plot, const ViewerPlot *plot,
const bool fromDefault) = 0; const bool fromDefault) = 0;
virtual QString *GetMenuName() const = 0;
virtual const char **XPMIconData() const { return 0; } virtual const char **XPMIconData() const { return 0; }
virtual bool GetUserSelectable() const { return true; }
virtual bool Removeable() const { return true; } virtual bool Removeable() const { return true; }
virtual bool Moveable() const { return true; } virtual bool Moveable() const { return true; }
virtual bool AllowsSubsequentOperators() const { return true; } virtual bool AllowsSubsequentOperators() const { return true; }
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
// Forward declarations. // Forward declarations.
class AttributeSubject; class AttributeSubject;
class QString;
class QvisNotepadArea; class QvisNotepadArea;
class QvisPostableWindowObserver; class QvisPostableWindowObserver;
class QvisWizard; class QvisWizard;
...@@ -134,15 +135,19 @@ class ViewerPlot; ...@@ -134,15 +135,19 @@ class ViewerPlot;
// Brad Whitlock, Tue Mar 20 11:44:35 PDT 2007 // Brad Whitlock, Tue Mar 20 11:44:35 PDT 2007
// Added ProvidesLegend method on the viewer plugin info. // Added ProvidesLegend method on the viewer plugin info.
// //
// Brad Whitlock, Fri Apr 25 10:09:24 PDT 2008
// Made the GUI plugin info return QString so we can internationalize
// plot names. Added const to strings returned from GeneralPlotPluginInfo.
//
// **************************************************************************** // ****************************************************************************
class PLUGIN_API GeneralPlotPluginInfo class PLUGIN_API GeneralPlotPluginInfo
{ {
public: public:
virtual ~GeneralPlotPluginInfo() { ; }; virtual ~GeneralPlotPluginInfo() { ; };
virtual char *GetName() const = 0; virtual const char *GetName() const = 0;
virtual char *GetVersion() const = 0; virtual const char *GetVersion() const = 0;
virtual char *GetID() const = 0; virtual const char *GetID() const = 0;
virtual bool EnabledByDefault() const { return true; } virtual bool EnabledByDefault() const { return true; }
}; };
...@@ -157,10 +162,11 @@ class PLUGIN_API CommonPlotPluginInfo : public virtual GeneralPlotPluginInfo ...@@ -157,10 +162,11 @@ class PLUGIN_API CommonPlotPluginInfo : public virtual GeneralPlotPluginInfo
class PLUGIN_API GUIPlotPluginInfo : public virtual CommonPlotPluginInfo class PLUGIN_API GUIPlotPluginInfo : public virtual CommonPlotPluginInfo
{ {
public: public:
virtual const char *GetMenuName() const = 0; virtual QString *GetMenuName() const = 0;
virtual int GetVariableTypes() const = 0; virtual int GetVariableTypes() const = 0;
virtual QvisPostableWindowObserver *CreatePluginWindow(int type, virtual QvisPostableWindowObserver *CreatePluginWindow(int type,
AttributeSubject *attr, QvisNotepadArea *notepad) = 0; AttributeSubject *attr, const QString &caption, const QString &shortName,
QvisNotepadArea *notepad) = 0;
virtual QvisWizard *CreatePluginWizard(AttributeSubject *attr, QWidget *parent, virtual QvisWizard *CreatePluginWizard(AttributeSubject *attr, QWidget *parent,
const std::string &varName, const avtDatabaseMetaData *md, const std::string &varName, const avtDatabaseMetaData *md,
const ExpressionList *expList, const char *name =0) const ExpressionList *expList, const char *name =0)
...@@ -189,6 +195,7 @@ class PLUGIN_API ViewerPlotPluginInfo : public virtual CommonPlotPluginInfo ...@@ -189,6 +195,7 @@ class PLUGIN_API ViewerPlotPluginInfo : public virtual CommonPlotPluginInfo
virtual void ResetPlotAtts(AttributeSubject *atts, virtual void ResetPlotAtts(AttributeSubject *atts,
ViewerPlot *) { ; } ViewerPlot *) { ; }
virtual QString *GetMenuName() const = 0;
virtual const char **XPMIconData() const { return 0; } virtual const char **XPMIconData() const { return 0; }
virtual int GetVariableTypes() const = 0; virtual int GetVariableTypes() const = 0;
......
...@@ -78,7 +78,7 @@ MessageAttributes::Severity_FromString(const std::string &s, MessageAttributes:: ...@@ -78,7 +78,7 @@ MessageAttributes::Severity_FromString(const std::string &s, MessageAttributes::
} }
// Type map format string // Type map format string
const char *MessageAttributes::TypeMapFormatString = "si"; const char *MessageAttributes::TypeMapFormatString = "su*bi";
// **************************************************************************** // ****************************************************************************
// Method: MessageAttributes::MessageAttributes // Method: MessageAttributes::MessageAttributes
...@@ -89,7 +89,7 @@ const char *MessageAttributes::TypeMapFormatString = "si"; ...@@ -89,7 +89,7 @@ const char *MessageAttributes::TypeMapFormatString = "si";
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -98,7 +98,7 @@ const char *MessageAttributes::TypeMapFormatString = "si"; ...@@ -98,7 +98,7 @@ const char *MessageAttributes::TypeMapFormatString = "si";
MessageAttributes::MessageAttributes() : MessageAttributes::MessageAttributes() :
AttributeSubject(MessageAttributes::TypeMapFormatString) AttributeSubject(MessageAttributes::TypeMapFormatString)
{ {
text = ""; hasUnicode = false;
severity = Message; severity = Message;
} }
...@@ -111,7 +111,7 @@ MessageAttributes::MessageAttributes() : ...@@ -111,7 +111,7 @@ MessageAttributes::MessageAttributes() :
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -121,6 +121,8 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) : ...@@ -121,6 +121,8 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) :
AttributeSubject(MessageAttributes::TypeMapFormatString) AttributeSubject(MessageAttributes::TypeMapFormatString)
{ {
text = obj.text; text = obj.text;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
severity = obj.severity; severity = obj.severity;
SelectAll(); SelectAll();
...@@ -135,7 +137,7 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) : ...@@ -135,7 +137,7 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) :
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -155,7 +157,7 @@ MessageAttributes::~MessageAttributes() ...@@ -155,7 +157,7 @@ MessageAttributes::~MessageAttributes()
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -166,6 +168,8 @@ MessageAttributes::operator = (const MessageAttributes &obj) ...@@ -166,6 +168,8 @@ MessageAttributes::operator = (const MessageAttributes &obj)
{ {
if (this == &obj) return *this; if (this == &obj) return *this;
text = obj.text; text = obj.text;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
severity = obj.severity; severity = obj.severity;
SelectAll(); SelectAll();
...@@ -181,7 +185,7 @@ MessageAttributes::operator = (const MessageAttributes &obj) ...@@ -181,7 +185,7 @@ MessageAttributes::operator = (const MessageAttributes &obj)
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -192,6 +196,8 @@ MessageAttributes::operator == (const MessageAttributes &obj) const ...@@ -192,6 +196,8 @@ MessageAttributes::operator == (const MessageAttributes &obj) const
{ {
// Create the return value // Create the return value
return ((text == obj.text) && return ((text == obj.text) &&
(unicode == obj.unicode) &&
(hasUnicode == obj.hasUnicode) &&
(severity == obj.severity)); (severity == obj.severity));
} }
...@@ -204,7 +210,7 @@ MessageAttributes::operator == (const MessageAttributes &obj) const ...@@ -204,7 +210,7 @@ MessageAttributes::operator == (const MessageAttributes &obj) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -225,7 +231,7 @@ MessageAttributes::operator != (const MessageAttributes &obj) const ...@@ -225,7 +231,7 @@ MessageAttributes::operator != (const MessageAttributes &obj) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -246,7 +252,7 @@ MessageAttributes::TypeName() const ...@@ -246,7 +252,7 @@ MessageAttributes::TypeName() const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -274,7 +280,7 @@ MessageAttributes::CopyAttributes(const AttributeGroup *atts) ...@@ -274,7 +280,7 @@ MessageAttributes::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -300,7 +306,7 @@ MessageAttributes::CreateCompatible(const std::string &tname) const ...@@ -300,7 +306,7 @@ MessageAttributes::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -327,7 +333,7 @@ MessageAttributes::NewInstance(bool copy) const ...@@ -327,7 +333,7 @@ MessageAttributes::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -337,6 +343,8 @@ void ...@@ -337,6 +343,8 @@ void
MessageAttributes::SelectAll() MessageAttributes::SelectAll()
{ {
Select(ID_text, (void *)&text); Select(ID_text, (void *)&text);
Select(ID_unicode, (void *)&unicode);
Select(ID_hasUnicode, (void *)&hasUnicode);
Select(ID_severity, (void *)&severity); Select(ID_severity, (void *)&severity);
} }
...@@ -353,7 +361,7 @@ MessageAttributes::SelectAll() ...@@ -353,7 +361,7 @@ MessageAttributes::SelectAll()
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -376,6 +384,18 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc ...@@ -376,6 +384,18 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc
node->AddNode(new DataNode("text", text)); node->AddNode(new DataNode("text", text));
} }
if(completeSave || !FieldsEqual(ID_unicode, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("unicode", unicode));
}
if(completeSave || !FieldsEqual(ID_hasUnicode, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("hasUnicode", hasUnicode));
}
if(completeSave || !FieldsEqual(ID_severity, &defaultObject)) if(completeSave || !FieldsEqual(ID_severity, &defaultObject))
{ {
addToParent = true; addToParent = true;
...@@ -401,7 +421,7 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc ...@@ -401,7 +421,7 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -421,6 +441,10 @@ MessageAttributes::SetFromNode(DataNode *parentNode) ...@@ -421,6 +441,10 @@ MessageAttributes::SetFromNode(DataNode *parentNode)
DataNode *node; DataNode *node;
if((node = searchNode->GetNode("text")) != 0) if((node = searchNode->GetNode("text")) != 0)
SetText(node->AsString()); SetText(node->AsString());
if((node = searchNode->GetNode("unicode")) != 0)
SetUnicode(node->AsUnsignedCharVector());
if((node = searchNode->GetNode("hasUnicode")) != 0)
SetHasUnicode(node->AsBool());
if((node = searchNode->GetNode("severity")) != 0) if((node = searchNode->GetNode("severity")) != 0)
{ {
// Allow enums to be int or string in the config file // Allow enums to be int or string in the config file
...@@ -450,6 +474,20 @@ MessageAttributes::SetText(const std::string &text_) ...@@ -450,6 +474,20 @@ MessageAttributes::SetText(const std::string &text_)
Select(ID_text, (void *)&text); Select(ID_text, (void *)&text);
} }
void
MessageAttributes::SetUnicode(const unsignedCharVector &unicode_)
{
unicode = unicode_;
Select(ID_unicode, (void *)&unicode);
}
void
MessageAttributes::SetHasUnicode(bool hasUnicode_)
{
hasUnicode = hasUnicode_;
Select(ID_hasUnicode, (void *)&hasUnicode);
}
void void
MessageAttributes::SetSeverity(MessageAttributes::Severity severity_) MessageAttributes::SetSeverity(MessageAttributes::Severity severity_)
{ {
...@@ -473,6 +511,24 @@ MessageAttributes::GetText() ...@@ -473,6 +511,24 @@ MessageAttributes::GetText()
return text; return text;
} }
const unsignedCharVector &
MessageAttributes::GetUnicode() const
{
return unicode;
}
unsignedCharVector &
MessageAttributes::GetUnicode()
{
return unicode;
}
bool
MessageAttributes::GetHasUnicode() const
{
return hasUnicode;
}
MessageAttributes::Severity MessageAttributes::Severity
MessageAttributes::GetSeverity() const MessageAttributes::GetSeverity() const
{ {
...@@ -489,6 +545,12 @@ MessageAttributes::SelectText() ...@@ -489,6 +545,12 @@ MessageAttributes::SelectText()
Select(ID_text, (void *)&text); Select(ID_text, (void *)&text);
} }
void
MessageAttributes::SelectUnicode()
{
Select(ID_unicode, (void *)&unicode);
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Keyframing methods // Keyframing methods
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
...@@ -502,7 +564,7 @@ MessageAttributes::SelectText() ...@@ -502,7 +564,7 @@ MessageAttributes::SelectText()
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -514,6 +576,8 @@ MessageAttributes::GetFieldName(int index) const ...@@ -514,6 +576,8 @@ MessageAttributes::GetFieldName(int index) const
switch (index) switch (index)
{ {
case ID_text: return "text"; case ID_text: return "text";
case ID_unicode: return "unicode";
case ID_hasUnicode: return "hasUnicode";
case ID_severity: return "severity"; case ID_severity: return "severity";
default: return "invalid index"; default: return "invalid index";
} }
...@@ -528,7 +592,7 @@ MessageAttributes::GetFieldName(int index) const ...@@ -528,7 +592,7 @@ MessageAttributes::GetFieldName(int index) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -540,6 +604,8 @@ MessageAttributes::GetFieldType(int index) const ...@@ -540,6 +604,8 @@ MessageAttributes::GetFieldType(int index) const
switch (index) switch (index)
{ {
case ID_text: return FieldType_string; case ID_text: return FieldType_string;
case ID_unicode: return FieldType_ucharVector;
case ID_hasUnicode: return FieldType_bool;
case ID_severity: return FieldType_enum; case ID_severity: return FieldType_enum;
default: return FieldType_unknown; default: return FieldType_unknown;
} }
...@@ -554,7 +620,7 @@ MessageAttributes::GetFieldType(int index) const ...@@ -554,7 +620,7 @@ MessageAttributes::GetFieldType(int index) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -566,6 +632,8 @@ MessageAttributes::GetFieldTypeName(int index) const ...@@ -566,6 +632,8 @@ MessageAttributes::GetFieldTypeName(int index) const
switch (index) switch (index)
{ {
case ID_text: return "string"; case ID_text: return "string";
case ID_unicode: return "ucharVector";
case ID_hasUnicode: return "bool";
case ID_severity: return "enum"; case ID_severity: return "enum";
default: return "invalid index"; default: return "invalid index";
} }
...@@ -580,7 +648,7 @@ MessageAttributes::GetFieldTypeName(int index) const ...@@ -580,7 +648,7 @@ MessageAttributes::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts. // Note: Autogenerated by xml2atts.
// //
// Programmer: xml2atts // Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008 // Creation: omitted
// //
// Modifications: // Modifications:
// //
...@@ -598,6 +666,16 @@ MessageAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const ...@@ -598,6 +666,16 @@ MessageAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (text == obj.text); retval = (text == obj.text);
} }
break; break;
case ID_unicode:
{ // new scope