]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merge from BR_DDS_IMP 29/12/2012
authorvsr <vsr@opencascade.com>
Sat, 29 Dec 2012 07:18:29 +0000 (07:18 +0000)
committervsr <vsr@opencascade.com>
Sat, 29 Dec 2012 07:18:29 +0000 (07:18 +0000)
25 files changed:
src/DDS/DDS_DicGroup.cxx
src/DDS/DDS_DicGroup.h
src/DDS/DDS_DicItem.cxx
src/DDS/DDS_DicItem.h
src/DDS/DDS_Dictionary.cxx
src/DDS/DDS_Dictionary.h
src/PyConsole/PyConsole_Console.cxx
src/QDS/QDS_CheckBox.h
src/QDS/QDS_ComboBox.cxx
src/QDS/QDS_ComboBox.h
src/QDS/QDS_Datum.cxx
src/QDS/QDS_Datum.h
src/QDS/QDS_LineEdit.h
src/QDS/QDS_RadioBox.h
src/QDS/QDS_SpinBox.h
src/QDS/QDS_SpinBoxDbl.h
src/QDS/QDS_TextEdit.h
src/Qtx/QtxWorkstack.cxx
src/Qtx/QtxWorkstack.h
src/STD/STD_Application.cxx
src/SUIT/SUIT_DataBrowser.cxx
src/SUIT/SUIT_DataObject.cxx
src/SUIT/SUIT_DataObject.h
src/SUIT/SUIT_TreeModel.cxx
src/SUIT/SUIT_TreeModel.h

index ea2c65593771f3bfccf850bfa5467e6a900e1771..5a492d658d099fce7c4db372cc11a14d6c3d3a72 100644 (file)
@@ -182,12 +182,12 @@ void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM
 
     // 1. Attributes (id,label,units?,format?,required?)
     TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) );
-    Handle(DDS_DicItem) aDicItem = new DDS_DicItem();
+    Handle(DDS_DicItem) aDicItem = CreateItem();
 
     aDicItem->myComponent = this;
     aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems );
     myDataMap.Add( anID, aDicItem );
-
+    
     bool exist = false;
     for( int i=1, n=myKeys.Length(); i<=n && !exist; i++ )
       if( myKeys.Value( i )==anID )
@@ -226,3 +226,67 @@ void DDS_DicGroup::GetKeys( TColStd_SequenceOfAsciiString& seq ) const
 {
   seq = myKeys;
 }
+
+/*!
+  \brief Instantiate new dictionary item, used for customization of
+         data dictionary items.
+  \return New dictionary item instance.
+*/
+Handle(DDS_DicItem) DDS_DicGroup::CreateItem() const
+{
+  return new DDS_DicItem();
+}
+
+/*!
+  \brief Bind dictionary item to ID
+  \return Standard_True if the item has been succesfully bound.
+          Standard_False if there is an item with same id.
+*/
+Standard_Boolean DDS_DicGroup::AddDicItem( const TCollection_AsciiString& theID,
+                                           const Handle(DDS_DicItem)& theDicItem )
+{
+  if ( myDataMap.Contains( theID ) )
+    return Standard_False;
+
+  myDataMap.Add( theID, theDicItem );
+  myKeys.Append( theID );
+
+  return Standard_True;
+}
+
+/*!
+  \brief Check if there is item bounded by id.
+  \return Standard_True if there is an item bound in map with given id.
+*/
+Standard_Boolean DDS_DicGroup::HasDicItem( const TCollection_AsciiString& theID ) const 
+{
+  return myDataMap.Contains( theID );
+}
+
+/*!
+  \brief Clear dictionary items map
+*/
+void DDS_DicGroup::RemoveAllDicItems() 
+{
+  myDataMap.Clear();
+  myKeys.Clear();
+}
+
+/*!
+  \brief Returns a reference to a map. Can be used to iterate through
+         dictionary items.
+*/
+const DDS_IndexedDataMapOfDicItems& DDS_DicGroup::GetItemMap() const
+{
+  return myDataMap;
+}
+
+/*!
+  \brief Add new unit system and bind its label name.
+  \return Standard_False if there is other system bound by this key.
+*/
+Standard_Boolean DDS_DicGroup::AddUnitSystem( const TCollection_AsciiString& theSystemKey,
+                                              const TCollection_ExtendedString& theSystemLabel )
+{
+  return myUnitSystem.Bind( theSystemKey, theSystemLabel );
+}
index 5b7d2f6c85c1aa14c0ee672d64346a784dbf62d6..ac53bd4094ca9a8c38a7d384ae1488f62a5088dc 100644 (file)
@@ -38,27 +38,44 @@ DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared)
 class DDS_DicGroup : public MMgt_TShared
 {
 public:
-  DDS_DicGroup( const TCollection_AsciiString& );
+  Standard_EXPORT DDS_DicGroup( const TCollection_AsciiString& );
 
-  TCollection_AsciiString                    GetName() const;
-  Standard_EXPORT void                       GetKeys( TColStd_SequenceOfAsciiString& ) const;
+  Standard_EXPORT TCollection_AsciiString     GetName() const;
+  Standard_EXPORT void                        GetKeys( TColStd_SequenceOfAsciiString& ) const;
 
-  Standard_EXPORT Handle(DDS_DicItem)        GetDicItem( const TCollection_AsciiString& ) const;
+  Standard_EXPORT Handle(DDS_DicItem)         GetDicItem( const TCollection_AsciiString& ) const;
 
-  Standard_EXPORT void                       GetUnitSystems( TColStd_SequenceOfAsciiString& ) const;
-  Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const;
+  Standard_EXPORT void                        GetUnitSystems( TColStd_SequenceOfAsciiString& ) const;
+  Standard_EXPORT TCollection_ExtendedString  GetUnitSystemLabel( const TCollection_AsciiString& ) const;
 
-  Standard_EXPORT TCollection_AsciiString    GetActiveUnitSystem() const;
-  Standard_EXPORT void                       SetActiveUnitSystem( const TCollection_AsciiString& );
+  Standard_EXPORT TCollection_AsciiString     GetActiveUnitSystem() const;
+  Standard_EXPORT void                        SetActiveUnitSystem( const TCollection_AsciiString& );
 
-private:
-  DDS_DicGroup( const DDS_DicGroup& );
+  virtual Standard_EXPORT Handle(DDS_DicItem) CreateItem() const;
+  
+protected:
 
-  void                                       operator=( const DDS_DicGroup& );
+  Standard_EXPORT DDS_DicGroup( const DDS_DicGroup& );
 
-  void                                       FillDataMap( const LDOM_Element&, const LDOM_Element& );
+  Standard_EXPORT void                        operator=( const DDS_DicGroup& );
+
+  Standard_EXPORT virtual void                FillDataMap( const LDOM_Element&, const LDOM_Element& );
+
+  Standard_EXPORT Standard_Boolean            AddDicItem( const TCollection_AsciiString&,
+                                                          const Handle(DDS_DicItem)& );
+
+  Standard_EXPORT Standard_Boolean            HasDicItem( const TCollection_AsciiString& ) const;
+
+  Standard_EXPORT void                        RemoveAllDicItems();
+
+  Standard_EXPORT const 
+    DDS_IndexedDataMapOfDicItems&             GetItemMap() const;
+
+  Standard_EXPORT Standard_Boolean            AddUnitSystem( const TCollection_AsciiString&,
+                                                             const TCollection_ExtendedString& );
+
+protected:
 
-private:
   typedef NCollection_DataMap<TCollection_AsciiString,
                               TCollection_ExtendedString> UnitSystemMap;
 
index 4ec5f83a4ed9fd2e87829abde24a55392be78b46..1e6daef4cbd5bfb8ebcbf950b0351c9b2ec933ca 100644 (file)
@@ -1291,3 +1291,188 @@ DDS_DicItem::UnitSystem DDS_DicItem::GetActiveUnitSystem() const
     aSystem = aComponent->GetActiveUnitSystem();
   return aSystem;
 }
