diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index c233b78b1..03bbba216 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -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); } } diff --git a/apps/calculation/history_controller.h b/apps/calculation/history_controller.h index fa9e0e414..b99816043 100644 --- a/apps/calculation/history_controller.h +++ b/apps/calculation/history_controller.h @@ -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; }; diff --git a/apps/graph/list/parameter_controller.cpp b/apps/graph/list/parameter_controller.cpp index 8776533f9..36a8abec0 100644 --- a/apps/graph/list/parameter_controller.cpp +++ b/apps/graph/list/parameter_controller.cpp @@ -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: diff --git a/apps/graph/list/parameter_controller.h b/apps/graph/list/parameter_controller.h index 52e833d35..eff2c30ea 100644 --- a/apps/graph/list/parameter_controller.h +++ b/apps/graph/list/parameter_controller.h @@ -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; diff --git a/apps/graph/values/abscissa_parameter_controller.cpp b/apps/graph/values/abscissa_parameter_controller.cpp index 1be5103ab..31b7a3754 100644 --- a/apps/graph/values/abscissa_parameter_controller.cpp +++ b/apps/graph/values/abscissa_parameter_controller.cpp @@ -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); } diff --git a/apps/graph/values/abscissa_parameter_controller.h b/apps/graph/values/abscissa_parameter_controller.h index 419727f92..2e61e0071 100644 --- a/apps/graph/values/abscissa_parameter_controller.h +++ b/apps/graph/values/abscissa_parameter_controller.h @@ -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; }; diff --git a/apps/graph/values/derivative_parameter_controller.cpp b/apps/graph/values/derivative_parameter_controller.cpp index c9edd28e7..30238bed1 100644 --- a/apps/graph/values/derivative_parameter_controller.cpp +++ b/apps/graph/values/derivative_parameter_controller.cpp @@ -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); } diff --git a/apps/graph/values/derivative_parameter_controller.h b/apps/graph/values/derivative_parameter_controller.h index a702fe5fc..4036b2e54 100644 --- a/apps/graph/values/derivative_parameter_controller.h +++ b/apps/graph/values/derivative_parameter_controller.h @@ -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; }; diff --git a/apps/graph/values/function_parameter_controller.cpp b/apps/graph/values/function_parameter_controller.cpp index 9f80dcb3a..44a291944 100644 --- a/apps/graph/values/function_parameter_controller.cpp +++ b/apps/graph/values/function_parameter_controller.cpp @@ -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: diff --git a/apps/graph/values/function_parameter_controller.h b/apps/graph/values/function_parameter_controller.h index 30571e2a0..b03d5b5d4 100644 --- a/apps/graph/values/function_parameter_controller.h +++ b/apps/graph/values/function_parameter_controller.h @@ -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; }; diff --git a/apps/graph/values/values_parameter_controller.cpp b/apps/graph/values/values_parameter_controller.cpp index 5ec1eda2d..4888d2f75 100644 --- a/apps/graph/values/values_parameter_controller.cpp +++ b/apps/graph/values/values_parameter_controller.cpp @@ -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); } diff --git a/apps/graph/values/values_parameter_controller.h b/apps/graph/values/values_parameter_controller.h index d8c4e9baf..2ff1a4a08 100644 --- a/apps/graph/values/values_parameter_controller.h +++ b/apps/graph/values/values_parameter_controller.h @@ -30,7 +30,7 @@ private: TextListViewCell m_intervalStartCell; TextListViewCell m_intervalEndCell; TextListViewCell m_intervalStepCell; - ListView m_listView; + TableView m_tableView; int m_activeCell; }; diff --git a/apps/probability/law/law_controller.cpp b/apps/probability/law/law_controller.cpp index f3374e940..09a249401 100644 --- a/apps/probability/law/law_controller.cpp +++ b/apps/probability/law/law_controller.cpp @@ -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); } diff --git a/apps/probability/law/law_controller.h b/apps/probability/law/law_controller.h index e08b61081..6fae03eb1 100644 --- a/apps/probability/law/law_controller.h +++ b/apps/probability/law/law_controller.h @@ -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; }; diff --git a/escher/Makefile b/escher/Makefile index 512b72060..2d591a14a 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -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\ diff --git a/escher/include/escher.h b/escher/include/escher.h index 37f01c12c..0de4bb944 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/escher/include/escher/list_view.h b/escher/include/escher/list_view.h deleted file mode 100644 index ccfe6ed50..000000000 --- a/escher/include/escher/list_view.h +++ /dev/null @@ -1,20 +0,0 @@ - #ifndef ESCHER_LIST_VIEW_H -#define ESCHER_LIST_VIEW_H - -#include -#include - -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 diff --git a/escher/src/list_view.cpp b/escher/src/list_view.cpp deleted file mode 100644 index 07e554100..000000000 --- a/escher/src/list_view.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -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