From 77b9630086651eb9cd2a48df9349fc99af24e213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 19 Dec 2016 12:20:11 +0100 Subject: [PATCH] [apps/graph/value] Use even odd editable pointer cell in values controller instead of title cell Change-Id: Ic6b2fa6dad45f4d56a6cf0a2d7708894a92c1a96 --- apps/graph/Makefile | 1 - apps/graph/values/title_cell.cpp | 35 ------------------------- apps/graph/values/title_cell.h | 21 --------------- apps/graph/values/values_controller.cpp | 2 +- apps/graph/values/values_controller.h | 3 +-- apps/statistics/data_controller.h | 3 +-- 6 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 apps/graph/values/title_cell.cpp delete mode 100644 apps/graph/values/title_cell.h diff --git a/apps/graph/Makefile b/apps/graph/Makefile index 47e5a7005..01bb69cda 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -22,7 +22,6 @@ app_objs += $(addprefix apps/graph/,\ values/function_parameter_controller.o\ values/interval.o\ values/interval_parameter_controller.o\ - values/title_cell.o\ values/value_cell.o\ values/values_controller.o\ ) diff --git a/apps/graph/values/title_cell.cpp b/apps/graph/values/title_cell.cpp deleted file mode 100644 index 8529dcee3..000000000 --- a/apps/graph/values/title_cell.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "title_cell.h" -#include - -namespace Graph { - -TitleCell::TitleCell() : - EvenOddCell(), - m_pointerTextView(nullptr, 0.5f, 0.5f) -{ -} - -void TitleCell::reloadCell() { - EvenOddCell::reloadCell(); - m_pointerTextView.setBackgroundColor(backgroundColor()); -} - -void TitleCell::setText(const char * title, KDColor textColor) { - m_pointerTextView.setText(title); - m_pointerTextView.setTextColor(textColor); -} - -int TitleCell::numberOfSubviews() const { - return 1; -} - -View * TitleCell::subviewAtIndex(int index) { - assert(index == 0); - return &m_pointerTextView; -} - -void TitleCell::layoutSubviews() { - m_pointerTextView.setFrame(bounds()); -} - -} diff --git a/apps/graph/values/title_cell.h b/apps/graph/values/title_cell.h deleted file mode 100644 index 83af544b1..000000000 --- a/apps/graph/values/title_cell.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef GRAPH_TITLE_CELL_H -#define GRAPH_TITLE_CELL_H - -#include - -namespace Graph { -class TitleCell : public EvenOddCell { -public: - TitleCell(); - void reloadCell() override; - void setText(const char * textContent, KDColor textColor = KDColorBlack); - int numberOfSubviews() const override; - View * subviewAtIndex(int index) override; - void layoutSubviews() override; -protected: - PointerTextView m_pointerTextView; -}; - -} - -#endif diff --git a/apps/graph/values/values_controller.cpp b/apps/graph/values/values_controller.cpp index c0aa2cc5e..c7d3e6f9c 100644 --- a/apps/graph/values/values_controller.cpp +++ b/apps/graph/values/values_controller.cpp @@ -311,7 +311,7 @@ void ValuesController::willDisplayCellAtLocation(TableViewCell * cell, int i, in myCell->setEven(j%2 == 0); // The cell is a title cell: if (j == 0) { - TitleCell * mytitleCell = (TitleCell *)cell; + EvenOddPointerTextCell * mytitleCell = (EvenOddPointerTextCell *)cell; if (i == 0) { mytitleCell->setText("x"); return; diff --git a/apps/graph/values/values_controller.h b/apps/graph/values/values_controller.h index 2f5d199e9..7947ca19d 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 "value_cell.h" -#include "title_cell.h" #include "interval.h" #include "abscissa_parameter_controller.h" #include "derivative_parameter_controller.h" @@ -72,7 +71,7 @@ private: // !!! CAUTION: The order here is important // The cells should be initialized *before* the TableView! SelectableTableView m_selectableTableView; - TitleCell m_abscissaTitleCell; + EvenOddPointerTextCell m_abscissaTitleCell; FunctionTitleCell m_functionTitleCells[k_maxNumberOfFunctions]; ValueCell m_floatCells[k_maxNumberOfCells]; char m_draftTextBuffer[EditableTextCell::k_bufferLength]; diff --git a/apps/statistics/data_controller.h b/apps/statistics/data_controller.h index 7bba56e32..558a352ab 100644 --- a/apps/statistics/data_controller.h +++ b/apps/statistics/data_controller.h @@ -2,7 +2,6 @@ #define STATISTICS_DATA_CONTROLLER_H #include -#include "../graph/values/title_cell.h" namespace Statistics { @@ -33,7 +32,7 @@ private: constexpr static int k_numberOfTitleCells = 2; Responder * tabController() const; //EvenOddEditableTextCell m_editableCells[k_maxNumberOfEditableCells]; - Graph::TitleCell m_titleCells[k_numberOfTitleCells]; + EvenOddPointerTextCell m_titleCells[k_numberOfTitleCells]; SelectableTableView m_selectableTableView; };