diff --git a/apps/graph/Makefile b/apps/graph/Makefile index 52eec76cc..70cc0177c 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -12,7 +12,6 @@ app_objs += $(addprefix apps/graph/,\ list/function_expression_view.o\ list/new_function_cell.o\ list/list_controller.o\ - list/parameter_controller.o\ values/abscissa_parameter_controller.o\ values/derivative_parameter_controller.o\ values/function_parameter_controller.o\ diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index 7d38aad46..42258ae29 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -2,6 +2,8 @@ #include "../app.h" #include +using namespace Shared; + namespace Graph { ListController::ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header) : @@ -11,7 +13,7 @@ ListController::ListController(Responder * parentResponder, FunctionStore * func FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator)}, m_selectableTableView(SelectableTableView(this, this, 0, 0, 0, 0, nullptr, false, true)), m_functionStore(functionStore), - m_parameterController(ParameterController(this, functionStore)) + m_parameterController(ListParameterController(this, functionStore)) { } diff --git a/apps/graph/list/list_controller.h b/apps/graph/list/list_controller.h index b273fb862..c917656b5 100644 --- a/apps/graph/list/list_controller.h +++ b/apps/graph/list/list_controller.h @@ -6,7 +6,7 @@ #include "../function_title_cell.h" #include "function_expression_view.h" #include "new_function_cell.h" -#include "parameter_controller.h" +#include "../../shared/list_parameter_controller.h" namespace Graph { @@ -48,7 +48,7 @@ private: NewFunctionCell m_addNewFunction; SelectableTableView m_selectableTableView; FunctionStore * m_functionStore; - ParameterController m_parameterController; + Shared::ListParameterController m_parameterController; }; } diff --git a/apps/shared/Makefile b/apps/shared/Makefile index 663670928..f30fbd156 100644 --- a/apps/shared/Makefile +++ b/apps/shared/Makefile @@ -12,6 +12,7 @@ app_objs += $(addprefix apps/shared/,\ function_store.o\ interactive_curve_view_controller.o\ interactive_curve_view_range.o\ + list_parameter_controller.o\ memoized_curve_view_range.o\ range_parameter_controller.o\ store_controller.o\ diff --git a/apps/graph/list/parameter_controller.cpp b/apps/shared/list_parameter_controller.cpp similarity index 73% rename from apps/graph/list/parameter_controller.cpp rename to apps/shared/list_parameter_controller.cpp index 797fb8272..37a767fc7 100644 --- a/apps/graph/list/parameter_controller.cpp +++ b/apps/shared/list_parameter_controller.cpp @@ -1,9 +1,9 @@ -#include "parameter_controller.h" +#include "list_parameter_controller.h" #include -namespace Graph { +namespace Shared { -ParameterController::ParameterController(Responder * parentResponder, FunctionStore * functionStore) : +ListParameterController::ListParameterController(Responder * parentResponder, FunctionStore * functionStore) : ViewController(parentResponder), m_colorCell(ChevronMenuListCell((char*)"Couleur de la fonction")), m_enableCell(SwitchMenuListCell((char*)"Activer/Desactiver")), @@ -14,32 +14,32 @@ ParameterController::ParameterController(Responder * parentResponder, FunctionSt { } -const char * ParameterController::title() const { +const char * ListParameterController::title() const { return "Options de la fonction"; } -View * ParameterController::view() { +View * ListParameterController::view() { return &m_selectableTableView; } -void ParameterController::didBecomeFirstResponder() { +void ListParameterController::didBecomeFirstResponder() { m_selectableTableView.dataHasChanged(true); m_selectableTableView.selectCellAtLocation(0, 0); app()->setFirstResponder(&m_selectableTableView); } -void ParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) { +void ListParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) { if (cell == &m_enableCell) { SwitchView * switchView = (SwitchView *)m_enableCell.accessoryView(); switchView->setState(m_function->isActive()); } } -void ParameterController::setFunction(Function * function) { +void ListParameterController::setFunction(Function * function) { m_function = function; } -bool ParameterController::handleEvent(Ion::Events::Event event) { +bool ListParameterController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK) { switch (m_selectableTableView.selectedRow()) { case 0: @@ -74,23 +74,22 @@ bool ParameterController::handleEvent(Ion::Events::Event event) { return false; } -int ParameterController::numberOfRows() { +int ListParameterController::numberOfRows() { return k_totalNumberOfCell; }; - -TableViewCell * ParameterController::reusableCell(int index) { +TableViewCell * ListParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); TableViewCell * cells[] = {&m_colorCell, &m_enableCell, &m_deleteCell}; return cells[index]; } -int ParameterController::reusableCellCount() { +int ListParameterController::reusableCellCount() { return k_totalNumberOfCell; } -KDCoordinate ParameterController::cellHeight() { +KDCoordinate ListParameterController::cellHeight() { return Metric::ParameterCellHeight; } diff --git a/apps/graph/list/parameter_controller.h b/apps/shared/list_parameter_controller.h similarity index 69% rename from apps/graph/list/parameter_controller.h rename to apps/shared/list_parameter_controller.h index a4e80660e..f8413c1e0 100644 --- a/apps/graph/list/parameter_controller.h +++ b/apps/shared/list_parameter_controller.h @@ -1,15 +1,15 @@ -#ifndef GRAPH_LIST_PARAM_CONTROLLER_H -#define GRAPH_LIST_PARAM_CONTROLLER_H +#ifndef SHARED_LIST_PARAM_CONTROLLER_H +#define SHARED_LIST_PARAM_CONTROLLER_H #include -#include "../function.h" -#include "../function_store.h" +#include "function.h" +#include "function_store.h" -namespace Graph { +namespace Shared { -class ParameterController : public ViewController, public SimpleListViewDataSource { +class ListParameterController : public ViewController, public SimpleListViewDataSource { public: - ParameterController(Responder * parentResponder, FunctionStore * functionStore); + ListParameterController(Responder * parentResponder, FunctionStore * functionStore); View * view() override; const char * title() const override;