From d1d18af8f6c601ad840cbe58e571d4fe84fbc140 Mon Sep 17 00:00:00 2001 From: afv Date: Tue, 30 Jun 2015 16:27:02 +0400 Subject: [PATCH] 0002982: External 20835 (Bug) Unit Axis --- src/Plot2d/Plot2d_ViewFrame.cxx | 20 +++++++++++++++++++- src/Plot2d/Plot2d_ViewFrame.h | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index cd3d72ec0..acaae9bd8 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -152,10 +152,12 @@ const char* imageCrossCursor[] = { QString Plot2d_ViewFrame::myPrefTitle = ""; QString Plot2d_ViewFrame::myPrefXTitle = ""; QString Plot2d_ViewFrame::myPrefYTitle = ""; +QString Plot2d_ViewFrame::myPrefY2Title = ""; bool Plot2d_ViewFrame::myPrefTitleChangedByUser = false; bool Plot2d_ViewFrame::myXPrefTitleChangedByUser = false; bool Plot2d_ViewFrame::myYPrefTitleChangedByUser = false; +bool Plot2d_ViewFrame::myY2PrefTitleChangedByUser = false; const long COLOR_DISTANCE = 100; const int MAX_ATTEMPTS = 10; @@ -180,7 +182,7 @@ Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title ) myXMode( 0 ), myYMode( 0 ), mySecondY( false ), myTitleAutoUpdate( true ), myXTitleAutoUpdate( true ), myYTitleAutoUpdate( true ), myTitleChangedByUser( false ), myXTitleChangedByUser( false ), myYTitleChangedByUser( false ), - myIsTimeColorization( false ), myTimePosition( -1 ), myInactiveColor( Qt::gray ) + myY2TitleChangedByUser( false ), myIsTimeColorization( false ), myTimePosition( -1 ), myInactiveColor( Qt::gray ) { setObjectName( title ); /* Plot 2d View */ @@ -428,6 +430,7 @@ void Plot2d_ViewFrame::readPreferences() myTitle = myPrefTitle; myXTitle = myPrefXTitle; myYTitle = myPrefYTitle; + myY2Title = myPrefY2Title; } /*! @@ -486,6 +489,11 @@ void Plot2d_ViewFrame::writePreferences() myPrefYTitle = myYTitle; myYPrefTitleChangedByUser = true; } + if ( myY2TitleChangedByUser ) + { + myPrefY2Title = myY2Title; + myY2PrefTitleChangedByUser = true; + } } /*! @@ -1037,7 +1045,11 @@ void Plot2d_ViewFrame::onSettings() myYTitleChangedByUser = true; if (mySecondY) // vertical right axis title + { + isTileChanged = dlg->getY2Title() != myY2Title; setTitle( dlg->isY2TitleEnabled(), dlg->getY2Title(), Y2Title, false ); + myY2TitleChangedByUser = isTileChanged ? true : myY2TitleChangedByUser; + } // main title isTileChanged = dlg->getMainTitle() != myTitle; @@ -2563,6 +2575,7 @@ void Plot2d_ViewFrame::copyPreferences( Plot2d_ViewFrame* vf ) myTitleChangedByUser = vf->myTitleChangedByUser; myXTitleChangedByUser = vf->myXTitleChangedByUser; myYTitleChangedByUser = vf->myYTitleChangedByUser; + myY2TitleChangedByUser = vf->myY2TitleChangedByUser; } /*! @@ -2856,6 +2869,8 @@ bool Plot2d_ViewFrame::isTitleChangedByUser( const ObjectType type ) return myXPrefTitleChangedByUser || myXTitleChangedByUser; case YTitle: return myYPrefTitleChangedByUser || myYTitleChangedByUser; + case Y2Title: + return myY2PrefTitleChangedByUser || myY2TitleChangedByUser; default: return false; } @@ -2877,6 +2892,9 @@ void Plot2d_ViewFrame::forgetLocalUserChanges( const ObjectType type ) case YTitle: myYTitleChangedByUser = false; break; + case Y2Title: + myY2TitleChangedByUser = false; + break; default: break; } diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index f17abb9c9..4262a6dc6 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -223,15 +223,18 @@ protected: bool mySecondY; bool myTitleAutoUpdate, myXTitleAutoUpdate, myYTitleAutoUpdate; - bool myTitleChangedByUser, myXTitleChangedByUser, myYTitleChangedByUser; + bool myTitleChangedByUser, myXTitleChangedByUser, myYTitleChangedByUser, + myY2TitleChangedByUser; static QString myPrefTitle; static QString myPrefXTitle; static QString myPrefYTitle; + static QString myPrefY2Title; static bool myPrefTitleChangedByUser; static bool myXPrefTitleChangedByUser; static bool myYPrefTitleChangedByUser; + static bool myY2PrefTitleChangedByUser; bool myIsTimeColorization; double myTimePosition; -- 2.39.2