mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
We memoize the checksum of the x first models, and we check that one of these models is still present when the graph view appears. If so, we do not reload the range, other wise we reload it. Scenario: f(t) = [t^2 t+1] in parametric Display the graph f(x) = 1 on ]-inf;0] g(x) = 2 on [0;inf[ Display the graph -> the range did not change
58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
#ifndef SHARED_FUNCTION_APP_H
|
|
#define SHARED_FUNCTION_APP_H
|
|
|
|
#include "expression_field_delegate_app.h"
|
|
#include "function_graph_controller.h"
|
|
#include "function_store.h"
|
|
#include "curve_view_cursor.h"
|
|
#include "values_controller.h"
|
|
|
|
namespace Shared {
|
|
|
|
class FunctionApp : public ExpressionFieldDelegateApp {
|
|
public:
|
|
class Snapshot : public ::App::Snapshot, public TabViewDataSource {
|
|
public:
|
|
Snapshot();
|
|
CurveViewCursor * cursor() { return &m_cursor; }
|
|
uint32_t * modelVersion() { return &m_modelVersion; }
|
|
uint32_t * previousModelsVersions() { return m_previousModelsVersions; }
|
|
uint32_t * rangeVersion() { return &m_rangeVersion; }
|
|
Poincare::Preferences::AngleUnit * angleUnitVersion() { return &m_angleUnitVersion; }
|
|
virtual FunctionStore * functionStore() = 0;
|
|
int * indexFunctionSelectedByCursor() { return &m_indexFunctionSelectedByCursor; }
|
|
void reset() override;
|
|
void storageDidChangeForRecord(const Ion::Storage::Record record) override;
|
|
protected:
|
|
CurveViewCursor m_cursor;
|
|
private:
|
|
int m_indexFunctionSelectedByCursor;
|
|
uint32_t m_modelVersion;
|
|
uint32_t m_previousModelsVersions[FunctionGraphController::sNumberOfMemoizedModelVersions];
|
|
uint32_t m_rangeVersion;
|
|
Poincare::Preferences::AngleUnit m_angleUnitVersion;
|
|
};
|
|
static FunctionApp * app() {
|
|
return static_cast<FunctionApp *>(Container::activeApp());
|
|
}
|
|
virtual ~FunctionApp() = default;
|
|
Snapshot * snapshot() const {
|
|
return static_cast<Snapshot *>(::App::snapshot());
|
|
}
|
|
virtual FunctionStore * functionStore() { return snapshot()->functionStore(); }
|
|
virtual ValuesController * valuesController() = 0;
|
|
virtual InputViewController * inputViewController() = 0;
|
|
void willBecomeInactive() override;
|
|
|
|
protected:
|
|
FunctionApp(Snapshot * snapshot, ViewController * rootViewController) :
|
|
ExpressionFieldDelegateApp(snapshot, rootViewController)
|
|
{}
|
|
// TextFieldDelegateApp
|
|
bool isAcceptableExpression(const Poincare::Expression expression) override;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|