]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
PAL9828 - regression of Plot2d legend
authorasl <asl@opencascade.com>
Thu, 24 Nov 2005 08:34:39 +0000 (08:34 +0000)
committerasl <asl@opencascade.com>
Thu, 24 Nov 2005 08:34:39 +0000 (08:34 +0000)
src/Plot2d/Plot2d_ViewFrame.h
src/SPlot2d/SPlot2d_ViewModel.cxx
src/SPlot2d/SPlot2d_ViewModel.h

index e7d6a753d900ed9ea725498ada33834998548836..cc5614afa414ba260063c752dd2e4e9999cef9a0 100755 (executable)
@@ -37,6 +37,7 @@ public:
   Plot2d_Prs* CreatePrs( const char* entry = 0 );
 
   /* operations */
+  void    updateTitles();
   void    setTitle( const QString& title );
   QString getTitle() const { return myTitle; }
   void    displayCurve( Plot2d_Curve* curve, bool update = false );
@@ -95,7 +96,6 @@ protected:
   int     testOperation( const QMouseEvent& );
   void    readPreferences();
   void    writePreferences();
-  void    updateTitles();
   QString getInfo( const QPoint& pnt );
   virtual void wheelEvent( QWheelEvent* );
 
index b8b376a82f0072fadee38a89a46a43692d38d8e9..6f1156a441982cc22398246cf44ced9236eb9dec 100644 (file)
@@ -67,17 +67,41 @@ SPlot2d_Viewer::~SPlot2d_Viewer()
 /*!
   Renames curve if it is found
 */
-void SPlot2d_Viewer::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName ) 
+void SPlot2d_Viewer::rename( const Handle(SALOME_InteractiveObject)& IObject,
+                            const QString& newName, Plot2d_ViewFrame* fr ) 
 {
-  Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
-  if(aViewFrame == NULL) return;
+  Plot2d_ViewFrame* aViewFrame = fr ? fr : getActiveViewFrame();
+  if( !aViewFrame )
+    return;
 
-  Plot2d_Curve* curve = getCurveByIO( IObject );
-  if ( curve ) {
-    curve->setVerTitle( newName );
-    int key = aViewFrame->hasCurve( curve );
-    if ( key ) {
-      aViewFrame->setCurveTitle( key, newName );
+  QIntDictIterator<Plot2d_Curve> it( aViewFrame->getCurves() );
+  for( ; it.current(); ++it )
+  {
+    SPlot2d_Curve* aCurve = dynamic_cast<SPlot2d_Curve*>( it.current() );
+    if( aCurve && aCurve->hasIO() && aCurve->getIO()->isSame( IObject ) )
+    {
+      aCurve->setVerTitle( newName );
+      int key = aViewFrame->hasCurve( aCurve );
+      if( key )
+       aViewFrame->setCurveTitle( key, newName );
+    }
+
+    if( aCurve && aCurve->hasTableIO() && aCurve->getTableIO()->isSame( IObject ) )
+      aCurve->getTableIO()->setName( newName.latin1() );
+  }
+  aViewFrame->updateTitles();
+}
+
+void SPlot2d_Viewer::renameAll( const Handle(SALOME_InteractiveObject)& IObj, const QString& name )
+{
+  SUIT_ViewManager* vm = getViewManager();
+  if( vm )
+  {
+    const QPtrVector<SUIT_ViewWindow>& wnds = vm->getViews();
+    for( int i=0; i<wnds.size(); i++ )
+    {
+      Plot2d_ViewWindow* pwnd = dynamic_cast<Plot2d_ViewWindow*>( wnds.at( i ) );
+      rename( IObj, name, pwnd->getViewFrame() );
     }
   }
 }
@@ -307,10 +331,11 @@ Plot2d_ViewFrame* SPlot2d_Viewer::getActiveViewFrame()
   return NULL;
 }
 
-SPlot2d_Curve* SPlot2d_Viewer::getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject )
+SPlot2d_Curve* SPlot2d_Viewer::getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject,
+                                            Plot2d_ViewFrame* fr )
 {
   if ( !theIObject.IsNull() ) {
-    Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
+    Plot2d_ViewFrame* aViewFrame = fr ? fr : getActiveViewFrame();
     if(aViewFrame) {
       QIntDictIterator<Plot2d_Curve> it( aViewFrame->getCurves() );
       for ( ; it.current(); ++it ) {
index f325b032f4a35bbb211fcbd99bf1d76c442c7af5..9b47e839c714f33cc137d06e80b21a50bdacffb3 100644 (file)
@@ -31,7 +31,8 @@ public:
   /*  interactive object management */
   void highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight, bool update = true ) {}
   void unHighlightAll() {}
-  void rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName );
+  void rename( const Handle(SALOME_InteractiveObject)&, const QString&, Plot2d_ViewFrame* = 0 );
+  void renameAll( const Handle(SALOME_InteractiveObject)&, const QString& );
   bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
   
   /* display */                
@@ -51,7 +52,7 @@ public:
 
 
   /* operations */
-  SPlot2d_Curve*                   getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject );
+  SPlot2d_Curve*                   getCurveByIO( const Handle(SALOME_InteractiveObject)&, Plot2d_ViewFrame* = 0 );
   Plot2d_ViewFrame*                getActiveViewFrame();
   Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );