myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ), myY2GridMaxMinor( 5 ),
myXMode( 0 ), myYMode( 0 ), mySecondY( false ),
myTitleAutoUpdate( true ), myXTitleAutoUpdate( true ), myYTitleAutoUpdate( true ),
- myTitleChangedByUser( false ), myXTitleChangedByUser( false ), myYTitleChangedByUser( false )
+ myTitleChangedByUser( false ), myXTitleChangedByUser( false ), myYTitleChangedByUser( false ),
+ myShowAutoReplot( true ), myAutoReplot( false )
{
setObjectName( title );
/* Plot 2d View */
myTitle = myPrefTitle;
myXTitle = myPrefXTitle;
myYTitle = myPrefYTitle;
+
+ if( myShowAutoReplot )
+ myAutoReplot = resMgr->integerValue( "Plot2d", "AutoReplot", myAutoReplot );
}
/*!
myPrefYTitle = myYTitle;
myYPrefTitleChangedByUser = true;
}
+
+ if( myShowAutoReplot )
+ {
+ resMgr->setValue( "Plot2d", "AutoReplot", myAutoReplot );
+ }
}
/*!
myYMode = vf->myYMode;
mySecondY = vf->mySecondY;
+ myAutoReplot = vf->myAutoReplot;
+
// special fields for automatic update of viewer titles
myTitleAutoUpdate = vf->myTitleAutoUpdate;
myXTitleAutoUpdate = vf->myXTitleAutoUpdate;
}
}
}
+
+/*!
+ Sets flag for show\hide of automatic replotting of view in accordance
+ with current selection. You should call setShowAutoReplot( false )
+ if your application doesn't support this functionality.
+ By default flag is true.
+*/
+void Plot2d_ViewFrame::setShowAutoReplot( const bool show )
+{
+ myShowAutoReplot = show;
+}
+
+/*!
+ Sets flag for automatic replotting of view in accordance with current selection.
+ By default flag is false.
+*/
+void Plot2d_ViewFrame::setAutoReplot( const bool replot )
+{
+ myAutoReplot = replot;
+}
void updateSymbols();
+ void setShowAutoReplot( const bool show );
+ bool isShowAutoReplot() const { return myShowAutoReplot; }
+
+ void setAutoReplot( const bool replot );
+ bool isAutoReplot() const { return myAutoReplot; }
+
protected:
int testOperation( const QMouseEvent& );
void readPreferences();
bool myTitleAutoUpdate, myXTitleAutoUpdate, myYTitleAutoUpdate;
bool myTitleChangedByUser, myXTitleChangedByUser, myYTitleChangedByUser;
+ bool myShowAutoReplot, myAutoReplot;
+
static QString myPrefTitle;
static QString myPrefXTitle;
static QString myPrefYTitle;
// settings
thePopup->addAction( mgr->action( CurvSettingsId ) );
thePopup->addAction( mgr->action( CurvesSettingsId ) );
+
+ if ( myViewFrame->isShowAutoReplot() )
+ {
+ // automatically update
+ QAction* aAutoReplot = new QAction( tr( "TOT_PLOT2D_AUTOREPLOT" ), this );
+ aAutoReplot->setCheckable( true );
+ aAutoReplot->setChecked( myViewFrame->isAutoReplot() );
+ connect( aAutoReplot, SIGNAL( triggered() ), this, SLOT( onAutoReplot() ) );
+
+ thePopup->addSeparator();
+ thePopup->addAction( aAutoReplot );
+ }
}
/*!
myViewFrame->updateSymbols();
}
+/*!
+ \brief Called when the "Automatically update" action is activated.
+*/
+void Plot2d_ViewWindow::onAutoReplot()
+{
+ QAction* anAct = ::qobject_cast<QAction*>( sender() );
+ if( !myViewFrame || !anAct )
+ return;
+ myViewFrame->setAutoReplot( anAct->isChecked() );
+}
+
/*!
\brief Dump the contents of the view window to the image.
\return image, containing all scene rendered in the window
void onDumpView();
void onPrintView();
+ void onAutoReplot();
+
protected:
virtual QImage dumpView();
virtual bool dumpViewToFormat( const QImage&,
<source>MEN_PLOT2D_CURVES_LINES</source>
<translation>Draw lines</translation>
</message>
+ <message>
+ <source>TOT_PLOT2D_AUTOREPLOT</source>
+ <translation>Update automatically</translation>
+ </message>
</context>
<context>
<name>Plot2d_FitDataDlg</name>
<source>MEN_PLOT2D_CURVES_LINES</source>
<translation type="unfinished">Dessiner les Lignes</translation>
</message>
+ <message>
+ <source>TOT_PLOT2D_AUTOREPLOT</source>
+ <translation type="unfinished">Mettre à jour automatiquement</translation>
+ </message>
</context>
<context>
<name>Plot2d_FitDataDlg</name>