+
+//=================================================================================
+// function : onCloseView()
+// purpose : SLOT called when close view
+//=================================================================================
+void SMESHGUI_PreviewDlg::onCloseView()
+{
+ if ( mySimulation && mySimulation->GetActor())
+ mySimulation->SetVisibility(false);
+ delete mySimulation;
+ mySimulation=0;
+}
+
+//=================================================================================
+// function : onOpenView()
+// purpose : SLOT called when open view
+//=================================================================================
+void SMESHGUI_PreviewDlg::onOpenView()
+{
+ if ( !mySimulation)
+ mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+}
+//=================================================================================
+// class : SMESHGUI_SMESHGUI_MultiPreviewDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_MultiPreviewDlg::SMESHGUI_MultiPreviewDlg( SMESHGUI* theModule ) :
+ QDialog( SMESH::GetDesktop( theModule ) ),
+ mySMESHGUI( theModule ),
+ myIsApplyAndClose( false )
+{
+ mySimulationList.clear();
+ connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
+}
+
+//=================================================================================
+// function : ~SMESHGUI_MultiPreviewDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_MultiPreviewDlg::~SMESHGUI_MultiPreviewDlg()
+{
+ qDeleteAll( mySimulationList );
+}
+
+//=================================================================================
+// function : showPreview
+// purpose : Show preview in the viewer
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::showPreview()
+{
+ for ( int i = 0; i < mySimulationList.count(); i++ )
+ if(mySimulationList[i] && mySimulationList[i]->GetActor())
+ mySimulationList[i]->SetVisibility( true );
+}
+
+//=================================================================================
+// function : hidePreview
+// purpose : Hide preview in the viewer
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::hidePreview()
+{
+ for ( int i = 0; i < mySimulationList.count(); i++ )
+ if(mySimulationList[i] && mySimulationList[i]->GetActor())
+ mySimulationList[i]->SetVisibility( false );
+}
+
+//=================================================================================
+// function : connectPreviewControl
+// purpose : Connect the preview check box
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::connectPreviewControl()
+{
+ connect( myPreviewCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( onDisplaySimulation( bool ) ) );
+}
+
+//=================================================================================
+// function : toDisplaySimulation
+// purpose :
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::toDisplaySimulation()
+{
+ onDisplaySimulation( true );
+}
+
+//=================================================================================
+// function : onDisplaySimulation
+// purpose :
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::onDisplaySimulation( bool /*toDisplayPreview*/ )
+{
+ //Empty implementation here
+}
+
+//================================================================
+// Function : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_MultiPreviewDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// Function : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_MultiPreviewDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
+
+//================================================================
+// Function : setSimulationPreview
+// Purpose :
+//================================================================
+void SMESHGUI_MultiPreviewDlg::setSimulationPreview( QList<SMESH::MeshPreviewStruct_var>& theMeshPreviewStruct )
+{
+ hidePreview();
+ qDeleteAll( mySimulationList );
+ mySimulationList.clear();
+ for ( int i = 0; i < theMeshPreviewStruct.count(); i++ ) {
+ mySimulationList << new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( mySMESHGUI ) );
+ mySimulationList[i]->SetData( theMeshPreviewStruct[i].in() );
+ }
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose : SLOT called when close view
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::onCloseView()
+{
+ qDeleteAll( mySimulationList );
+ mySimulationList.clear();
+}