From 04766313536b0be8318c2d4f12808ef55f80d908 Mon Sep 17 00:00:00 2001 From: afv Date: Thu, 2 Jul 2015 12:43:15 +0400 Subject: [PATCH] 0002786: External 20761 Zoom lost --- src/Plot2d/Plot2d_ViewFrame.cxx | 23 +++++++++++++++++++++-- src/Plot2d/Plot2d_ViewFrame.h | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index acaae9bd8..b591d7274 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -179,7 +179,7 @@ Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title ) myXGridMinorEnabled( false ), myYGridMinorEnabled( false ), myY2GridMinorEnabled( false ), myXGridMaxMajor( 8 ), myYGridMaxMajor( 8 ), myY2GridMaxMajor( 8 ), myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ), myY2GridMaxMinor( 5 ), - myXMode( 0 ), myYMode( 0 ), mySecondY( false ), + myXMode( 0 ), myYMode( 0 ), mySecondY( false ), myKeepCurrentRange( false ), myTitleAutoUpdate( true ), myXTitleAutoUpdate( true ), myYTitleAutoUpdate( true ), myTitleChangedByUser( false ), myXTitleChangedByUser( false ), myYTitleChangedByUser( false ), myY2TitleChangedByUser( false ), myIsTimeColorization( false ), myTimePosition( -1 ), myInactiveColor( Qt::gray ) @@ -311,6 +311,22 @@ bool Plot2d_ViewFrame::getSecondY() return mySecondY; } +/*! + Set flag which indicate keep current range or not +*/ +void Plot2d_ViewFrame::setKeepCurrentRange( const bool& theKeepCurrentRange ) +{ + myKeepCurrentRange = theKeepCurrentRange; +} + +/*! + Get flag which indicate keep current range or not +*/ +bool Plot2d_ViewFrame::getKeepCurrentRange() +{ + return myKeepCurrentRange; +} + /*! Erase presentation */ @@ -680,7 +696,10 @@ void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update ) aCurve = *it; displayCurve( aCurve, false ); } - fitAll(); + + if ( !myKeepCurrentRange ) + fitAll(); + //myPlot->setUpdatesEnabled( true ); // update legend if ( update ) diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index 4262a6dc6..e30ea6139 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -118,6 +118,9 @@ public: void setSecondY( const bool& theSecondY ); bool getSecondY(); + bool getKeepCurrentRange(); + void setKeepCurrentRange( const bool& theKeepCurrentRange ); + bool isTitleChangedByUser( const ObjectType type ); void forgetLocalUserChanges( const ObjectType type ); @@ -221,6 +224,7 @@ protected: int myXMode, myYMode; double myXDistance, myYDistance, myYDistance2; bool mySecondY; + bool myKeepCurrentRange; bool myTitleAutoUpdate, myXTitleAutoUpdate, myYTitleAutoUpdate; bool myTitleChangedByUser, myXTitleChangedByUser, myYTitleChangedByUser, -- 2.39.2