Files
Upsilon/apps/shared/function_app.h
Gabriel Ozouf 8970e294aa [apps] Remove modelVersion from curves apps
The graph range used to be reset to default whenever all functions were
modified. As we no longer want to reset the range without the user's
input, we do not need to track whether the functions changed at all.

/!\ As of this commit, there is no longer a way to restore the default
zoom, until a new automatic zoom button is added.

Change-Id: Ie74e8fd61e13055fa6ce2b2d1e883182d4ecffce
2020-11-04 15:58:09 +01:00

55 lines
1.8 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"
#include "shared_app.h"
namespace Shared {
class FunctionApp : public ExpressionFieldDelegateApp {
public:
class Snapshot : public ::SharedApp::Snapshot, public TabViewDataSource {
public:
Snapshot();
CurveViewCursor * cursor() { return &m_cursor; }
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_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