From 39dfd2424fb79e74b528b643b365b6a66d04694f Mon Sep 17 00:00:00 2001 From: sln Date: Wed, 18 Apr 2007 08:28:28 +0000 Subject: [PATCH] Titles are stored in static variables (customer request) --- src/Plot2d/Plot2d_ViewFrame.cxx | 25 +++++++++++++++++++++---- src/Plot2d/Plot2d_ViewFrame.h | 13 ++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 2ba1a51f0..01d9eb0b1 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -134,6 +134,14 @@ const char* imageCrossCursor[] = { "................................", "................................", "................................"}; + +QString Plot2d_ViewFrame::myPrefTitle = ""; +QString Plot2d_ViewFrame::myPrefXTitle = ""; +QString Plot2d_ViewFrame::myPrefYTitle = ""; + +bool Plot2d_ViewFrame::myTitleAutoGeneration = true; +bool Plot2d_ViewFrame::myXTitleAutoGeneration = true; +bool Plot2d_ViewFrame::myYTitleAutoGeneration = true; /*! @@ -149,8 +157,6 @@ Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title ) myBackground( white ), myTitleEnabled( true ), myXTitleEnabled( true ), myYTitleEnabled( true ), myY2TitleEnabled (true), - myTitleAutoGeneration( true ), myXTitleAutoGeneration( true ), - myYTitleAutoGeneration( true ), myXGridMajorEnabled( true ), myYGridMajorEnabled( true ), myY2GridMajorEnabled( true ), myXGridMinorEnabled( false ), myYGridMinorEnabled( false ), myY2GridMinorEnabled( false ), myXGridMaxMajor( 8 ), myYGridMaxMajor( 8 ), myY2GridMaxMajor( 8 ), @@ -346,6 +352,10 @@ void Plot2d_ViewFrame::readPreferences() myYMode = resMgr->integerValue( "Plot2d", "VerScaleMode", myYMode ); myYMode = QMAX( 0, QMIN( 1, myYMode ) ); + + myTitle = myPrefTitle; + myXTitle = myPrefXTitle; + myYTitle = myPrefYTitle; } /*! @@ -388,6 +398,13 @@ void Plot2d_ViewFrame::writePreferences() } resMgr->setValue( "Plot2d", "VerScaleMode", myYMode ); + + if ( !myTitleAutoGeneration ) + myPrefTitle = myTitle; + if ( !myXTitleAutoGeneration ) + myPrefXTitle = myXTitle; + if ( !myYTitleAutoGeneration ) + myPrefYTitle = myYTitle; } /*! @@ -2365,7 +2382,7 @@ void Plot2d_ViewFrame::setTitleAutoGeneration( const bool toGenerate, const bool /*! Verifies whether plot title must be generated automatically using curves titles */ -bool Plot2d_ViewFrame::getTitleAutoGeneration() const +bool Plot2d_ViewFrame::getTitleAutoGeneration() { return myTitleAutoGeneration; } @@ -2398,7 +2415,7 @@ void Plot2d_ViewFrame::setTitleAutoGeneration( const bool toGenerate, /*! Verifies whether plot title must be generated automatically using curves titles */ -bool Plot2d_ViewFrame::getTitleAutoGeneration( const ObjectType type ) const +bool Plot2d_ViewFrame::getTitleAutoGeneration( const ObjectType type ) { switch ( type ) { diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index f4c4caf59..932a47794 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -59,7 +59,7 @@ public: void setTitle( const QString& title ); QString getTitle() const { return myTitle; } void setTitleAutoGeneration( const bool toGenerate, const bool update = true ); - bool getTitleAutoGeneration() const; + bool getTitleAutoGeneration(); void displayCurve( Plot2d_Curve* curve, bool update = false ); void displayCurves( const curveList& curves, bool update = false ); void eraseCurve ( Plot2d_Curve* curve, bool update = false ); @@ -104,7 +104,7 @@ public: void setTitleAutoGeneration( const bool toGenerate, const ObjectType type, const bool update = true ); - bool getTitleAutoGeneration( const ObjectType type ) const; + static bool getTitleAutoGeneration( const ObjectType type ); void setFont( const QFont& font, ObjectType type, bool update = true ); void setHorScaleMode( const int mode, bool update = true ); @@ -184,7 +184,6 @@ protected: QColor myBackground; QString myTitle, myXTitle, myYTitle, myY2Title; bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled; - bool myTitleAutoGeneration, myXTitleAutoGeneration, myYTitleAutoGeneration; bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled; bool myXGridMinorEnabled, myYGridMinorEnabled, myY2GridMinorEnabled; int myXGridMaxMajor, myYGridMaxMajor, myY2GridMaxMajor; @@ -192,6 +191,14 @@ protected: int myXMode, myYMode; double myXDistance, myYDistance, myYDistance2; bool mySecondY; + + static QString myPrefTitle; + static QString myPrefXTitle; + static QString myPrefYTitle; + + static bool myTitleAutoGeneration; + static bool myXTitleAutoGeneration; + static bool myYTitleAutoGeneration; }; class Plot2d_Plot2d : public QwtPlot -- 2.39.2