diff --git a/apps/graph/app.cpp b/apps/graph/app.cpp index c150b7f97..9b873e3a8 100644 --- a/apps/graph/app.cpp +++ b/apps/graph/app.cpp @@ -31,16 +31,6 @@ App * App::Snapshot::unpack(Container * container) { return new (container->currentAppBuffer()) App(container, this); } -void App::Snapshot::reset() { - StorageFunctionApp::Snapshot::reset(); - *(modelVersion()) = 0; - *(rangeVersion()) = 0; -} - -void App::Snapshot::storageDidChangeForRecord(const Ion::Storage::Record record) { - m_functionStore.storageDidChangeForRecord(record); -} - App::Descriptor * App::Snapshot::descriptor() { static Descriptor descriptor; return &descriptor; diff --git a/apps/graph/app.h b/apps/graph/app.h index 0d3dc79ad..a38715e72 100644 --- a/apps/graph/app.h +++ b/apps/graph/app.h @@ -22,10 +22,8 @@ public: public: Snapshot(); App * unpack(Container * container) override; - void reset() override; - void storageDidChangeForRecord(const Ion::Storage::Record record) override; Descriptor * descriptor() override; - StorageCartesianFunctionStore * functionStore(); + StorageCartesianFunctionStore * functionStore() override; Shared::InteractiveCurveViewRange * graphRange(); private: void tidy() override; @@ -35,7 +33,7 @@ public: InputViewController * inputViewController() override; char XNT() override; NestedMenuController * variableBoxForInputEventHandler(InputEventHandler * textInput) override; - StorageCartesianFunctionStore * functionStore() override { return static_cast(snapshot())->functionStore(); } + StorageCartesianFunctionStore * functionStore() override { return static_cast(Shared::StorageFunctionApp::functionStore()); } private: App(Container * container, Snapshot * snapshot); StorageListController m_listController; diff --git a/apps/shared/storage_function_app.cpp b/apps/shared/storage_function_app.cpp index 0395b9f6c..c4dcc295e 100644 --- a/apps/shared/storage_function_app.cpp +++ b/apps/shared/storage_function_app.cpp @@ -28,6 +28,10 @@ void StorageFunctionApp::Snapshot::reset() { setActiveTab(0); } +void StorageFunctionApp::Snapshot::storageDidChangeForRecord(const Ion::Storage::Record record) { + functionStore()->storageDidChangeForRecord(record); +} + void StorageFunctionApp::willBecomeInactive() { if (m_modalViewController.isDisplayingModal()) { m_modalViewController.dismissModalViewController(); diff --git a/apps/shared/storage_function_app.h b/apps/shared/storage_function_app.h index cf8efdc02..23e089e28 100644 --- a/apps/shared/storage_function_app.h +++ b/apps/shared/storage_function_app.h @@ -19,9 +19,11 @@ public: uint32_t * modelVersion() { return &m_modelVersion; } uint32_t * rangeVersion() { return &m_rangeVersion; } Poincare::Preferences::AngleUnit * angleUnitVersion() { return &m_angleUnitVersion; } + virtual StorageFunctionStore * functionStore() = 0; Interval * interval() { return &m_interval; } int * indexFunctionSelectedByCursor() { return &m_indexFunctionSelectedByCursor; } void reset() override; + void storageDidChangeForRecord(const Ion::Storage::Record record) override; protected: CurveViewCursor m_cursor; Interval m_interval; @@ -32,7 +34,7 @@ public: Poincare::Preferences::AngleUnit m_angleUnitVersion; }; virtual ~StorageFunctionApp() = default; - virtual StorageFunctionStore * functionStore() = 0; + virtual StorageFunctionStore * functionStore() { return static_cast(snapshot())->functionStore(); } virtual InputViewController * inputViewController() = 0; void willBecomeInactive() override;