From: rnv Date: Thu, 10 Jul 2008 06:49:51 +0000 (+0000) Subject: Issue 0019874 (EDF 746 VISU: Picking alphanumeric Gauss): X-Git-Tag: V4_1_0_maintainance_20080714~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e08ad93db875fe391cb05a4b2fe87ab39d4e450;p=modules%2Fvisu.git Issue 0019874 (EDF 746 VISU: Picking alphanumeric Gauss): When user creates a Gauss point presentation, the selection in the object browser should automatically switch to this presentation. --- diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 8ab2fb39..e5641107 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -43,6 +43,7 @@ #include "LightApp_Application.h" #include "SalomeApp_Module.h" +#include "LightApp_SelectionMgr.h" #include "SUIT_Desktop.h" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" @@ -506,7 +507,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, myModeLbl->setEnabled(isScalarMode); myModeCombo->setEnabled(isScalarMode); - // "Title" + // "Title" myTextDlg->setTitleText(QString(thePrs->GetTitle())); vtkFloatingPointType R, G, B; @@ -731,6 +732,7 @@ void VisuGUI_GaussScalarBarPane::onBarPref() * Constructor */ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule): + myModule(theModule), VisuGUI_Prs3dDlg(theModule) { setName("VisuGUI_GaussPointsDlg"); @@ -788,6 +790,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule): // Input pane myInputPane = new VisuGUI_InputPane(VISU::TGAUSSPOINTS, theModule, this); + myInputPane->SetRestoreInitialSelection(false); connect( myResultsButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleResults() ) ); connect( myResultsButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) ); @@ -923,8 +926,22 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) myPrsCopy->SetMagnification( mySizeBox->getMagnification() ); myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() ); - VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); - + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); + + //Set created Gauss points presentation selected, + //Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss) + if(thePrs){ + SALOME_ListIO aListIO; + LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule); + Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO(); + if(anIO && anIO->hasEntry()) { + aListIO.Append(anIO); + VISU::UpdateObjBrowser(myModule,true); + aSelectionMgr->setSelectedObjects(aListIO); + } + else + myInputPane->SetRestoreInitialSelection(true); + } return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index d5c28d99..dd95b4bd 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -167,6 +167,7 @@ private: QtxDblSpinBox* myScaleSpinBox; SALOME::GenericObjPtr myPrsCopy; + SalomeApp_Module* myModule; }; #endif // VISUGUI_GAUSSPOINTSDLS_H diff --git a/src/VISUGUI/VisuGUI_InputPane.cxx b/src/VISUGUI/VisuGUI_InputPane.cxx index 6b1a68f8..029e8038 100644 --- a/src/VISUGUI/VisuGUI_InputPane.cxx +++ b/src/VISUGUI/VisuGUI_InputPane.cxx @@ -80,7 +80,8 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, QGroupBox( theDialog ), myModule( theModule ), myDialog( theDialog ), - myPrs( NULL ) + myPrs( NULL ), + isRestoreInitialSelection(true) { setFrameStyle( QFrame::NoFrame ); @@ -230,9 +231,17 @@ VisuGUI_InputPane::~VisuGUI_InputPane() } // Restore initial selection - aSelectionMgr->setSelectedObjects(mySavedSelection); + if(isRestoreInitialSelection) + aSelectionMgr->setSelectedObjects(mySavedSelection); } +void VisuGUI_InputPane::SetRestoreInitialSelection(bool on){ + isRestoreInitialSelection = on; +} + +bool VisuGUI_InputPane::GetRestoreInitialSelection(){ + return isRestoreInitialSelection; +} //--------------------------------------------------------------- /*! diff --git a/src/VISUGUI/VisuGUI_InputPane.h b/src/VISUGUI/VisuGUI_InputPane.h index eea4df64..177a28e7 100644 --- a/src/VISUGUI/VisuGUI_InputPane.h +++ b/src/VISUGUI/VisuGUI_InputPane.h @@ -71,6 +71,8 @@ public: int storeToPrsObject( VISU::ColoredPrs3d_i* ); bool eventFilter (QObject* object, QEvent* event); + void SetRestoreInitialSelection(bool on); + bool GetRestoreInitialSelection(); public slots: virtual void onSelectionChanged(); @@ -104,6 +106,7 @@ private: VISU::Result_var myResult; int myEntity; + bool isRestoreInitialSelection; VisuGUI_FieldFilter* myFieldFilter; SALOME_ListIO mySavedSelection;