+
+/*!
+  \brief Set item's identify string.
+  \param theId identify string.
+*/
+void DDS_DicItem::SetId( const TCollection_AsciiString& theId )
+{
+  myId = theId;
+}
+
+/*!
+  \brief Set item's component pointer.
+  \param theComponent component pointer.
+*/
+void DDS_DicItem::SetComponent( const Handle(Standard_Transient)& theComponent )
+{
+  myComponent = theComponent;
+}
+
+/*!
+  \brief Set item's label string.
+  \param theLabel label string.
+*/
+void DDS_DicItem::SetLabel( const TCollection_AsciiString& theLabel )
+{
+  myLabel = theLabel;
+}
+
+/*!
+  \brief Set item's filter string.
+  \param theFilter filter string.
+*/
+void DDS_DicItem::SetFilter( const TCollection_AsciiString& theFilter )
+{
+  myFilter = theFilter;
+}
+
+/*!
+  \brief Set item's required value.
+  \param theRequired required value string.
+*/
+void DDS_DicItem::SetRequired( const TCollection_AsciiString& theRequired )
+{
+  myRequired = theRequired;
+}
+
+/*!
+  \brief Set item's warning level value.
+  \param theWarningLevel warning level value.
+*/
+void DDS_DicItem::SetWarningLevel( const Standard_Integer& theWarningLevel )
+{
+  myWarnLevel = theWarningLevel;
+}
+
+/*!
+  \brief Set item's minimum zoom value.
+  \param theMinZoom minimum zoom value.
+*/
+void DDS_DicItem::SetMinZoom( const Standard_Real& theMinZoom )
+{
+  myMinZoom = theMinZoom;
+}
+
+/*!
+  \brief Set item's maximum zoom value.
+  \param theMaxZoom maximum zoom value.
+*/
+void DDS_DicItem::SetMaxZoom( const Standard_Real& theMaxZoom )
+{
+  myMaxZoom = theMaxZoom;
+}
+
+/*!
+  \brief Set item's zoom order value.
+  \param theZoomOrder zoom order value.
+*/
+void DDS_DicItem::SetZoomOrder( const Standard_Real& theZoomOrder )
+{
+  myZoomOrder = theZoomOrder;
+}
+
+/*!
+  \brief Set item's short description.
+  \param theShortDescr short description string.
+*/
+void DDS_DicItem::SetShortDescription( const TCollection_ExtendedString& theShortDescr )
+{
+  myShortDescr = theShortDescr;
+}
+
+/*!
+  \brief Set item's long description.
+  \param theLongDescr long description string.
+*/
+void DDS_DicItem::SetLongDescription( const TCollection_ExtendedString& theLongDescr )
+{
+  myLongDescr = theLongDescr;
+}
+
+/*!
+  \brief Add item's option.
+  \param theOptionName option name string.
+  \param theOptionValue option value string.
+*/
+bool DDS_DicItem::SetOption( const TCollection_AsciiString& theOptionName,
+                             const TCollection_AsciiString& theOptionValue )
+{
+  return myOptions.Bind( theOptionName, theOptionValue );
+}
+
+/*!
+  \brief Set item's type value.
+  \param theType item value type.
+*/
+void DDS_DicItem::SetType( const DDS_DicItem::Type& theType )
+{
+  myType = theType;
+}
+
+/*!
+  \brief Set item's minimum value.
+  \param theMinVal minimum possible value.
+*/
+void DDS_DicItem::SetMin( const Standard_Real& theMinVal )
+{
+  myData |= MinValue;
+  myMin = theMinVal;
+}
+
+/*!
+  \brief Set item's maximum value.
+  \param theMaxVal maximum possible value.
+*/
+void DDS_DicItem::SetMax( const Standard_Real& theMaxVal )
+{
+  myData |= MaxValue;
+  myMax = theMaxVal;
+}
+
+/*!
+  \brief Set item's default value as a real number.
+  \param theDefVal default value.
+*/
+void DDS_DicItem::SetDefaultValue( const Standard_Real& theDefVal )
+{
+  myData |= DefaultValue;
+  myDefValue = theDefVal;
+}
+
+/*!
+  \brief Set item's default value as a string.
+  \param theDefStr default value.
+*/
+void DDS_DicItem::SetDefaultValue( const TCollection_AsciiString& theDefStr )
+{
+  myDefString = theDefStr;
+}
+
+/*!
+  \brief Set item's value list.
+  \param theStrings list of value strings.
+  \param theIntegers list of integer values associated with string item.
+*/
+void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings,
+                                   const Handle(TColStd_HArray1OfInteger)& theIntegers )
+{
+  myListRef   = theStrings;
+  myListRefID = theIntegers;
+}
+
+/*!
+  \brief Set item's value list and icons.
+  \param theStrings list of value strings.
+  \param theIntegers list of integer values associated with string item.
+  \param theIcons list of icons associated with string item.
+*/
+void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings,
+                                   const Handle(TColStd_HArray1OfInteger)& theIntegers,
+                                   const Handle(TColStd_HArray1OfExtendedString)& theIcons )
+{
+  myListRef      = theStrings;
+  myListRefID    = theIntegers;
+  myListRefIcons = theIcons;
+}
index 96efab7fae2abf946ce23b78827762c398d450e8..814ac28e2733117644c1da716354d18103c09f0f 100644 (file)
@@ -82,90 +82,132 @@ public:
   typedef TCollection_AsciiString UnitSystem;
 
 public:
