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;
class QvisPostableWindowObserver;
class QvisWizard;
class QWidget;
class QString;
class avtPluginFilter;
class ViewerPlot;
class ExpressionList;
......@@ -110,15 +111,20 @@ class ExpressionList;
// definition is intended for intialization; the filter should override
// 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
{
public:
virtual ~GeneralOperatorPluginInfo() {;};
virtual char *GetName() const = 0;
virtual char *GetVersion() const = 0;
virtual char *GetID() const = 0;
virtual const char *GetName() const = 0;
virtual const char *GetVersion() const = 0;
virtual const char *GetID() const = 0;
virtual bool EnabledByDefault() const { return true; }
};
......@@ -133,9 +139,10 @@ class PLUGIN_API CommonOperatorPluginInfo : public virtual GeneralOperatorPlugin
class PLUGIN_API GUIOperatorPluginInfo : public virtual CommonOperatorPluginInfo
{
public:
virtual const char *GetMenuName() const = 0;
virtual QString *GetMenuName() const = 0;
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, const char *name =0)
{
......@@ -158,7 +165,9 @@ class PLUGIN_API ViewerOperatorPluginInfo : public virtual CommonOperatorPluginI
virtual void InitializeOperatorAtts(AttributeSubject *atts,
const ViewerPlot *plot,
const bool fromDefault) = 0;
virtual QString *GetMenuName() const = 0;
virtual const char **XPMIconData() const { return 0; }
virtual bool GetUserSelectable() const { return true; }
virtual bool Removeable() const { return true; }
virtual bool Moveable() const { return true; }
virtual bool AllowsSubsequentOperators() const { return true; }
......
......@@ -50,6 +50,7 @@
// Forward declarations.
class AttributeSubject;
class QString;
class QvisNotepadArea;
class QvisPostableWindowObserver;
class QvisWizard;
......@@ -134,15 +135,19 @@ class ViewerPlot;
// Brad Whitlock, Tue Mar 20 11:44:35 PDT 2007
// 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
{
public:
virtual ~GeneralPlotPluginInfo() { ; };
virtual char *GetName() const = 0;
virtual char *GetVersion() const = 0;
virtual char *GetID() const = 0;
virtual const char *GetName() const = 0;
virtual const char *GetVersion() const = 0;
virtual const char *GetID() const = 0;
virtual bool EnabledByDefault() const { return true; }
};
......@@ -157,10 +162,11 @@ class PLUGIN_API CommonPlotPluginInfo : public virtual GeneralPlotPluginInfo
class PLUGIN_API GUIPlotPluginInfo : public virtual CommonPlotPluginInfo
{
public:
virtual const char *GetMenuName() const = 0;
virtual QString *GetMenuName() const = 0;
virtual int GetVariableTypes() const = 0;
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,
const std::string &varName, const avtDatabaseMetaData *md,
const ExpressionList *expList, const char *name =0)
......@@ -189,6 +195,7 @@ class PLUGIN_API ViewerPlotPluginInfo : public virtual CommonPlotPluginInfo
virtual void ResetPlotAtts(AttributeSubject *atts,
ViewerPlot *) { ; }
virtual QString *GetMenuName() const = 0;
virtual const char **XPMIconData() const { return 0; }
virtual int GetVariableTypes() const = 0;
......
......@@ -78,7 +78,7 @@ MessageAttributes::Severity_FromString(const std::string &s, MessageAttributes::
}
// Type map format string
const char *MessageAttributes::TypeMapFormatString = "si";
const char *MessageAttributes::TypeMapFormatString = "su*bi";
// ****************************************************************************
// Method: MessageAttributes::MessageAttributes
......@@ -89,7 +89,7 @@ const char *MessageAttributes::TypeMapFormatString = "si";
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -98,7 +98,7 @@ const char *MessageAttributes::TypeMapFormatString = "si";
MessageAttributes::MessageAttributes() :
AttributeSubject(MessageAttributes::TypeMapFormatString)
{
text = "";
hasUnicode = false;
severity = Message;
}
......@@ -111,7 +111,7 @@ MessageAttributes::MessageAttributes() :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -121,6 +121,8 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) :
AttributeSubject(MessageAttributes::TypeMapFormatString)
{
text = obj.text;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
severity = obj.severity;
SelectAll();
......@@ -135,7 +137,7 @@ MessageAttributes::MessageAttributes(const MessageAttributes &obj) :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -155,7 +157,7 @@ MessageAttributes::~MessageAttributes()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -166,6 +168,8 @@ MessageAttributes::operator = (const MessageAttributes &obj)
{
if (this == &obj) return *this;
text = obj.text;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
severity = obj.severity;
SelectAll();
......@@ -181,7 +185,7 @@ MessageAttributes::operator = (const MessageAttributes &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -192,6 +196,8 @@ MessageAttributes::operator == (const MessageAttributes &obj) const
{
// Create the return value
return ((text == obj.text) &&
(unicode == obj.unicode) &&
(hasUnicode == obj.hasUnicode) &&
(severity == obj.severity));
}
......@@ -204,7 +210,7 @@ MessageAttributes::operator == (const MessageAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -225,7 +231,7 @@ MessageAttributes::operator != (const MessageAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -246,7 +252,7 @@ MessageAttributes::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -274,7 +280,7 @@ MessageAttributes::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -300,7 +306,7 @@ MessageAttributes::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -327,7 +333,7 @@ MessageAttributes::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -336,8 +342,10 @@ MessageAttributes::NewInstance(bool copy) const
void
MessageAttributes::SelectAll()
{
Select(ID_text, (void *)&text);
Select(ID_severity, (void *)&severity);
Select(ID_text, (void *)&text);
Select(ID_unicode, (void *)&unicode);
Select(ID_hasUnicode, (void *)&hasUnicode);
Select(ID_severity, (void *)&severity);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -353,7 +361,7 @@ MessageAttributes::SelectAll()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -376,6 +384,18 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc
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))
{
addToParent = true;
......@@ -401,7 +421,7 @@ MessageAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forc
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -421,6 +441,10 @@ MessageAttributes::SetFromNode(DataNode *parentNode)
DataNode *node;
if((node = searchNode->GetNode("text")) != 0)
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)
{
// Allow enums to be int or string in the config file
......@@ -450,6 +474,20 @@ MessageAttributes::SetText(const std::string &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
MessageAttributes::SetSeverity(MessageAttributes::Severity severity_)
{
......@@ -473,6 +511,24 @@ MessageAttributes::GetText()
return text;
}
const unsignedCharVector &
MessageAttributes::GetUnicode() const
{
return unicode;
}
unsignedCharVector &
MessageAttributes::GetUnicode()
{
return unicode;
}
bool
MessageAttributes::GetHasUnicode() const
{
return hasUnicode;
}
MessageAttributes::Severity
MessageAttributes::GetSeverity() const
{
......@@ -489,6 +545,12 @@ MessageAttributes::SelectText()
Select(ID_text, (void *)&text);
}
void
MessageAttributes::SelectUnicode()
{
Select(ID_unicode, (void *)&unicode);
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
......@@ -502,7 +564,7 @@ MessageAttributes::SelectText()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -513,8 +575,10 @@ MessageAttributes::GetFieldName(int index) const
{
switch (index)
{
case ID_text: return "text";
case ID_severity: return "severity";
case ID_text: return "text";
case ID_unicode: return "unicode";
case ID_hasUnicode: return "hasUnicode";
case ID_severity: return "severity";
default: return "invalid index";
}
}
......@@ -528,7 +592,7 @@ MessageAttributes::GetFieldName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -539,8 +603,10 @@ MessageAttributes::GetFieldType(int index) const
{
switch (index)
{
case ID_text: return FieldType_string;
case ID_severity: return FieldType_enum;
case ID_text: return FieldType_string;
case ID_unicode: return FieldType_ucharVector;
case ID_hasUnicode: return FieldType_bool;
case ID_severity: return FieldType_enum;
default: return FieldType_unknown;
}
}
......@@ -554,7 +620,7 @@ MessageAttributes::GetFieldType(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -565,8 +631,10 @@ MessageAttributes::GetFieldTypeName(int index) const
{
switch (index)
{
case ID_text: return "string";
case ID_severity: return "enum";
case ID_text: return "string";
case ID_unicode: return "ucharVector";
case ID_hasUnicode: return "bool";
case ID_severity: return "enum";
default: return "invalid index";
}
}
......@@ -580,7 +648,7 @@ MessageAttributes::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -598,6 +666,16 @@ MessageAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (text == obj.text);
}
break;
case ID_unicode:
{ // new scope
retval = (unicode == obj.unicode);
}
break;
case ID_hasUnicode:
{ // new scope
retval = (hasUnicode == obj.hasUnicode);
}
break;
case ID_severity:
{ // new scope
retval = (severity == obj.severity);
......
......@@ -51,7 +51,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 18 14:43:37 PST 2008
// Creation: omitted
//
// Modifications:
//
......@@ -85,15 +85,21 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectText();
void SelectUnicode();
// Property setting methods
void SetText(const std::string &text_);
void SetUnicode(const unsignedCharVector &unicode_);
void SetHasUnicode(bool hasUnicode_);
void SetSeverity(Severity severity_);
// Property getting methods
const std::string &GetText() const;
std::string &GetText();
Severity GetSeverity() const;
const std::string &GetText() const;
std::string &GetText();
const unsignedCharVector &GetUnicode() const;
unsignedCharVector &GetUnicode();
bool GetHasUnicode() const;
Severity GetSeverity() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -116,12 +122,16 @@ public:
// IDs that can be used to identify fields in case statements
enum {
ID_text = 0,
ID_unicode,
ID_hasUnicode,
ID_severity
};
private:
std::string text;
int severity;
std::string text;
unsignedCharVector unicode;
bool hasUnicode;
int severity;
// Static class format string for type map.
static const char *TypeMapFormatString;
......
<?xml version="1.0"?>
<Attribute name="MessageAttributes" purpose="This class contains attributes for sending messages." exportAPI="STATE_API" exportInclude="state_exports.h">
<Attribute name="MessageAttributes" purpose="This class contains attributes for sending messages." persistent="true" keyframe="true" exportAPI="STATE_API" exportInclude="state_exports.h">
<Enum name="Severity">
Error
Warning
......@@ -7,6 +7,15 @@
ErrorClear
Information
</Enum>
<Field name="text" type="string">""</Field>
<Field name="severity" type="enum" subtype="Severity">Message</Field>
<Field name="text" label="text" type="string">
</Field>
<Field name="unicode" label="unicode" type="ucharVector">
</Field>
<Field name="hasUnicode" label="hasUnicode" type="bool">
false
</Field>
<Field name="severity" label="severity" type="enum" subtype="Severity">
Message
</Field>
</Attribute>
......@@ -42,7 +42,7 @@
const int StatusAttributes::DEFAULT_DURATION = 5000;
// Type map format string
const char *StatusAttributes::TypeMapFormatString = "sbsiisiii";
const char *StatusAttributes::TypeMapFormatString = "sbsu*biisiii";
// ****************************************************************************
// Method: StatusAttributes::StatusAttributes
......@@ -53,7 +53,7 @@ const char *StatusAttributes::TypeMapFormatString = "sbsiisiii";
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -64,6 +64,7 @@ StatusAttributes::StatusAttributes() :
{
sender = "viewer";
clearStatus = false;
hasUnicode = false;
percent = 0;
currentStage = 1;
currentStageName = "stage1";
......@@ -81,7 +82,7 @@ StatusAttributes::StatusAttributes() :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -93,6 +94,8 @@ StatusAttributes::StatusAttributes(const StatusAttributes &obj) :
sender = obj.sender;
clearStatus = obj.clearStatus;
statusMessage = obj.statusMessage;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
percent = obj.percent;
currentStage = obj.currentStage;
currentStageName = obj.currentStageName;
......@@ -112,7 +115,7 @@ StatusAttributes::StatusAttributes(const StatusAttributes &obj) :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -132,7 +135,7 @@ StatusAttributes::~StatusAttributes()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -145,6 +148,8 @@ StatusAttributes::operator = (const StatusAttributes &obj)
sender = obj.sender;
clearStatus = obj.clearStatus;
statusMessage = obj.statusMessage;
unicode = obj.unicode;
hasUnicode = obj.hasUnicode;
percent = obj.percent;
currentStage = obj.currentStage;
currentStageName = obj.currentStageName;
......@@ -165,7 +170,7 @@ StatusAttributes::operator = (const StatusAttributes &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -178,6 +183,8 @@ StatusAttributes::operator == (const StatusAttributes &obj) const
return ((sender == obj.sender) &&
(clearStatus == obj.clearStatus) &&
(statusMessage == obj.statusMessage) &&
(unicode == obj.unicode) &&
(hasUnicode == obj.hasUnicode) &&
(percent == obj.percent) &&
(currentStage == obj.currentStage) &&
(currentStageName == obj.currentStageName) &&
......@@ -195,7 +202,7 @@ StatusAttributes::operator == (const StatusAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -216,7 +223,7 @@ StatusAttributes::operator != (const StatusAttributes &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007
// Creation: omitted
//
// Modifications:
//
......@@ -237,7 +244,7 @@ StatusAttributes::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 20 09:40:44 PDT 2007