[apps/shared] Functions cache clears on change

Added several triggers to clear the cache when the function's type,
range or content is changed.

Change-Id: I4f49a90bb6571e335a4a601723d7715b8de1e25e
This commit is contained in:
Gabriel Ozouf
2020-06-09 14:00:11 +02:00
committed by Émilie Feral
parent 552dca9494
commit a9c633a540
3 changed files with 11 additions and 1 deletions

View File

@@ -125,6 +125,8 @@ void ContinuousFunction::setPlotType(PlotType newPlotType, Poincare::Preferences
recordData()->setPlotType(newPlotType);
cache()->clear();
// Recompute the layouts
m_model.tidy();
@@ -251,10 +253,12 @@ float ContinuousFunction::tMax() const {
void ContinuousFunction::setTMin(float tMin) {
recordData()->setTMin(tMin);
cache()->clear();
}
void ContinuousFunction::setTMax(float tMax) {
recordData()->setTMax(tMax);
cache()->clear();
}
void * ContinuousFunction::Model::expressionAddress(const Ion::Storage::Record * record) const {
@@ -347,6 +351,11 @@ Poincare::Expression ContinuousFunction::sumBetweenBounds(double start, double e
* the derivative table. */
}
Ion::Storage::Record::ErrorStatus ContinuousFunction::setContent(const char * c, Poincare::Context * context) {
cache()->clear();
return ExpressionModelHandle::setContent(c, context);
}
template Coordinate2D<float> ContinuousFunction::templatedApproximateAtParameter<float>(float, Poincare::Context *) const;
template Coordinate2D<double> ContinuousFunction::templatedApproximateAtParameter<double>(double, Poincare::Context *) const;