-  DDS_DicItem();
+  Standard_EXPORT DDS_DicItem();
 
-  Standard_EXPORT TCollection_AsciiString    GetId() const;
-  Standard_EXPORT DDS_DicItem::Type          GetType() const;
-  Standard_EXPORT TCollection_ExtendedString GetLabel() const;
-  Standard_EXPORT TCollection_ExtendedString GetFilter() const;
-  Standard_EXPORT TCollection_ExtendedString GetRequired() const;
-  Standard_EXPORT DDS_MsgType                GetWarningLevel() const;
-  Standard_EXPORT TCollection_ExtendedString GetLongDescription() const;
-  Standard_EXPORT TCollection_ExtendedString GetShortDescription() const;
-  Standard_EXPORT TCollection_AsciiString    GetComponent() const;
+  Standard_EXPORT TCollection_AsciiString            GetId() const;
+  Standard_EXPORT DDS_DicItem::Type                  GetType() const;
+  Standard_EXPORT TCollection_ExtendedString         GetLabel() const;
+  Standard_EXPORT TCollection_ExtendedString         GetFilter() const;
+  Standard_EXPORT TCollection_ExtendedString         GetRequired() const;
+  Standard_EXPORT DDS_MsgType                        GetWarningLevel() const;
+  Standard_EXPORT TCollection_ExtendedString         GetLongDescription() const;
+  Standard_EXPORT TCollection_ExtendedString         GetShortDescription() const;
+  Standard_EXPORT TCollection_AsciiString            GetComponent() const;
 
-  Standard_EXPORT TCollection_AsciiString    GetUnits() const;
-  Standard_EXPORT TCollection_AsciiString    GetUnits( const UnitSystem& ) const;
+  Standard_EXPORT virtual TCollection_AsciiString    GetUnits() const;
+  Standard_EXPORT virtual TCollection_AsciiString    GetUnits( const UnitSystem& ) const;
 
-  Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const;
-  Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const;
+  Standard_EXPORT TCollection_ExtendedString         GetDefaultValue() const;
+  Standard_EXPORT TCollection_ExtendedString         GetDefaultValue( const UnitSystem& ) const;
 
-  Standard_EXPORT Standard_Real              GetMinValue() const;
-  Standard_EXPORT Standard_Real              GetMinValue( const UnitSystem& ) const;
+  Standard_EXPORT Standard_Real                      GetMinValue() const;
+  Standard_EXPORT Standard_Real                      GetMinValue( const UnitSystem& ) const;
 
-  Standard_EXPORT Standard_Real              GetMaxValue() const;
-  Standard_EXPORT Standard_Real              GetMaxValue( const UnitSystem& ) const;
+  Standard_EXPORT Standard_Real                      GetMaxValue() const;
+  Standard_EXPORT Standard_Real                      GetMaxValue( const UnitSystem& ) const;
 
-  Standard_EXPORT Standard_Integer           GetPrecision() const;
-  Standard_EXPORT Standard_Integer           GetPrecision( const UnitSystem& ) const;
+  Standard_EXPORT virtual Standard_Integer           GetPrecision() const;
+  Standard_EXPORT virtual Standard_Integer           GetPrecision( const UnitSystem& ) const;
 
-  Standard_EXPORT TCollection_AsciiString    GetFormat( const Standard_Boolean = Standard_True ) const;
-  Standard_EXPORT TCollection_AsciiString    GetFormat( const UnitSystem&,
-                                                        const Standard_Boolean = Standard_True ) const;
-  Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const;
-  Standard_EXPORT Standard_Boolean           GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
-                                                              Handle(TColStd_HArray1OfInteger)& ) const;
-  Standard_EXPORT Standard_Boolean           GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
-                                                              Handle(TColStd_HArray1OfInteger)&,
-                                                              Handle(TColStd_HArray1OfExtendedString)& ) const;
-  Standard_EXPORT Standard_Boolean           GetSpecialValues( TColStd_MapOfReal& ) const;
+  Standard_EXPORT virtual TCollection_AsciiString    GetFormat( const Standard_Boolean = Standard_True ) const;
+  Standard_EXPORT virtual TCollection_AsciiString    GetFormat( const UnitSystem&,
+                                                                const Standard_Boolean = Standard_True ) const;
+  Standard_EXPORT TCollection_ExtendedString         GetNameOfValues() const;
+  Standard_EXPORT Standard_Boolean                   GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
+                                                                      Handle(TColStd_HArray1OfInteger)& ) const;
+  Standard_EXPORT Standard_Boolean                   GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
+                                                                      Handle(TColStd_HArray1OfInteger)&,
+                                                                      Handle(TColStd_HArray1OfExtendedString)& ) const;
+  Standard_EXPORT Standard_Boolean                   GetSpecialValues( TColStd_MapOfReal& ) const;
 
-  Standard_EXPORT Standard_Real              GetMinZoom() const;
-  Standard_EXPORT Standard_Real              GetMaxZoom() const;
-  Standard_EXPORT Standard_Real              GetZoomOrder() const;
+  Standard_EXPORT Standard_Real                      GetMinZoom() const;
+  Standard_EXPORT Standard_Real                      GetMaxZoom() const;
+  Standard_EXPORT Standard_Real                      GetZoomOrder() const;
 
-  Standard_EXPORT Standard_Real              ToSI( const Standard_Real ) const;
-  Standard_EXPORT Standard_Real              FromSI( const Standard_Real ) const;
+  Standard_EXPORT virtual Standard_Real              ToSI( const Standard_Real ) const;
+  Standard_EXPORT virtual Standard_Real              FromSI( const Standard_Real ) const;
 
-  Standard_EXPORT Standard_Real              ToSI( const Standard_Real, const UnitSystem& ) const;
-  Standard_EXPORT Standard_Real              FromSI( const Standard_Real, const UnitSystem& ) const;
+  Standard_EXPORT virtual Standard_Real              ToSI( const Standard_Real, const UnitSystem& ) const;
+  Standard_EXPORT virtual Standard_Real              FromSI( const Standard_Real, const UnitSystem& ) const;
 
-  Standard_EXPORT Standard_Boolean           HasData( const Standard_Integer ) const;
+  Standard_EXPORT Standard_Boolean                   HasData( const Standard_Integer ) const;
 
