From: asl Date: Thu, 24 Nov 2005 08:34:39 +0000 (+0000) Subject: PAL9828 - regression of Plot2d legend X-Git-Tag: BR_3_1_0_deb~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96866e45f8d877972033ff6d5613d46d6b2af296;p=modules%2Fgui.git PAL9828 - regression of Plot2d legend --- diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index e7d6a753d..cc5614afa 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -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* ); diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index b8b376a82..6f1156a44 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -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 it( aViewFrame->getCurves() ); + for( ; it.current(); ++it ) + { + SPlot2d_Curve* aCurve = dynamic_cast( 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& wnds = vm->getViews(); + for( int i=0; i( 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 it( aViewFrame->getCurves() ); for ( ; it.current(); ++it ) { diff --git a/src/SPlot2d/SPlot2d_ViewModel.h b/src/SPlot2d/SPlot2d_ViewModel.h index f325b032f..9b47e839c 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.h +++ b/src/SPlot2d/SPlot2d_ViewModel.h @@ -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 );