/*!
SLOT: called when action "Clone view" is activated
*/
-void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* )
+void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF )
{
+ if( !clonedVF || !newVF )
+ return;
+
+ // 1) Copy all properties of view
+
+ newVF->copyPreferences( clonedVF );
+
+ // 2) Display all curves displayed in cloned view
+
+ QList<Plot2d_Curve> aCurves;
+ clonedVF->getCurves( aCurves );
+ QList<Plot2d_Curve>::const_iterator anIt = aCurves.begin(), aLast = aCurves.end();
+
+ for( ; anIt!=aLast; anIt++ )
+ if( clonedVF->isVisible( *anIt ) )
+ newVF->displayCurve( *anIt, false );
+ newVF->Repaint();
+
+ if ( newVF )
+ {
+ // find view window corresponding to the frame
+ QWidget* p = newVF->parentWidget();
+ while( p && !p->inherits( "SUIT_ViewWindow" ) )
+ p = p->parentWidget();
+
+ // emits signal
+ if ( p && p->inherits( "SUIT_ViewWindow" ) )
+ emit viewCloned( (SUIT_ViewWindow*)p );
+ }
}
/*!