From: mpa Date: Thu, 5 Jun 2014 07:44:52 +0000 (+0400) Subject: - clean programming code X-Git-Tag: V7_5_0a1~50^2~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6076f118e7c6a05b3bc6ae9033b99397496af783;p=modules%2Fgeom.git - clean programming code - add signals for GEOMGUI-->DependecyTree cooperation - begin of documentation --- diff --git a/doc/salome/gui/GEOM/images/pref15.png b/doc/salome/gui/GEOM/images/pref15.png old mode 100755 new mode 100644 index c4b2cac4d..0fec2802a Binary files a/doc/salome/gui/GEOM/images/pref15.png and b/doc/salome/gui/GEOM/images/pref15.png differ diff --git a/doc/salome/gui/GEOM/images/pref_dep_tree.png b/doc/salome/gui/GEOM/images/pref_dep_tree.png new file mode 100644 index 000000000..c02134335 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pref_dep_tree.png differ diff --git a/doc/salome/gui/GEOM/input/geometry_preferences.doc b/doc/salome/gui/GEOM/input/geometry_preferences.doc index 6ad3270cb..f06e510bb 100644 --- a/doc/salome/gui/GEOM/input/geometry_preferences.doc +++ b/doc/salome/gui/GEOM/input/geometry_preferences.doc @@ -128,5 +128,34 @@ system immediately after the module activation. +Also you can set preferences for visualisation of Dependency Tree in 2D Viewer. + +\image html pref_dep_tree.png + + + + */ diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 465b04884..24a0f148d 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -68,15 +68,16 @@ - - - - - - - + + + + + + + + - + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 624c14bcc..641853c22 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,8 +50,8 @@ ENDIF() ## IF(SALOME_BUILD_GUI) SET(SUBDIRS_GUI - DependencyTree OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI - GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI + OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI + GEOMBase DependencyTree GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI ImportExportGUI GEOM_SWIG_WITHIHM diff --git a/src/DependencyTree/CMakeLists.txt b/src/DependencyTree/CMakeLists.txt index a3807832a..b57dce943 100644 --- a/src/DependencyTree/CMakeLists.txt +++ b/src/DependencyTree/CMakeLists.txt @@ -18,7 +18,6 @@ # INCLUDE(UseQt4Ext) -INCLUDE(${QT_USE_FILE}) # --- options --- @@ -26,47 +25,30 @@ INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES( ${QT_INCLUDES} ${GUI_INCLUDE_DIRS} - ${CAS_INCLUDE_DIRS} - ${OMNIORB_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/GEOMGUI ${PROJECT_SOURCE_DIR}/src/GEOMBase - ${PROJECT_SOURCE_DIR}/src/GEOM - ${PROJECT_SOURCE_DIR}/src/GEOMUtils - - - ${PROJECT_BINARY_DIR}/idl - ${PROJECT_BINARY_DIR} + ${PROJECT_SOURCE_DIR}/src/GEOM ${PROJECT_SOURCE_DIR}/src/OBJECT - ${PROJECT_SOURCE_DIR}/src/GEOMClient - ${PROJECT_SOURCE_DIR}/src/GEOMImpl ${PROJECT_SOURCE_DIR}/src/GEOMUtils - ${PROJECT_SOURCE_DIR}/src/DlgRef - ${PROJECT_BINARY_DIR}/src/DlgRef - + ${PROJECT_SOURCE_DIR}/src/GEOMClient + ${PROJECT_BINARY_DIR}/idl ) # additional preprocessor / compiler flags ADD_DEFINITIONS( ${QT_DEFINITIONS} ${GUI_DEFINITIONS} - ${CAS_DEFINITIONS} - ${OMNIORB_DEFINITIONS} + ${CAS_DEFINITIONS} ) # libraries to link to SET(_link_LIBRARIES ${QT_LIBRARIES} ${GUI_SalomeApp} - ${GUI_suit} - ${GUI_qtx} - ${GUI_QxScene} ${GUI_GraphicsView} - ${GUI_SalomeObject} - GEOMUtils - ${KERNEL_SalomeDS} -) + GEOM + GEOMBase + ) # --- headers --- @@ -80,7 +62,7 @@ SET(DependencyTree_HEADERS SET(_moc_HEADERS DependencyTree_View.h DependencyTree_ViewModel.h -) + ) # --- sources --- @@ -88,13 +70,13 @@ SET(_moc_HEADERS QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) SET(DependencyTree_SOURCES - DependencyTree_View.cxx - DependencyTree_Object.cxx DependencyTree_Arrow.cxx + DependencyTree_Object.cxx DependencyTree_Selector.cxx + DependencyTree_View.cxx DependencyTree_ViewModel.cxx ${_moc_SOURCES} -) + ) # --- resources --- @@ -103,7 +85,7 @@ SET(_res_files resources/DependencyTree_msg_en.ts resources/DependencyTree_msg_fr.ts resources/DependencyTree_msg_ja.ts -) + ) # --- rules --- diff --git a/src/DependencyTree/DependencyTree_Object.cxx b/src/DependencyTree/DependencyTree_Object.cxx index ebe0cfe90..a25f4caa3 100644 --- a/src/DependencyTree/DependencyTree_Object.cxx +++ b/src/DependencyTree/DependencyTree_Object.cxx @@ -22,7 +22,6 @@ // GEOM includes #include -#include // GUI includes #include @@ -45,6 +44,7 @@ myIsMainObject( false ) myColor = resMgr->colorValue( "Geometry", "dependency_tree_node_color", QColor( 62, 180, 238 ) ); mySelectColor = resMgr->colorValue( "Geometry", "dependency_tree_select_node_color", QColor( 237, 243, 58 ) ); myMainObjectColor = resMgr->colorValue( "Geometry", "dependency_tree_main_node_color", QColor( 238, 90, 125 ) ); + myUnpublishObjectColor = resMgr->colorValue( "Geometry", "dependency_tree_unpublish_node_color", QColor( 255, 255, 255 ) ); myPolygonItem = new QGraphicsPolygonItem(); QPolygonF myPolygon; @@ -52,8 +52,6 @@ myIsMainObject( false ) << QPointF( -itemW, itemH ) << QPointF( -itemW, -itemH ); myPolygonItem->setPolygon( myPolygon ); - myPolygonItem->setBrush( myColor ); - myPolygonItem->setPen( getPen( myColor ) ); myTextItem = new QGraphicsSimpleTextItem(); QFont textFont; @@ -174,11 +172,12 @@ void DependencyTree_Object::updateName() if( studyEntry.isEmpty() ) { if( name.isEmpty() ) name = "unpublished"; - myColor = QColor( 255, 255, 255 ); - myPolygonItem->setBrush( myColor ); - myPolygonItem->setPen( getPen( myColor ) ); + myColor = myUnpublishObjectColor; } + myPolygonItem->setBrush( myColor ); + myPolygonItem->setPen( getPen( myColor ) ); + setName( name ); myTextItem->setText( name ); @@ -204,7 +203,12 @@ void DependencyTree_Object::updateName() //================================================================================= void DependencyTree_Object::setColor( const QColor& theColor ) { - myColor = theColor; + QString studyEntry = myGeomObject->GetStudyEntry(); + if( studyEntry.isEmpty() ) + myColor = myUnpublishObjectColor; + else + myColor = theColor; + } //================================================================================= @@ -225,6 +229,18 @@ void DependencyTree_Object::setMainObjectColor( const QColor& theColor ) myMainObjectColor = theColor; } +//================================================================================= +// function : setUnpublishObjectColor() +// purpose : set color if current item is unpublished object +//================================================================================= +void DependencyTree_Object::setUnpublishObjectColor( const QColor& theColor ) +{ + myUnpublishObjectColor = theColor; + QString studyEntry = myGeomObject->GetStudyEntry(); + if( studyEntry.isEmpty() ) + myColor = myUnpublishObjectColor; +} + //================================================================================= // function : setIsMainObject() // purpose : set true if current item is main object of dependency tree diff --git a/src/DependencyTree/DependencyTree_Object.h b/src/DependencyTree/DependencyTree_Object.h index 64be40adc..fae775edc 100644 --- a/src/DependencyTree/DependencyTree_Object.h +++ b/src/DependencyTree/DependencyTree_Object.h @@ -23,8 +23,8 @@ #include // GEOM includes -#include -#include +#include +#include CORBA_CLIENT_HEADER(GEOM_Gen) #include @@ -50,9 +50,10 @@ public: void updateName(); - void setColor(const QColor& ); - void setSelectColor(const QColor& ); - void setMainObjectColor(const QColor& ); + void setColor( const QColor& ); + void setSelectColor( const QColor& ); + void setMainObjectColor( const QColor& ); + void setUnpublishObjectColor( const QColor& ); void setIsMainObject( bool ); @@ -63,6 +64,7 @@ private: QColor myColor; QColor mySelectColor; QColor myMainObjectColor; + QColor myUnpublishObjectColor; QGraphicsPolygonItem* myPolygonItem; QGraphicsSimpleTextItem* myTextItem; diff --git a/src/DependencyTree/DependencyTree_Selector.cxx b/src/DependencyTree/DependencyTree_Selector.cxx index 7d17d63c8..370e4511c 100644 --- a/src/DependencyTree/DependencyTree_Selector.cxx +++ b/src/DependencyTree/DependencyTree_Selector.cxx @@ -28,6 +28,7 @@ //GEOM includes #include +#include DependencyTree_Selector::DependencyTree_Selector( DependencyTree_ViewModel* theModel, SUIT_SelectionMgr* theSelMgr ) :LightApp_GVSelector( (GraphicsView_Viewer*)theModel, theSelMgr ) diff --git a/src/DependencyTree/DependencyTree_View.cxx b/src/DependencyTree/DependencyTree_View.cxx index e675dc410..42e8715e7 100644 --- a/src/DependencyTree/DependencyTree_View.cxx +++ b/src/DependencyTree/DependencyTree_View.cxx @@ -117,8 +117,16 @@ void DependencyTree_View::init( GraphicsView_ViewFrame* theViewFrame ) connect( myDisplayDescendants, SIGNAL( toggled( bool ) ), this, SLOT( onHierarchyType() ) ); connect( updateButton, SIGNAL( clicked() ), this, SLOT( onUpdateModel() ) ); - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); + if ( aGeomGUI ) { + connect( aGeomGUI, SIGNAL( SignalDependencyTreeParamChanged( const QString&, const QString& ) ), + this, SLOT( onPreferenceChanged( const QString&, const QString& ) ) ); + connect( aGeomGUI, SIGNAL( SignalDependencyTreeRenameObject( const QString& ) ), + this, SLOT( onRenameObject( const QString& ) ) ); + } + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); setPrefBackgroundColor( resMgr->colorValue( "Geometry", "dependency_tree_background_color", QColor( 255, 255, 255 ) ) ); setNodesMovable( resMgr->booleanValue( "Geometry", "dependency_tree_move_nodes", true ) ); setHierarchyType( resMgr->integerValue( "Geometry", "dependency_tree_hierarchy_type", 0 ) ); @@ -175,22 +183,6 @@ DependencyTree_Object* DependencyTree_View::getObjectByEntry( const std::string& return myTreeMap[ theEntry ]; } -//================================================================================= -// function : updateObjectName() -// purpose : update object name, having edited it in Object Browser -//================================================================================= -bool DependencyTree_View::updateObjectName( const std::string& theEntry ) -{ - bool res = false; - for( initSelected(); moreSelected(); nextSelected() ) { - if( DependencyTree_Object* aDepObject = dynamic_cast( selectedObject() ) ) { - aDepObject->updateName(); - res = true; - } - } - return res; -} - //================================================================================= // function : setHierarchyType() // purpose : set hierarchy type of dependency tree @@ -267,6 +259,19 @@ void DependencyTree_View::setMainNodeColor( const QColor& theColor ) } } +//================================================================================= +// function : setUnpublishNodeColor() +// purpose : set unpublished node color from preferences +//================================================================================= +void DependencyTree_View::setUnpublishNodeColor( const QColor& theColor ) +{ + EntryObjectMap::const_iterator i; + for( i = myTreeMap.begin(); i != myTreeMap.end(); i++ ) { + DependencyTree_Object* object = myTreeMap[ i->first ]; + object->setUnpublishObjectColor( theColor ); + } +} + //================================================================================= // function : setSelectNodeColor() // purpose : set selected node color from preferences @@ -369,6 +374,66 @@ void DependencyTree_View::onHierarchyType() updateView(); } +//================================================================================= +// function : onPreferencesChanged() +// purpose : slot for changing tree parameters from preferences +//================================================================================= +void DependencyTree_View::onPreferenceChanged( const QString& section, const QString& param ) +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + if( param == QString("dependency_tree_hierarchy_type") ) { + int hierarchyType = resMgr->integerValue( section, param, 0); + setHierarchyType( hierarchyType ); + } + else if( param == QString("dependency_tree_move_nodes") ) { + bool isNodesMovable = resMgr->booleanValue( section, param, true); + setNodesMovable( isNodesMovable ); + } + else if( param == QString("dependency_tree_background_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 255, 255, 255 ) ); + setPrefBackgroundColor( c ); + } + else if( param == QString("dependency_tree_node_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 62, 180, 238 ) ); + setNodeColor( c ); + } + else if( param == QString("dependency_tree_main_node_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 238, 90, 125 ) ); + setMainNodeColor( c ); + } + else if( param == QString("dependency_tree_unpublish_node_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 255, 255, 255 ) ); + setUnpublishNodeColor( c ); + } + else if( param == QString("dependency_tree_select_node_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 237, 243, 58 ) ); + setSelectNodeColor( c ); + } + else if( param == QString("dependency_tree_arrow_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 0, 0, 130 ) ); + setArrowColor( c ); + } + else if( param == QString("dependency_tree_highlight_arrow_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 0, 0, 255 ) ); + setHighlightArrowColor( c ); + } + else if( param == QString("dependency_tree_select_arrow_color") ) { + QColor c = resMgr->colorValue( section, param, QColor( 255, 0, 0 ) ); + setSelectArrowColor( c ); + } +} + +//================================================================================= +// function : onRenameObject() +// purpose : update object name, having edited it in Object Browser +//================================================================================= +void DependencyTree_View::onRenameObject( const QString& theEntry ) +{ + DependencyTree_Object* object = getObjectByEntry( theEntry.toStdString() ); + object->updateName(); +} + //================================================================================= // function : parseTree() // purpose : parse created model to initialize all nodes and arrows diff --git a/src/DependencyTree/DependencyTree_View.h b/src/DependencyTree/DependencyTree_View.h index 94943ab7d..29d16bae5 100644 --- a/src/DependencyTree/DependencyTree_View.h +++ b/src/DependencyTree/DependencyTree_View.h @@ -60,17 +60,6 @@ public: int getStudyId() const; DependencyTree_Object* getObjectByEntry( const std::string& ); - bool updateObjectName( const std::string& theEntry ); - - void setHierarchyType( const int ); - void setNodesMovable( const bool ); - void setPrefBackgroundColor( const QColor& ); - void setNodeColor( const QColor& ); - void setMainNodeColor( const QColor& ); - void setSelectNodeColor( const QColor& ); - void setArrowColor( const QColor& ); - void setHighlightArrowColor( const QColor& ); - void setSelectArrowColor( const QColor& ); public slots: @@ -81,6 +70,8 @@ private slots: void onUpdateModel(); void onMoveNodes( bool ); void onHierarchyType(); + void onPreferenceChanged( const QString&, const QString& ); + void onRenameObject( const QString& theEntry ); private: @@ -99,9 +90,20 @@ private: void updateView(); void clearView( bool ); + int checkMaxLevelsNumber(); + void getNewTreeModel( bool = true, bool = true ); - int checkMaxLevelsNumber(); + void setHierarchyType( const int ); + void setNodesMovable( const bool ); + void setPrefBackgroundColor( const QColor& ); + void setNodeColor( const QColor& ); + void setMainNodeColor( const QColor& ); + void setUnpublishNodeColor( const QColor& ); + void setSelectNodeColor( const QColor& ); + void setArrowColor( const QColor& ); + void setHighlightArrowColor( const QColor& ); + void setSelectArrowColor( const QColor& ); GEOMUtils::TreeModel myTreeModel; diff --git a/src/DependencyTree/DependencyTree_ViewModel.cxx b/src/DependencyTree/DependencyTree_ViewModel.cxx index bc62e35c6..74bf9f2c4 100644 --- a/src/DependencyTree/DependencyTree_ViewModel.cxx +++ b/src/DependencyTree/DependencyTree_ViewModel.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include // GEOM includes diff --git a/src/GEOMGUI/CMakeLists.txt b/src/GEOMGUI/CMakeLists.txt index 9ac751273..c5dc25f8a 100755 --- a/src/GEOMGUI/CMakeLists.txt +++ b/src/GEOMGUI/CMakeLists.txt @@ -39,7 +39,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GEOMClient ${PROJECT_SOURCE_DIR}/src/GEOMImpl ${PROJECT_SOURCE_DIR}/src/GEOMUtils - ${PROJECT_SOURCE_DIR}/src/DependencyTree ${CMAKE_CURRENT_SOURCE_DIR} ) @@ -59,7 +58,6 @@ SET(_link_LIBRARIES Material GEOMImpl GEOMUtils - DependencyTree ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDS} ${KERNEL_SalomeDSClient} diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 5f45808a3..6f21d29b1 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5068,13 +5068,17 @@ Please, select face, shell or solid and try again PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR Main node color + + PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR + Unpublished node color + PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR Selected node color PREF_DEPENDENCY_VIEW_ARROW_COLOR - Arrow color + Default arrow color PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 7c7878d86..1c3146a9a 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -5028,6 +5028,66 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_PREVIEW Prévisualiser + + PREF_TAB_DEPENDENCY_VIEW + Dependency Tree + + + PREF_HIERARCHY_TYPE + Hierarchy type + + + MEN_ONLY_ASCENDANTS + Display only ascendants tree + + + MEN_ONLY_DESCENDANTS + Display only descendants tree + + + MEN_BOTH_ASCENDANTS_DESCENDANTS + Display both ascendants and descendants trees + + + GEOM_MOVE_POSSIBILITY + Possibility to move nodes + + + PREF_GROUP_DEPENDENCY_VIEW_COLOR + Color + + + PREF_DEPENDENCY_VIEW_BACKGROUND_COLOR + Background color + + + PREF_DEPENDENCY_VIEW_NODE_COLOR + Default node color + + + PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR + Main node color + + + PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR + Unpublished node color + + + PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR + Selected node color + + + PREF_DEPENDENCY_VIEW_ARROW_COLOR + Arrow color + + + PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR + Highlighted arrow color + + + PREF_DEPENDENCY_VIEW_SELECT_ARROW_COLOR + Selected arrow color + GEOM_ALL_IMPORT_FILES Tous les formats supportés ( %1 ) diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index ecad4cb1f..0609b2ae2 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -5003,6 +5003,66 @@ GEOM_PREVIEW プレビュー + + PREF_TAB_DEPENDENCY_VIEW + Dependency Tree + + + PREF_HIERARCHY_TYPE + Hierarchy type + + + MEN_ONLY_ASCENDANTS + Display only ascendants tree + + + MEN_ONLY_DESCENDANTS + Display only descendants tree + + + MEN_BOTH_ASCENDANTS_DESCENDANTS + Display both ascendants and descendants trees + + + GEOM_MOVE_POSSIBILITY + Possibility to move nodes + + + PREF_GROUP_DEPENDENCY_VIEW_COLOR + Color + + + PREF_DEPENDENCY_VIEW_BACKGROUND_COLOR + Background color + + + PREF_DEPENDENCY_VIEW_NODE_COLOR + Default node color + + + PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR + Main node color + + + PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR + Unpublished node color + + + PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR + Selected node color + + + PREF_DEPENDENCY_VIEW_ARROW_COLOR + Arrow color + + + PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR + Highlighted arrow color + + + PREF_DEPENDENCY_VIEW_SELECT_ARROW_COLOR + Selected arrow color + GEOM_ALL_IMPORT_FILES サポートされているすべての形式 (%1) diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 8fed3dfef..0da53dde9 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -75,10 +75,6 @@ #include #include -#include -#include -#include - #include // #include #include @@ -2630,7 +2626,9 @@ void GeometryGUI::createPreferences() int DependencyViewId = addPreference( tr( "PREF_TAB_DEPENDENCY_VIEW" ) ); - int hierarchy_type = addPreference( tr( "PREF_HIERARCHY_TYPE" ), DependencyViewId, + int treeGeneralGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), DependencyViewId ); + + int hierarchy_type = addPreference( tr( "PREF_HIERARCHY_TYPE" ), treeGeneralGroup, LightApp_Preferences::Selector, "Geometry", "dependency_tree_hierarchy_type" ); QStringList aHierarchyTypeList; @@ -2646,7 +2644,7 @@ void GeometryGUI::createPreferences() setPreferenceProperty( hierarchy_type, "strings", aHierarchyTypeList ); setPreferenceProperty( hierarchy_type, "indexes", aHierarchyTypeIndexesList ); - addPreference( tr( "GEOM_MOVE_POSSIBILITY" ), DependencyViewId, + addPreference( tr( "GEOM_MOVE_POSSIBILITY" ), treeGeneralGroup, LightApp_Preferences::Bool, "Geometry", "dependency_tree_move_nodes" ); int treeColorGroup = addPreference( tr( "PREF_GROUP_DEPENDENCY_VIEW_COLOR" ), DependencyViewId ); @@ -2658,6 +2656,8 @@ void GeometryGUI::createPreferences() LightApp_Preferences::Color, "Geometry", "dependency_tree_node_color" ); addPreference( tr( "PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR"), treeColorGroup, LightApp_Preferences::Color, "Geometry", "dependency_tree_main_node_color" ); + addPreference( tr( "PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR"), treeColorGroup, + LightApp_Preferences::Color, "Geometry", "dependency_tree_unpublish_node_color" ); addPreference( tr( "PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR"), treeColorGroup, LightApp_Preferences::Color, "Geometry", "dependency_tree_select_node_color" ); @@ -2742,54 +2742,7 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par aDisplayer.UpdateViewer(); } else if ( param.startsWith( "dependency_tree") ) - { - SalomeApp_Application* app = getApp(); - if ( !app ) return; - - SUIT_ViewManager *svm = app->getViewManager( GraphicsView_Viewer::Type(), false ); - if( !svm ) return; - - if( DependencyTree_ViewModel* viewModel = dynamic_cast( svm->getViewModel() ) ) - if( DependencyTree_View* view = dynamic_cast( viewModel->getActiveViewPort() ) ) { - if( param == QString("dependency_tree_hierarchy_type") ) { - int hierarchyType = aResourceMgr->integerValue( section, param, 0); - view->setHierarchyType( hierarchyType ); - } - else if( param == QString("dependency_tree_move_nodes") ) { - bool isNodesMovable = aResourceMgr->booleanValue( section, param, true); - view->setNodesMovable( isNodesMovable ); - } - else if( param == QString("dependency_tree_background_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 255, 255, 255 ) ); - view->setPrefBackgroundColor( c ); - } - else if( param == QString("dependency_tree_node_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 62, 180, 238 ) ); - view->setNodeColor( c ); - } - else if( param == QString("dependency_tree_main_node_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 238, 90, 125 ) ); - view->setMainNodeColor( c ); - } - else if( param == QString("dependency_tree_select_node_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 237, 243, 58 ) ); - view->setSelectNodeColor( c ); - } - else if( param == QString("dependency_tree_arrow_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 0, 0, 130 ) ); - view->setArrowColor( c ); - } - else if( param == QString("dependency_tree_highlight_arrow_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 0, 0, 255 ) ); - view->setHighlightArrowColor( c ); - } - else if( param == QString("dependency_tree_select_arrow_color") ) { - QColor c = aResourceMgr->colorValue( section, param, QColor( 255, 0, 0 ) ); - view->setSelectArrowColor( c ); - } - - } - } + emit SignalDependencyTreeParamChanged( section, param ); } } @@ -3343,11 +3296,7 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name) GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); if (!CORBA::is_nil(anObj)) { anObj->SetName( name.toLatin1().data() ); // Rename the corresponding GEOM_Object - // rename the given object in the dependency tree - if ( SUIT_ViewManager *svm = app->getViewManager( GraphicsView_Viewer::Type(), false ) ) - if ( DependencyTree_ViewModel* viewModel = dynamic_cast( svm->getViewModel() ) ) - if ( DependencyTree_View* view = dynamic_cast( viewModel->getActiveViewPort() ) ) - view->updateObjectName( anObj->GetEntry() ); + emit SignalDependencyTreeRenameObject( anObj->GetEntry() ); } result = true; } diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 4f28fc928..f2f2ad8e5 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -182,6 +182,8 @@ signals : void SignalDeactivateActiveDialog(); void SignalCloseAllDialogs(); void SignalDefaultStepValueChanged( double newVal ); + void SignalDependencyTreeParamChanged( const QString&, const QString& ); + void SignalDependencyTreeRenameObject( const QString& ); protected: virtual LightApp_Selection* createSelection() const;