mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps] Define TextFieldDelegate::textFieldDelegateApp() directly from ::app()
This commit is contained in:
committed by
EmilieNumworks
parent
5058f64163
commit
055d601854
@@ -108,10 +108,6 @@ void EditExpressionController::layoutFieldDidChangeSize(::LayoutField * layoutFi
|
||||
}
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * EditExpressionController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
void EditExpressionController::reloadView() {
|
||||
((ContentView *)view())->reload();
|
||||
m_historyController->reload();
|
||||
|
||||
@@ -53,7 +53,6 @@ private:
|
||||
bool inputViewDidReceiveEvent(Ion::Events::Event event, bool shouldDuplicateLastCalculation);
|
||||
bool inputViewDidFinishEditing(const char * text, Poincare::Layout layoutR);
|
||||
bool inputViewDidAbortEditing(const char * text);
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
static constexpr int k_cacheBufferSize = Constant::MaxSerializedExpressionSize;
|
||||
char m_cacheBuffer[k_cacheBufferSize];
|
||||
HistoryController * m_historyController;
|
||||
|
||||
@@ -189,8 +189,4 @@ void ListController::setFunctionNameInTextField(ExpiringPointer<Function> functi
|
||||
textField->setText(bufferName);
|
||||
}
|
||||
|
||||
Shared::TextFieldDelegateApp * ListController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ private:
|
||||
HighlightCell * expressionCells(int index) override;
|
||||
void willDisplayTitleCellAtIndex(HighlightCell * cell, int j) override;
|
||||
void willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) override;
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
void setFunctionNameInTextField(Shared::ExpiringPointer<Shared::Function> function, TextField * textField);
|
||||
TextFieldFunctionTitleCell m_functionTitleCells[k_maxNumberOfDisplayableRows];
|
||||
Shared::FunctionExpressionCell m_expressionCells[k_maxNumberOfDisplayableRows];
|
||||
|
||||
@@ -266,10 +266,6 @@ void CalculationController::setCalculationAccordingToIndex(int index, bool force
|
||||
m_calculation->setLaw(m_law);
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * CalculationController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
void CalculationController::updateTitle() {
|
||||
int currentChar = 0;
|
||||
for (int index = 0; index < m_law->numberOfParameter(); index++) {
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
private:
|
||||
constexpr static int k_numberOfCalculationCells = 3;
|
||||
constexpr static KDCoordinate k_tableMargin = 3;
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
void updateTitle();
|
||||
class ContentView : public View {
|
||||
public:
|
||||
|
||||
@@ -158,10 +158,6 @@ bool ListController::editInitialConditionOfSelectedRecordWithText(const char * t
|
||||
return (error == Ion::Storage::Record::ErrorStatus::None);
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * ListController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
ListParameterController * ListController::parameterController() {
|
||||
return &m_parameterController;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public:
|
||||
private:
|
||||
static constexpr KDCoordinate k_expressionCellVerticalMargin = 3;
|
||||
bool editInitialConditionOfSelectedRecordWithText(const char * text, bool firstInitialCondition);
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
ListParameterController * parameterController() override;
|
||||
int maxNumberOfDisplayableRows() override;
|
||||
Shared::FunctionTitleCell * titleCells(int index) override;
|
||||
|
||||
@@ -148,10 +148,6 @@ void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int
|
||||
}
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * ListParameterController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
int ListParameterController::totalNumberOfCells() const {
|
||||
if (hasInitialRankRow()) {
|
||||
return k_totalNumberOfCell;
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
|
||||
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
|
||||
void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY, bool withinTemporarySelection) override;
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
|
||||
// ListViewDataSource
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
|
||||
@@ -95,8 +95,4 @@ bool DisplayModeController::textFieldDidFinishEditing(TextField * textField, con
|
||||
return true;
|
||||
}
|
||||
|
||||
Shared::TextFieldDelegateApp * DisplayModeController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
|
||||
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
|
||||
private:
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
MessageTableCellWithEditableTextWithSeparator m_editableCell;
|
||||
char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength];
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "editable_cell_table_view_controller.h"
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include "../constant.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -112,8 +111,4 @@ void EditableCellTableViewController::viewWillAppear() {
|
||||
}
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * EditableCellTableViewController::textFieldDelegateApp() {
|
||||
return (TextFieldDelegateApp *)app();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
protected:
|
||||
static constexpr KDCoordinate k_cellHeight = 20;
|
||||
private:
|
||||
TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
virtual bool cellAtLocationIsEditable(int columnIndex, int rowIndex) = 0;
|
||||
virtual bool setDataAtLocation(double floatBody, int columnIndex, int rowIndex) = 0;
|
||||
virtual double dataAtLocation(int columnIndex, int rowIndex) = 0;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "float_parameter_controller.h"
|
||||
#include "../constant.h"
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -138,10 +137,6 @@ bool FloatParameterController::textFieldDidFinishEditing(TextField * textField,
|
||||
return true;
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * FloatParameterController::textFieldDelegateApp() {
|
||||
return (TextFieldDelegateApp *)app();
|
||||
}
|
||||
|
||||
int FloatParameterController::activeCell() {
|
||||
return selectedRow();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ private:
|
||||
virtual void buttonAction();
|
||||
virtual int reusableParameterCellCount(int type) = 0;
|
||||
virtual HighlightCell * reusableParameterCell(int index, int type) = 0;
|
||||
TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
virtual bool setParameterAtIndex(int parameterIndex, double f) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "go_to_parameter_controller.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "interactive_curve_view_controller.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
#include <cmath>
|
||||
#include <float.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "parameter_text_field_delegate.h"
|
||||
|
||||
using namespace Poincare;
|
||||
#include <escher/text_field.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
bool ParameterTextFieldDelegate::textFieldDidReceiveEvent(::TextField * textField, Ion::Events::Event event) {
|
||||
bool ParameterTextFieldDelegate::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Backspace && !textField->isEditing()) {
|
||||
textField->setEditing(true);
|
||||
return true;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef SHARED_PARAMETER_TEXT_FIELD_DELEGATE_H
|
||||
#define SHARED_PARAMETER_TEXT_FIELD_DELEGATE_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "text_field_delegate.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
|
||||
namespace Shared {
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "range_parameter_controller.h"
|
||||
#include "text_field_delegate_app.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define SHARED_SIMPLE_INTERACTIVE_CURVE_VIEW_CONTROLLER_H
|
||||
|
||||
#include <escher/view_controller.h>
|
||||
#include <escher/app.h>
|
||||
#include "text_field_delegate.h"
|
||||
#include "interactive_curve_view_range.h"
|
||||
#include "curve_view_cursor.h"
|
||||
@@ -21,9 +20,6 @@ public:
|
||||
bool textFieldDidAbortEditing(TextField * textField) override;
|
||||
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
|
||||
protected:
|
||||
TextFieldDelegateApp * textFieldDelegateApp() override {
|
||||
return static_cast<TextFieldDelegateApp *>(app());
|
||||
}
|
||||
constexpr static float k_cursorRightMarginRatio = 0.04f; // (cursorWidth/2)/graphViewWidth
|
||||
constexpr static float k_cursorLeftMarginRatio = 0.04f; // (cursorWidth/2)/graphViewWidth
|
||||
virtual float cursorTopMarginRatio() { return 0.07f; } // (cursorHeight/2)/graphViewHeight
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef SHARED_TEXT_FIELD_DELEGATE_H
|
||||
#define SHARED_TEXT_FIELD_DELEGATE_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "text_field_delegate_app.h"
|
||||
|
||||
namespace Shared {
|
||||
@@ -10,8 +9,10 @@ class TextFieldDelegate : public ::TextFieldDelegate {
|
||||
public:
|
||||
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
|
||||
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
|
||||
private:
|
||||
virtual TextFieldDelegateApp * textFieldDelegateApp() = 0;
|
||||
protected:
|
||||
TextFieldDelegateApp * textFieldDelegateApp() {
|
||||
return static_cast<TextFieldDelegateApp *>(::app());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
#define SHARED_TEXT_FIELD_DELEGATE_APP_H
|
||||
|
||||
#include <poincare/context.h>
|
||||
#include <escher.h>
|
||||
#include "input_event_handler_delegate_app.h"
|
||||
#include <escher/text_field_delegate.h>
|
||||
#include <apps/i18n.h>
|
||||
|
||||
class EditableField;
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class TextFieldDelegateApp : public InputEventHandlerDelegateApp, public TextFieldDelegate {
|
||||
|
||||
@@ -228,10 +228,6 @@ SelectableTableView * ListController::selectableTableView() {
|
||||
return m_equationListView.selectableTableView();
|
||||
}
|
||||
|
||||
Shared::TextFieldDelegateApp * ListController::textFieldDelegateApp() {
|
||||
return app();
|
||||
}
|
||||
|
||||
StackViewController * ListController::stackController() const {
|
||||
return static_cast<StackViewController *>(parentResponder()->parentResponder());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
/* ViewController */
|
||||
View * view() override { return &m_equationListView; }
|
||||
/* Text/Layout Field Delegate */
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
|
||||
bool layoutFieldDidReceiveEvent(LayoutField * layoutField, Ion::Events::Event event) override;
|
||||
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef ESCHER_TEXT_FIELD_DELEGATE_H
|
||||
#define ESCHER_TEXT_FIELD_DELEGATE_H
|
||||
|
||||
#include <ion/events.h>
|
||||
|
||||
class TextField;
|
||||
|
||||
class TextFieldDelegate {
|
||||
|
||||
Reference in New Issue
Block a user