-  Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const;
-  Standard_EXPORT Standard_Boolean           GetOptionNames( TColStd_SequenceOfAsciiString& ) const;
+  Standard_EXPORT TCollection_ExtendedString         GetOption( const TCollection_AsciiString& ) const;
+  Standard_EXPORT Standard_Boolean                   GetOptionNames( TColStd_SequenceOfAsciiString& ) const;
+
+protected:
+  
+  Standard_EXPORT void                               SetId( const TCollection_AsciiString& );
+
+  Standard_EXPORT void                               SetComponent( const Handle(Standard_Transient)& );
+
+  Standard_EXPORT void                               SetLabel( const TCollection_AsciiString& );
+
+  Standard_EXPORT void                               SetFilter( const TCollection_AsciiString& );
+
+  Standard_EXPORT void                               SetRequired( const TCollection_AsciiString& );
+
+  Standard_EXPORT void                               SetWarningLevel( const Standard_Integer& );
+
+  Standard_EXPORT void                               SetMinZoom( const Standard_Real& );
+  Standard_EXPORT void                               SetMaxZoom( const Standard_Real& );
+  Standard_EXPORT void                               SetZoomOrder( const Standard_Real& );
+
+  Standard_EXPORT void                               SetShortDescription( const TCollection_ExtendedString& );
+  Standard_EXPORT void                               SetLongDescription( const TCollection_ExtendedString& );
+
+  Standard_EXPORT bool                               SetOption( const TCollection_AsciiString&, const TCollection_AsciiString& );
+  Standard_EXPORT void                               SetType( const DDS_DicItem::Type& );
+
+  Standard_EXPORT void                               SetMin( const Standard_Real& );
+  Standard_EXPORT void                               SetMax( const Standard_Real& );
+
+  Standard_EXPORT void                               SetDefaultValue( const Standard_Real& );
+  Standard_EXPORT void                               SetDefaultValue( const TCollection_AsciiString& );
+
+  Standard_EXPORT void                               SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
+                                                                      const Handle(TColStd_HArray1OfInteger)& );
+  Standard_EXPORT void                               SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
+                                                                      const Handle(TColStd_HArray1OfInteger)&,
+                                                                      const Handle(TColStd_HArray1OfExtendedString)& );
+
+protected:
+
+  Standard_EXPORT DDS_DicItem( const DDS_DicItem& );
+
+  Standard_EXPORT void                               operator=( const DDS_DicItem& );
+
+  Standard_EXPORT virtual void                       FillDataMap( TCollection_AsciiString, const LDOM_Element&,
+                                                                  const LDOM_Element&, const LDOM_Element&,
+                                                                  const TColStd_SequenceOfAsciiString& );
 
 private:
-  DDS_DicItem( const DDS_DicItem& );
-  void                                       operator=( const DDS_DicItem& );
-  void                                       FillDataMap( TCollection_AsciiString, const LDOM_Element&,
-                                                          const LDOM_Element&, const LDOM_Element&,
-                                                          const TColStd_SequenceOfAsciiString& );
-  void                                       PrepareFormats( const TCollection_AsciiString& );
-  void                                       GetDefaultFormat();
-  UnitSystem                                 GetActiveUnitSystem() const;
-
-  void                                       GetStringFormat( const TCollection_AsciiString&,
-                                                              const TCollection_AsciiString&,
-                                                              const TCollection_AsciiString&,
-                                                              const TCollection_AsciiString&,
-                                                              TCollection_AsciiString& );
-  void                                       GetIntegerFormat( const TCollection_AsciiString&,
-                                                               const TCollection_AsciiString&,
-                                                               const TCollection_AsciiString&,
-                                                               const TCollection_AsciiString&,
-                                                               const Standard_Character,
-                                                               TCollection_AsciiString& );
-  void                                       GetFloatFormat( const TCollection_AsciiString&,
-                                                             const TCollection_AsciiString&,
-                                                             const TCollection_AsciiString&,
-                                                             const TCollection_AsciiString&,
-                                                             const Standard_Character,
-                                                             TCollection_AsciiString& );
-  void                                       Split( const TCollection_AsciiString&,
-                                                    Handle(TColStd_HArray1OfExtendedString)& );
-
-  UnitData*                                  GetUnitData( const UnitSystem& ) const;
+
+  Standard_EXPORT void                               PrepareFormats( const TCollection_AsciiString& );
+  Standard_EXPORT void                               GetDefaultFormat();
+  Standard_EXPORT UnitSystem                         GetActiveUnitSystem() const;
+
+  Standard_EXPORT void                               GetStringFormat( const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      TCollection_AsciiString& );
+  Standard_EXPORT void                               GetIntegerFormat( const TCollection_AsciiString&,
+                                                                       const TCollection_AsciiString&,
+                                                                       const TCollection_AsciiString&,
+                                                                       const TCollection_AsciiString&,
+                                                                       const Standard_Character,
+                                                                       TCollection_AsciiString& );
+  Standard_EXPORT void                               GetFloatFormat( const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      const TCollection_AsciiString&,
+                                                                      const Standard_Character,
+                                                                      TCollection_AsciiString& );
+  Standard_EXPORT void                               Split( const TCollection_AsciiString&,
+                                                            Handle(TColStd_HArray1OfExtendedString)& );
+
+  Standard_EXPORT UnitData*                          GetUnitData( const UnitSystem& ) const;
 
 private:
   typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> OptionsMap;
index 28c309574dc5435aabef61e3e453f00ea96be51c..4cb46aaf9a77edcf9d73831867f257b00369fffa 100644 (file)
@@ -43,6 +43,8 @@
 IMPLEMENT_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared)
 IMPLEMENT_STANDARD_RTTIEXT(DDS_Dictionary, MMgt_TShared)
 
