mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/functions] Save if user want display derivative even when quitting the app
This commit is contained in:
@@ -27,7 +27,8 @@ const Image * App::Descriptor::icon() {
|
||||
App::Snapshot::Snapshot() :
|
||||
Shared::FunctionApp::Snapshot::Snapshot(),
|
||||
m_functionStore(),
|
||||
m_graphRange()
|
||||
m_graphRange(),
|
||||
m_shouldDisplayDerivative(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,6 +41,7 @@ void App::Snapshot::reset() {
|
||||
for (int i = 0; i < Shared::ContinuousFunction::k_numberOfPlotTypes; i++) {
|
||||
m_interval[i].reset();
|
||||
}
|
||||
m_shouldDisplayDerivative = false;
|
||||
}
|
||||
|
||||
App::Descriptor * App::Snapshot::descriptor() {
|
||||
@@ -58,7 +60,7 @@ App::App(Snapshot * snapshot) :
|
||||
m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray),
|
||||
m_listHeader(&m_listStackViewController, &m_listFooter, &m_listController),
|
||||
m_listStackViewController(&m_tabViewController, &m_listHeader),
|
||||
m_graphController(&m_graphAlternateEmptyViewController, this, snapshot->graphRange(), snapshot->cursor(), snapshot->indexFunctionSelectedByCursor(), snapshot->rangeVersion(), &m_graphHeader),
|
||||
m_graphController(&m_graphAlternateEmptyViewController, this, snapshot->graphRange(), snapshot->cursor(), snapshot->indexFunctionSelectedByCursor(), snapshot->rangeVersion(), &m_graphHeader, snapshot->shouldDisplayDerivative()),
|
||||
m_graphAlternateEmptyViewController(&m_graphHeader, &m_graphController, &m_graphController),
|
||||
m_graphHeader(&m_graphStackViewController, &m_graphAlternateEmptyViewController, &m_graphController),
|
||||
m_graphStackViewController(&m_tabViewController, &m_graphHeader),
|
||||
|
||||
@@ -31,11 +31,13 @@ public:
|
||||
Shared::Interval * intervalForType(Shared::ContinuousFunction::PlotType plotType) {
|
||||
return m_interval + static_cast<size_t>(plotType);
|
||||
}
|
||||
bool * shouldDisplayDerivative() { return &m_shouldDisplayDerivative; }
|
||||
private:
|
||||
void tidy() override;
|
||||
ContinuousFunctionStore m_functionStore;
|
||||
Shared::InteractiveCurveViewRange m_graphRange;
|
||||
Shared::Interval m_interval[Shared::ContinuousFunction::k_numberOfPlotTypes];
|
||||
bool m_shouldDisplayDerivative;
|
||||
};
|
||||
static App * app() {
|
||||
return static_cast<App *>(Container::activeApp());
|
||||
|
||||
@@ -7,13 +7,13 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
GraphController::GraphController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * rangeVersion, ButtonRowController * header) :
|
||||
GraphController::GraphController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * rangeVersion, ButtonRowController * header, bool * shouldDisplayDerivative) :
|
||||
FunctionGraphController(parentResponder, inputEventHandlerDelegate, header, curveViewRange, &m_view, cursor, indexFunctionSelectedByCursor, rangeVersion),
|
||||
m_bannerView(this, inputEventHandlerDelegate, this),
|
||||
m_view(curveViewRange, m_cursor, &m_bannerView, &m_cursorView),
|
||||
m_graphRange(curveViewRange),
|
||||
m_curveParameterController(inputEventHandlerDelegate, curveViewRange, &m_bannerView, m_cursor, &m_view, this),
|
||||
m_displayDerivativeInBanner(false)
|
||||
m_displayDerivativeInBanner(shouldDisplayDerivative)
|
||||
{
|
||||
m_graphRange->setDelegate(this);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void GraphController::selectFunctionWithCursor(int functionIndex) {
|
||||
|
||||
void GraphController::reloadBannerView() {
|
||||
Ion::Storage::Record record = functionStore()->activeRecordAtIndex(indexFunctionSelectedByCursor());
|
||||
bool displayDerivative = m_displayDerivativeInBanner &&
|
||||
bool displayDerivative = *m_displayDerivativeInBanner &&
|
||||
functionStore()->modelForRecord(record)->plotType() == ContinuousFunction::PlotType::Cartesian;
|
||||
m_bannerView.setNumberOfSubviews(Shared::XYBannerView::k_numberOfSubviews + displayDerivative);
|
||||
FunctionGraphController::reloadBannerView();
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace Graph {
|
||||
|
||||
class GraphController : public Shared::FunctionGraphController, public GraphControllerHelper {
|
||||
public:
|
||||
GraphController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * rangeVersion, ButtonRowController * header);
|
||||
GraphController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * rangeVersion, ButtonRowController * header, bool * shouldDisplayDerivative);
|
||||
I18n::Message emptyMessage() override;
|
||||
void viewWillAppear() override;
|
||||
bool displayDerivativeInBanner() const { return m_displayDerivativeInBanner; }
|
||||
void setDisplayDerivativeInBanner(bool displayDerivative) { m_displayDerivativeInBanner = displayDerivative; }
|
||||
bool displayDerivativeInBanner() const { return *m_displayDerivativeInBanner; }
|
||||
void setDisplayDerivativeInBanner(bool displayDerivative) { *m_displayDerivativeInBanner = displayDerivative; }
|
||||
private:
|
||||
int estimatedBannerNumberOfLines() const override { return 1 + m_displayDerivativeInBanner; }
|
||||
int estimatedBannerNumberOfLines() const override { return 1 + *m_displayDerivativeInBanner; }
|
||||
void selectFunctionWithCursor(int functionIndex) override;
|
||||
BannerView * bannerView() override { return &m_bannerView; }
|
||||
void reloadBannerView() override;
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
GraphView m_view;
|
||||
Shared::InteractiveCurveViewRange * m_graphRange;
|
||||
CurveParameterController m_curveParameterController;
|
||||
bool m_displayDerivativeInBanner;
|
||||
bool * m_displayDerivativeInBanner;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user