[escher] delete list view

Change-Id: Ia3e2aa2613479e2fcc7f12e7de3b7e8b8f2cff68
This commit is contained in:
Émilie Feral
2016-10-25 11:59:56 +02:00
parent e7b3cb8df6
commit a29c46f662
18 changed files with 49 additions and 95 deletions

View File

@@ -8,14 +8,14 @@ namespace Calculation {
HistoryController::HistoryController(Responder * parentResponder, CalculationStore * calculationStore) :
ViewController(parentResponder),
m_listView(ListView(this, 0, 0, 0, 0)),
m_tableView(TableView(this, 0, 0, 0, 0)),
m_activeCell(0),
m_calculationStore(calculationStore)
{
}
View * HistoryController::HistoryController::view() {
return &m_listView;
return &m_tableView;
}
const char * HistoryController::title() const {
@@ -23,12 +23,12 @@ const char * HistoryController::title() const {
}
void HistoryController::reload() {
m_listView.reloadData();
m_tableView.reloadData();
}
void HistoryController::didBecomeFirstResponder() {
setActiveCell(numberOfRows()-1);
m_listView.reloadData();
m_tableView.reloadData();
}
void HistoryController::setActiveCell(int index) {
@@ -36,13 +36,13 @@ void HistoryController::setActiveCell(int index) {
return;
}
if (m_activeCell >= 0) {
HistoryViewCell * previousCell = (HistoryViewCell *)(m_listView.cellAtIndex(m_activeCell));
HistoryViewCell * previousCell = (HistoryViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
}
m_activeCell = index;
if (m_activeCell >= 0) {
m_listView.scrollToRow(index);
HistoryViewCell * cell = (HistoryViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
HistoryViewCell * cell = (HistoryViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}
}

View File

@@ -35,7 +35,7 @@ private:
constexpr static int k_defaultCalculationCellWidth = 320;
constexpr static int k_resultWidth = 7*14;
HistoryViewCell m_calculationHistory[k_maxNumberOfDisplayedRows];
ListView m_listView;
TableView m_tableView;
int m_activeCell;
CalculationStore * m_calculationStore;
};

View File

@@ -8,7 +8,7 @@ ParameterController::ParameterController(Responder * parentResponder, FunctionSt
m_colorCell(ListViewCell((char*)"Couleur de la fonction")),
m_enableCell(SwitchListViewCell((char*)"Activer/Desactiver")),
m_deleteCell(ListViewCell((char*)"Supprimer la fonction")),
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this,Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0),
m_functionStore(functionStore)
@@ -20,11 +20,11 @@ const char * ParameterController::title() const {
}
View * ParameterController::view() {
return &m_listView;
return &m_tableView;
}
void ParameterController::didBecomeFirstResponder() {
m_listView.reloadData();
m_tableView.reloadData();
setActiveCell(0);
}
@@ -39,12 +39,12 @@ void ParameterController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfCell) {
return;
}
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
ListViewCell * previousCell = (ListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
ListViewCell * cell = (ListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}
@@ -78,7 +78,7 @@ bool ParameterController::handleEnter() {
case 1:
{
m_function->setActive(!m_function->isActive());
m_listView.reloadData();
m_tableView.reloadData();
return true;
}
case 2:

View File

@@ -29,7 +29,7 @@ private:
ListViewCell m_colorCell;
SwitchListViewCell m_enableCell;
ListViewCell m_deleteCell;
ListView m_listView;
TableView m_tableView;
int m_activeCell;
Function * m_function;
FunctionStore * m_functionStore;

View File

@@ -8,7 +8,7 @@ AbscissaParameterController::AbscissaParameterController(Responder * parentRespo
m_deleteColumn(ListViewCell((char*)"Effacer la colonne")),
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
m_setInterval(ListViewCell((char*)"Regler l'intervalle")),
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this,Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0),
m_valuesParameterController(valuesParameterController)
@@ -20,7 +20,7 @@ const char * AbscissaParameterController::title() const {
}
View * AbscissaParameterController::view() {
return &m_listView;
return &m_tableView;
}
void AbscissaParameterController::didBecomeFirstResponder() {
@@ -31,12 +31,12 @@ void AbscissaParameterController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfCell) {
return;
}
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
ListViewCell * previousCell = (ListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
ListViewCell * cell = (ListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}

View File

@@ -25,7 +25,7 @@ private:
ListViewCell m_deleteColumn;
ListViewCell m_copyColumn;
ListViewCell m_setInterval;
ListView m_listView;
TableView m_tableView;
int m_activeCell;
ValuesParameterController * m_valuesParameterController;
};

View File

@@ -8,7 +8,7 @@ DerivativeParameterController::DerivativeParameterController(Responder * parentR
m_pageTitle("Colonne f'(x)"),
m_hideColumn(ListViewCell((char*)"Masquer la colonne de la derivee")),
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this,Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0),
m_function(nullptr)
@@ -20,7 +20,7 @@ const char * DerivativeParameterController::title() const {
}
View * DerivativeParameterController::view() {
return &m_listView;
return &m_tableView;
}
void DerivativeParameterController::setFunction(Function * function) {
@@ -34,7 +34,7 @@ void DerivativeParameterController::setFunction(Function * function) {
}
void DerivativeParameterController::didBecomeFirstResponder() {
m_listView.reloadData();
m_tableView.reloadData();
setActiveCell(m_activeCell);
}
@@ -42,12 +42,12 @@ void DerivativeParameterController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfCell) {
return;
}
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
ListViewCell * previousCell = (ListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
ListViewCell * cell = (ListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}

View File

@@ -28,7 +28,7 @@ private:
char m_pageTitle[k_maxNumberOfCharsInTitle];
ListViewCell m_hideColumn;
ListViewCell m_copyColumn;
ListView m_listView;
TableView m_tableView;
int m_activeCell;
Function * m_function;
};

View File

@@ -8,7 +8,7 @@ FunctionParameterController::FunctionParameterController(Responder * parentRespo
m_pageTitle("Colonne f(x)"),
m_displayDerivativeColumn(SwitchListViewCell((char*)"Colonne de la fonction derivee")),
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this,Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0),
m_function(nullptr)
@@ -20,7 +20,7 @@ const char * FunctionParameterController::title() const {
}
View * FunctionParameterController::view() {
return &m_listView;
return &m_tableView;
}
void FunctionParameterController::setFunction(Function * function) {
@@ -34,7 +34,7 @@ void FunctionParameterController::setFunction(Function * function) {
}
void FunctionParameterController::didBecomeFirstResponder() {
m_listView.reloadData();
m_tableView.reloadData();
setActiveCell(m_activeCell);
}
@@ -42,12 +42,12 @@ void FunctionParameterController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfCell) {
return;
}
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
ListViewCell * previousCell = (ListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
ListViewCell * cell = (ListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}
@@ -71,7 +71,7 @@ bool FunctionParameterController::handleEnter() {
case 0:
{
m_function->setDisplayDerivative(!m_function->displayDerivative());
m_listView.reloadData();
m_tableView.reloadData();
return true;
}
case 1:

View File

@@ -29,7 +29,7 @@ private:
char m_pageTitle[k_maxNumberOfCharsInTitle];
SwitchListViewCell m_displayDerivativeColumn;
ListViewCell m_copyColumn;
ListView m_listView;
TableView m_tableView;
int m_activeCell;
Function * m_function;
};

View File

@@ -10,7 +10,7 @@ ValuesParameterController::ValuesParameterController(Responder * parentResponder
m_intervalStartCell(TextListViewCell((char*)"X Debut")),
m_intervalEndCell(TextListViewCell((char*)"X Fin")),
m_intervalStepCell(TextListViewCell((char*)"Pas")),
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this,Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0)
{
@@ -21,7 +21,7 @@ const char * ValuesParameterController::title() const {
}
View * ValuesParameterController::view() {
return &m_listView;
return &m_tableView;
}
Graph::Interval * ValuesParameterController::interval() {
@@ -62,12 +62,12 @@ void ValuesParameterController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfCell) {
return;
}
TextListViewCell * previousCell = (TextListViewCell *)(m_listView.cellAtIndex(m_activeCell));
TextListViewCell * previousCell = (TextListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
TextListViewCell * cell = (TextListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
TextListViewCell * cell = (TextListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}

View File

@@ -30,7 +30,7 @@ private:
TextListViewCell m_intervalStartCell;
TextListViewCell m_intervalEndCell;
TextListViewCell m_intervalStepCell;
ListView m_listView;
TableView m_tableView;
int m_activeCell;
};

View File

@@ -14,7 +14,7 @@ static const char * sMessages[] = {
Probability::LawController::LawController(Responder * parentResponder) :
ViewController(parentResponder),
m_listView(ListView(this, Metric::TopMargin, Metric::RightMargin,
m_tableView(TableView(this, Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_activeCell(0)
{
@@ -22,7 +22,7 @@ Probability::LawController::LawController(Responder * parentResponder) :
}
View * Probability::LawController::view() {
return &m_listView;
return &m_tableView;
}
const char * Probability::LawController::title() const {
@@ -37,12 +37,12 @@ void Probability::LawController::setActiveCell(int index) {
if (index < 0 || index >= k_totalNumberOfModels) {
return;
}
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
ListViewCell * previousCell = (ListViewCell *)(m_tableView.cellAtLocation(0, m_activeCell));
previousCell->setHighlighted(false);
m_activeCell = index;
m_listView.scrollToRow(index);
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
m_tableView.scrollToCell(0, index);
ListViewCell * cell = (ListViewCell *)(m_tableView.cellAtLocation(0, index));
cell->setHighlighted(true);
}

View File

@@ -27,7 +27,7 @@ private:
// !!! CAUTION: The order here is important
// The cells should be initialized *before* the listview!
ListViewCell m_cells[k_maxNumberOfCells];
ListView m_listView;
TableView m_tableView;
const char ** m_messages;
int m_activeCell;
};

View File

@@ -9,7 +9,6 @@ objs += $(addprefix escher/src/,\
image_view.o\
invocation.o\
input_view_controller.o\
list_view.o\
list_view_cell.o\
list_view_data_source.o\
metric.o\

View File

@@ -10,7 +10,6 @@
#include <escher/image_view.h>
#include <escher/input_view_controller.h>
#include <escher/invocation.h>
#include <escher/list_view.h>
#include <escher/list_view_cell.h>
#include <escher/list_view_data_source.h>
#include <escher/metric.h>

View File

@@ -1,20 +0,0 @@
#ifndef ESCHER_LIST_VIEW_H
#define ESCHER_LIST_VIEW_H
#include <escher/table_view.h>
#include <escher/list_view_data_source.h>
class ListView : public TableView {
public:
ListView(ListViewDataSource * dataSource, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0,
KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
void scrollToRow(int index);
View * cellAtIndex(int index);
protected:
#if ESCHER_VIEW_LOGGING
const char * className() const override;
#endif
};
#endif

View File

@@ -1,24 +0,0 @@
#include <escher/list_view.h>
#include <escher/metric.h>
ListView::ListView(ListViewDataSource * dataSource, KDCoordinate topMargin, KDCoordinate rightMargin,
KDCoordinate bottomMargin, KDCoordinate leftMargin) :
TableView(dataSource, topMargin, rightMargin, bottomMargin, leftMargin)
{
}
// This method computes the minimal scrolling needed to properly display the
// requested cell.
void ListView::scrollToRow(int index) {
scrollToCell(0, index);
}
View * ListView::cellAtIndex(int index) {
return cellAtLocation(0, index);
}
#if ESCHER_VIEW_LOGGING
const char * ListView::className() const {
return "ListView";
}
#endif