ObjPtr nullSrc() const;
ItemPtr nullTrg() const;
ItemPtr createItem( const ObjPtr&, const ItemPtr&, const ItemPtr&, const bool ) const;
- void updateItem( const ItemPtr& ) const;
+ void updateItem( const ObjPtr& , const ItemPtr& ) const;
void deleteItemWithChildren( const ItemPtr& ) const;
void children( const ObjPtr&, QValueList<ObjPtr>& ) const;
void children( const ItemPtr&, QValueList<ItemPtr>& ) const;
Updates item
\param p - item
*/
-void OB_BrowserSync::updateItem( const ItemPtr& p ) const
+void OB_BrowserSync::updateItem( const ObjPtr& o, const ItemPtr& p ) const
{
if ( p && needUpdate( p ) ) {
// printf( "--- needUpdate for %s = true ---\n", p->text( 0 ).latin1() );
myBrowser->updateText( p );
p->update();
}
+ if( o && myBrowser->getUpdater() )
+ {
+ myBrowser->getUpdater()->update( o, p );
+ }
}
/*!
myRoot( 0 ),
myTooltip( 0 ),
+myUpdater( 0 ),
myAutoOpenLevel( 0 ),
myAutoUpdate( false ),
myAutoDelObjs( false ),
{
myItems.clear();
delete myTooltip;
+ setUpdater( 0 );
}
/*!
myAutoDelObjs = on;
}
+/*!
+ \return updater of browser
+*/
+OB_Updater* OB_Browser::getUpdater() const
+{
+ return myUpdater;
+}
+
+/*!
+ \sets new updater of browser
+*/
+void OB_Browser::setUpdater( OB_Updater* theUpdate )
+{
+ if( myUpdater )
+ delete myUpdater;
+ myUpdater = theUpdate;
+}
+
/*!
\return root SUIT object of browser
*/
class OB_ListView;
class OB_ListItem;
+class OB_Updater
+{
+public:
+ OB_Updater(){};
+ virtual ~OB_Updater(){};
+ virtual void update( SUIT_DataObject* theObj, OB_ListItem* theLI ) = 0;
+};
+
/*!
\class OB_Browser
Represents object browser. Allows to get/set selection,
void setModified();
unsigned long getModifiedTime() { return myModifiedTime; }
+
+ OB_Updater* getUpdater() const;
+ virtual void setUpdater( OB_Updater* theUpdate = 0 );
signals:
void selectionChanged();
SUIT_DataObject* myRoot;
ItemMap myItems;
QToolTip* myTooltip;
+ OB_Updater* myUpdater;
QMap<int, int> myColumnIds;
bool myAutoUpdate;
bool myAutoDelObjs;
if( td.isEqual( r1, r2 ) )
{
// update items themselves
- td.updateItem( r2 );
+ td.updateItem( r1, r2 );
// iterate 'siblings' (direct children)
QValueList< DiffItem< SrcItem, TrgItem > > d;
else
{
//to update
- td.updateItem( item.myTrg );
+ td.updateItem( item.mySrc, item.myTrg );
synchronize( item.mySrc, item.myTrg, td );
lastItem = item.myTrg;
}
#include <SALOMEDSClient_ClientFactory.hxx>
#include <vector>
+/*!Internal class that updates object browser item properties */
+class SalomeApp_Updater : public OB_Updater
+{
+public:
+ SalomeApp_Updater() : OB_Updater(){};
+ virtual ~SalomeApp_Updater(){};
+ virtual void update( SUIT_DataObject* theObj, OB_ListItem* theItem );
+};
+
+void SalomeApp_Updater::update( SUIT_DataObject* theObj, OB_ListItem* theItem )
+{
+ if( !theObj || !theItem )
+ return;
+
+ SalomeApp_DataObject* SAObj = dynamic_cast<SalomeApp_DataObject*>( theObj );
+ if( !SAObj )
+ return;
+
+ _PTR(SObject) SObj = SAObj->object();
+ if( !SObj )
+ return;
+ _PTR( GenericAttribute ) anAttr;
+
+ // Selectable
+ if ( SObj->FindAttribute( anAttr, "AttributeSelectable" ) )
+ {
+ _PTR(AttributeSelectable) aAttrSel = anAttr;
+ theItem->setSelectable( aAttrSel->IsSelectable() );
+ }
+ // Expandable
+ if ( SObj->FindAttribute(anAttr, "AttributeExpandable") )
+ {
+ _PTR(AttributeExpandable) aAttrExpand = anAttr;
+ theItem->setExpandable( aAttrExpand->IsExpandable() );
+ }
+ // Opened
+ //this attribute is not supported in the version of SALOME 3.x
+ //if ( SObj->FindAttribute(anAttr, "AttributeOpened") )
+ //{
+ // _PTR(AttributeOpened) aAttrOpen = anAttr;
+ // theItem->setOpen( aAttrOpen->IsOpened() );
+ //}
+}
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
if ( flag == WT_ObjectBrowser )
{
OB_Browser* ob = (OB_Browser*)wid;
+ ob->setUpdater( new SalomeApp_Updater() );
connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ),
autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
void children( const suitPtr&, QValueList<suitPtr>& ) const;
suitPtr parent( const suitPtr& ) const;
bool isCorrect( const kerPtr& ) const;
- void updateItem( const suitPtr& ) const;
+ void updateItem( const kerPtr&, const suitPtr& ) const;
private:
_PTR( Study ) myStudy;
{
kerPtr refObj;
QString name = so->GetName().c_str();
- bool res = so && ( so->GetName().size() || so->ReferencedObject( refObj ) );
+ _PTR( GenericAttribute ) anAttr;
+ bool isDraw = true;
+ if ( so->FindAttribute(anAttr, "AttributeDrawable") )
+ {
+ _PTR(AttributeDrawable) aAttrDraw = anAttr;
+ isDraw = aAttrDraw->IsDrawable();
+ }
+ bool res = so && ( so->GetName().size() || so->ReferencedObject( refObj ) ) && isDraw;
return res;
}
Updates SUIT object
\param p - SUIT object
*/
-void SalomeApp_DataModelSync::updateItem( const suitPtr& ) const
+void SalomeApp_DataModelSync::updateItem( const kerPtr& obj, const suitPtr& ) const
{
}
{
if( !study || !study->root() || !sobj )
return 0;
-
+
DataObjectList ch; study->root()->children( ch );
DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end();
SUIT_DataObject* suitObj = 0;
else
clr = QColor( 200, 200, 200 );
}
+ else if ( myObject )
+ {
+ _PTR(GenericAttribute) anAttr;
+ if( myObject->FindAttribute ( anAttr, "AttributeTextHighlightColor") )
+ {
+ _PTR(AttributeTextHighlightColor) aHighColAttr = anAttr;
+ clr = QColor( (int)(aHighColAttr->TextHighlightColor().R),
+ (int)(aHighColAttr->TextHighlightColor().G),
+ (int)(aHighColAttr->TextHighlightColor().B));
+ }
+ }
break;
case HighlightedText:
if ( isReference() )
SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
: SUIT_ExceptionHandler()
{
- // JFA 2006-09-28: PAL10867: suppress signal catching,
- // if environment variable DISABLE_SIGNALS_CATCHING is set to 1.
- // Commonly this is used with "noexcepthandler" option.
- char* envNoCatchSignals = getenv("NOT_INTERCEPT_SIGNALS");
- if (!envNoCatchSignals || !atoi(envNoCatchSignals))
- {
- OSD::SetSignal( floatSignal );
- }
+ OSD::SetSignal( floatSignal );
}
/*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
#else
raiseFPE = false;
#endif
-
return new SalomeApp_ExceptionHandler( raiseFPE );
}