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 ),
myY2GridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yRight ) );
if ( dlg->exec() == QDialog::Accepted ) {
// horizontal axis title
+ bool isTileChanged = dlg->getXTitle() != myXTitle;
setTitle( dlg->isXTitleEnabled(), dlg->getXTitle(), XTitle, false );
+ if ( isTileChanged )
+ {
+ myXTitleAutoGeneration = false;
+ emit titleChangedByUser( XTitle );
+ }
// vertical left axis title
+ isTileChanged = dlg->getYTitle() != myYTitle;
setTitle( dlg->isYTitleEnabled(), dlg->getYTitle(), YTitle, false );
+ if ( isTileChanged )
+ {
+ myYTitleAutoGeneration = false;
+ emit titleChangedByUser( YTitle );
+ }
if (mySecondY) // vertical right axis title
setTitle( dlg->isY2TitleEnabled(), dlg->getY2Title(), Y2Title, false );
// main title
+ isTileChanged = dlg->getMainTitle() != myTitle;
setTitle( dlg->isMainTitleEnabled(), dlg->getMainTitle(), MainTitle, true );
+ if ( isTileChanged )
+ {
+ myTitleAutoGeneration = false;
+ emit titleChangedByUser( MainTitle );
+ }
// curve type
if ( myCurveType != dlg->getCurveType() ) {
setCurveType( dlg->getCurveType(), false );
if ( !yTitle.isEmpty() && !yUnits.isEmpty() )
yTitle += " ";
- setTitle( myXTitleEnabled, xTitle + xUnits, XTitle, true );
- setTitle( myYTitleEnabled, yTitle + yUnits, YTitle, true );
- setTitle( true, aTables.join("; "), MainTitle, true );
+ if ( myXTitleAutoGeneration )
+ setTitle( myXTitleEnabled, xTitle + xUnits, XTitle, true );
+ if ( myYTitleAutoGeneration )
+ setTitle( myYTitleEnabled, yTitle + yUnits, YTitle, true );
+ if ( myTitleAutoGeneration )
+ setTitle( true, aTables.join("; "), MainTitle, true );
}
/*!
{
this->incrementalZoom( -INCREMENT_FOR_OP, -INCREMENT_FOR_OP );
}
+
+/*!
+ Specifies whether plot title must be generated automatically using curves titles
+*/
+void Plot2d_ViewFrame::setTitleAutoGeneration( const bool toGenerate, const bool update )
+{
+ setTitleAutoGeneration( toGenerate, MainTitle, update );
+}
+
+/*!
+ Verifies whether plot title must be generated automatically using curves titles
+*/
+bool Plot2d_ViewFrame::getTitleAutoGeneration() const
+{
+ return myTitleAutoGeneration;
+}
+
+/*!
+ Specifies whether plot title must be generated automatically using curves titles
+*/
+void Plot2d_ViewFrame::setTitleAutoGeneration( const bool toGenerate,
+ const ObjectType type,
+ const bool update )
+{
+ switch ( type )
+ {
+ case MainTitle:
+ myTitleAutoGeneration = toGenerate;
+ break;
+ case XTitle:
+ myXTitleAutoGeneration = toGenerate;
+ break;
+ case YTitle:
+ myYTitleAutoGeneration = toGenerate;
+ break;
+ default:
+ return;
+ }
+ if ( update )
+ updateTitles();
+}
+
+/*!
+ Verifies whether plot title must be generated automatically using curves titles
+*/
+bool Plot2d_ViewFrame::getTitleAutoGeneration( const ObjectType type ) const
+{
+ switch ( type )
+ {
+ case MainTitle:
+ return myTitleAutoGeneration;
+ case XTitle:
+ return myXTitleAutoGeneration;
+ case YTitle:
+ return myYTitleAutoGeneration;
+ default:
+ return false;
+ }
+}
+
+
+
+
void updateTitles();
void setTitle( const QString& title );
QString getTitle() const { return myTitle; }
+ void setTitleAutoGeneration( const bool toGenerate, const bool update = true );
+ bool getTitleAutoGeneration() const;
void displayCurve( Plot2d_Curve* curve, bool update = false );
void displayCurves( const curveList& curves, bool update = false );
void eraseCurve ( Plot2d_Curve* curve, bool update = false );
bool y2MinorEnabled, const int y2MinorMax, bool update = true );
void setTitle( bool enabled, const QString& title, ObjectType type, bool update = true );
QString getTitle( ObjectType type ) const;
+ void setTitleAutoGeneration( const bool toGenerate,
+ const ObjectType type,
+ const bool update = true );
+ bool getTitleAutoGeneration( const ObjectType type ) const;
void setFont( const QFont& font, ObjectType type, bool update = true );
void setHorScaleMode( const int mode, bool update = true );
void curveDisplayed( Plot2d_Curve* );
void curveErased( Plot2d_Curve* );
+ void titleChangedByUser( const int theObjectType );
+
protected:
Plot2d_Plot2d* myPlot;
int myOperation;
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;