From 924b0372d082579ed7ffd6fa0d55ea00c43163a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 23 Dec 2016 13:58:31 +0100 Subject: [PATCH] [escher][apps] Move value cell class to escher folder renamed even odd buffer text view Change-Id: I6c8b8fdcd90d2b6847ec94f65c4b2e64204b52ba --- apps/graph/Makefile | 1 - apps/graph/values/value_cell.cpp | 35 ------------------- apps/graph/values/values_controller.cpp | 4 +-- apps/graph/values/values_controller.h | 3 +- escher/Makefile | 1 + escher/include/escher.h | 1 + .../escher/even_odd_buffer_text_cell.h | 15 ++++---- escher/src/even_odd_buffer_text_cell.cpp | 31 ++++++++++++++++ 8 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 apps/graph/values/value_cell.cpp rename apps/graph/values/value_cell.h => escher/include/escher/even_odd_buffer_text_cell.h (52%) create mode 100644 escher/src/even_odd_buffer_text_cell.cpp diff --git a/apps/graph/Makefile b/apps/graph/Makefile index afd4276c9..a28e90b82 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -23,7 +23,6 @@ app_objs += $(addprefix apps/graph/,\ values/function_parameter_controller.o\ values/interval.o\ values/interval_parameter_controller.o\ - values/value_cell.o\ values/values_controller.o\ ) diff --git a/apps/graph/values/value_cell.cpp b/apps/graph/values/value_cell.cpp deleted file mode 100644 index 334e0fe1d..000000000 --- a/apps/graph/values/value_cell.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "value_cell.h" -#include "assert.h" - -namespace Graph { - -ValueCell::ValueCell() : - EvenOddCell(), - m_bufferTextView(BufferTextView(1.0f, 0.5f)) -{ -} - -void ValueCell::reloadCell() { - EvenOddCell::reloadCell(); - m_bufferTextView.setBackgroundColor(backgroundColor()); -} - -void ValueCell::setText(const char * textContent) { - m_bufferTextView.setText(textContent); -} - - -int ValueCell::numberOfSubviews() const { - return 1; -} - -View * ValueCell::subviewAtIndex(int index) { - assert(index == 0); - return &m_bufferTextView; -} - -void ValueCell::layoutSubviews() { - m_bufferTextView.setFrame(bounds()); -} - -} diff --git a/apps/graph/values/values_controller.cpp b/apps/graph/values/values_controller.cpp index bfeaa8d1d..b654a751c 100644 --- a/apps/graph/values/values_controller.cpp +++ b/apps/graph/values/values_controller.cpp @@ -145,13 +145,13 @@ void ValuesController::willDisplayCellAtLocation(TableViewCell * cell, int i, in int numberOfIntervalElements = m_interval.numberOfElements(); if (numberOfIntervalElements < Interval::k_maxNumberOfElements) { buffer[0] = 0; - ValueCell * myValueCell = (ValueCell *)cell; + EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell; myValueCell->setText(buffer); return; } } // The cell is a value cell - ValueCell * myValueCell = (ValueCell *)cell; + EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell; Function * function = functionAtColumn(i); float x = m_interval.element(j-1); App * graphApp = (Graph::App *)app(); diff --git a/apps/graph/values/values_controller.h b/apps/graph/values/values_controller.h index dcbf7c545..c40e9f98a 100644 --- a/apps/graph/values/values_controller.h +++ b/apps/graph/values/values_controller.h @@ -5,7 +5,6 @@ #include "../function_store.h" #include "../function_title_cell.h" #include "../../editable_cell_table_view_controller.h" -#include "value_cell.h" #include "interval.h" #include "abscissa_parameter_controller.h" #include "derivative_parameter_controller.h" @@ -61,7 +60,7 @@ private: constexpr static int k_maxNumberOfFunctions = 5; EvenOddPointerTextCell m_abscissaTitleCell; FunctionTitleCell m_functionTitleCells[k_maxNumberOfFunctions]; - ValueCell m_floatCells[k_maxNumberOfCells]; + EvenOddBufferTextCell m_floatCells[k_maxNumberOfCells]; char m_draftTextBuffer[EditableTextCell::k_bufferLength]; EvenOddEditableTextCell m_abscissaCells[k_maxNumberOfAbscissaCells]; FunctionStore * m_functionStore; diff --git a/escher/Makefile b/escher/Makefile index 10a315c4c..477468aa9 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -11,6 +11,7 @@ objs += $(addprefix escher/src/,\ editable_text_menu_list_cell.o\ editable_text_cell.o\ even_odd_cell.o\ + even_odd_buffer_text_cell.o\ even_odd_editable_text_cell.o\ even_odd_pointer_text_cell.o\ expression_view.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index 6fdb9876b..3aa75599d 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/apps/graph/values/value_cell.h b/escher/include/escher/even_odd_buffer_text_cell.h similarity index 52% rename from apps/graph/values/value_cell.h rename to escher/include/escher/even_odd_buffer_text_cell.h index 0f5216441..738732a9a 100644 --- a/apps/graph/values/value_cell.h +++ b/escher/include/escher/even_odd_buffer_text_cell.h @@ -1,13 +1,12 @@ -#ifndef GRAPH_VALUE_CELL_H -#define GRAPH_VALUE_CELL_H +#ifndef ESCHER_EVEN_ODD_BUFFER_TEXT_CELL_H +#define ESCHER_EVEN_ODD_BUFFER_TEXT_CELL_H -#include -#include +#include +#include -namespace Graph { -class ValueCell : public EvenOddCell { +class EvenOddBufferTextCell : public EvenOddCell { public: - ValueCell(); + EvenOddBufferTextCell(); void reloadCell() override; void setText(const char * textContent); int numberOfSubviews() const override; @@ -18,6 +17,4 @@ protected: BufferTextView m_bufferTextView; }; -} - #endif diff --git a/escher/src/even_odd_buffer_text_cell.cpp b/escher/src/even_odd_buffer_text_cell.cpp new file mode 100644 index 000000000..3d1ca3c79 --- /dev/null +++ b/escher/src/even_odd_buffer_text_cell.cpp @@ -0,0 +1,31 @@ +#include +#include + +EvenOddBufferTextCell::EvenOddBufferTextCell() : + EvenOddCell(), + m_bufferTextView(BufferTextView(1.0f, 0.5f)) +{ +} + +void EvenOddBufferTextCell::reloadCell() { + EvenOddCell::reloadCell(); + m_bufferTextView.setBackgroundColor(backgroundColor()); +} + +void EvenOddBufferTextCell::setText(const char * textContent) { + m_bufferTextView.setText(textContent); +} + + +int EvenOddBufferTextCell::numberOfSubviews() const { + return 1; +} + +View * EvenOddBufferTextCell::subviewAtIndex(int index) { + assert(index == 0); + return &m_bufferTextView; +} + +void EvenOddBufferTextCell::layoutSubviews() { + m_bufferTextView.setFrame(bounds()); +}