+Handle(DDS_Dictionary) DDS_Dictionary::myDictionary = Handle(DDS_Dictionary)();
+
 /*!
   \class DDS_Dictionary
   \brief This class provides an information about used datums, 
@@ -425,12 +427,10 @@ void DDS_Dictionary::SetActiveUnitSystem( const TCollection_AsciiString& theSyst
 */
 Handle_DDS_Dictionary DDS_Dictionary::Get()
 {
-  static Handle(DDS_Dictionary) sDictionary;
-
-  if ( sDictionary.IsNull() )
-    sDictionary = new DDS_Dictionary();
+  if ( myDictionary.IsNull() )
+    myDictionary = new DDS_Dictionary();
 
-  return sDictionary;
+  return myDictionary;
 }
 
 /*!
@@ -456,9 +456,8 @@ Standard_Boolean DDS_Dictionary::Load( const TCollection_AsciiString theFileName
 
   LDOM_Document aDoc = aParser.getDocument();
   LDOM_Element aDocElement = aDoc.getDocumentElement();
-  for ( LDOM_Element aComponentElem = aDocElement.GetChildByTagName( KeyWord( "COMPONENT" ) );
-        !aComponentElem.isNull(); aComponentElem = aComponentElem.GetSiblingByTagName() )
-    aDic->FillDataMap( aComponentElem, aDocElement );
+  if ( !aDocElement.isNull() )
+    aDic->FillDataMap( aDocElement );
 
   _LoadMap.Add( theFileName );
 
@@ -527,17 +526,20 @@ Handle_DDS_DicItem DDS_Dictionary::GetDicItem( const TCollection_AsciiString& th
 
 /*!
   \brief Fill the internal data structures from the XML node.
-  \param theComponentData component XML node
   \param theDocElement document XML node
 */
-void DDS_Dictionary::FillDataMap( const LDOM_Element& theComponentData, const LDOM_Element& theDocElement )
+void DDS_Dictionary::FillDataMap( const LDOM_Element& theDocElement )
 {
-  TCollection_AsciiString aCompName = theComponentData.getAttribute( KeyWord( "COMPONENT_NAME" ) );
-  if ( !myGroupMap.Contains( aCompName ) )
-    myGroupMap.Add( aCompName, new DDS_DicGroup( aCompName ) );
-  Handle(DDS_DicGroup) aDicGroup = myGroupMap.FindFromKey( aCompName );
-  aDicGroup->FillDataMap( theComponentData, theDocElement );
-  myGroupMap.Add( aCompName, aDicGroup );
+  for ( LDOM_Element aComponentElem = theDocElement.GetChildByTagName( KeyWord( "COMPONENT" ) );
+        !aComponentElem.isNull(); aComponentElem = aComponentElem.GetSiblingByTagName() )
+  {
+    TCollection_AsciiString aCompName = aComponentElem.getAttribute( KeyWord( "COMPONENT_NAME" ) );
+    if ( !myGroupMap.Contains( aCompName ) )
+      myGroupMap.Add( aCompName, CreateGroup( aCompName ) );
+    Handle(DDS_DicGroup) aDicGroup = myGroupMap.FindFromKey( aCompName );
+    aDicGroup->FillDataMap( aComponentElem, theDocElement );
+    myGroupMap.Add( aCompName, aDicGroup );
+  }
 }
 
 /*!
@@ -608,3 +610,25 @@ void DDS_Dictionary::GetKeys( const TCollection_AsciiString& theComponent, TColS
   if( !aDicGroup.IsNull() )
     aDicGroup->GetKeys( seq );
 }
+
+/*!
+  \brief  Create instance of a dictionary group. This method can
+          be used for customization data dictionary by specific
+          groups design.
+  \return New dictionary group instance.
+*/
+Handle(DDS_DicGroup) DDS_Dictionary::CreateGroup( const TCollection_AsciiString& theCompName ) const
+{
+  return new DDS_DicGroup( theCompName );
+}
+
+/*!
+  \brief Set instance of dictionary. This method might be used in descendant classes to initialize
+         custom dictionary and replace the default implementation.
+         This method overrides static handle on dictionary that is available
+         through Get() method
+*/
+void DDS_Dictionary::SetDictionary( const Handle(DDS_Dictionary)& theDict )
+{
+  myDictionary = theDict; 
+}
index a091f8b8ae59d76c10994ad145de27399ed59400..beb9733bb8a0e41f1c5b3053d713ac45ba91a9b7 100644 (file)
@@ -67,17 +67,30 @@ public:
 
   static Standard_EXPORT LDOMString              KeyWord( const TCollection_AsciiString& );
 
-private:
-  DDS_Dictionary();
-  DDS_Dictionary( const DDS_Dictionary& );
+protected:
 
-  void                                           operator=( const DDS_Dictionary& );
+  Standard_EXPORT virtual Handle(DDS_DicGroup)   CreateGroup( const TCollection_AsciiString& ) const;
 
-  void                                           FillDataMap( const LDOM_Element&, const LDOM_Element& );
+protected:
+
+  Standard_EXPORT DDS_Dictionary();
+
+  Standard_EXPORT DDS_Dictionary( const DDS_Dictionary& );
+
+  Standard_EXPORT void                           operator=( const DDS_Dictionary& );
+
+  Standard_EXPORT virtual void                   FillDataMap( const LDOM_Element& );
+
+  Standard_EXPORT static void                    SetDictionary(const Handle(DDS_Dictionary)& theDict);
+
+protected:
 
-private:
   DDS_IndexedDataMapOfDicGroups                  myGroupMap;
 
+private:
+
+  static Handle(DDS_Dictionary)                  myDictionary;
+
 public:
   DEFINE_STANDARD_RTTI(DDS_Dictionary)
 };
index 85edfbe70887af39df6804db3a66d8ca30c88977..03bb8c8faba1d1eb7001fab8e00229cb8318af49 100644 (file)
@@ -41,8 +41,6 @@
 #include <QMenu>
 #include <QVBoxLayout>
 
