[apps] Move float parameter controller from apps/graph to apps/ to be

used in apps/robability

Change-Id: I00ab38bd35d2b3ad77d9aee3072422b9bd36fe01
This commit is contained in:
Émilie Feral
2016-12-05 11:46:31 +01:00
parent 306d36ca69
commit f95e49929b
10 changed files with 29 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ app_objs += $(addprefix apps/,\
apps_container.o\
constant.o\
expression_text_field_delegate.o\
float_parameter_controller.o\
main.o\
node.o\
node_list_view_controller.o\

View File

@@ -1,11 +1,8 @@
#include "float_parameter_controller.h"
#include "app.h"
#include "../constant.h"
#include "../apps_container.h"
#include "constant.h"
#include "apps_container.h"
#include <assert.h>
namespace Graph {
FloatParameterController::FloatParameterController(Responder * parentResponder) :
ViewController(parentResponder),
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
@@ -61,8 +58,7 @@ void FloatParameterController::editParameter(const char * initialText) {
int cursorLocation = strlen(initialTextContent) + cursorDelta;
EditableTextMenuListCell * cell = (EditableTextMenuListCell *)m_selectableTableView.cellAtLocation(0, activeCell());
cell->setParentResponder(&m_selectableTableView);
App * myApp = (App *)app();
cell->editValue(myApp, initialTextContent, cursorLocation, this,
cell->editValue(textFieldDelegate(), initialTextContent, cursorLocation, this,
[](void * context, void * sender){
FloatParameterController * floatParameterController = (FloatParameterController *)context;
int activeCell = floatParameterController->activeCell();
@@ -79,5 +75,3 @@ void FloatParameterController::editParameter(const char * initialText) {
KDCoordinate FloatParameterController::cellHeight() {
return 35;
}
}

View File

@@ -1,9 +1,8 @@
#ifndef GRAPH_FLOAT_PARAMETER_CONTROLLER_H
#define GRAPH_FLOAT_PARAMETER_CONTROLLER_H
#ifndef APPS_FLOAT_PARAMETER_CONTROLLER_H
#define APPS_FLOAT_PARAMETER_CONTROLLER_H
#include <escher.h>
namespace Graph {
#include "expression_text_field_delegate.h"
/* This controller edits float parameter of any model (given through
* parameterAtIndex and setParameterAtIndex). */
@@ -13,7 +12,7 @@ public:
FloatParameterController(Responder * parentResponder);
int activeCell();
void editParameter(const char * initialText = nullptr);
virtual ExpressionTextFieldDelegate * textFieldDelegate() = 0;
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
@@ -27,6 +26,4 @@ private:
};
}
#endif

View File

@@ -1,7 +1,6 @@
app_objs += $(addprefix apps/graph/,\
app.o\
evaluate_context.o\
float_parameter_controller.o\
function.o\
function_store.o\
function_title_cell.o\

View File

@@ -16,6 +16,11 @@ AxisParameterController::AxisParameterController(Responder * parentResponder, Ax
}
ExpressionTextFieldDelegate * AxisParameterController::textFieldDelegate() {
ExpressionTextFieldDelegate * myApp = (ExpressionTextFieldDelegate *)app();
return myApp;
}
const char * AxisParameterController::title() const {
return "Axes";
}

View File

@@ -4,12 +4,13 @@
#include <escher.h>
#include "axis_interval.h"
#include "graph_view.h"
#include "../float_parameter_controller.h"
#include "../../float_parameter_controller.h"
namespace Graph {
class AxisParameterController : public FloatParameterController {
public:
AxisParameterController(Responder * parentResponder, AxisInterval * axisInterval, GraphView * graphView);
ExpressionTextFieldDelegate * textFieldDelegate() override;
const char * title() const override;
int numberOfRows() override;
TableViewCell * reusableCell(int index) override;

View File

@@ -11,6 +11,11 @@ GoToParameterController::GoToParameterController(Responder * parentResponder, Gr
{
}
ExpressionTextFieldDelegate * GoToParameterController::textFieldDelegate() {
ExpressionTextFieldDelegate * myApp = (ExpressionTextFieldDelegate *)app();
return myApp;
}
const char * GoToParameterController::title() const {
return "Aller a";
}

View File

@@ -4,12 +4,13 @@
#include <escher.h>
#include "axis_interval.h"
#include "graph_view.h"
#include "../float_parameter_controller.h"
#include "../../float_parameter_controller.h"
namespace Graph {
class GoToParameterController : public FloatParameterController {
public:
GoToParameterController(Responder * parentResponder, GraphView * graphView);
ExpressionTextFieldDelegate * textFieldDelegate() override;
const char * title() const override;
int numberOfRows() override;
TableViewCell * reusableCell(int index) override;

View File

@@ -12,6 +12,11 @@ IntervalParameterController::IntervalParameterController(Responder * parentRespo
{
}
ExpressionTextFieldDelegate * IntervalParameterController::textFieldDelegate() {
ExpressionTextFieldDelegate * myApp = (ExpressionTextFieldDelegate *)app();
return myApp;
}
const char * IntervalParameterController::title() const {
return "Regler l'intervalle";
}

View File

@@ -3,13 +3,14 @@
#include <escher.h>
#include "interval.h"
#include "../float_parameter_controller.h"
#include "../../float_parameter_controller.h"
namespace Graph {
class IntervalParameterController : public FloatParameterController {
public:
IntervalParameterController(Responder * parentResponder, Interval * interval);
ExpressionTextFieldDelegate * textFieldDelegate() override;
Interval * interval();
const char * title() const override;
int numberOfRows() override;