mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[shared] Clean class names containing storage
This commit is contained in:
@@ -3,7 +3,7 @@ app_headers += apps/graph/app.h
|
||||
|
||||
app_src += $(addprefix apps/graph/,\
|
||||
app.cpp \
|
||||
storage_cartesian_function_store.cpp \
|
||||
cartesian_function_store.cpp \
|
||||
graph/banner_view.cpp \
|
||||
graph/calculation_graph_controller.cpp \
|
||||
graph/calculation_parameter_controller.cpp \
|
||||
@@ -16,12 +16,12 @@ app_src += $(addprefix apps/graph/,\
|
||||
graph/intersection_graph_controller.cpp \
|
||||
graph/root_graph_controller.cpp \
|
||||
graph/tangent_graph_controller.cpp \
|
||||
list/list_controller.cpp \
|
||||
list/list_parameter_controller.cpp \
|
||||
list/storage_list_controller.cpp \
|
||||
list/text_field_function_title_cell.cpp \
|
||||
values/storage_derivative_parameter_controller.cpp \
|
||||
values/storage_function_parameter_controller.cpp \
|
||||
values/storage_values_controller.cpp \
|
||||
values/derivative_parameter_controller.cpp \
|
||||
values/function_parameter_controller.cpp \
|
||||
values/values_controller.cpp \
|
||||
)
|
||||
|
||||
i18n_files += $(addprefix apps/graph/,\
|
||||
|
||||
@@ -36,7 +36,7 @@ App::Descriptor * App::Snapshot::descriptor() {
|
||||
return &descriptor;
|
||||
}
|
||||
|
||||
StorageCartesianFunctionStore * App::Snapshot::functionStore() {
|
||||
CartesianFunctionStore * App::Snapshot::functionStore() {
|
||||
return &m_functionStore;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#define GRAPH_APP_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_cartesian_function_store.h"
|
||||
#include "cartesian_function_store.h"
|
||||
#include "graph/graph_controller.h"
|
||||
#include "list/storage_list_controller.h"
|
||||
#include "values/storage_values_controller.h"
|
||||
#include "list/list_controller.h"
|
||||
#include "values/values_controller.h"
|
||||
#include "../shared/function_app.h"
|
||||
|
||||
namespace Graph {
|
||||
@@ -23,20 +23,20 @@ public:
|
||||
Snapshot();
|
||||
App * unpack(Container * container) override;
|
||||
Descriptor * descriptor() override;
|
||||
StorageCartesianFunctionStore * functionStore() override;
|
||||
CartesianFunctionStore * functionStore() override;
|
||||
Shared::InteractiveCurveViewRange * graphRange();
|
||||
private:
|
||||
void tidy() override;
|
||||
StorageCartesianFunctionStore m_functionStore;
|
||||
CartesianFunctionStore m_functionStore;
|
||||
Shared::InteractiveCurveViewRange m_graphRange;
|
||||
};
|
||||
InputViewController * inputViewController() override;
|
||||
char XNT() override;
|
||||
NestedMenuController * variableBoxForInputEventHandler(InputEventHandler * textInput) override;
|
||||
StorageCartesianFunctionStore * functionStore() override { return static_cast<StorageCartesianFunctionStore *>(Shared::FunctionApp::functionStore()); }
|
||||
CartesianFunctionStore * functionStore() override { return static_cast<CartesianFunctionStore *>(Shared::FunctionApp::functionStore()); }
|
||||
private:
|
||||
App(Container * container, Snapshot * snapshot);
|
||||
StorageListController m_listController;
|
||||
ListController m_listController;
|
||||
ButtonRowController m_listFooter;
|
||||
ButtonRowController m_listHeader;
|
||||
StackViewController m_listStackViewController;
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
AlternateEmptyViewController m_graphAlternateEmptyViewController;
|
||||
ButtonRowController m_graphHeader;
|
||||
StackViewController m_graphStackViewController;
|
||||
StorageValuesController m_valuesController;
|
||||
ValuesController m_valuesController;
|
||||
AlternateEmptyViewController m_valuesAlternateEmptyViewController;
|
||||
ButtonRowController m_valuesHeader;
|
||||
StackViewController m_valuesStackViewController;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_cartesian_function_store.h"
|
||||
#include "cartesian_function_store.h"
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
@@ -9,18 +9,18 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
Ion::Storage::Record::ErrorStatus StorageCartesianFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus CartesianFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus error;
|
||||
CartesianFunction newModel = CartesianFunction::NewModel(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
void StorageCartesianFunctionStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
|
||||
void CartesianFunctionStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
|
||||
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
|
||||
m_functions[cacheIndex] = CartesianFunction(record);
|
||||
}
|
||||
|
||||
ExpressionModelHandle * StorageCartesianFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
|
||||
ExpressionModelHandle * CartesianFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
|
||||
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
|
||||
return &m_functions[cacheIndex];
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef GRAPH_STORAGE_CARTESIAN_FUNCTION_STORE_H
|
||||
#define GRAPH_STORAGE_CARTESIAN_FUNCTION_STORE_H
|
||||
#ifndef GRAPH_CARTESIAN_FUNCTION_STORE_H
|
||||
#define GRAPH_CARTESIAN_FUNCTION_STORE_H
|
||||
|
||||
#include "../shared/cartesian_function.h"
|
||||
#include "../shared/storage_function_store.h"
|
||||
#include "../shared/function_store.h"
|
||||
#include <stdint.h>
|
||||
#include <escher.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageCartesianFunctionStore : public Shared::FunctionStore {
|
||||
class CartesianFunctionStore : public Shared::FunctionStore {
|
||||
public:
|
||||
Shared::ExpiringPointer<Shared::CartesianFunction> modelForRecord(Ion::Storage::Record record) const { return Shared::ExpiringPointer<Shared::CartesianFunction>(static_cast<Shared::CartesianFunction *>(privateModelForRecord(record))); }
|
||||
char symbol() const override { return Shared::CartesianFunction::Symbol(); }
|
||||
@@ -84,7 +84,7 @@ Expression::Coordinate2D CalculationGraphController::computeNewPointOfInteresetF
|
||||
return computeNewPointOfInterest(start, step, max, myApp->localContext());
|
||||
}
|
||||
|
||||
StorageCartesianFunctionStore * CalculationGraphController::functionStore() const {
|
||||
CartesianFunctionStore * CalculationGraphController::functionStore() const {
|
||||
App * a = static_cast<App *>(app());
|
||||
return a->functionStore();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "banner_view.h"
|
||||
#include "../../shared/curve_view_cursor.h"
|
||||
#include "../../shared/interactive_curve_view_range.h"
|
||||
#include "../../shared/storage_function_banner_delegate.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../../shared/function_banner_delegate.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
@@ -26,7 +26,7 @@ protected:
|
||||
virtual void reloadBannerView();
|
||||
bool moveCursor(int direction);
|
||||
Poincare::Expression::Coordinate2D computeNewPointOfInteresetFromAbscissa(double start, int direction);
|
||||
StorageCartesianFunctionStore * functionStore() const;
|
||||
CartesianFunctionStore * functionStore() const;
|
||||
virtual Poincare::Expression::Coordinate2D computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) = 0;
|
||||
GraphView * m_graphView;
|
||||
BannerView * m_bannerView;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define GRAPH_CALCULATION_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
#include "tangent_graph_controller.h"
|
||||
#include "extremum_graph_controller.h"
|
||||
#include "integral_graph_controller.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GRAPH_GRAPH_CURVE_PARAMETER_CONTROLLER_H
|
||||
#define GRAPH_GRAPH_CURVE_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include "../../shared/storage_function_curve_parameter_controller.h"
|
||||
#include "../../shared/function_curve_parameter_controller.h"
|
||||
#include "calculation_parameter_controller.h"
|
||||
#include "banner_view.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Graph {
|
||||
|
||||
static inline float maxFloat(float x, float y) { return x > y ? x : y; }
|
||||
|
||||
GraphController::GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, StorageCartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion, ButtonRowController * header) :
|
||||
GraphController::GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion, ButtonRowController * header) :
|
||||
FunctionGraphController(parentResponder, inputEventHandlerDelegate, header, curveViewRange, &m_view, cursor, indexFunctionSelectedByCursor, modelVersion, rangeVersion, angleUnitVersion),
|
||||
m_bannerView(),
|
||||
m_view(functionStore, curveViewRange, m_cursor, &m_bannerView, &m_cursorView),
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
#include "graph_controller_helper.h"
|
||||
#include "banner_view.h"
|
||||
#include "curve_parameter_controller.h"
|
||||
#include "../../shared/storage_function_graph_controller.h"
|
||||
#include "../../shared/function_graph_controller.h"
|
||||
#include "../../shared/curve_view_cursor.h"
|
||||
#include "../../shared/round_cursor_view.h"
|
||||
#include "../../shared/interactive_curve_view_range.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class GraphController : public Shared::FunctionGraphController, public GraphControllerHelper {
|
||||
public:
|
||||
GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, StorageCartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion, ButtonRowController * header);
|
||||
GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion, ButtonRowController * header);
|
||||
I18n::Message emptyMessage() override;
|
||||
void viewWillAppear() override;
|
||||
bool displayDerivativeInBanner() const;
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
return &m_cursorView;
|
||||
}
|
||||
CurveParameterController * curveParameterController() override;
|
||||
StorageCartesianFunctionStore * functionStore() const override { return static_cast<StorageCartesianFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
|
||||
CartesianFunctionStore * functionStore() const override { return static_cast<CartesianFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
|
||||
Shared::RoundCursorView m_cursorView;
|
||||
BannerView m_bannerView;
|
||||
GraphView m_view;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "graph_controller_helper.h"
|
||||
#include "../../shared/storage_function_banner_delegate.h"
|
||||
#include "../../shared/function_banner_delegate.h"
|
||||
#include "../app.h"
|
||||
#include "../../constant.h"
|
||||
#include "../../shared/poincare_helpers.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "../../shared/banner_view.h"
|
||||
#include "../../shared/text_field_delegate_app.h"
|
||||
#include "../../shared/interactive_curve_view_range.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
GraphView::GraphView(StorageCartesianFunctionStore * functionStore, InteractiveCurveViewRange * graphRange,
|
||||
GraphView::GraphView(CartesianFunctionStore * functionStore, InteractiveCurveViewRange * graphRange,
|
||||
CurveViewCursor * cursor, BannerView * bannerView, View * cursorView) :
|
||||
FunctionGraphView(graphRange, cursor, bannerView, cursorView),
|
||||
m_functionStore(functionStore),
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef GRAPH_GRAPH_VIEW_H
|
||||
#define GRAPH_GRAPH_VIEW_H
|
||||
|
||||
#include "../../shared/storage_function_graph_view.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../../shared/function_graph_view.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class GraphView : public Shared::FunctionGraphView {
|
||||
public:
|
||||
|
||||
GraphView(StorageCartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * graphRange,
|
||||
GraphView(CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * graphRange,
|
||||
Shared::CurveViewCursor * cursor, Shared::BannerView * bannerView, View * cursorView);
|
||||
void reload() override;
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
* of the graph where the area under the curve is colored. */
|
||||
void setAreaHighlightColor(bool highlightColor) override {};
|
||||
private:
|
||||
StorageCartesianFunctionStore * m_functionStore;
|
||||
CartesianFunctionStore * m_functionStore;
|
||||
bool m_tangent;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace Poincare;
|
||||
namespace Graph {
|
||||
|
||||
IntegralGraphController::IntegralGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, GraphView * graphView, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) :
|
||||
StorageSumGraphController(parentResponder, inputEventHandlerDelegate, graphView, graphRange, cursor, UCodePointIntegral)
|
||||
SumGraphController(parentResponder, inputEventHandlerDelegate, graphView, graphRange, cursor, UCodePointIntegral)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <escher.h>
|
||||
#include "graph_view.h"
|
||||
#include "../../shared/storage_sum_graph_controller.h"
|
||||
#include "../../shared/sum_graph_controller.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class IntegralGraphController : public Shared::StorageSumGraphController {
|
||||
class IntegralGraphController : public Shared::SumGraphController {
|
||||
public:
|
||||
IntegralGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, GraphView * graphView, Shared::InteractiveCurveViewRange * graphRange, Shared::CurveViewCursor * cursor);
|
||||
const char * title() override;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define GRAPH_INTERSECTION_GRAPH_CONTROLLER_H
|
||||
|
||||
#include "calculation_graph_controller.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "banner_view.h"
|
||||
#include "graph_controller_helper.h"
|
||||
#include "../../shared/simple_interactive_curve_view_controller.h"
|
||||
#include "../../shared/storage_function_banner_delegate.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../../shared/function_banner_delegate.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_list_controller.h"
|
||||
#include "list_controller.h"
|
||||
#include "../app.h"
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
@@ -9,7 +9,7 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
StorageListController::StorageListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer) :
|
||||
ListController::ListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer) :
|
||||
Shared::FunctionListController(parentResponder, header, footer, I18n::Message::AddFunction),
|
||||
m_functionTitleCells{ //TODO find better initialization
|
||||
TextFieldFunctionTitleCell(this),
|
||||
@@ -26,11 +26,11 @@ StorageListController::StorageListController(Responder * parentResponder, Button
|
||||
}
|
||||
}
|
||||
|
||||
const char * StorageListController::title() {
|
||||
const char * ListController::title() {
|
||||
return I18n::translate(I18n::Message::FunctionTab);
|
||||
}
|
||||
|
||||
void StorageListController::renameSelectedFunction() {
|
||||
void ListController::renameSelectedFunction() {
|
||||
assert(selectedColumn() == 0);
|
||||
assert(selectedRow() >= 0 && selectedRow() < numberOfRows()-1); // TODO change if sometimes the addFunction row is not displayed
|
||||
|
||||
@@ -45,7 +45,7 @@ void StorageListController::renameSelectedFunction() {
|
||||
selectedTitleCell->setEditing(true);
|
||||
}
|
||||
|
||||
bool StorageListController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
bool ListController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
assert(textField != nullptr);
|
||||
// Compute the new name
|
||||
size_t textLength = strlen(text);
|
||||
@@ -113,7 +113,7 @@ bool StorageListController::textFieldDidFinishEditing(TextField * textField, con
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StorageListController::textFieldDidAbortEditing(TextField * textField) {
|
||||
bool ListController::textFieldDidAbortEditing(TextField * textField) {
|
||||
assert(textField != nullptr);
|
||||
// Put the name column back to normal size
|
||||
computeTitlesColumnWidth();
|
||||
@@ -126,11 +126,11 @@ bool StorageListController::textFieldDidAbortEditing(TextField * textField) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StorageListController::textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) {
|
||||
bool ListController::textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) {
|
||||
return event == Ion::Events::Up || event == Ion::Events::Down || Shared::TextFieldDelegate::textFieldShouldFinishEditing(textField, event);
|
||||
}
|
||||
|
||||
bool StorageListController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
bool ListController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
assert(textField != nullptr);
|
||||
if (textField->isEditing() && textField->shouldFinishEditing(event)) {
|
||||
return false;
|
||||
@@ -138,30 +138,30 @@ bool StorageListController::textFieldDidReceiveEvent(TextField * textField, Ion:
|
||||
return Shared::TextFieldDelegate::textFieldDidReceiveEvent(textField, event);
|
||||
}
|
||||
|
||||
StorageListParameterController * StorageListController::parameterController() {
|
||||
Shared::ListParameterController * ListController::parameterController() {
|
||||
return &m_parameterController;
|
||||
}
|
||||
|
||||
int StorageListController::maxNumberOfDisplayableRows() {
|
||||
int ListController::maxNumberOfDisplayableRows() {
|
||||
return k_maxNumberOfDisplayableRows;
|
||||
}
|
||||
|
||||
FunctionTitleCell * StorageListController::titleCells(int index) {
|
||||
FunctionTitleCell * ListController::titleCells(int index) {
|
||||
assert(index >= 0 && index < k_maxNumberOfDisplayableRows);
|
||||
return &m_functionTitleCells[index];
|
||||
}
|
||||
|
||||
HighlightCell * StorageListController::expressionCells(int index) {
|
||||
HighlightCell * ListController::expressionCells(int index) {
|
||||
assert(index >= 0 && index < k_maxNumberOfDisplayableRows);
|
||||
return &m_expressionCells[index];
|
||||
}
|
||||
|
||||
void StorageListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
assert(cell != nullptr);
|
||||
assert(j >= 0 && j < modelStore()->numberOfModels());
|
||||
TextFieldFunctionTitleCell * titleCell = static_cast<TextFieldFunctionTitleCell *>(cell);
|
||||
// Update the corresponding expression cell in order to get the baseline
|
||||
StorageExpressionModelListController::willDisplayExpressionCellAtIndex(m_selectableTableView.cellAtLocation(1, j), j);
|
||||
ExpressionModelListController::willDisplayExpressionCellAtIndex(m_selectableTableView.cellAtLocation(1, j), j);
|
||||
titleCell->setBaseline(baseline(j));
|
||||
if (!titleCell->isEditing()) {
|
||||
// Set name and color if the name is not being edited
|
||||
@@ -172,7 +172,7 @@ void StorageListController::willDisplayTitleCellAtIndex(HighlightCell * cell, in
|
||||
}
|
||||
}
|
||||
|
||||
void StorageListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {
|
||||
void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {
|
||||
assert(cell != nullptr);
|
||||
assert(j >= 0 && j < modelStore()->numberOfModels());
|
||||
Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j);
|
||||
@@ -182,7 +182,7 @@ void StorageListController::willDisplayExpressionCellAtIndex(HighlightCell * cel
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
void StorageListController::setFunctionNameInTextField(ExpiringPointer<Function> function, TextField * textField) {
|
||||
void ListController::setFunctionNameInTextField(ExpiringPointer<Function> function, TextField * textField) {
|
||||
assert(textField != nullptr);
|
||||
char bufferName[BufferTextView::k_maxNumberOfChar];
|
||||
function->nameWithArgument(bufferName, BufferTextView::k_maxNumberOfChar, modelStore()->symbol());
|
||||
@@ -1,19 +1,19 @@
|
||||
#ifndef GRAPH_STORAGE_LIST_CONTROLLER_H
|
||||
#define GRAPH_STORAGE_LIST_CONTROLLER_H
|
||||
#ifndef GRAPH_LIST_CONTROLLER_H
|
||||
#define GRAPH_LIST_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "list_parameter_controller.h"
|
||||
#include "text_field_function_title_cell.h"
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
#include <apps/shared/function_expression_cell.h>
|
||||
#include <apps/shared/storage_function_list_controller.h>
|
||||
#include <apps/shared/function_list_controller.h>
|
||||
#include <apps/shared/text_field_delegate.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageListController : public Shared::FunctionListController, public Shared::TextFieldDelegate {
|
||||
class ListController : public Shared::FunctionListController, public Shared::TextFieldDelegate {
|
||||
public:
|
||||
StorageListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer);
|
||||
ListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer);
|
||||
const char * title() override;
|
||||
void renameSelectedFunction();
|
||||
// TextFieldDelegate
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
|
||||
private:
|
||||
constexpr static int k_maxNumberOfDisplayableRows = 5;
|
||||
Shared::StorageListParameterController * parameterController() override;
|
||||
Shared::ListParameterController * parameterController() override;
|
||||
int maxNumberOfDisplayableRows() override;
|
||||
Shared::FunctionTitleCell * titleCells(int index) override;
|
||||
HighlightCell * expressionCells(int index) override;
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "list_parameter_controller.h"
|
||||
#include "storage_list_controller.h"
|
||||
#include "list_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace Shared;
|
||||
@@ -10,7 +10,7 @@ HighlightCell * ListParameterController::reusableCell(int index) {
|
||||
if (index == 0) {
|
||||
return &m_renameCell;
|
||||
}
|
||||
return StorageListParameterController::reusableCell(index -1);
|
||||
return ListParameterController::reusableCell(index -1);
|
||||
}
|
||||
|
||||
bool ListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
@@ -18,7 +18,7 @@ bool ListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
renameFunction();
|
||||
return true;
|
||||
}
|
||||
return StorageListParameterController::handleEnterOnRow(rowIndex-1);
|
||||
return ListParameterController::handleEnterOnRow(rowIndex-1);
|
||||
}
|
||||
|
||||
void ListParameterController::renameFunction() {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef GRAPH_LIST_LIST_PARAM_CONTROLLER_H
|
||||
#define GRAPH_LIST_LIST_PARAM_CONTROLLER_H
|
||||
|
||||
#include <apps/shared/storage_list_parameter_controller.h>
|
||||
#include <apps/shared/list_parameter_controller.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageListController;
|
||||
class ListController;
|
||||
|
||||
class ListParameterController : public Shared::StorageListParameterController {
|
||||
class ListParameterController : public Shared::ListParameterController {
|
||||
public:
|
||||
ListParameterController(StorageListController * listController, Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate = nullptr) :
|
||||
Shared::StorageListParameterController(parentResponder, functionColorMessage, deleteFunctionMessage, tableDelegate),
|
||||
ListParameterController(ListController * listController, Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate = nullptr) :
|
||||
Shared::ListParameterController(parentResponder, functionColorMessage, deleteFunctionMessage, tableDelegate),
|
||||
m_listController(listController),
|
||||
m_renameCell(I18n::Message::Rename)
|
||||
{}
|
||||
@@ -19,10 +19,10 @@ protected:
|
||||
bool handleEnterOnRow(int rowIndex) override;
|
||||
private:
|
||||
int totalNumberOfCells() const override {
|
||||
return Shared::StorageListParameterController::totalNumberOfCells() + 1;
|
||||
return Shared::ListParameterController::totalNumberOfCells() + 1;
|
||||
}
|
||||
void renameFunction();
|
||||
StorageListController * m_listController;
|
||||
ListController * m_listController;
|
||||
MessageTableCell m_renameCell;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "text_field_function_title_cell.h"
|
||||
#include "storage_list_controller.h"
|
||||
#include "list_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Graph {
|
||||
@@ -7,7 +7,7 @@ namespace Graph {
|
||||
static inline float minFloat(float x, float y) { return x < y ? x : y; }
|
||||
static inline float maxFloat(float x, float y) { return x > y ? x : y; }
|
||||
|
||||
TextFieldFunctionTitleCell::TextFieldFunctionTitleCell(StorageListController * listController, Orientation orientation, const KDFont * font) :
|
||||
TextFieldFunctionTitleCell::TextFieldFunctionTitleCell(ListController * listController, Orientation orientation, const KDFont * font) :
|
||||
Shared::FunctionTitleCell(orientation),
|
||||
Responder(listController),
|
||||
m_textField(Shared::Function::k_parenthesedArgumentLength, this, m_textFieldBuffer, m_textFieldBuffer, k_textFieldBufferSize, nullptr, listController, false, font, 1.0f, 0.5f)
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageListController;
|
||||
class ListController;
|
||||
|
||||
class TextFieldFunctionTitleCell : public Shared::FunctionTitleCell, public Responder {
|
||||
public:
|
||||
TextFieldFunctionTitleCell(StorageListController * listController, Orientation orientation = Orientation::VerticalIndicator, const KDFont * font = KDFont::LargeFont);
|
||||
TextFieldFunctionTitleCell(ListController * listController, Orientation orientation = Orientation::VerticalIndicator, const KDFont * font = KDFont::LargeFont);
|
||||
TextField * textField() { return &m_textField; }
|
||||
void setEditing(bool editing);
|
||||
bool isEditing() const;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "storage_derivative_parameter_controller.h"
|
||||
#include "storage_values_controller.h"
|
||||
#include "derivative_parameter_controller.h"
|
||||
#include "values_controller.h"
|
||||
#include "../app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
StorageDerivativeParameterController::StorageDerivativeParameterController(StorageValuesController * valuesController) :
|
||||
DerivativeParameterController::DerivativeParameterController(ValuesController * valuesController) :
|
||||
ViewController(valuesController),
|
||||
m_hideColumn(I18n::Message::HideDerivativeColumn),
|
||||
#if COPY_COLUMN
|
||||
@@ -17,24 +17,24 @@ StorageDerivativeParameterController::StorageDerivativeParameterController(Stora
|
||||
{
|
||||
}
|
||||
|
||||
void StorageDerivativeParameterController::viewWillAppear() {
|
||||
void DerivativeParameterController::viewWillAppear() {
|
||||
functionStore()->modelForRecord(m_record)->derivativeNameWithArgument(m_pageTitle, k_maxNumberOfCharsInTitle, Shared::CartesianFunction::Symbol());
|
||||
}
|
||||
|
||||
const char * StorageDerivativeParameterController::title() {
|
||||
const char * DerivativeParameterController::title() {
|
||||
return m_pageTitle;
|
||||
}
|
||||
|
||||
View * StorageDerivativeParameterController::view() {
|
||||
View * DerivativeParameterController::view() {
|
||||
return &m_selectableTableView;
|
||||
}
|
||||
|
||||
void StorageDerivativeParameterController::didBecomeFirstResponder() {
|
||||
void DerivativeParameterController::didBecomeFirstResponder() {
|
||||
selectCellAtLocation(0, 0);
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
bool StorageDerivativeParameterController::handleEvent(Ion::Events::Event event) {
|
||||
bool DerivativeParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
switch (selectedRow()) {
|
||||
case 0:
|
||||
@@ -58,11 +58,11 @@ bool StorageDerivativeParameterController::handleEvent(Ion::Events::Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
int StorageDerivativeParameterController::numberOfRows() {
|
||||
int DerivativeParameterController::numberOfRows() {
|
||||
return k_totalNumberOfCell;
|
||||
};
|
||||
|
||||
HighlightCell * StorageDerivativeParameterController::reusableCell(int index) {
|
||||
HighlightCell * DerivativeParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_totalNumberOfCell);
|
||||
#if COPY_COLUMN
|
||||
@@ -73,15 +73,15 @@ HighlightCell * StorageDerivativeParameterController::reusableCell(int index) {
|
||||
return cells[index];
|
||||
}
|
||||
|
||||
int StorageDerivativeParameterController::reusableCellCount() {
|
||||
int DerivativeParameterController::reusableCellCount() {
|
||||
return k_totalNumberOfCell;
|
||||
}
|
||||
|
||||
KDCoordinate StorageDerivativeParameterController::cellHeight() {
|
||||
KDCoordinate DerivativeParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
StorageCartesianFunctionStore * StorageDerivativeParameterController::functionStore() {
|
||||
CartesianFunctionStore * DerivativeParameterController::functionStore() {
|
||||
App * a = static_cast<App *>(app());
|
||||
return a->functionStore();
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef GRAPH_STORAGE_DERIVATIVE_PARAM_CONTROLLER_H
|
||||
#define GRAPH_STORAGE_DERIVATIVE_PARAM_CONTROLLER_H
|
||||
#ifndef GRAPH_DERIVATIVE_PARAM_CONTROLLER_H
|
||||
#define GRAPH_DERIVATIVE_PARAM_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageValuesController;
|
||||
class ValuesController;
|
||||
|
||||
class StorageDerivativeParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
class DerivativeParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
StorageDerivativeParameterController(StorageValuesController * valuesController);
|
||||
DerivativeParameterController(ValuesController * valuesController);
|
||||
|
||||
View * view() override;
|
||||
const char * title() override;
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
m_record = record;
|
||||
}
|
||||
private:
|
||||
StorageCartesianFunctionStore * functionStore();
|
||||
CartesianFunctionStore * functionStore();
|
||||
#if COPY_COLUMN
|
||||
constexpr static int k_totalNumberOfCell = 2;
|
||||
#else
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
#endif
|
||||
SelectableTableView m_selectableTableView;
|
||||
Ion::Storage::Record m_record;
|
||||
StorageValuesController * m_valuesController;
|
||||
ValuesController * m_valuesController;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "storage_function_parameter_controller.h"
|
||||
#include "storage_values_controller.h"
|
||||
#include "function_parameter_controller.h"
|
||||
#include "values_controller.h"
|
||||
#include "../app.h"
|
||||
#include <assert.h>
|
||||
|
||||
@@ -7,8 +7,8 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
FunctionParameterController::FunctionParameterController(StorageValuesController * valuesController) :
|
||||
StorageValuesFunctionParameterController(CartesianFunction::Symbol()),
|
||||
FunctionParameterController::FunctionParameterController(ValuesController * valuesController) :
|
||||
ValuesFunctionParameterController(CartesianFunction::Symbol()),
|
||||
m_displayDerivativeColumn(I18n::Message::DerivativeFunctionColumn),
|
||||
m_valuesController(valuesController)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ int FunctionParameterController::reusableCellCount() {
|
||||
}
|
||||
|
||||
void FunctionParameterController::viewWillAppear() {
|
||||
StorageValuesFunctionParameterController::viewWillAppear();
|
||||
ValuesFunctionParameterController::viewWillAppear();
|
||||
m_selectedFunctionColumn = m_valuesController->selectedColumn();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef GRAPH_STORAGE_FUNCTION_PARAM_CONTROLLER_H
|
||||
#define GRAPH_STORAGE_FUNCTION_PARAM_CONTROLLER_H
|
||||
#ifndef GRAPH_FUNCTION_PARAM_CONTROLLER_H
|
||||
#define GRAPH_FUNCTION_PARAM_CONTROLLER_H
|
||||
|
||||
#include "../../shared/expiring_pointer.h"
|
||||
#include "../../shared/cartesian_function.h"
|
||||
#include "../../shared/storage_values_function_parameter_controller.h"
|
||||
#include "../../shared/values_function_parameter_controller.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageValuesController;
|
||||
class ValuesController;
|
||||
|
||||
class FunctionParameterController : public Shared::StorageValuesFunctionParameterController {
|
||||
class FunctionParameterController : public Shared::ValuesFunctionParameterController {
|
||||
public:
|
||||
FunctionParameterController(StorageValuesController * valuesController);
|
||||
FunctionParameterController(ValuesController * valuesController);
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
int numberOfRows() override;
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
@@ -26,7 +26,7 @@ private:
|
||||
constexpr static int k_totalNumberOfCell = 1;
|
||||
#endif
|
||||
MessageTableCellWithSwitch m_displayDerivativeColumn;
|
||||
StorageValuesController * m_valuesController;
|
||||
ValuesController * m_valuesController;
|
||||
// Index of the column corresponding to the function in the values controller
|
||||
int m_selectedFunctionColumn;
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_values_controller.h"
|
||||
#include "values_controller.h"
|
||||
#include <assert.h>
|
||||
#include "../../constant.h"
|
||||
|
||||
@@ -7,8 +7,8 @@ using namespace Poincare;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
StorageValuesController::StorageValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Interval * interval, ButtonRowController * header) :
|
||||
Shared::StorageValuesController(parentResponder, inputEventHandlerDelegate, header, I18n::Message::X, &m_intervalParameterController, interval),
|
||||
ValuesController::ValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Interval * interval, ButtonRowController * header) :
|
||||
Shared::ValuesController(parentResponder, inputEventHandlerDelegate, header, I18n::Message::X, &m_intervalParameterController, interval),
|
||||
m_functionTitleCells{},
|
||||
m_floatCells{},
|
||||
m_functionParameterController(this),
|
||||
@@ -21,17 +21,17 @@ StorageValuesController::StorageValuesController(Responder * parentResponder, In
|
||||
}
|
||||
}
|
||||
|
||||
bool StorageValuesController::handleEvent(Ion::Events::Event event) {
|
||||
bool ValuesController::handleEvent(Ion::Events::Event event) {
|
||||
if ((event == Ion::Events::OK || event == Ion::Events::EXE) && selectedRow() == 0
|
||||
&& selectedColumn()>0 && isDerivativeColumn(selectedColumn())) {
|
||||
configureDerivativeFunction();
|
||||
return true;
|
||||
}
|
||||
return Shared::StorageValuesController::handleEvent(event);
|
||||
return Shared::ValuesController::handleEvent(event);
|
||||
}
|
||||
|
||||
void StorageValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
Shared::StorageValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
Shared::ValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
// The cell is the abscissa title cell:
|
||||
if (j == 0 && i == 0) {
|
||||
EvenOddMessageTextCell * mytitleCell = (EvenOddMessageTextCell *)cell;
|
||||
@@ -57,18 +57,18 @@ void StorageValuesController::willDisplayCellAtLocation(HighlightCell * cell, in
|
||||
}
|
||||
}
|
||||
|
||||
I18n::Message StorageValuesController::emptyMessage() {
|
||||
I18n::Message ValuesController::emptyMessage() {
|
||||
if (functionStore()->numberOfDefinedModels() == 0) {
|
||||
return I18n::Message::NoFunction;
|
||||
}
|
||||
return I18n::Message::NoActivatedFunction;
|
||||
}
|
||||
|
||||
IntervalParameterController * StorageValuesController::intervalParameterController() {
|
||||
IntervalParameterController * ValuesController::intervalParameterController() {
|
||||
return &m_intervalParameterController;
|
||||
}
|
||||
|
||||
Ion::Storage::Record StorageValuesController::recordAtColumn(int i) {
|
||||
Ion::Storage::Record ValuesController::recordAtColumn(int i) {
|
||||
assert(i > 0);
|
||||
int index = 1;
|
||||
for (int k = 0; k < functionStore()->numberOfDefinedModels(); k++) {
|
||||
@@ -91,7 +91,7 @@ Ion::Storage::Record StorageValuesController::recordAtColumn(int i) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool StorageValuesController::isDerivativeColumn(int i) {
|
||||
bool ValuesController::isDerivativeColumn(int i) {
|
||||
assert(i >= 1);
|
||||
int index = 1;
|
||||
for (int k = 0; k < functionStore()->numberOfDefinedModels(); k++) {
|
||||
@@ -113,35 +113,35 @@ bool StorageValuesController::isDerivativeColumn(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StorageValuesController::configureDerivativeFunction() {
|
||||
void ValuesController::configureDerivativeFunction() {
|
||||
m_derivativeParameterController.setRecord(recordAtColumn(selectedColumn()));
|
||||
StackViewController * stack = stackController();
|
||||
stack->push(&m_derivativeParameterController);
|
||||
}
|
||||
|
||||
int StorageValuesController::maxNumberOfCells() {
|
||||
int ValuesController::maxNumberOfCells() {
|
||||
return k_maxNumberOfCells;
|
||||
}
|
||||
|
||||
int StorageValuesController::maxNumberOfFunctions() {
|
||||
int ValuesController::maxNumberOfFunctions() {
|
||||
return k_maxNumberOfFunctions;
|
||||
}
|
||||
|
||||
Shared::BufferFunctionTitleCell * StorageValuesController::functionTitleCells(int j) {
|
||||
Shared::BufferFunctionTitleCell * ValuesController::functionTitleCells(int j) {
|
||||
assert(j >= 0 && j < k_maxNumberOfFunctions);
|
||||
return &m_functionTitleCells[j];
|
||||
}
|
||||
|
||||
EvenOddBufferTextCell * StorageValuesController::floatCells(int j) {
|
||||
EvenOddBufferTextCell * ValuesController::floatCells(int j) {
|
||||
assert(j >= 0 && j < k_maxNumberOfCells);
|
||||
return &m_floatCells[j];
|
||||
}
|
||||
|
||||
FunctionParameterController * StorageValuesController::functionParameterController() {
|
||||
FunctionParameterController * ValuesController::functionParameterController() {
|
||||
return &m_functionParameterController;
|
||||
}
|
||||
|
||||
double StorageValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
|
||||
double ValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
|
||||
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
|
||||
bool isDerivative = isDerivativeColumn(columnIndex);
|
||||
/* isDerivativeColumn uses expiring pointers, so "function" must be created
|
||||
@@ -153,7 +153,7 @@ double StorageValuesController::evaluationOfAbscissaAtColumn(double abscissa, in
|
||||
return function->evaluateAtAbscissa(abscissa, myApp->localContext());
|
||||
}
|
||||
|
||||
void StorageValuesController::updateNumberOfColumns() {
|
||||
void ValuesController::updateNumberOfColumns() {
|
||||
int result = 1;
|
||||
for (int i = 0; i < functionStore()->numberOfActiveFunctions(); i++) {
|
||||
ExpiringPointer<CartesianFunction> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
@@ -1,18 +1,18 @@
|
||||
#ifndef GRAPH_VALUES_CONTROLLER_H
|
||||
#define GRAPH_VALUES_CONTROLLER_H
|
||||
|
||||
#include "../storage_cartesian_function_store.h"
|
||||
#include "../cartesian_function_store.h"
|
||||
#include "../../shared/buffer_function_title_cell.h"
|
||||
#include "../../shared/storage_values_controller.h"
|
||||
#include "../../shared/values_controller.h"
|
||||
#include "../../shared/interval_parameter_controller.h"
|
||||
#include "storage_derivative_parameter_controller.h"
|
||||
#include "storage_function_parameter_controller.h"
|
||||
#include "derivative_parameter_controller.h"
|
||||
#include "function_parameter_controller.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class StorageValuesController : public Shared::StorageValuesController {
|
||||
class ValuesController : public Shared::ValuesController {
|
||||
public:
|
||||
StorageValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::Interval * interval, ButtonRowController * header);
|
||||
ValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::Interval * interval, ButtonRowController * header);
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
I18n::Message emptyMessage() override;
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
int maxNumberOfCells() override;
|
||||
int maxNumberOfFunctions() override;
|
||||
double evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) override;
|
||||
StorageCartesianFunctionStore * functionStore() const override { return static_cast<StorageCartesianFunctionStore *>(Shared::StorageValuesController::functionStore()); }
|
||||
CartesianFunctionStore * functionStore() const override { return static_cast<CartesianFunctionStore *>(Shared::ValuesController::functionStore()); }
|
||||
Shared::BufferFunctionTitleCell * functionTitleCells(int j) override;
|
||||
EvenOddBufferTextCell * floatCells(int j) override;
|
||||
FunctionParameterController * functionParameterController() override;
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
EvenOddBufferTextCell m_floatCells[k_maxNumberOfCells];
|
||||
FunctionParameterController m_functionParameterController;
|
||||
Shared::IntervalParameterController m_intervalParameterController;
|
||||
StorageDerivativeParameterController m_derivativeParameterController;
|
||||
DerivativeParameterController m_derivativeParameterController;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
#define SEQUENCE_CURVE_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "../../shared/storage_function_curve_parameter_controller.h"
|
||||
#include "../../shared/function_curve_parameter_controller.h"
|
||||
#include "go_to_parameter_controller.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SEQUENCE_GO_TO_PARAMETER_CONTROLLER_H
|
||||
#define SEQUENCE_GO_TO_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include "../../shared/storage_function_go_to_parameter_controller.h"
|
||||
#include "../../shared/function_go_to_parameter_controller.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "curve_parameter_controller.h"
|
||||
#include "curve_view_range.h"
|
||||
#include "term_sum_controller.h"
|
||||
#include "../../shared/storage_function_graph_controller.h"
|
||||
#include "../../shared/function_graph_controller.h"
|
||||
#include "../../shared/cursor_view.h"
|
||||
#include "../sequence_store.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SEQUENCE_GRAPH_VIEW_H
|
||||
#define SEQUENCE_GRAPH_VIEW_H
|
||||
|
||||
#include "../../shared/storage_function_graph_view.h"
|
||||
#include "../../shared/function_graph_view.h"
|
||||
#include "../sequence_store.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
@@ -17,7 +17,7 @@ using namespace Poincare;
|
||||
namespace Sequence {
|
||||
|
||||
TermSumController::TermSumController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, GraphView * graphView, CurveViewRange * graphRange, CurveViewCursor * cursor) :
|
||||
StorageSumGraphController(parentResponder, inputEventHandlerDelegate, graphView, graphRange, cursor, UCodePointNArySummation)
|
||||
SumGraphController(parentResponder, inputEventHandlerDelegate, graphView, graphRange, cursor, UCodePointNArySummation)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ bool TermSumController::moveCursorHorizontallyToPosition(double position) {
|
||||
if (position < 0.0) {
|
||||
return false;
|
||||
}
|
||||
return StorageSumGraphController::moveCursorHorizontallyToPosition(std::round(position));
|
||||
return SumGraphController::moveCursorHorizontallyToPosition(std::round(position));
|
||||
}
|
||||
|
||||
I18n::Message TermSumController::legendMessageAtStep(Step step) {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include <poincare/layout.h>
|
||||
#include "graph_view.h"
|
||||
#include "curve_view_range.h"
|
||||
#include "../../shared/storage_sum_graph_controller.h"
|
||||
#include "../../shared/sum_graph_controller.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
class TermSumController : public Shared::StorageSumGraphController {
|
||||
class TermSumController : public Shared::SumGraphController {
|
||||
public:
|
||||
TermSumController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, GraphView * graphView, CurveViewRange * graphRange, Shared::CurveViewCursor * cursor);
|
||||
const char * title() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../sequence_title_cell.h"
|
||||
#include "../sequence_store.h"
|
||||
#include "../../shared/function_expression_cell.h"
|
||||
#include "../../shared/storage_function_list_controller.h"
|
||||
#include "../../shared/function_list_controller.h"
|
||||
#include "../../shared/input_event_handler_delegate.h"
|
||||
#include "../../shared/layout_field_delegate.h"
|
||||
#include "../../shared/text_field_delegate.h"
|
||||
|
||||
@@ -10,7 +10,7 @@ using namespace Shared;
|
||||
namespace Sequence {
|
||||
|
||||
ListParameterController::ListParameterController(::InputEventHandlerDelegate * inputEventHandlerDelegate, ListController * listController) :
|
||||
Shared::StorageListParameterController(listController, I18n::Message::SequenceColor, I18n::Message::DeleteSequence, this),
|
||||
Shared::ListParameterController(listController, I18n::Message::SequenceColor, I18n::Message::DeleteSequence, this),
|
||||
m_typeCell(I18n::Message::SequenceType),
|
||||
m_initialRankCell(&m_selectableTableView, inputEventHandlerDelegate, this, m_draftTextBuffer, I18n::Message::FirstTermIndex),
|
||||
m_typeParameterController(this, listController, TableCell::Layout::Horizontal, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
@@ -75,13 +75,13 @@ HighlightCell * ListParameterController::reusableCell(int index) {
|
||||
return &m_initialRankCell;
|
||||
}
|
||||
default:
|
||||
return Shared::StorageListParameterController::reusableCell(index-1-hasInitialRankRow());
|
||||
return Shared::ListParameterController::reusableCell(index-1-hasInitialRankRow());
|
||||
}
|
||||
}
|
||||
|
||||
void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
cell->setHighlighted(index == selectedRow()); // See FIXME in SelectableTableView::reloadData()
|
||||
Shared::StorageListParameterController::willDisplayCellForIndex(cell, index);
|
||||
Shared::ListParameterController::willDisplayCellForIndex(cell, index);
|
||||
if (cell == &m_typeCell && !m_record.isNull()) {
|
||||
m_typeCell.setLayout(sequence()->definitionName());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SEQUENCE_LIST_PARAM_CONTROLLER_H
|
||||
#define SEQUENCE_LIST_PARAM_CONTROLLER_H
|
||||
|
||||
#include "../../shared/storage_list_parameter_controller.h"
|
||||
#include "../../shared/list_parameter_controller.h"
|
||||
#include "../../shared/parameter_text_field_delegate.h"
|
||||
#include "../sequence.h"
|
||||
#include "../sequence_store.h"
|
||||
@@ -11,7 +11,7 @@ namespace Sequence {
|
||||
|
||||
class ListController;
|
||||
|
||||
class ListParameterController : public Shared::StorageListParameterController, public SelectableTableViewDelegate, public Shared::ParameterTextFieldDelegate {
|
||||
class ListParameterController : public Shared::ListParameterController, public SelectableTableViewDelegate, public Shared::ParameterTextFieldDelegate {
|
||||
public:
|
||||
ListParameterController(::InputEventHandlerDelegate * inputEventHandlerDelegate, ListController * list);
|
||||
const char * title() override;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SEQUENCE_SEQUENCE_STORE_H
|
||||
#define SEQUENCE_SEQUENCE_STORE_H
|
||||
|
||||
#include "../shared/storage_function_store.h"
|
||||
#include "../shared/function_store.h"
|
||||
#include "../shared/global_context.h"
|
||||
#include "sequence.h"
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace Shared;
|
||||
namespace Sequence {
|
||||
|
||||
ValuesController::ValuesController(Responder * parentResponder,InputEventHandlerDelegate * inputEventHandlerDelegate, Interval * interval, ButtonRowController * header) :
|
||||
Shared::StorageValuesController(parentResponder, inputEventHandlerDelegate, header, I18n::Message::NColumn, &m_intervalParameterController, interval),
|
||||
Shared::ValuesController(parentResponder, inputEventHandlerDelegate, header, I18n::Message::NColumn, &m_intervalParameterController, interval),
|
||||
m_sequenceTitleCells{},
|
||||
m_floatCells{},
|
||||
#if COPY_COLUMN
|
||||
@@ -21,7 +21,7 @@ ValuesController::ValuesController(Responder * parentResponder,InputEventHandler
|
||||
}
|
||||
|
||||
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
Shared::StorageValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
Shared::ValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
// The cell is the abscissa title cell:
|
||||
if (j == 0 && i == 0) {
|
||||
EvenOddMessageTextCell * mytitleCell = (EvenOddMessageTextCell *)cell;
|
||||
@@ -52,7 +52,7 @@ bool ValuesController::setDataAtLocation(double floatBody, int columnIndex, int
|
||||
if (floatBody < 0) {
|
||||
return false;
|
||||
}
|
||||
return Shared::StorageValuesController::setDataAtLocation(std::round(floatBody), columnIndex, rowIndex);
|
||||
return Shared::ValuesController::setDataAtLocation(std::round(floatBody), columnIndex, rowIndex);
|
||||
}
|
||||
|
||||
int ValuesController::maxNumberOfCells() {
|
||||
@@ -73,7 +73,7 @@ EvenOddBufferTextCell * ValuesController::floatCells(int j) {
|
||||
return &m_floatCells[j];
|
||||
}
|
||||
|
||||
Shared::StorageValuesFunctionParameterController * ValuesController::functionParameterController() {
|
||||
Shared::ValuesFunctionParameterController * ValuesController::functionParameterController() {
|
||||
#if COPY_COLUMN
|
||||
return &m_sequenceParameterController;
|
||||
#else
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
#include "../sequence_store.h"
|
||||
#include "../sequence_title_cell.h"
|
||||
#include "../../shared/storage_values_controller.h"
|
||||
#include "../../shared/values_controller.h"
|
||||
#include "interval_parameter_controller.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
class ValuesController : public Shared::StorageValuesController {
|
||||
class ValuesController : public Shared::ValuesController {
|
||||
public:
|
||||
ValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Shared::Interval * interval, ButtonRowController * header);
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
@@ -24,11 +24,11 @@ private:
|
||||
SequenceTitleCell * functionTitleCells(int j) override;
|
||||
EvenOddBufferTextCell m_floatCells[k_maxNumberOfCells];
|
||||
EvenOddBufferTextCell * floatCells(int j) override;
|
||||
SequenceStore * functionStore() const override { return static_cast<SequenceStore *>(Shared::StorageValuesController::functionStore()); }
|
||||
SequenceStore * functionStore() const override { return static_cast<SequenceStore *>(Shared::ValuesController::functionStore()); }
|
||||
#if COPY_COLUMN
|
||||
Shared::ValuesFunctionParameterController m_sequenceParameterController;
|
||||
#endif
|
||||
Shared::StorageValuesFunctionParameterController * functionParameterController() override;
|
||||
Shared::ValuesFunctionParameterController * functionParameterController() override;
|
||||
IntervalParameterController m_intervalParameterController;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,10 +13,19 @@ app_src += $(addprefix apps/shared/,\
|
||||
expression_field_delegate_app.cpp \
|
||||
expression_model.cpp \
|
||||
expression_model_handle.cpp \
|
||||
expression_model_list_controller.cpp \
|
||||
expression_model_store.cpp \
|
||||
float_parameter_controller.cpp \
|
||||
function.cpp \
|
||||
function_app.cpp \
|
||||
function_banner_delegate.cpp \
|
||||
function_curve_parameter_controller.cpp \
|
||||
function_expression_cell.cpp \
|
||||
function_graph_controller.cpp \
|
||||
function_graph_view.cpp \
|
||||
function_go_to_parameter_controller.cpp \
|
||||
function_list_controller.cpp \
|
||||
function_store.cpp \
|
||||
function_title_cell.cpp \
|
||||
global_context.cpp \
|
||||
go_to_parameter_controller.cpp \
|
||||
@@ -31,6 +40,7 @@ app_src += $(addprefix apps/shared/,\
|
||||
interval_parameter_controller.cpp \
|
||||
language_controller.cpp \
|
||||
layout_field_delegate.cpp \
|
||||
list_parameter_controller.cpp \
|
||||
margin_even_odd_message_text_cell.cpp \
|
||||
memoized_curve_view_range.cpp \
|
||||
message_view.cpp \
|
||||
@@ -43,30 +53,20 @@ app_src += $(addprefix apps/shared/,\
|
||||
scrollable_exact_approximate_expressions_view.cpp \
|
||||
separator_even_odd_buffer_text_cell.cpp \
|
||||
simple_interactive_curve_view_controller.cpp \
|
||||
storage_expression_model_list_controller.cpp \
|
||||
storage_expression_model_store.cpp \
|
||||
storage_function_banner_delegate.cpp \
|
||||
storage_function_curve_parameter_controller.cpp \
|
||||
storage_function_go_to_parameter_controller.cpp \
|
||||
storage_function_graph_controller.cpp \
|
||||
storage_function_graph_view.cpp \
|
||||
storage_function_list_controller.cpp \
|
||||
storage_function_store.cpp \
|
||||
storage_list_parameter_controller.cpp \
|
||||
storage_sum_graph_controller.cpp \
|
||||
storage_values_controller.cpp \
|
||||
storage_values_function_parameter_controller.cpp \
|
||||
store_cell.cpp \
|
||||
store_context.cpp \
|
||||
store_controller.cpp \
|
||||
store_parameter_controller.cpp \
|
||||
store_selectable_table_view.cpp \
|
||||
store_title_cell.cpp \
|
||||
sum_graph_controller.cpp \
|
||||
tab_table_controller.cpp \
|
||||
text_field_delegate.cpp \
|
||||
text_field_delegate_app.cpp \
|
||||
text_field_with_extension.cpp \
|
||||
toolbox_helpers.cpp \
|
||||
values_controller.cpp \
|
||||
values_function_parameter_controller.cpp \
|
||||
values_parameter_controller.cpp \
|
||||
vertical_cursor_view.cpp \
|
||||
zoom_parameter_controller.cpp \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cartesian_function.h"
|
||||
#include "storage_expression_model_store.h"
|
||||
#include "expression_model_store.h"
|
||||
#include "poincare_helpers.h"
|
||||
#include <poincare/derivative.h>
|
||||
#include <poincare/integral.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_expression_model_list_controller.h"
|
||||
#include "expression_model_list_controller.h"
|
||||
#include <apps/constant.h>
|
||||
#include <poincare/symbol.h>
|
||||
|
||||
@@ -8,7 +8,7 @@ static inline int minInt(int x, int y) { return x < y ? x : y; }
|
||||
|
||||
/* Table Data Source */
|
||||
|
||||
StorageExpressionModelListController::StorageExpressionModelListController(Responder * parentResponder, I18n::Message text) :
|
||||
ExpressionModelListController::ExpressionModelListController(Responder * parentResponder, I18n::Message text) :
|
||||
ViewController(parentResponder),
|
||||
m_addNewModel()
|
||||
{
|
||||
@@ -16,7 +16,7 @@ StorageExpressionModelListController::StorageExpressionModelListController(Respo
|
||||
m_addNewModel.setMessage(text);
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) {
|
||||
void ExpressionModelListController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) {
|
||||
int currentSelectedRow = selectedRow();
|
||||
|
||||
// Update m_cumulatedHeightForSelectedIndex if we scrolled one cell up/down
|
||||
@@ -48,7 +48,7 @@ void StorageExpressionModelListController::tableViewDidChangeSelection(Selectabl
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate StorageExpressionModelListController::memoizedRowHeight(int j) {
|
||||
KDCoordinate ExpressionModelListController::memoizedRowHeight(int j) {
|
||||
if (j < 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ KDCoordinate StorageExpressionModelListController::memoizedRowHeight(int j) {
|
||||
return expressionRowHeight(j);
|
||||
}
|
||||
|
||||
KDCoordinate StorageExpressionModelListController::memoizedCumulatedHeightFromIndex(int j) {
|
||||
KDCoordinate ExpressionModelListController::memoizedCumulatedHeightFromIndex(int j) {
|
||||
if (j <= 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ KDCoordinate StorageExpressionModelListController::memoizedCumulatedHeightFromIn
|
||||
return result;
|
||||
}
|
||||
|
||||
int StorageExpressionModelListController::memoizedIndexFromCumulatedHeight(KDCoordinate offsetY) {
|
||||
int ExpressionModelListController::memoizedIndexFromCumulatedHeight(KDCoordinate offsetY) {
|
||||
if (offsetY == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -134,14 +134,14 @@ int StorageExpressionModelListController::memoizedIndexFromCumulatedHeight(KDCoo
|
||||
return notMemoizedIndexFromCumulatedHeight(offsetY);
|
||||
}
|
||||
|
||||
int StorageExpressionModelListController::numberOfExpressionRows() {
|
||||
int ExpressionModelListController::numberOfExpressionRows() {
|
||||
if (modelStore()->numberOfModels() == modelStore()->maxNumberOfModels()) {
|
||||
return modelStore()->numberOfModels();
|
||||
}
|
||||
return 1 + modelStore()->numberOfModels();
|
||||
}
|
||||
|
||||
KDCoordinate StorageExpressionModelListController::expressionRowHeight(int j) {
|
||||
KDCoordinate ExpressionModelListController::expressionRowHeight(int j) {
|
||||
if (isAddEmptyRow(j)) {
|
||||
return Metric::StoreRowHeight;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ KDCoordinate StorageExpressionModelListController::expressionRowHeight(int j) {
|
||||
return Metric::StoreRowHeight > modelHeightWithMargins ? Metric::StoreRowHeight : modelHeightWithMargins;
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {
|
||||
void ExpressionModelListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {
|
||||
EvenOddExpressionCell * myCell = (EvenOddExpressionCell *)cell;
|
||||
ExpiringPointer<ExpressionModelHandle> m = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
myCell->setLayout(m->layout());
|
||||
@@ -162,7 +162,7 @@ void StorageExpressionModelListController::willDisplayExpressionCellAtIndex(High
|
||||
|
||||
/* Responder */
|
||||
|
||||
bool StorageExpressionModelListController::handleEventOnExpression(Ion::Events::Event event) {
|
||||
bool ExpressionModelListController::handleEventOnExpression(Ion::Events::Event event) {
|
||||
if (selectedRow() < 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ bool StorageExpressionModelListController::handleEventOnExpression(Ion::Events::
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void StorageExpressionModelListController::addEmptyModel() {
|
||||
void ExpressionModelListController::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus error = modelStore()->addEmptyModel();
|
||||
if (error == Ion::Storage::Record::ErrorStatus::NotEnoughSpaceAvailable) {
|
||||
return;
|
||||
@@ -206,14 +206,14 @@ void StorageExpressionModelListController::addEmptyModel() {
|
||||
editExpression(Ion::Events::OK);
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::reinitSelectedExpression(ExpiringPointer<ExpressionModelHandle> model) {
|
||||
void ExpressionModelListController::reinitSelectedExpression(ExpiringPointer<ExpressionModelHandle> model) {
|
||||
model->setContent("");
|
||||
// Reset memoization of the selected cell which always corresponds to the k_memoizedCellsCount/2 memoized cell
|
||||
resetMemoizationForIndex(k_memoizedCellsCount/2);
|
||||
selectableTableView()->reloadData();
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::replaceUnknownSymbolWithReadableSymbol(char * text) {
|
||||
void ExpressionModelListController::replaceUnknownSymbolWithReadableSymbol(char * text) {
|
||||
size_t textLength = strlen(text);
|
||||
char unknownSymb = modelStore()->unknownSymbol();
|
||||
char symb = modelStore()->symbol();
|
||||
@@ -224,7 +224,7 @@ void StorageExpressionModelListController::replaceUnknownSymbolWithReadableSymbo
|
||||
}
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::editExpression(Ion::Events::Event event) {
|
||||
void ExpressionModelListController::editExpression(Ion::Events::Event event) {
|
||||
char * initialText = nullptr;
|
||||
constexpr int initialTextContentMaxSize = Constant::MaxSerializedExpressionSize;
|
||||
char initialTextContent[initialTextContentMaxSize];
|
||||
@@ -238,7 +238,7 @@ void StorageExpressionModelListController::editExpression(Ion::Events::Event eve
|
||||
}
|
||||
inputController()->edit(this, event, this, initialText,
|
||||
[](void * context, void * sender){
|
||||
StorageExpressionModelListController * myController = static_cast<StorageExpressionModelListController *>(context);
|
||||
ExpressionModelListController * myController = static_cast<ExpressionModelListController *>(context);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
const char * textBody = myInputViewController->textBody();
|
||||
return myController->editSelectedRecordWithText(textBody);
|
||||
@@ -248,7 +248,7 @@ void StorageExpressionModelListController::editExpression(Ion::Events::Event eve
|
||||
});
|
||||
}
|
||||
|
||||
bool StorageExpressionModelListController::editSelectedRecordWithText(const char * text) {
|
||||
bool ExpressionModelListController::editSelectedRecordWithText(const char * text) {
|
||||
// Reset memoization of the selected cell which always corresponds to the k_memoizedCellsCount/2 memoized cell
|
||||
resetMemoizationForIndex(k_memoizedCellsCount/2);
|
||||
Ion::Storage::Record record = modelStore()->recordAtIndex(modelIndexForRow(selectedRow()));
|
||||
@@ -256,22 +256,22 @@ bool StorageExpressionModelListController::editSelectedRecordWithText(const char
|
||||
return (model->setContent(text) == Ion::Storage::Record::ErrorStatus::None);
|
||||
}
|
||||
|
||||
bool StorageExpressionModelListController::removeModelRow(Ion::Storage::Record record) {
|
||||
bool ExpressionModelListController::removeModelRow(Ion::Storage::Record record) {
|
||||
modelStore()->removeModel(record);
|
||||
didChangeModelsList();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StorageExpressionModelListController::isAddEmptyRow(int j) {
|
||||
bool ExpressionModelListController::isAddEmptyRow(int j) {
|
||||
return j == modelStore()->numberOfModels();
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::resetMemoizationForIndex(int index) {
|
||||
void ExpressionModelListController::resetMemoizationForIndex(int index) {
|
||||
assert(index >= 0 && index < k_memoizedCellsCount);
|
||||
m_memoizedCellHeight[index] = k_resetedMemoizedValue;
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::shiftMemoization(bool newCellIsUnder) {
|
||||
void ExpressionModelListController::shiftMemoization(bool newCellIsUnder) {
|
||||
if (newCellIsUnder) {
|
||||
for (int i = 0; i < k_memoizedCellsCount - 1; i++) {
|
||||
m_memoizedCellHeight[i] = m_memoizedCellHeight[i+1];
|
||||
@@ -283,7 +283,7 @@ void StorageExpressionModelListController::shiftMemoization(bool newCellIsUnder)
|
||||
}
|
||||
}
|
||||
|
||||
void StorageExpressionModelListController::resetMemoization() {
|
||||
void ExpressionModelListController::resetMemoization() {
|
||||
m_cumulatedHeightForSelectedIndex = k_resetedMemoizedValue;
|
||||
for (int i = 0; i < k_memoizedCellsCount; i++) {
|
||||
resetMemoizationForIndex(i);
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef SHARED_STORAGE_EXPRESSION_MODEL_LIST_CONTROLLER_H
|
||||
#define SHARED_STORAGE_EXPRESSION_MODEL_LIST_CONTROLLER_H
|
||||
#ifndef SHARED_EXPRESSION_MODEL_LIST_CONTROLLER_H
|
||||
#define SHARED_EXPRESSION_MODEL_LIST_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_expression_model_store.h"
|
||||
#include "expression_model_store.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class StorageExpressionModelListController : public ViewController, public SelectableTableViewDataSource, public SelectableTableViewDelegate {
|
||||
class ExpressionModelListController : public ViewController, public SelectableTableViewDataSource, public SelectableTableViewDelegate {
|
||||
public:
|
||||
StorageExpressionModelListController(Responder * parentResponder, I18n::Message text);
|
||||
ExpressionModelListController(Responder * parentResponder, I18n::Message text);
|
||||
protected:
|
||||
static constexpr KDCoordinate k_expressionMargin = 5;
|
||||
// SelectableTableViewDelegate
|
||||
@@ -34,7 +34,7 @@ protected:
|
||||
virtual bool isAddEmptyRow(int j);
|
||||
// ViewController
|
||||
virtual SelectableTableView * selectableTableView() = 0;
|
||||
virtual StorageExpressionModelStore * modelStore() = 0;
|
||||
virtual ExpressionModelStore * modelStore() = 0;
|
||||
virtual InputViewController * inputController() = 0;
|
||||
// Memoization
|
||||
static constexpr int k_memoizedCellsCount = 7;
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
* (ScreenHeight - Metric::TitleBarHeight - Metric::TabHeight - ButtonRowHeight
|
||||
* - currentSelectedRowHeight) / Metric::StoreRowHeight
|
||||
* = (240-18-27-20-50)/50 = 2.5 */
|
||||
static_assert(StorageExpressionModelListController::k_memoizedCellsCount % 2 == 1, "StorageExpressionModelListController::k_memoizedCellsCount should be odd.");
|
||||
static_assert(ExpressionModelListController::k_memoizedCellsCount % 2 == 1, "ExpressionModelListController::k_memoizedCellsCount should be odd.");
|
||||
/* We memoize values for indexes around the selectedRow index.
|
||||
* k_memoizedCellsCount needs to be odd to compute things such as:
|
||||
* constexpr int halfMemoizationCount = k_memoizedCellsCount/2;
|
||||
@@ -1,21 +1,21 @@
|
||||
#include "storage_expression_model_store.h"
|
||||
#include "expression_model_store.h"
|
||||
|
||||
namespace Shared {
|
||||
|
||||
StorageExpressionModelStore::StorageExpressionModelStore() :
|
||||
ExpressionModelStore::ExpressionModelStore() :
|
||||
m_oldestMemoizedIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
int StorageExpressionModelStore::numberOfModels() const {
|
||||
int ExpressionModelStore::numberOfModels() const {
|
||||
return Ion::Storage::sharedStorage()->numberOfRecordsWithExtension(modelExtension());
|
||||
}
|
||||
|
||||
Ion::Storage::Record StorageExpressionModelStore::recordAtIndex(int i) const {
|
||||
Ion::Storage::Record ExpressionModelStore::recordAtIndex(int i) const {
|
||||
return Ion::Storage::sharedStorage()->recordWithExtensionAtIndex(modelExtension(), i);
|
||||
}
|
||||
|
||||
ExpressionModelHandle * StorageExpressionModelStore::privateModelForRecord(Ion::Storage::Record record) const {
|
||||
ExpressionModelHandle * ExpressionModelStore::privateModelForRecord(Ion::Storage::Record record) const {
|
||||
for (int i = 0; i < maxNumberOfMemoizedModels(); i++) {
|
||||
if (!memoizedModelAtIndex(i)->isNull() && *memoizedModelAtIndex(i) == record) {
|
||||
return memoizedModelAtIndex(i);
|
||||
@@ -28,20 +28,20 @@ ExpressionModelHandle * StorageExpressionModelStore::privateModelForRecord(Ion::
|
||||
}
|
||||
|
||||
|
||||
void StorageExpressionModelStore::removeAll() {
|
||||
void ExpressionModelStore::removeAll() {
|
||||
Ion::Storage::sharedStorage()->destroyRecordsWithExtension(modelExtension());
|
||||
}
|
||||
|
||||
void StorageExpressionModelStore::removeModel(Ion::Storage::Record record) {
|
||||
void ExpressionModelStore::removeModel(Ion::Storage::Record record) {
|
||||
assert(!record.isNull());
|
||||
record.destroy();
|
||||
}
|
||||
|
||||
void StorageExpressionModelStore::tidy() {
|
||||
void ExpressionModelStore::tidy() {
|
||||
resetMemoizedModelsExceptRecord();
|
||||
}
|
||||
|
||||
int StorageExpressionModelStore::numberOfModelsSatisfyingTest(ModelTest test) const {
|
||||
int ExpressionModelStore::numberOfModelsSatisfyingTest(ModelTest test) const {
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
ExpressionModelHandle * m = privateModelForRecord(recordAtIndex(i++));
|
||||
@@ -54,7 +54,7 @@ int StorageExpressionModelStore::numberOfModelsSatisfyingTest(ModelTest test) co
|
||||
return result;
|
||||
}
|
||||
|
||||
Ion::Storage::Record StorageExpressionModelStore::recordStatifyingTestAtIndex(int i, ModelTest test) const {
|
||||
Ion::Storage::Record ExpressionModelStore::recordStatifyingTestAtIndex(int i, ModelTest test) const {
|
||||
assert(i >= 0 && i < numberOfDefinedModels());
|
||||
int index = 0;
|
||||
int currentModelIndex = 0;
|
||||
@@ -75,7 +75,7 @@ Ion::Storage::Record StorageExpressionModelStore::recordStatifyingTestAtIndex(in
|
||||
return Ion::Storage::Record();
|
||||
}
|
||||
|
||||
void StorageExpressionModelStore::resetMemoizedModelsExceptRecord(const Ion::Storage::Record record) const {
|
||||
void ExpressionModelStore::resetMemoizedModelsExceptRecord(const Ion::Storage::Record record) const {
|
||||
Ion::Storage::Record emptyRecord;
|
||||
for (int i = 0; i < maxNumberOfMemoizedModels(); i++) {
|
||||
if (*memoizedModelAtIndex(i) != record) {
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SHARED_STORAGE_EXPRESSION_MODEL_STORE_H
|
||||
#define SHARED_STORAGE_EXPRESSION_MODEL_STORE_H
|
||||
#ifndef SHARED_EXPRESSION_MODEL_STORE_H
|
||||
#define SHARED_EXPRESSION_MODEL_STORE_H
|
||||
|
||||
#include "expression_model_handle.h"
|
||||
#include "expiring_pointer.h"
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
namespace Shared {
|
||||
|
||||
// StorageExpressionModelStore is a handle to Ion::Storage::sharedStorage()
|
||||
// ExpressionModelStore is a handle to Ion::Storage::sharedStorage()
|
||||
|
||||
class StorageExpressionModelStore {
|
||||
class ExpressionModelStore {
|
||||
// TODO find better name (once we remove ExpressionModelStore?)
|
||||
public:
|
||||
StorageExpressionModelStore();
|
||||
ExpressionModelStore();
|
||||
virtual char symbol() const { return 0; }
|
||||
virtual char unknownSymbol() const { return 0; }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_APP_H
|
||||
#define SHARED_STORAGE_FUNCTION_APP_H
|
||||
#ifndef SHARED_FUNCTION_APP_H
|
||||
#define SHARED_FUNCTION_APP_H
|
||||
|
||||
#include "expression_field_delegate_app.h"
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include "curve_view_cursor.h"
|
||||
#include "interval.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_banner_delegate.h"
|
||||
#include "function_banner_delegate.h"
|
||||
#include "poincare_helpers.h"
|
||||
#include "../constant.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_BANNER_DELEGATE_H
|
||||
#define SHARED_STORAGE_FUNCTION_BANNER_DELEGATE_H
|
||||
#ifndef SHARED_FUNCTION_BANNER_DELEGATE_H
|
||||
#define SHARED_FUNCTION_BANNER_DELEGATE_H
|
||||
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include "banner_view.h"
|
||||
#include "curve_view_cursor.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_curve_parameter_controller.h"
|
||||
#include "function_curve_parameter_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_CURVE_PARAMETER_CONTROLLER_H
|
||||
#define SHARED_STORAGE_FUNCTION_CURVE_PARAMETER_CONTROLLER_H
|
||||
#ifndef SHARED_FUNCTION_CURVE_PARAMETER_CONTROLLER_H
|
||||
#define SHARED_FUNCTION_CURVE_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_function_go_to_parameter_controller.h"
|
||||
#include "function_go_to_parameter_controller.h"
|
||||
#include "curve_view_cursor.h"
|
||||
#include "interactive_curve_view_range.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_go_to_parameter_controller.h"
|
||||
#include "function_go_to_parameter_controller.h"
|
||||
#include "function_app.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_GO_TO_PARAMETER_CONTROLLER_H
|
||||
#define SHARED_STORAGE_FUNCTION_GO_TO_PARAMETER_CONTROLLER_H
|
||||
#ifndef SHARED_FUNCTION_GO_TO_PARAMETER_CONTROLLER_H
|
||||
#define SHARED_FUNCTION_GO_TO_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include "go_to_parameter_controller.h"
|
||||
#include "function.h"
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_graph_controller.h"
|
||||
#include "function_graph_controller.h"
|
||||
#include "function_app.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_GRAPH_CONTROLLER_H
|
||||
#define SHARED_STORAGE_FUNCTION_GRAPH_CONTROLLER_H
|
||||
#ifndef SHARED_FUNCTION_GRAPH_CONTROLLER_H
|
||||
#define SHARED_FUNCTION_GRAPH_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "initialisation_parameter_controller.h"
|
||||
#include "storage_function_banner_delegate.h"
|
||||
#include "function_banner_delegate.h"
|
||||
#include "interactive_curve_view_controller.h"
|
||||
#include "storage_function_store.h"
|
||||
#include "storage_function_graph_view.h"
|
||||
#include "storage_function_curve_parameter_controller.h"
|
||||
#include "function_store.h"
|
||||
#include "function_graph_view.h"
|
||||
#include "function_curve_parameter_controller.h"
|
||||
|
||||
namespace Shared {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_graph_view.h"
|
||||
#include "function_graph_view.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
#include <float.h>
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_GRAPH_VIEW_H
|
||||
#define SHARED_STORAGE_FUNCTION_GRAPH_VIEW_H
|
||||
#ifndef SHARED_FUNCTION_GRAPH_VIEW_H
|
||||
#define SHARED_FUNCTION_GRAPH_VIEW_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "curve_view.h"
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_list_controller.h"
|
||||
#include "function_list_controller.h"
|
||||
#include "function_app.h"
|
||||
#include "function_expression_cell.h"
|
||||
|
||||
@@ -8,7 +8,7 @@ static inline int maxInt(int x, int y) { return x > y ? x : y; }
|
||||
static inline int minInt(int x, int y) { return x < y ? x : y; }
|
||||
|
||||
FunctionListController::FunctionListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer, I18n::Message text) :
|
||||
StorageExpressionModelListController(parentResponder, text),
|
||||
ExpressionModelListController(parentResponder, text),
|
||||
ButtonRowDelegate(header, footer),
|
||||
m_selectableTableView(this, this, this, this),
|
||||
m_emptyCell(),
|
||||
@@ -27,7 +27,7 @@ FunctionListController::FunctionListController(Responder * parentResponder, Butt
|
||||
m_titlesColumnWidth(k_minTitleColumnWidth)
|
||||
{
|
||||
/* m_memoizedCellBaseline is not initialized by the call to
|
||||
* resetMemoizationForIndex in StorageExpressionModelListController's
|
||||
* resetMemoizationForIndex in ExpressionModelListController's
|
||||
* constructor, because it is a virtual method in a constructor. */
|
||||
for (int i = 0; i < k_memoizedCellsCount; i++) {
|
||||
m_memoizedCellBaseline[i] = -1;
|
||||
@@ -217,7 +217,7 @@ void FunctionListController::willExitResponderChain(Responder * nextFirstRespond
|
||||
|
||||
void FunctionListController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) {
|
||||
// Update memoization of cell heights
|
||||
StorageExpressionModelListController::tableViewDidChangeSelection(t, previousSelectedCellX, previousSelectedCellY);
|
||||
ExpressionModelListController::tableViewDidChangeSelection(t, previousSelectedCellX, previousSelectedCellY);
|
||||
// Do not select the cell left of the "addEmptyFunction" cell
|
||||
if (isAddEmptyRow(selectedRow()) && selectedColumn() == 0) {
|
||||
t->selectCellAtLocation(1, numberOfRows()-1);
|
||||
@@ -273,7 +273,7 @@ KDCoordinate FunctionListController::maxFunctionNameWidth() {
|
||||
}
|
||||
|
||||
void FunctionListController::didChangeModelsList() {
|
||||
StorageExpressionModelListController::didChangeModelsList();
|
||||
ExpressionModelListController::didChangeModelsList();
|
||||
computeTitlesColumnWidth();
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ KDCoordinate FunctionListController::baseline(int j) {
|
||||
void FunctionListController::resetMemoizationForIndex(int index) {
|
||||
assert(index >= 0 && index < k_memoizedCellsCount);
|
||||
m_memoizedCellBaseline[index] = -1;
|
||||
StorageExpressionModelListController::resetMemoizationForIndex(index);
|
||||
ExpressionModelListController::resetMemoizationForIndex(index);
|
||||
}
|
||||
|
||||
void FunctionListController::shiftMemoization(bool newCellIsUnder) {
|
||||
@@ -309,7 +309,7 @@ void FunctionListController::shiftMemoization(bool newCellIsUnder) {
|
||||
m_memoizedCellBaseline[i] = m_memoizedCellBaseline[i-1];
|
||||
}
|
||||
}
|
||||
StorageExpressionModelListController::shiftMemoization(newCellIsUnder);
|
||||
ExpressionModelListController::shiftMemoization(newCellIsUnder);
|
||||
}
|
||||
|
||||
KDCoordinate FunctionListController::nameWidth(int nameLength) const {
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_LIST_CONTROLLER_H
|
||||
#define SHARED_STORAGE_FUNCTION_LIST_CONTROLLER_H
|
||||
#ifndef SHARED_FUNCTION_LIST_CONTROLLER_H
|
||||
#define SHARED_FUNCTION_LIST_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include "function_title_cell.h"
|
||||
#include "storage_list_parameter_controller.h"
|
||||
#include "storage_expression_model_list_controller.h"
|
||||
#include "list_parameter_controller.h"
|
||||
#include "expression_model_list_controller.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class FunctionListController : public StorageExpressionModelListController, public ButtonRowDelegate, public TableViewDataSource {
|
||||
class FunctionListController : public ExpressionModelListController, public ButtonRowDelegate, public TableViewDataSource {
|
||||
public:
|
||||
FunctionListController(Responder * parentResponder, ButtonRowController * header, ButtonRowController * footer, I18n::Message text);
|
||||
|
||||
@@ -19,9 +19,9 @@ public:
|
||||
|
||||
/* TableViewDataSource */
|
||||
int numberOfRows() override { return this->numberOfExpressionRows(); }
|
||||
KDCoordinate rowHeight(int j) override { return StorageExpressionModelListController::memoizedRowHeight(j); }
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override { return StorageExpressionModelListController::memoizedCumulatedHeightFromIndex(j); }
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override { return StorageExpressionModelListController::memoizedIndexFromCumulatedHeight(offsetY); }
|
||||
KDCoordinate rowHeight(int j) override { return ExpressionModelListController::memoizedRowHeight(j); }
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override { return ExpressionModelListController::memoizedCumulatedHeightFromIndex(j); }
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override { return ExpressionModelListController::memoizedIndexFromCumulatedHeight(offsetY); }
|
||||
int numberOfColumns() override { return 2; }
|
||||
KDCoordinate columnWidth(int i) override;
|
||||
KDCoordinate cumulatedWidthFromIndex(int i) override;
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
int notMemoizedIndexFromCumulatedHeight(KDCoordinate offsetY) override {
|
||||
return TableViewDataSource::indexFromCumulatedHeight(offsetY);
|
||||
}
|
||||
virtual StorageListParameterController * parameterController() = 0;
|
||||
virtual ListParameterController * parameterController() = 0;
|
||||
virtual int maxNumberOfDisplayableRows() = 0;
|
||||
virtual FunctionTitleCell * titleCells(int index) = 0;
|
||||
virtual HighlightCell * expressionCells(int index) = 0;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include "cartesian_function.h"
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef SHARED_STORAGE_FUNCTION_STORE_H
|
||||
#define SHARED_STORAGE_FUNCTION_STORE_H
|
||||
#ifndef SHARED_FUNCTION_STORE_H
|
||||
#define SHARED_FUNCTION_STORE_H
|
||||
|
||||
#include "function.h"
|
||||
#include "storage_expression_model_store.h"
|
||||
#include "expression_model_store.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
/* FunctionStore storse functions and gives them a color. */
|
||||
|
||||
class FunctionStore : public StorageExpressionModelStore {
|
||||
class FunctionStore : public ExpressionModelStore {
|
||||
public:
|
||||
FunctionStore() : StorageExpressionModelStore() {}
|
||||
FunctionStore() : ExpressionModelStore() {}
|
||||
uint32_t storeChecksum();
|
||||
// An active function must be defined to be counted
|
||||
int numberOfActiveFunctions() const { return numberOfModelsSatisfyingTest([](ExpressionModelHandle * m) { return m->isDefined() && static_cast<Function *>(m)->isActive(); }); }
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "storage_list_parameter_controller.h"
|
||||
#include "list_parameter_controller.h"
|
||||
#include "function_app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
StorageListParameterController::StorageListParameterController(Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate) :
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this, this, this, tableDelegate),
|
||||
m_record(),
|
||||
@@ -16,15 +16,15 @@ StorageListParameterController::StorageListParameterController(Responder * paren
|
||||
{
|
||||
}
|
||||
|
||||
const char * StorageListParameterController::title() {
|
||||
const char * ListParameterController::title() {
|
||||
return I18n::translate(I18n::Message::FunctionOptions);
|
||||
}
|
||||
|
||||
void StorageListParameterController::didBecomeFirstResponder() {
|
||||
void ListParameterController::didBecomeFirstResponder() {
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
void StorageListParameterController::viewWillAppear() {
|
||||
void ListParameterController::viewWillAppear() {
|
||||
ViewController::viewWillAppear();
|
||||
if (selectedRow() == -1) {
|
||||
selectCellAtLocation(0, 0);
|
||||
@@ -34,26 +34,26 @@ void StorageListParameterController::viewWillAppear() {
|
||||
m_selectableTableView.reloadData();
|
||||
}
|
||||
|
||||
void StorageListParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
if (cell == &m_enableCell) {
|
||||
SwitchView * switchView = (SwitchView *)m_enableCell.accessoryView();
|
||||
switchView->setState(function()->isActive());
|
||||
}
|
||||
}
|
||||
|
||||
void StorageListParameterController::setRecord(Ion::Storage::Record record) {
|
||||
void ListParameterController::setRecord(Ion::Storage::Record record) {
|
||||
m_record = record;
|
||||
selectCellAtLocation(0, 0);
|
||||
}
|
||||
|
||||
bool StorageListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
return handleEnterOnRow(selectedRow());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
HighlightCell * StorageListParameterController::reusableCell(int index) {
|
||||
HighlightCell * ListParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < totalNumberOfCells());
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
@@ -64,7 +64,7 @@ HighlightCell * StorageListParameterController::reusableCell(int index) {
|
||||
return cells[index];
|
||||
}
|
||||
|
||||
bool StorageListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
bool ListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
switch (rowIndex) {
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
case 0:
|
||||
@@ -94,11 +94,11 @@ bool StorageListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
ExpiringPointer<Function> StorageListParameterController::function() {
|
||||
ExpiringPointer<Function> ListParameterController::function() {
|
||||
return functionStore()->modelForRecord(m_record);
|
||||
}
|
||||
|
||||
FunctionStore * StorageListParameterController::functionStore() {
|
||||
FunctionStore * ListParameterController::functionStore() {
|
||||
FunctionApp * a = static_cast<FunctionApp *>(app());
|
||||
return a->functionStore();
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef SHARED_STORAGE_LIST_PARAM_CONTROLLER_H
|
||||
#define SHARED_STORAGE_LIST_PARAM_CONTROLLER_H
|
||||
#ifndef SHARED_LIST_PARAM_CONTROLLER_H
|
||||
#define SHARED_LIST_PARAM_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class StorageListParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
class ListParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
StorageListParameterController(Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate = nullptr);
|
||||
ListParameterController(Responder * parentResponder, I18n::Message functionColorMessage, I18n::Message deleteFunctionMessage, SelectableTableViewDelegate * tableDelegate = nullptr);
|
||||
|
||||
View * view() override { return &m_selectableTableView; }
|
||||
const char * title() override;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_sum_graph_controller.h"
|
||||
#include "sum_graph_controller.h"
|
||||
#include "function_app.h"
|
||||
#include "../apps_container.h"
|
||||
#include <poincare_layouts.h>
|
||||
@@ -13,7 +13,7 @@ using namespace Poincare;
|
||||
|
||||
namespace Shared {
|
||||
|
||||
StorageSumGraphController::StorageSumGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, FunctionGraphView * graphView, InteractiveCurveViewRange * range, CurveViewCursor * cursor, CodePoint sumSymbol) :
|
||||
SumGraphController::SumGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, FunctionGraphView * graphView, InteractiveCurveViewRange * range, CurveViewCursor * cursor, CodePoint sumSymbol) :
|
||||
SimpleInteractiveCurveViewController(parentResponder, range, graphView, cursor),
|
||||
m_step(Step::FirstParameter),
|
||||
m_startSum(NAN),
|
||||
@@ -26,7 +26,7 @@ StorageSumGraphController::StorageSumGraphController(Responder * parentResponder
|
||||
{
|
||||
}
|
||||
|
||||
void StorageSumGraphController::viewWillAppear() {
|
||||
void SumGraphController::viewWillAppear() {
|
||||
m_graphRange->panToMakePointVisible(m_cursor->x(), m_cursor->y(), k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
|
||||
m_graphView->setBannerView(&m_legendView);
|
||||
m_graphView->setCursorView(&m_cursorView);
|
||||
@@ -45,11 +45,11 @@ void StorageSumGraphController::viewWillAppear() {
|
||||
}
|
||||
|
||||
|
||||
void StorageSumGraphController::didEnterResponderChain(Responder * previousFirstResponder) {
|
||||
void SumGraphController::didEnterResponderChain(Responder * previousFirstResponder) {
|
||||
app()->setFirstResponder(m_legendView.textField());
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::handleEvent(Ion::Events::Event event) {
|
||||
bool SumGraphController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Plus || event == Ion::Events::Minus) {
|
||||
return handleZoom(event);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ bool StorageSumGraphController::handleEvent(Ion::Events::Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::moveCursorHorizontallyToPosition(double x) {
|
||||
bool SumGraphController::moveCursorHorizontallyToPosition(double x) {
|
||||
FunctionApp * myApp = static_cast<FunctionApp *>(app());
|
||||
assert(!m_record.isNull());
|
||||
ExpiringPointer<Function> function = myApp->functionStore()->modelForRecord(m_record);
|
||||
@@ -119,12 +119,12 @@ bool StorageSumGraphController::moveCursorHorizontallyToPosition(double x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void StorageSumGraphController::setRecord(Ion::Storage::Record record) {
|
||||
void SumGraphController::setRecord(Ion::Storage::Record record) {
|
||||
m_graphView->selectRecord(record);
|
||||
m_record = record;
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
bool SumGraphController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container();
|
||||
Context * globalContext = appsContainer->globalContext();
|
||||
double floatBody = PoincareHelpers::ApproximateToScalar<double>(text, *globalContext);
|
||||
@@ -145,7 +145,7 @@ bool StorageSumGraphController::textFieldDidFinishEditing(TextField * textField,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::textFieldDidAbortEditing(TextField * textField) {
|
||||
bool SumGraphController::textFieldDidAbortEditing(TextField * textField) {
|
||||
char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits)];
|
||||
double parameter = NAN;
|
||||
switch(m_step) {
|
||||
@@ -163,7 +163,7 @@ bool StorageSumGraphController::textFieldDidAbortEditing(TextField * textField)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
bool SumGraphController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
if ((event == Ion::Events::OK || event == Ion::Events::EXE) && !textField->isEditing()) {
|
||||
return handleEnter();
|
||||
}
|
||||
@@ -173,7 +173,7 @@ bool StorageSumGraphController::textFieldDidReceiveEvent(TextField * textField,
|
||||
return TextFieldDelegate::textFieldDidReceiveEvent(textField, event);
|
||||
}
|
||||
|
||||
bool StorageSumGraphController::handleEnter() {
|
||||
bool SumGraphController::handleEnter() {
|
||||
if (m_step == Step::Result) {
|
||||
StackViewController * stack = (StackViewController *)parentResponder();
|
||||
stack->pop();
|
||||
@@ -203,7 +203,7 @@ bool StorageSumGraphController::handleEnter() {
|
||||
|
||||
/* Legend View */
|
||||
|
||||
StorageSumGraphController::LegendView::LegendView(StorageSumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) :
|
||||
SumGraphController::LegendView::LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) :
|
||||
m_sum(0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_sumLayout(),
|
||||
m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
@@ -213,26 +213,26 @@ StorageSumGraphController::LegendView::LegendView(StorageSumGraphController * co
|
||||
m_draftText[0] = 0;
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
void SumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), Palette::GreyMiddle);
|
||||
}
|
||||
|
||||
KDSize StorageSumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
|
||||
KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
|
||||
return KDSize(0, k_legendHeight);
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::setLegendMessage(I18n::Message message, Step step) {
|
||||
void SumGraphController::LegendView::setLegendMessage(I18n::Message message, Step step) {
|
||||
m_legend.setMessage(message);
|
||||
layoutSubviews(step);
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::setEditableZone(double d) {
|
||||
void SumGraphController::LegendView::setEditableZone(double d) {
|
||||
char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits)];
|
||||
PrintFloat::convertFloatToText<double>(d, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
|
||||
m_editableZone.setText(buffer);
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::setSumSymbol(Step step, double start, double end, double result, Layout functionLayout) {
|
||||
void SumGraphController::LegendView::setSumSymbol(Step step, double start, double end, double result, Layout functionLayout) {
|
||||
assert(step == Step::Result || functionLayout.isUninitialized());
|
||||
constexpr int sigmaLength = 2;
|
||||
const CodePoint sigma[sigmaLength] = {UCodePointSpace, m_sumSymbol};
|
||||
@@ -271,11 +271,11 @@ void StorageSumGraphController::LegendView::setSumSymbol(Step step, double start
|
||||
layoutSubviews(step);
|
||||
}
|
||||
|
||||
int StorageSumGraphController::LegendView::numberOfSubviews() const {
|
||||
int SumGraphController::LegendView::numberOfSubviews() const {
|
||||
return 3;
|
||||
}
|
||||
|
||||
View * StorageSumGraphController::LegendView::subviewAtIndex(int index) {
|
||||
View * SumGraphController::LegendView::subviewAtIndex(int index) {
|
||||
assert(index >= 0 && index < 3);
|
||||
if (index == 0) {
|
||||
return &m_sum;
|
||||
@@ -286,11 +286,11 @@ View * StorageSumGraphController::LegendView::subviewAtIndex(int index) {
|
||||
return &m_legend;
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::layoutSubviews() {
|
||||
void SumGraphController::LegendView::layoutSubviews() {
|
||||
layoutSubviews(Step::FirstParameter);
|
||||
}
|
||||
|
||||
void StorageSumGraphController::LegendView::layoutSubviews(Step step) {
|
||||
void SumGraphController::LegendView::layoutSubviews(Step step) {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate heigth = bounds().height();
|
||||
KDSize legendSize = m_legend.minimalSizeForOptimalDisplay();
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef SHARED_STORAGE_SUM_GRAPH_CONTROLLER_H
|
||||
#define SHARED_STORAGE_SUM_GRAPH_CONTROLLER_H
|
||||
#ifndef SHARED_SUM_GRAPH_CONTROLLER_H
|
||||
#define SHARED_SUM_GRAPH_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_function_graph_view.h"
|
||||
#include "function_graph_view.h"
|
||||
#include "interactive_curve_view_range.h"
|
||||
#include "vertical_cursor_view.h"
|
||||
#include "curve_view_cursor.h"
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class StorageSumGraphController : public SimpleInteractiveCurveViewController, public TextFieldDelegate {
|
||||
class SumGraphController : public SimpleInteractiveCurveViewController, public TextFieldDelegate {
|
||||
public:
|
||||
StorageSumGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, FunctionGraphView * curveView, InteractiveCurveViewRange * range, CurveViewCursor * cursor, CodePoint sumSymbol);
|
||||
SumGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, FunctionGraphView * curveView, InteractiveCurveViewRange * range, CurveViewCursor * cursor, CodePoint sumSymbol);
|
||||
void viewWillAppear() override;
|
||||
void didEnterResponderChain(Responder * previousFirstResponder) override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
bool handleEnter() override;
|
||||
class LegendView : public View {
|
||||
public:
|
||||
LegendView(StorageSumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol);
|
||||
LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol);
|
||||
LegendView(const LegendView& other) = delete;
|
||||
LegendView(LegendView&& other) = delete;
|
||||
LegendView& operator=(const LegendView& other) = delete;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "storage_values_controller.h"
|
||||
#include "values_controller.h"
|
||||
#include "function_app.h"
|
||||
#include "../constant.h"
|
||||
#include "../apps_container.h"
|
||||
@@ -9,7 +9,7 @@ using namespace Poincare;
|
||||
|
||||
namespace Shared {
|
||||
|
||||
StorageValuesController::StorageValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, I18n::Message parameterTitle, IntervalParameterController * intervalParameterController, Interval * interval) :
|
||||
ValuesController::ValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, I18n::Message parameterTitle, IntervalParameterController * intervalParameterController, Interval * interval) :
|
||||
EditableCellTableViewController(parentResponder),
|
||||
ButtonRowDelegate(header, nullptr),
|
||||
m_interval(interval),
|
||||
@@ -20,7 +20,7 @@ StorageValuesController::StorageValuesController(Responder * parentResponder, In
|
||||
m_abscissaCells{},
|
||||
m_abscissaParameterController(this, intervalParameterController, parameterTitle),
|
||||
m_setIntervalButton(this, I18n::Message::IntervalSet, Invocation([](void * context, void * sender) {
|
||||
StorageValuesController * valuesController = (StorageValuesController *) context;
|
||||
ValuesController * valuesController = (ValuesController *) context;
|
||||
StackViewController * stack = ((StackViewController *)valuesController->stackController());
|
||||
stack->push(valuesController->intervalParameterController());
|
||||
return true;
|
||||
@@ -41,11 +41,11 @@ StorageValuesController::StorageValuesController(Responder * parentResponder, In
|
||||
}
|
||||
}
|
||||
|
||||
const char * StorageValuesController::title() {
|
||||
const char * ValuesController::title() {
|
||||
return I18n::translate(I18n::Message::ValuesTab);
|
||||
}
|
||||
|
||||
int StorageValuesController::numberOfColumns() {
|
||||
int ValuesController::numberOfColumns() {
|
||||
if (m_numberOfColumnsNeedUpdate) {
|
||||
updateNumberOfColumns();
|
||||
m_numberOfColumnsNeedUpdate = false;
|
||||
@@ -53,11 +53,11 @@ int StorageValuesController::numberOfColumns() {
|
||||
return m_numberOfColumns;
|
||||
}
|
||||
|
||||
Interval * StorageValuesController::interval() {
|
||||
Interval * ValuesController::interval() {
|
||||
return m_interval;
|
||||
}
|
||||
|
||||
bool StorageValuesController::handleEvent(Ion::Events::Event event) {
|
||||
bool ValuesController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Down) {
|
||||
if (selectedRow() == -1) {
|
||||
header()->setSelectedButton(-1);
|
||||
@@ -104,7 +104,7 @@ bool StorageValuesController::handleEvent(Ion::Events::Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StorageValuesController::didBecomeFirstResponder() {
|
||||
void ValuesController::didBecomeFirstResponder() {
|
||||
EditableCellTableViewController::didBecomeFirstResponder();
|
||||
if (selectedRow() == -1) {
|
||||
selectableTableView()->deselectTable();
|
||||
@@ -114,7 +114,7 @@ void StorageValuesController::didBecomeFirstResponder() {
|
||||
}
|
||||
}
|
||||
|
||||
void StorageValuesController::willExitResponderChain(Responder * nextFirstResponder) {
|
||||
void ValuesController::willExitResponderChain(Responder * nextFirstResponder) {
|
||||
if (nextFirstResponder == tabController()) {
|
||||
selectableTableView()->deselectTable();
|
||||
selectableTableView()->scrollToCell(0,0);
|
||||
@@ -122,18 +122,18 @@ void StorageValuesController::willExitResponderChain(Responder * nextFirstRespon
|
||||
}
|
||||
}
|
||||
|
||||
int StorageValuesController::numberOfButtons(ButtonRowController::Position) const {
|
||||
int ValuesController::numberOfButtons(ButtonRowController::Position) const {
|
||||
if (isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Button * StorageValuesController::buttonAtIndex(int index, ButtonRowController::Position position) const {
|
||||
Button * ValuesController::buttonAtIndex(int index, ButtonRowController::Position position) const {
|
||||
return (Button *)&m_setIntervalButton;
|
||||
}
|
||||
|
||||
void StorageValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
willDisplayCellAtLocationWithDisplayMode(cell, i, j, Preferences::sharedPreferences()->displayMode());
|
||||
if (cellAtLocationIsEditable(i, j)) {
|
||||
return;
|
||||
@@ -159,7 +159,7 @@ void StorageValuesController::willDisplayCellAtLocation(HighlightCell * cell, in
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate StorageValuesController::columnWidth(int i) {
|
||||
KDCoordinate ValuesController::columnWidth(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return k_abscissaCellWidth;
|
||||
@@ -168,7 +168,7 @@ KDCoordinate StorageValuesController::columnWidth(int i) {
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate StorageValuesController::cumulatedWidthFromIndex(int i) {
|
||||
KDCoordinate ValuesController::cumulatedWidthFromIndex(int i) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -176,14 +176,14 @@ KDCoordinate StorageValuesController::cumulatedWidthFromIndex(int i) {
|
||||
}
|
||||
}
|
||||
|
||||
int StorageValuesController::indexFromCumulatedWidth(KDCoordinate offsetX) {
|
||||
int ValuesController::indexFromCumulatedWidth(KDCoordinate offsetX) {
|
||||
if (offsetX <= k_abscissaCellWidth) {
|
||||
return 0;
|
||||
}
|
||||
return (offsetX - k_abscissaCellWidth)/k_ordinateCellWidth+1;
|
||||
}
|
||||
|
||||
HighlightCell * StorageValuesController::reusableCell(int index, int type) {
|
||||
HighlightCell * ValuesController::reusableCell(int index, int type) {
|
||||
assert(index >= 0);
|
||||
switch (type) {
|
||||
case 0:
|
||||
@@ -202,7 +202,7 @@ HighlightCell * StorageValuesController::reusableCell(int index, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
int StorageValuesController::reusableCellCount(int type) {
|
||||
int ValuesController::reusableCellCount(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return 1;
|
||||
@@ -218,7 +218,7 @@ int StorageValuesController::reusableCellCount(int type) {
|
||||
}
|
||||
}
|
||||
|
||||
int StorageValuesController::typeAtLocation(int i, int j) {
|
||||
int ValuesController::typeAtLocation(int i, int j) {
|
||||
if (j == 0) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
@@ -231,46 +231,46 @@ int StorageValuesController::typeAtLocation(int i, int j) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
bool StorageValuesController::isEmpty() const {
|
||||
bool ValuesController::isEmpty() const {
|
||||
if (functionStore()->numberOfActiveFunctions() == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Responder * StorageValuesController::defaultController() {
|
||||
Responder * ValuesController::defaultController() {
|
||||
return tabController();
|
||||
}
|
||||
|
||||
void StorageValuesController::viewWillAppear() {
|
||||
void ValuesController::viewWillAppear() {
|
||||
EditableCellTableViewController::viewWillAppear();
|
||||
header()->setSelectedButton(-1);
|
||||
}
|
||||
|
||||
void StorageValuesController::viewDidDisappear() {
|
||||
void ValuesController::viewDidDisappear() {
|
||||
m_numberOfColumnsNeedUpdate = true;
|
||||
EditableCellTableViewController::viewDidDisappear();
|
||||
}
|
||||
|
||||
Ion::Storage::Record StorageValuesController::recordAtColumn(int i) {
|
||||
Ion::Storage::Record ValuesController::recordAtColumn(int i) {
|
||||
assert(i > 0);
|
||||
return functionStore()->activeRecordAtIndex(i-1);
|
||||
}
|
||||
|
||||
Responder * StorageValuesController::tabController() const {
|
||||
Responder * ValuesController::tabController() const {
|
||||
return (parentResponder()->parentResponder()->parentResponder()->parentResponder());
|
||||
}
|
||||
|
||||
StackViewController * StorageValuesController::stackController() const {
|
||||
StackViewController * ValuesController::stackController() const {
|
||||
return (StackViewController *)(parentResponder()->parentResponder()->parentResponder());
|
||||
}
|
||||
|
||||
void StorageValuesController::configureAbscissa() {
|
||||
void ValuesController::configureAbscissa() {
|
||||
StackViewController * stack = stackController();
|
||||
stack->push(&m_abscissaParameterController);
|
||||
}
|
||||
|
||||
void StorageValuesController::configureFunction() {
|
||||
void ValuesController::configureFunction() {
|
||||
#if COPY_COLUMN
|
||||
#else
|
||||
/* Temporary: the sequence value controller does not have a function parameter
|
||||
@@ -284,41 +284,41 @@ void StorageValuesController::configureFunction() {
|
||||
stack->push(functionParameterController());
|
||||
}
|
||||
|
||||
bool StorageValuesController::cellAtLocationIsEditable(int columnIndex, int rowIndex) {
|
||||
bool ValuesController::cellAtLocationIsEditable(int columnIndex, int rowIndex) {
|
||||
if (rowIndex > 0 && columnIndex == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StorageValuesController::setDataAtLocation(double floatBody, int columnIndex, int rowIndex) {
|
||||
bool ValuesController::setDataAtLocation(double floatBody, int columnIndex, int rowIndex) {
|
||||
m_interval->setElement(rowIndex-1, floatBody);
|
||||
return true;
|
||||
}
|
||||
|
||||
double StorageValuesController::dataAtLocation(int columnIndex, int rowIndex) {
|
||||
double ValuesController::dataAtLocation(int columnIndex, int rowIndex) {
|
||||
return m_interval->element(rowIndex-1);
|
||||
}
|
||||
|
||||
int StorageValuesController::numberOfElements() {
|
||||
int ValuesController::numberOfElements() {
|
||||
return m_interval->numberOfElements();
|
||||
}
|
||||
|
||||
int StorageValuesController::maxNumberOfElements() const {
|
||||
int ValuesController::maxNumberOfElements() const {
|
||||
return Interval::k_maxNumberOfElements;
|
||||
}
|
||||
|
||||
double StorageValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
|
||||
double ValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
|
||||
ExpiringPointer<Function> function = functionStore()->modelForRecord(recordAtColumn(columnIndex));
|
||||
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
|
||||
return function->evaluateAtAbscissa(abscissa, myApp->localContext());
|
||||
}
|
||||
|
||||
void StorageValuesController::updateNumberOfColumns() {
|
||||
void ValuesController::updateNumberOfColumns() {
|
||||
m_numberOfColumns = 1+functionStore()->numberOfActiveFunctions();
|
||||
}
|
||||
|
||||
FunctionStore * StorageValuesController::functionStore() const {
|
||||
FunctionStore * ValuesController::functionStore() const {
|
||||
FunctionApp * myApp = static_cast<FunctionApp *>(app());
|
||||
return myApp->functionStore();
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
#ifndef SHARED_STORAGE_VALUES_CONTROLLER_H
|
||||
#define SHARED_STORAGE_VALUES_CONTROLLER_H
|
||||
#ifndef SHARED_VALUES_CONTROLLER_H
|
||||
#define SHARED_VALUES_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "storage_function_store.h"
|
||||
#include "function_store.h"
|
||||
#include "function_title_cell.h"
|
||||
#include "editable_cell_table_view_controller.h"
|
||||
#include "interval.h"
|
||||
#include "values_parameter_controller.h"
|
||||
#include "storage_values_function_parameter_controller.h"
|
||||
#include "values_function_parameter_controller.h"
|
||||
#include "interval_parameter_controller.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class StorageValuesController : public EditableCellTableViewController, public ButtonRowDelegate, public AlternateEmptyViewDefaultDelegate {
|
||||
class ValuesController : public EditableCellTableViewController, public ButtonRowDelegate, public AlternateEmptyViewDefaultDelegate {
|
||||
public:
|
||||
StorageValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, I18n::Message parameterTitle, IntervalParameterController * intervalParameterController, Interval * interval);
|
||||
ValuesController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, I18n::Message parameterTitle, IntervalParameterController * intervalParameterController, Interval * interval);
|
||||
const char * title() override;
|
||||
Interval * interval();
|
||||
int numberOfColumns() override;
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
virtual EvenOddBufferTextCell * floatCells(int j) = 0;
|
||||
char m_draftTextBuffer[TextField::maxBufferSize()];
|
||||
EvenOddEditableTextCell m_abscissaCells[k_maxNumberOfAbscissaCells];
|
||||
virtual StorageValuesFunctionParameterController * functionParameterController() = 0;
|
||||
virtual ValuesFunctionParameterController * functionParameterController() = 0;
|
||||
ValuesParameterController m_abscissaParameterController;
|
||||
Button m_setIntervalButton;
|
||||
};
|
||||
@@ -1,19 +1,19 @@
|
||||
#include "storage_values_function_parameter_controller.h"
|
||||
#include "values_function_parameter_controller.h"
|
||||
#include "function_app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
const char * StorageValuesFunctionParameterController::title() {
|
||||
const char * ValuesFunctionParameterController::title() {
|
||||
return m_pageTitle;
|
||||
}
|
||||
|
||||
void StorageValuesFunctionParameterController::viewWillAppear() {
|
||||
void ValuesFunctionParameterController::viewWillAppear() {
|
||||
FunctionApp * myApp = static_cast<FunctionApp *>(app());
|
||||
myApp->functionStore()->modelForRecord(m_record)->nameWithArgument(m_pageTitle, Function::k_maxNameWithArgumentSize, m_symbol);
|
||||
}
|
||||
|
||||
void StorageValuesFunctionParameterController::didBecomeFirstResponder() {
|
||||
void ValuesFunctionParameterController::didBecomeFirstResponder() {
|
||||
m_selectableTableView.reloadData();
|
||||
selectCellAtLocation(0, 0);
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SHARED_STORAGE_VALUES_FUNCTION_PARAM_CONTROLLER_H
|
||||
#define SHARED_STORAGE_VALUES_FUNCTION_PARAM_CONTROLLER_H
|
||||
#ifndef SHARED_VALUES_FUNCTION_PARAM_CONTROLLER_H
|
||||
#define SHARED_VALUES_FUNCTION_PARAM_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "function.h"
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class StorageValuesFunctionParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
class ValuesFunctionParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
StorageValuesFunctionParameterController(char symbol) :
|
||||
ValuesFunctionParameterController(char symbol) :
|
||||
ViewController(nullptr),
|
||||
m_copyColumn(I18n::Message::CopyColumnInList),
|
||||
m_selectableTableView(this, this, this),
|
||||
@@ -22,7 +22,7 @@ using namespace Shared;
|
||||
namespace Solver {
|
||||
|
||||
EquationStore::EquationStore() :
|
||||
StorageExpressionModelStore(),
|
||||
ExpressionModelStore(),
|
||||
m_type(Type::LinearSystem),
|
||||
m_numberOfSolutions(0),
|
||||
m_exactSolutionExactLayouts{},
|
||||
@@ -55,7 +55,7 @@ ExpressionModelHandle * EquationStore::memoizedModelAtIndex(int cacheIndex) cons
|
||||
}
|
||||
|
||||
void EquationStore::tidy() {
|
||||
StorageExpressionModelStore::tidy();
|
||||
ExpressionModelStore::tidy();
|
||||
tidySolution();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#define SOLVER_EQUATION_STORE_H
|
||||
|
||||
#include "equation.h"
|
||||
#include "../shared/storage_expression_model_store.h"
|
||||
#include "../shared/expression_model_store.h"
|
||||
#include <poincare/symbol_abstract.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Solver {
|
||||
|
||||
class EquationStore : public Shared::StorageExpressionModelStore {
|
||||
class EquationStore : public Shared::ExpressionModelStore {
|
||||
public:
|
||||
enum class Type {
|
||||
LinearSystem,
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
};
|
||||
EquationStore();
|
||||
|
||||
/* StorageExpressionModelStore */
|
||||
/* ExpressionModelStore */
|
||||
int maxNumberOfModels() const override { return k_maxNumberOfEquations; }
|
||||
Shared::ExpiringPointer<Equation> modelForRecord(Ion::Storage::Record record) const { return Shared::ExpiringPointer<Equation>(static_cast<Equation *>(privateModelForRecord(record))); }
|
||||
Ion::Storage::Record::ErrorStatus addEmptyModel() override;
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
static constexpr double k_precision = 0.01;
|
||||
static constexpr int k_maxNumberOfEquations = Poincare::Expression::k_maxNumberOfVariables; // Enable the same number of equations as the number of unknown variables
|
||||
|
||||
// StorageExpressionModelStore
|
||||
// ExpressionModelStore
|
||||
const char * modelExtension() const override { return Ion::Storage::eqExtension; }
|
||||
/* We don't really use model memoization as the number of Equation is limited
|
||||
* and we keep enough Equations to store them all. */
|
||||
|
||||
@@ -8,7 +8,7 @@ using namespace Shared;
|
||||
namespace Solver {
|
||||
|
||||
ListController::ListController(Responder * parentResponder, EquationStore * equationStore, ButtonRowController * footer) :
|
||||
StorageExpressionModelListController(parentResponder, I18n::Message::AddEquation),
|
||||
ExpressionModelListController(parentResponder, I18n::Message::AddEquation),
|
||||
ButtonRowDelegate(nullptr, footer),
|
||||
m_equationStore(equationStore),
|
||||
m_equationListView(this),
|
||||
@@ -215,7 +215,7 @@ void ListController::addEmptyModel() {
|
||||
}
|
||||
|
||||
bool ListController::removeModelRow(Ion::Storage::Record record) {
|
||||
StorageExpressionModelListController::removeModelRow(record);
|
||||
ExpressionModelListController::removeModelRow(record);
|
||||
reloadButtonMessage();
|
||||
reloadBrace();
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define SOLVER_LIST_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "../shared/storage_expression_model_list_controller.h"
|
||||
#include "../shared/expression_model_list_controller.h"
|
||||
#include "../shared/layout_field_delegate.h"
|
||||
#include "../shared/text_field_delegate.h"
|
||||
#include "equation_store.h"
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Solver {
|
||||
|
||||
class ListController : public Shared::StorageExpressionModelListController, public ButtonRowDelegate, public ListViewDataSource, public Shared::TextFieldDelegate, public Shared::LayoutFieldDelegate {
|
||||
class ListController : public Shared::ExpressionModelListController, public ButtonRowDelegate, public ListViewDataSource, public Shared::TextFieldDelegate, public Shared::LayoutFieldDelegate {
|
||||
public:
|
||||
ListController(Responder * parentResponder, EquationStore * equationStore, ButtonRowController * footer);
|
||||
/* ButtonRowDelegate */
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
Button * buttonAtIndex(int index, ButtonRowController::Position position) const override;
|
||||
/* ListViewDataSource */
|
||||
int numberOfRows() override { return numberOfExpressionRows(); }
|
||||
KDCoordinate rowHeight(int j) override{ return StorageExpressionModelListController::memoizedRowHeight(j); }
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override { return StorageExpressionModelListController::memoizedCumulatedHeightFromIndex(j); }
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override { return StorageExpressionModelListController::memoizedIndexFromCumulatedHeight(offsetY); }
|
||||
KDCoordinate rowHeight(int j) override{ return ExpressionModelListController::memoizedRowHeight(j); }
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override { return ExpressionModelListController::memoizedCumulatedHeightFromIndex(j); }
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override { return ExpressionModelListController::memoizedIndexFromCumulatedHeight(offsetY); }
|
||||
int typeAtLocation(int i, int j) override;
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
int reusableCellCount(int type) override;
|
||||
@@ -31,10 +31,10 @@ public:
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void didBecomeFirstResponder() override;
|
||||
void didEnterResponderChain(Responder * previousFirstResponder) override;
|
||||
/* StorageExpressionModelListController */
|
||||
/* ExpressionModelListController */
|
||||
// Make methods public
|
||||
void editExpression(Ion::Events::Event event) override { return Shared::StorageExpressionModelListController::editExpression(event); }
|
||||
bool editSelectedRecordWithText(const char * text) override { return Shared::StorageExpressionModelListController::editSelectedRecordWithText(text); }
|
||||
void editExpression(Ion::Events::Event event) override { return Shared::ExpressionModelListController::editExpression(event); }
|
||||
bool editSelectedRecordWithText(const char * text) override { return Shared::ExpressionModelListController::editSelectedRecordWithText(text); }
|
||||
/* ViewController */
|
||||
View * view() override { return &m_equationListView; }
|
||||
/* Text/Layout Field Delegate */
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
void addEmptyModel() override;
|
||||
bool removeModelRow(Ion::Storage::Record record) override;
|
||||
void reloadBrace();
|
||||
Shared::StorageExpressionModelStore * modelStore() override { return m_equationStore; }
|
||||
Shared::ExpressionModelStore * modelStore() override { return m_equationStore; }
|
||||
StackViewController * stackController() const;
|
||||
InputViewController * inputController() override;
|
||||
// ListViewDataSource
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "shared/poincare_helpers.h"
|
||||
#include "shared/function.h"
|
||||
#include "shared/cartesian_function.h"
|
||||
#include "graph/storage_cartesian_function_store.h"
|
||||
#include "graph/cartesian_function_store.h"
|
||||
#include "constant.h"
|
||||
#include <escher/metric.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
MessageTableCellWithChevron m_nodeCells[k_numberOfMenuRows];
|
||||
VariableBoxEmptyController m_emptyViewController;
|
||||
// Layout memoization
|
||||
// TODO: make a helper doing the RingMemoizationOfConsecutiveObjets to factorize this code and StorageExpressionModelStore code
|
||||
// TODO: make a helper doing the RingMemoizationOfConsecutiveObjets to factorize this code and ExpressionModelStore code
|
||||
int m_firstMemoizedLayoutIndex;
|
||||
Poincare::Layout m_layouts[k_maxNumberOfDisplayedRows];
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "variable_box_empty_controller.h"
|
||||
#include <poincare/layout_helper.h>
|
||||
#include "graph/storage_cartesian_function_store.h"
|
||||
#include "graph/cartesian_function_store.h"
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ bool SelectableTableView::selectCellAtLocation(int i, int j, bool setFirstRespon
|
||||
|
||||
/* We need to scroll:
|
||||
* - After notifying the delegate. For instance,
|
||||
* StorageExpressionModelListController needs to update its memoized cell
|
||||
* ExpressionModelListController needs to update its memoized cell
|
||||
* height values before any scroll.
|
||||
* - Before setting the first responder. If the first responder is a view, it
|
||||
* might change during the scroll. */
|
||||
|
||||
Reference in New Issue
Block a user