-#include <utilities.h>
-
 /*!
   \brief Constructor.
 
@@ -69,7 +67,6 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp
   char* synchronous = getenv("PYTHON_CONSOLE_SYNC");
   if (synchronous && atoi(synchronous))
   {
-      MESSAGE("Python console is synchronous");
       myEditor->setIsSync(true);
   }
   myEditor->viewport()->installEventFilter( this );
index 0d950ae8ac2140307f93b0b9430baf4e1ab1548a..6b79e017bb62d759a6a4f4643ce8cf5ed4469d45 100644 (file)
@@ -38,6 +38,8 @@ public:
   bool                 isChecked() const;
   void                 setChecked( const bool );
 
+  virtual QString      getString() const;
+
   virtual void         clear();
 
 signals:
@@ -51,7 +53,6 @@ protected:
   QCheckBox*           checkBox() const;
   virtual QWidget*     createControl( QWidget* );
 
-  virtual QString      getString() const;
   virtual void         setString( const QString& );
 };
 
index b58bee9b70ae176098b0ae5ce9a34eb8909697ec..02f67868f85562e2c905e91d89c9c2bc5409ce85 100644 (file)
@@ -443,7 +443,7 @@ QWidget* QDS_ComboBox::createControl( QWidget* parent )
 {
   QtxComboBox* cb = new QtxComboBox( parent );
   cb->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
-  connect( cb, SIGNAL( textChanged( const QString& ) ), this,
+  connect( cb, SIGNAL( editTextChanged( const QString& ) ), this,
            SLOT( onTextChanged( const QString& ) ) );
   connect( cb, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
   return cb;
index 31a45aee6d4eb9a5248c93213efe50f028c53141..e704b2e3d03a508371a29c386788ce29376be845 100644 (file)
@@ -62,6 +62,8 @@ public:
   void                       setValues( const QList<int>&, const QStringList& );
   void                       setValues( const QStringList& );
 
+  virtual QString            getString() const;
+
   virtual void               reset();
 
   int                        stringToValue( const QString& ) const;
@@ -79,7 +81,6 @@ protected:
   QtxComboBox*               comboBox() const;
   virtual QWidget*           createControl( QWidget* );
 
-  virtual QString            getString() const;
   virtual void               setString( const QString& );
 
   virtual void               unitSystemChanged( const QString& );
index 9b7cae69d6334338599a8ee8d621d85c6e96585c..e7dde329218f6aeaf7a49cdb779243fe461649dd 100644 (file)
@@ -551,8 +551,29 @@ int QDS_Datum::optionInteger( const QString& name ) const
 QVariant QDS_Datum::value() const
 {
   QVariant val;
-  if ( !isEmpty() )
-    val = stringValue();
+  // trying to return QVariant containing value of correct data type
+  if ( dicItem().IsNull() )
+  {
+    if ( !isEmpty() )
+      val = stringValue();
+  }
+  else
+  {
+    switch( type() )
+    {
+      case DDS_DicItem::Float:
+        val = doubleValue();
+        break;
+      case DDS_DicItem::Integer:
+      case DDS_DicItem::List:
+        val = integerValue();
+        break;
+      case DDS_DicItem::String:
+      case DDS_DicItem::Unknown:
+        val = stringValue();
+        break;
+    }
+  }
   return val;
 }
 
@@ -698,6 +719,39 @@ void QDS_Datum::clear()
 */
 void QDS_Datum::setValue( const QVariant& val )
 {
+  // trying to extract data of correct type from QVariant
+  if ( !dicItem().IsNull() )
+  {
+    bool isOk = false;
+    switch( type() )
+    {
+      case DDS_DicItem::Float:
+      {
+        double aDblVal = val.toDouble( &isOk );
+        if ( isOk )
+        {
+          setDoubleValue( aDblVal );
+          return;
+        }
+        break;
+      }
+      case DDS_DicItem::Integer:
+      case DDS_DicItem::List:
+      {
+        int anIntVal = val.toInt( &isOk );
+        if ( isOk )
+        {
+          setIntegerValue( anIntVal );
+          return;
+        }
+        break;
+      }
+      case DDS_DicItem::String:
+      case DDS_DicItem::Unknown:
+        break;
+    }
+  }
+
   if ( val.isValid() && val.canConvert( QVariant::String ) )
     setStringValue( val.toString() );
   else
@@ -1033,7 +1087,7 @@ void QDS_Datum::addTo( QHBoxLayout* l )
   if ( wrapper( Control ) )
     l->addWidget( wrapper( Control ) );
   if ( wrapper( Units ) )
-    l->addWidget( unitsWidget() );
+    l->addWidget( wrapper( Units ) );
 }
 
 /*!
index 0217602e35498d5a1fd21b1c4b50af62822d307c..ce5e0920a8581fcd16a665bc1603eebb30afd15d 100644 (file)
@@ -114,6 +114,8 @@ public:
   static QString            format( const double, const QString&, const bool = false );
   static QString            units( const QString& );
 
+  virtual QString           getString() const = 0;
+
   virtual bool              eventFilter( QObject*, QEvent* );
 
   operator QWidget*() const;
@@ -151,7 +153,6 @@ protected:
   virtual QLabel*           createUnits( QWidget* );
   virtual QWidget*          createControl( QWidget* ) = 0;
 
-  virtual QString           getString() const = 0;
   virtual void              setString( const QString& ) = 0;
 
   virtual bool              validate( const QString& ) const;
index f5ddfb0cfa91cdb2cf3cfaaf613a5e590077dd50..f89605106413197fc32dab065df7755ce7846b2a 100644 (file)
@@ -47,6 +47,8 @@ public:
   bool                 hasSelection() const;
   void                 setSelection( const bool );
 
+  virtual QString      getString() const;
+
 signals:
   void                 returnPressed();
 
@@ -60,7 +62,6 @@ protected:
   virtual QWidget*     createControl( QWidget* );
   QLineEdit*           lineEdit() const;
 
-  virtual QString      getString() const;
   virtual void         setString( const QString& );
 
   virtual void         unitSystemChanged( const QString& );
index 56b280dcb6160f0f97bae5e1a5b60a7f55d72289..b76fd168ed6e10bb20bc9108369743da19ce1dca 100644 (file)
@@ -58,6 +58,8 @@ public:
   void                       setValues( const QList<int>&, const QStringList& );
   void                       setValues( const QStringList& );
 
+  virtual QString            getString() const;
+
 signals:
   void                       activated( int );
 
@@ -70,7 +72,6 @@ protected:
   virtual QWidget*           createControl( QWidget* );
   void                       buttons( QList<QRadioButton*>& ) const;
 
-  virtual QString            getString() const;
   virtual void               setString( const QString& );
 
   virtual void               unitSystemChanged( const QString& );
index d9030397af3662d8e2a080fbd729978ba643106d..30cb133d1a463b24c24cc9b6c61dbde6a8035fae 100644 (file)
@@ -38,6 +38,8 @@ public:
   int              step() const;
   void             setStep( const int );
 
+  virtual QString  getString() const;
+
 private slots:
   void             onValueChanged( int );
 
@@ -46,7 +48,6 @@ protected:
 
   virtual QWidget* createControl( QWidget* );
 
-  virtual QString  getString() const;
   virtual void     setString( const QString& );
 
   virtual void     unitSystemChanged( const QString& );
index 47b7a0bfadbc612441c0cb59b7031f39388fef44..9ed90e8b06fd418eb939c9d51600031bd310bd3f 100644 (file)
@@ -38,6 +38,8 @@ public:
   double            step() const;
   void              setStep( const double );
 
+  virtual QString   getString() const;
+
 private slots:
   void              onValueChanged( double );
 
@@ -45,7 +47,6 @@ protected:
   QtxDoubleSpinBox* spinBox() const;
   virtual QWidget*  createControl( QWidget* );
 
-  virtual QString   getString() const;
   virtual void      setString( const QString& );
 
   virtual void      unitSystemChanged( const QString& );
index 7f792c2a9faaa326f9bf0e62921a714ed842b0f8..34d811423148113abb6bc00fdc1a5b8dc275517b 100644 (file)
@@ -35,6 +35,8 @@ public:
   QDS_TextEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString() );
   virtual ~QDS_TextEdit();
 
+  virtual QString                 getString() const;
+
 signals:
   void                            returnPressed();
 
@@ -45,7 +47,6 @@ protected:
   QTextEdit*                      textEdit() const;
   virtual QWidget*                createControl( QWidget* );
 
-  virtual QString                 getString() const;
   virtual void                    setString( const QString& );
 };
 
index 6607e2f1e07ef0e7aa8c3232113389837f6039f4..74aefc0553fb886e680756788a25aa8f117be587 100644 (file)
@@ -1104,7 +1104,7 @@ void QtxWorkstackArea::onChildCaptionChanged( QtxWorkstackChild* c )
 */
 void QtxWorkstackArea::updateCurrent()
 {
-  QWidget* cur = child( widget( myBar->tabId( myBar->currentIndex() ) ) );
+  QWidget* cur = child( myBar->tabId( myBar->currentIndex() ) );
   if ( cur )
     myStack->setCurrentWidget( cur );
 }
