From d323a0aa049f158ed4b2469afeea6e803496fa1e Mon Sep 17 00:00:00 2001 From: asv Date: Fri, 3 Jun 2005 10:41:52 +0000 Subject: [PATCH] Displayer: bug in clearTemporary() is fixed. GeometryGUI: rules of popups are changed (fixed). --- src/GEOMGUI/GEOM_Displayer.cxx | 20 +++++++++----------- src/GEOMGUI/GEOM_msg_en.po | 16 +++++++++++----- src/GEOMGUI/GeometryGUI.cxx | 22 ++++++++++++++++++++-- src/GEOMGUI/GeometryGUI.h | 1 + 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 06d24894c..a8a839790 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1113,17 +1113,15 @@ bool GEOM_Displayer::ToActivate() const //================================================================= void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr ) { - SALOME_ListIO toBeSelected; - theSelMgr->selectedObjects(toBeSelected) -; - SALOME_ListIteratorOfListIO anIter( toBeSelected ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if ( !(anIO->hasEntry()) || ( strncmp( anIO->getEntry(), "TEMP_", 5 ) != 0 ) ) - toBeSelected.Remove( anIter ); - } + SALOME_ListIO selected, toSelect; + theSelMgr->selectedObjects( selected ); + + for ( SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) { + Handle(SALOME_InteractiveObject) io = it.Value(); + if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 ) + toSelect.Append( it.Value() ); + } - theSelMgr->setSelectedObjects( toBeSelected, true ); + theSelMgr->setSelectedObjects( toSelect, true ); } diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index dc7d9be1d..949154307 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: 2005-06-01 16:24+0400\n" +"PO-Revision-Date: 2003-10-27 17:32+0100\n" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -2041,22 +2041,22 @@ msgid "STB_CIRCLE" msgstr "Create a circle" msgid "TOP_ELLIPSE" -msgstr "Create an ellipse" +msgstr "Create a ellipse" msgid "MEN_ELLIPSE" msgstr "Ellipse" msgid "STB_ELLIPSE" -msgstr "Create an ellipse" +msgstr "Create a ellipse" msgid "TOP_ARC" -msgstr "Create an arc" +msgstr "Create a arc" msgid "MEN_ARC" msgstr "Arc" msgid "STB_ARC" -msgstr "Create an arc" +msgstr "Create a arc" msgid "TOP_CURVE" msgstr "Create a curve" @@ -2876,3 +2876,9 @@ msgstr "Generation" msgid "TOOL_TRANSFORMATION" msgstr "Transformation" + +msgid "TLT_RENAME" +msgstr "Rename" + +msgid "NAME_LBL" +msgstr "Name: " diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index ac147d58c..da79dd19f 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -49,7 +49,9 @@ #include #include #include +#include #include +#include // External includes #include @@ -308,6 +310,7 @@ void GeometryGUI::OnGUIEvent( int id ) id == 804 || // POPUP VIEWER - ADD IN STUDY id == 901 || // OBJECT BROWSER - RENAME id == 9024 ) { // OBJECT BROWSER - OPEN + //cout << "id " << id << " received" << endl; library = getLibrary( "libGEOMToolsGUI.so" ); } else if( id == 211 || // MENU VIEW - WIREFRAME/SHADING @@ -936,9 +939,9 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( 216 ), -1, -1 ); // display mgr->setRule( action( 216 ), "$client in {'ObjectBrowser'} and selcount>0 and (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true ); mgr->insert( action( 215 ), -1, -1 ); // erase - mgr->setRule( action( 215 ), "$client in {'ObjectBrowser'} and ((($type in {'Shape' 'Group'}) and ($isVisible in {true})) or ($type in {'Component'} and selcount=1))", true ); + mgr->setRule( action( 215 ), "$client in {'ObjectBrowser'} and selcount>0 and (($type in {'Shape' 'Group'} and $isVisible in {true}) or ($type in {'Component'} and selcount=1))", true ); mgr->insert( action( 213 ), -1, -1 ); // display only - mgr->setRule( action( 213 ), "$client in {'ObjectBrowser'} and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true ); + mgr->setRule( action( 213 ), "$client in {'ObjectBrowser'} and selcount>0 and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true ); mgr->insert( separator(), -1, -1 ); dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe @@ -947,6 +950,7 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading mgr->setRule( action( 80312 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); mgr->setRule( action( 80312 ), "$displaymode in {'Shading'}", false ); + mgr->insert( separator(), -1, -1 ); mgr->insert( action( 8032 ), -1, -1 ); // color mgr->setRule( action( 8032 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); mgr->insert( action( 8033 ), -1, -1 ); // transparency @@ -1422,3 +1426,17 @@ SalomeApp_Selection* GeometryGUI::createSelection() const return new GEOMGUI_Selection(); } +void GeometryGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& title ) +{ + SalomeApp_Module::contextMenuPopup( client, menu, title ); + SALOME_ListIO lst; + getApp()->selectionMgr()->selectedObjects( lst ); + if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) { + Handle(SALOME_InteractiveObject) io = lst.First(); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + _PTR(Study) study = appStudy->studyDS(); + _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); + if ( obj ) + title = QString( obj->GetName().c_str() ); + } +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 968f7798c..966e331cb 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -104,6 +104,7 @@ public: virtual void windows( QMap& ) const; virtual void viewManagers( QStringList& ) const; + virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); public slots: virtual void deactivateModule( SUIT_Study* ); -- 2.39.2