From 508ce2188fc621fcbedd2c2734916aa33bbef491 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 17 Feb 2011 07:58:57 +0000 Subject: [PATCH] Implementation of the "20830: EDF 1357 GUI : Hide/Show Icon" (at the moment implemeted only in GEOM and SMESH modules). --- src/SALOMEDS/SALOMEDS_Study_i.cxx | 4 ++-- src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx | 4 ++++ src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx | 2 +- src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx | 9 ++++++--- src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx | 2 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 7 ++++--- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 2 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx | 2 +- 8 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 5832eaa4c..9bee45f32 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -104,7 +104,7 @@ Notifier(CORBA::ORB_ptr orb) */ //============================================================================ - virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject) + virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason) { for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it) { @@ -112,7 +112,7 @@ Notifier(CORBA::ORB_ptr orb) { std::string anID=theSObject.GetID(); const char* cID=anID.c_str(); - it->first->notifyObserverID(cID,0); + it->first->notifyObserverID(cID,reason); } } return true; // NGE return always true but can be modified if needed diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index 668e1a142..5bdef1d9b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -138,6 +138,10 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) //add IOR entry in study SALOMEDSImpl_Study::IORUpdated(this); + + //Reason = 5 means that IOR attribute updated + //Used in the gui module to detect that IOR attribure was assigned to the object + SetModifyFlag(5); } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx index 906403c97..5d196209b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx @@ -59,6 +59,6 @@ class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AbstractCallback public: virtual bool addSO_Notification(const SALOMEDSImpl_SObject& theSObject){return false;}; virtual bool removeSO_Notification(const SALOMEDSImpl_SObject& theSObject){return false;}; - virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject){return false;}; + virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason ){return false;}; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx index 7f3544df1..0e5321c24 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx @@ -79,13 +79,16 @@ SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject() return SALOMEDSImpl_Study::SObject(aLabel); } -void SALOMEDSImpl_GenericAttribute::SetModifyFlag() +/*! + * Set modification flag of the Attribute. + * param reason reason of the modification (by default equal to 0) + */ +void SALOMEDSImpl_GenericAttribute::SetModifyFlag(int reason) { DF_Label aLabel = Label(); if(aLabel.IsNull()) return; SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); - if(aStudy) aStudy->modifySO_Notification(GetSObject()); + if(aStudy) aStudy->modifySO_Notification(GetSObject(), reason); if(aStudy) aStudy->Modify(); } - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx index 45b0b83ce..293aa4c57 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx @@ -51,7 +51,7 @@ public: virtual void CheckLocked(); std::string GetClassType() { return _type; } SALOMEDSImpl_SObject GetSObject(); - void SetModifyFlag(); + void SetModifyFlag(int reason = 0); static std::string Impl_GetType(DF_Attribute* theAttr); static std::string Impl_GetClassType(DF_Attribute* theAttr); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 0e4a3db6f..a3450207e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -2017,13 +2017,14 @@ bool SALOMEDSImpl_Study::removeSO_Notification (const SALOMEDSImpl_SObject& theS //============================================================================ /*! Function : modifySO_Notification - * Purpose : This function tells all the observers that a SO has been modified + * Purpose : This function tells all the observers that a SO has been modified and + pass the mofification reason */ //============================================================================ -bool SALOMEDSImpl_Study::modifySO_Notification (const SALOMEDSImpl_SObject& theSObject) +bool SALOMEDSImpl_Study::modifySO_Notification (const SALOMEDSImpl_SObject& theSObject, int reason) { if(_notifier) - return _notifier->modifySO_Notification(theSObject); + return _notifier->modifySO_Notification(theSObject, reason); else return false; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 0731d3ab3..a257da08e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -317,7 +317,7 @@ public: // Notification mechanism virtual bool addSO_Notification(const SALOMEDSImpl_SObject& theSObject); virtual bool removeSO_Notification(const SALOMEDSImpl_SObject& theSObject); - virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject); + virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason); virtual void setNotifier(SALOMEDSImpl_AbstractCallback* notifier); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 60d9ff07e..f02b2bd94 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -556,7 +556,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anOb Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)); _doc->SetModified(true); - _study->modifySO_Notification(anObject); + _study->modifySO_Notification(anObject,0); return true; } -- 2.39.2