index 09babe484266ec9e7bb7a0a90ed0f912a002c1bb..9c48b4bebb8ec082f839d68b5de33d1cb3a66524 100644 (file)
@@ -200,7 +200,7 @@ public:
   bool                restoreState( QDataStream&, QMap<QString, QtxWorkstackChild*>& );
 };
 
-class QtxWorkstackArea : public QFrame
+class QTX_EXPORT QtxWorkstackArea : public QFrame
 {
   Q_OBJECT
 
index e4eb217cda4f776cc84a3f77b8e22ba5231fca50..65e06a1fde0408aac531ff88f43f457f1352d91c 100755 (executable)
@@ -219,7 +219,8 @@ void STD_Application::createActions()
   // Create menus
 
   int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, MenuFileId, 0 );
-  int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 10 );
+  // Let the application developers insert some menus between Edit and View
+  int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 5 );
   int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, MenuViewId, 10 );
   int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, MenuHelpId, 1000 );
 
index 99adcc0cdf1afb5168e9cdc4b436184d7c22e7de..d346cfe1c3d5328f4729905f874195ac4dfef60c 100644 (file)
@@ -176,7 +176,7 @@ int SUIT_DataBrowser::shortcutKey(const int id) const
 */
 void SUIT_DataBrowser::setShortcutKey( const int id, const int key )
 { 
-  ShortcutMap::iterator it = myShortcutMap.find( key );
+  ShortcutMap::iterator it = myShortcutMap.find( id );
   if( it != myShortcutMap.end() )
     (*it)->setKey(key);
 }
index a169442011610280f8963965834ca147c1a4befc..8c8b3e78a48fa96d76bcf9e481620b760e5ca459 100755 (executable)
@@ -399,6 +399,24 @@ void SUIT_DataObject::assignParent( SUIT_DataObject* p )
   myParent = p;
 }
 
+/*!
+  \brief Sets modification state of the object.
+
+  When the object has been modified (modified is set to true)
+  a signal is emitted to notify the tree model and eventually redraw the data object.
+
+  \param modified modified state 
+*/
+void SUIT_DataObject::setModified(bool modified)
+{
+  if ( _modified == modified )
+    return;
+
+  _modified = modified;
+  if ( _modified )
+    signal()->emitModified( this );
+}
+
 /*!
   \brief Get data object name.
 
@@ -928,6 +946,15 @@ void SUIT_DataObject::Signal::emitRemoved( SUIT_DataObject* object, SUIT_DataObj
   emit( removed( object, parent ) );
 }
 
+/*!
+  \brief Emit a signal to notify that the data object has been modified.
+  \param object data object that has been modified
+*/
+void SUIT_DataObject::Signal::emitModified( SUIT_DataObject* object )
+{
+  emit( modified( object ) );
+}
+
 /*!
   \brief Schedule data object for the late deleting.
   \param object data object to be deleted later
index 3358c01311765b2e54db67ca23a29f4cf39d80ab..e17ab3951d61b2ab720e70043c3fcfecfb7e15c3 100755 (executable)
@@ -101,7 +101,7 @@ public:
   virtual void                assignParent( SUIT_DataObject* );
   void                        insertChildAtPos( SUIT_DataObject* obj, int position );
   bool                        modified(){return _modified;};
-  void                        setModified(bool modified){_modified = modified;};
+  virtual void                setModified(bool modified);
 
   virtual QString             name() const;
   virtual QString             text( const int = NameId ) const;
@@ -173,6 +173,7 @@ private:
   void emitDestroyed( SUIT_DataObject* );
   void emitInserted( SUIT_DataObject*, SUIT_DataObject* );
   void emitRemoved( SUIT_DataObject*, SUIT_DataObject* );
+  void emitModified( SUIT_DataObject* );
 
   void deleteLater( SUIT_DataObject* );
 
@@ -181,6 +182,7 @@ signals:
   void destroyed( SUIT_DataObject* );
   void inserted( SUIT_DataObject*, SUIT_DataObject* );
   void removed( SUIT_DataObject*, SUIT_DataObject* );
+  void modified( SUIT_DataObject* );
 
   friend class SUIT_DataObject;
 
index 4b3c8a77608ffdbda166a231300b45ec624e5e31..321173da3700a360aaa9744dc52c7948ea8975b1 100755 (executable)
@@ -483,6 +483,8 @@ SUIT_TreeModel::~SUIT_TreeModel()
                                  this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
     SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                                  this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+    SUIT_DataObject::disconnect( SIGNAL( modifed( SUIT_DataObject* ) ),
+                                 this, SLOT( onModified( SUIT_DataObject* ) ) );
     delete myRoot;
   }
 
@@ -669,8 +671,10 @@ Qtx::HeaderViewFlags SUIT_TreeModel::headerFlags( const QString& name ) const
   
   \param id - column name
   \param state - visible state
+  \param emitChanged - if set to false, blocks dataChanged() signal, this can be used to
+  prevent emitting dataChanged() several times for the same data object
 */
