]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix bug 16041: IOLS. Regression with selection.
authorjfa <jfa@opencascade.com>
Fri, 25 May 2007 13:09:01 +0000 (13:09 +0000)
committerjfa <jfa@opencascade.com>
Fri, 25 May 2007 13:09:01 +0000 (13:09 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_InputPane.cxx
src/VISUGUI/VisuGUI_InputPane.h
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h

index 36251fa5985af1209cb8c86b83a190b34577bb17..95c9fa52e135a2a82d0e7731e4d833e47670b994 100644 (file)
@@ -2694,7 +2694,6 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
-  mySelectedObjects = aListIO;
 
   if (aListIO.Extent() < 1) return;
 
@@ -3358,13 +3357,6 @@ VisuGUI
   return myScalarBarsMap;
 }
 
-void
-VisuGUI
-::selectedObjects( SALOME_ListIO& theList ) const
-{
-  theList = mySelectedObjects;
-}
-
 LightApp_Displayer* VisuGUI::displayer()
 {
   if( !myDisplayer )
index 8205d4e2d6c4dd3d7f0bbd425dd64eb1cb5d1d01..c0c9834d76beede534ddd4d017df30adced1e9a3 100644 (file)
@@ -77,8 +77,6 @@ public:
 
   VISU::TViewToPrs3d&
   getScalarBarsMap();
-
-  void selectedObjects( SALOME_ListIO& theList ) const;
   
 public slots:
   virtual bool deactivateModule( SUIT_Study* );
@@ -185,7 +183,6 @@ private:
 
 private:
   LightApp_Displayer* myDisplayer;
-  SALOME_ListIO mySelectedObjects;
   VISU::TViewToPrs3d myScalarBarsMap;
 };
 
index fb1c77d4f2c03d33e070a214a156e3ee1a8727bd..1ee34f36e8466fb2303c953bbb1acdec1d3989e0 100644 (file)
@@ -84,7 +84,9 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
 {
   setFrameStyle( QFrame::NoFrame );
 
-  connect( VISU::GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
+  LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(theModule);
+
+  connect( aSelectionMgr, SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
 
   QGridLayout* aMainLayout = new QGridLayout( this, 1, 1, 11, 6 ); 
 
@@ -202,6 +204,9 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
   connect( myAddButton, SIGNAL(clicked()), this, SLOT(onAdd()));
   connect( myRemoveButton, SIGNAL(clicked()), this, SLOT(onRemove()));
 
+  // Save current selection (to be restored in destructor)
+  aSelectionMgr->selectedObjects(mySavedSelection);
+
   onTypeChanged();
   onSelectionChanged();
 
@@ -214,11 +219,16 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
 //---------------------------------------------------------------
 VisuGUI_InputPane::~VisuGUI_InputPane()
 {
-  if( myFieldFilter )
+  LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
+
+  if (myFieldFilter)
   {
-    VISU::GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
+    aSelectionMgr->removeFilter(myFieldFilter);
     delete myFieldFilter;
   }
+
+  // Restore initial selection
+  aSelectionMgr->setSelectedObjects(mySavedSelection);
 }
 
 
index e5e3fb30c103c2eac73ecdd4cefc7f3a7f04bbfb..47a0cf8c6f6301e771b8c065b9cb56ccd49f670c 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "VISUConfig.hh"
 
+#include "SALOME_ListIO.hxx"
+
 #include <qgroupbox.h>
 
 class QCheckBox;
@@ -103,6 +105,7 @@ private:
   int                myEntity;
 
   VisuGUI_FieldFilter* myFieldFilter;
+  SALOME_ListIO        mySavedSelection;
 };
 
 #endif
index 0ae3d9d19dcf4a62dd5c67a32833d0e4d0a1a26e..abf4cdb9e4401edfa6ea4431927f05535c16b5ae 100644 (file)
@@ -85,7 +85,6 @@ namespace VISU
        QApplication::restoreOverrideCursor();
       }
       delete aDlg;
-      RestoreSelection(theModule);
     }
   }
 
@@ -289,11 +288,10 @@ namespace VISU
     if (!GetViewWindow<TViewer>(theModule))
       return;
 
-    TPrs3d_i* aPrs3d = CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>
+    //TPrs3d_i* aPrs3d =
+    CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>
       (theModule,theTimeStampSObj,thePublishInStudyMode);
 
-    RestoreSelection(theModule);
-
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
   }
 
index a4246b58354738bd45de2de013053b9c60e06b69..97bbd189eee6e412b8ca138c99bf537825b3e2e9 100644 (file)
@@ -418,24 +418,6 @@ namespace VISU
     theSelectionMgr->setSelectedObjects(aNewListIO);
   }
 
-  //------------------------------------------------------------
-  //! Restores selection after presentation creating and editing
-  void
-  RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d)
-  {
-    SALOME_ListIO aList;
-    theModule->selectedObjects(aList);
-
-    if( thePrs3d )
-    {
-      Handle(SALOME_InteractiveObject) anIO = thePrs3d->GetIO();
-      aList.Append(anIO);
-    }
-
-    LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
-    aSelectionMgr->setSelectedObjects(aList);
-  }
-
   /*!
    * \brief Check, if "Delete" popup-menu can be put on current selection
    *
index 901e4d21c049a311af6305541f1714f974e7c60f..b1e55a5ff58ade753655c2525c28c99c766b14ca 100644 (file)
@@ -130,8 +130,6 @@ namespace VISU
   void                                 Remove(LightApp_SelectionMgr* theSelectionMgr,
                                              const Handle(SALOME_InteractiveObject)& theIO);
 
-  void                                 RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d = NULL);
-
   bool                                 IsRemovableSelected(const SalomeApp_Module* theModule);
 
   void                                 DeleteSObject(VisuGUI* theModule,