-void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState state )
+void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState state, bool emitChanged )
 {
   VisibilityMap::const_iterator it = myVisibilityMap.find( id );
   if ( it != myVisibilityMap.end() && it.value() == state )
@@ -684,7 +688,7 @@ void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState
   else {
     needSignal = myVisibilityMap.remove( id ) > 0;
   }
-  if ( needSignal ) {
+  if ( emitChanged && needSignal ) {
     QModelIndexList lst;
     if ( searcher() ) {
       SUIT_DataObject* o = searcher()->findObject( id );
@@ -703,7 +707,6 @@ void SUIT_TreeModel::setVisibilityState( const QString& id, Qtx::VisibilityState
 /*!
   \brief Set visibility state for all objects.
   
-  \param id - column name
   \param state - visible state
 */
 void SUIT_TreeModel::setVisibilityStateForAll( Qtx::VisibilityState state )
@@ -775,7 +778,15 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r )
                                  this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
     SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                                  this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+    SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ),
+                                 this, SLOT( onModified( SUIT_DataObject* ) ) );
     delete myRoot;
+    
+    if ( myRootItem ) {
+      QList<TreeItem*> items = myRootItem->children();
+      for ( QList<TreeItem*>::iterator anIt = items.begin(); anIt != items.end(); anIt++ )
+        delete *anIt;
+    }
   }
 
   myRoot = r;
@@ -1212,6 +1223,8 @@ void SUIT_TreeModel::setAutoUpdate( const bool on )
                                this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
   SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                                this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+  SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ),
+                               this, SLOT( onModified( SUIT_DataObject* ) ) );
   myAutoUpdate = on;
 
   if ( myAutoUpdate ) {
@@ -1219,6 +1232,8 @@ void SUIT_TreeModel::setAutoUpdate( const bool on )
                               this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
     SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                               this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+    SUIT_DataObject::connect( SIGNAL( modified( SUIT_DataObject* ) ),
+                              this, SLOT( onModified( SUIT_DataObject* ) ) );
 
     updateTree();
   }
@@ -1412,11 +1427,15 @@ void SUIT_TreeModel::initialize()
                                this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
   SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                                this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+  SUIT_DataObject::disconnect( SIGNAL( modified( SUIT_DataObject* ) ),
+                               this, SLOT( onModified( SUIT_DataObject* ) ) );
   if ( autoUpdate() ) {
     SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
                               this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
     SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
                               this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+    SUIT_DataObject::connect( SIGNAL( modified( SUIT_DataObject* ) ),
+                              this, SLOT( onModified( SUIT_DataObject* ) ) );
   }
 
   myItems.clear(); // ????? is it really necessary
@@ -1597,7 +1616,7 @@ void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item, bool emitLayout
   QModelIndex lastIdx  = index( obj, columnCount() - 1 );
   emit dataChanged( firstIdx, lastIdx );
   obj->setModified(false);
-  if( emitLayoutChanged )
+  if ( emitLayoutChanged )
     emit layoutChanged();
 }
 
@@ -1664,6 +1683,22 @@ void SUIT_TreeModel::onRemoved( SUIT_DataObject* /*object*/, SUIT_DataObject* pa
     updateTree( parent );
 }
 
+/*!
+  \brief Called when the data object is modified. TreeSync is not used here for maximum efficiency.
+  It is assumed that it is up to the application to decide when its data objects are modified.
+  \param obj data object that has been modified
+*/
+void SUIT_TreeModel::onModified( SUIT_DataObject* obj )
+{
+  if ( autoUpdate() )
+  {
+    QModelIndex firstIdx = index( obj, 0 );
+    QModelIndex lastIdx  = index( obj, columnCount() - 1 );
+    emit dataChanged( firstIdx, lastIdx );
+    obj->setModified(false);
+  }
+}
+
 /*!
   \brief Drag and Drop support.
 */
@@ -2171,11 +2206,12 @@ Qtx::HeaderViewFlags SUIT_ProxyModel::headerFlags( const QString& name ) const
   
   \param id - column name
   \param state - visible state
+  \param emitChanged - if set to false, blocks dataChanged() signal, this can be used to
+  prevent emitting dataChanged() several times for the same data object
 */
-void SUIT_ProxyModel::setVisibilityState(const QString& id, Qtx::VisibilityState state)
-{
+void SUIT_ProxyModel::setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged ) {
   if(treeModel())
-    treeModel()->setVisibilityState(id,state);
+    treeModel()->setVisibilityState(id,state,emitChanged);
 }
 
 /*!
index f06ffb32fe5a69c5db439aeb8dd384d65b148e99..c016b79fbf6721f7aee32946b6bbe043b9944906 100755 (executable)
@@ -83,7 +83,7 @@ public:
   virtual QPixmap               columnIcon( const QString& name ) const = 0;
   virtual void                  setAppropriate( const QString& name, const Qtx::Appropriate appr ) = 0;
   virtual Qtx::Appropriate      appropriate( const QString& name ) const = 0;
-  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state) = 0;
+  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true) = 0;
   virtual void                  setVisibilityStateForAll(Qtx::VisibilityState state) = 0;
   virtual Qtx::VisibilityState  visibilityState(const QString& id) const = 0;
   virtual void                  setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags ) = 0;
@@ -152,7 +152,7 @@ public:
   virtual QPixmap          columnIcon( const QString& name ) const;
   virtual void             setAppropriate( const QString& name, const Qtx::Appropriate appr );
   virtual Qtx::Appropriate appropriate( const QString& name ) const;
-  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state);
+  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true);
   virtual void                  setVisibilityStateForAll(Qtx::VisibilityState state);
   virtual Qtx::VisibilityState  visibilityState(const QString& id) const;
   virtual void                  setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags );
@@ -212,6 +212,7 @@ private:
 private slots:
   void                   onInserted( SUIT_DataObject*, SUIT_DataObject* );
   void                   onRemoved( SUIT_DataObject*, SUIT_DataObject* );
+  void                   onModified( SUIT_DataObject* );
 
 private:
   typedef QMap<SUIT_DataObject*, TreeItem*> ItemMap;
@@ -275,7 +276,7 @@ public:
   virtual QPixmap          columnIcon( const QString& name ) const;
   virtual void             setAppropriate( const QString& name, const Qtx::Appropriate appr );
   virtual Qtx::Appropriate appropriate( const QString& name ) const;
-  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state);
+  virtual void                  setVisibilityState(const QString& id, Qtx::VisibilityState state, bool emitChanged = true);
   virtual void                  setVisibilityStateForAll(Qtx::VisibilityState state);
   virtual Qtx::VisibilityState  visibilityState(const QString& id) const;
   virtual void                  setHeaderFlags( const QString& name, const Qtx::HeaderViewFlags flags );