diff --git a/apps/graph/list/parameter_controller.cpp b/apps/graph/list/parameter_controller.cpp index 5c0badbeb..6b2d307f6 100644 --- a/apps/graph/list/parameter_controller.cpp +++ b/apps/graph/list/parameter_controller.cpp @@ -5,9 +5,9 @@ namespace Graph { ParameterController::ParameterController(Responder * parentResponder, FunctionStore * functionStore) : ViewController(parentResponder), - m_colorCell(ListViewCell((char*)"Couleur de la fonction")), - m_enableCell(SwitchListViewCell((char*)"Activer/Desactiver")), - m_deleteCell(ListViewCell((char*)"Supprimer la fonction")), + m_colorCell(MenuListCell((char*)"Couleur de la fonction")), + m_enableCell(SwitchMenuListCell((char*)"Activer/Desactiver")), + m_deleteCell(MenuListCell((char*)"Supprimer la fonction")), m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin)), m_functionStore(functionStore) diff --git a/apps/graph/list/parameter_controller.h b/apps/graph/list/parameter_controller.h index 87c3641ac..37db05ae7 100644 --- a/apps/graph/list/parameter_controller.h +++ b/apps/graph/list/parameter_controller.h @@ -24,9 +24,9 @@ public: private: bool handleEnter(); constexpr static int k_totalNumberOfCell = 3; - ListViewCell m_colorCell; - SwitchListViewCell m_enableCell; - ListViewCell m_deleteCell; + MenuListCell m_colorCell; + SwitchMenuListCell m_enableCell; + MenuListCell m_deleteCell; SelectableTableView m_selectableTableView; 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 73ff0512a..1745aa86e 100644 --- a/apps/graph/values/abscissa_parameter_controller.cpp +++ b/apps/graph/values/abscissa_parameter_controller.cpp @@ -5,9 +5,9 @@ namespace Graph { AbscissaParameterController::AbscissaParameterController(Responder * parentResponder, ValuesParameterController * valuesParameterController) : ViewController(parentResponder), - 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_deleteColumn(MenuListCell((char*)"Effacer la colonne")), + m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")), + m_setInterval(MenuListCell((char*)"Regler l'intervalle")), m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin)), m_valuesParameterController(valuesParameterController) diff --git a/apps/graph/values/abscissa_parameter_controller.h b/apps/graph/values/abscissa_parameter_controller.h index e049a7059..beab0025c 100644 --- a/apps/graph/values/abscissa_parameter_controller.h +++ b/apps/graph/values/abscissa_parameter_controller.h @@ -20,9 +20,9 @@ public: private: bool handleEnter(); constexpr static int k_totalNumberOfCell = 3; - ListViewCell m_deleteColumn; - ListViewCell m_copyColumn; - ListViewCell m_setInterval; + MenuListCell m_deleteColumn; + MenuListCell m_copyColumn; + MenuListCell m_setInterval; SelectableTableView m_selectableTableView; ValuesParameterController * m_valuesParameterController; }; diff --git a/apps/graph/values/derivative_parameter_controller.cpp b/apps/graph/values/derivative_parameter_controller.cpp index 91d87e909..3962ecee5 100644 --- a/apps/graph/values/derivative_parameter_controller.cpp +++ b/apps/graph/values/derivative_parameter_controller.cpp @@ -6,8 +6,8 @@ namespace Graph { DerivativeParameterController::DerivativeParameterController(Responder * parentResponder) : ViewController(parentResponder), 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_hideColumn(MenuListCell((char*)"Masquer la colonne de la derivee")), + m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")), m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin)), m_function(nullptr) diff --git a/apps/graph/values/derivative_parameter_controller.h b/apps/graph/values/derivative_parameter_controller.h index b034a17a1..65c3a18d5 100644 --- a/apps/graph/values/derivative_parameter_controller.h +++ b/apps/graph/values/derivative_parameter_controller.h @@ -24,8 +24,8 @@ private: constexpr static int k_totalNumberOfCell = 2; constexpr static int k_maxNumberOfCharsInTitle = 16; char m_pageTitle[k_maxNumberOfCharsInTitle]; - ListViewCell m_hideColumn; - ListViewCell m_copyColumn; + MenuListCell m_hideColumn; + MenuListCell m_copyColumn; SelectableTableView m_selectableTableView; Function * m_function; }; diff --git a/apps/graph/values/function_parameter_controller.cpp b/apps/graph/values/function_parameter_controller.cpp index 283468939..3bebbea73 100644 --- a/apps/graph/values/function_parameter_controller.cpp +++ b/apps/graph/values/function_parameter_controller.cpp @@ -6,8 +6,8 @@ namespace Graph { FunctionParameterController::FunctionParameterController(Responder * parentResponder) : ViewController(parentResponder), 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_displayDerivativeColumn(SwitchMenuListCell((char*)"Colonne de la fonction derivee")), + m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")), m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin)), m_function(nullptr) diff --git a/apps/graph/values/function_parameter_controller.h b/apps/graph/values/function_parameter_controller.h index eb947c4f3..f97cd6ba5 100644 --- a/apps/graph/values/function_parameter_controller.h +++ b/apps/graph/values/function_parameter_controller.h @@ -25,8 +25,8 @@ private: constexpr static int k_totalNumberOfCell = 2; constexpr static int k_maxNumberOfCharsInTitle = 16; char m_pageTitle[k_maxNumberOfCharsInTitle]; - SwitchListViewCell m_displayDerivativeColumn; - ListViewCell m_copyColumn; + SwitchMenuListCell m_displayDerivativeColumn; + MenuListCell m_copyColumn; SelectableTableView m_selectableTableView; Function * m_function; }; diff --git a/apps/graph/values/values_parameter_controller.cpp b/apps/graph/values/values_parameter_controller.cpp index c4c24812e..156516fa9 100644 --- a/apps/graph/values/values_parameter_controller.cpp +++ b/apps/graph/values/values_parameter_controller.cpp @@ -7,9 +7,9 @@ namespace Graph { ValuesParameterController::ValuesParameterController(Responder * parentResponder, Interval * interval) : ViewController(parentResponder), m_interval(interval), - m_intervalStartCell(TextListViewCell((char*)"X Debut")), - m_intervalEndCell(TextListViewCell((char*)"X Fin")), - m_intervalStepCell(TextListViewCell((char*)"Pas")), + m_intervalStartCell(TextMenuListCell((char*)"X Debut")), + m_intervalEndCell(TextMenuListCell((char*)"X Fin")), + m_intervalStepCell(TextMenuListCell((char*)"Pas")), m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin)) { @@ -37,7 +37,7 @@ int ValuesParameterController::activeCell() { } void ValuesParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) { - TextListViewCell * myCell = (TextListViewCell *) cell; + TextMenuListCell * myCell = (TextMenuListCell *) cell; char buffer[14]; switch (index) { case 0: @@ -97,8 +97,8 @@ void ValuesParameterController::editInterval(bool overwrite, char initialDigit) initialTextContent[0] = initialDigit; initialTextContent[1] = 0; } else { - TextListViewCell * textListViewCell = (TextListViewCell *)reusableCell(activeCell()); - strlcpy(initialTextContent, textListViewCell->textContent(), sizeof(initialTextContent)); + TextMenuListCell * textMenuListCell = (TextMenuListCell *)reusableCell(activeCell()); + strlcpy(initialTextContent, textMenuListCell->textContent(), sizeof(initialTextContent)); } App * myApp = (App *)app(); InputViewController * inputController = myApp->inputViewController(); @@ -106,7 +106,7 @@ void ValuesParameterController::editInterval(bool overwrite, char initialDigit) [](void * context, void * sender){ ValuesParameterController * valuesParameterController = (ValuesParameterController *)context; int activeCell = valuesParameterController->activeCell(); - TextListViewCell * cell = (TextListViewCell *)valuesParameterController->reusableCell(activeCell); + TextMenuListCell * cell = (TextMenuListCell *)valuesParameterController->reusableCell(activeCell); InputViewController * myInputViewController = (InputViewController *)sender; const char * textBody = myInputViewController->textBody(); App * myApp = (App *)valuesParameterController->app(); diff --git a/apps/graph/values/values_parameter_controller.h b/apps/graph/values/values_parameter_controller.h index d205d95ba..2aa5c8f70 100644 --- a/apps/graph/values/values_parameter_controller.h +++ b/apps/graph/values/values_parameter_controller.h @@ -25,9 +25,9 @@ public: private: constexpr static int k_totalNumberOfCell = 3; Interval * m_interval; - TextListViewCell m_intervalStartCell; - TextListViewCell m_intervalEndCell; - TextListViewCell m_intervalStepCell; + TextMenuListCell m_intervalStartCell; + TextMenuListCell m_intervalEndCell; + TextMenuListCell m_intervalStepCell; SelectableTableView m_selectableTableView; }; diff --git a/apps/probability/law/law_controller.cpp b/apps/probability/law/law_controller.cpp index 8d264a8cd..6767e486c 100644 --- a/apps/probability/law/law_controller.cpp +++ b/apps/probability/law/law_controller.cpp @@ -62,7 +62,7 @@ int Probability::LawController::reusableCellCount() { } void Probability::LawController::willDisplayCellForIndex(TableViewCell * cell, int index) { - ListViewCell * myCell = (ListViewCell *)cell; + MenuListCell * myCell = (MenuListCell *)cell; myCell->textView()->setText(m_messages[index]); myCell->textView()->setAlignment(0., 0.5); } diff --git a/apps/probability/law/law_controller.h b/apps/probability/law/law_controller.h index ba9320b50..4ec3eb512 100644 --- a/apps/probability/law/law_controller.h +++ b/apps/probability/law/law_controller.h @@ -24,7 +24,7 @@ private: constexpr static int k_maxNumberOfCells = 10; // !!! CAUTION: The order here is important // The cells should be initialized *before* the listview! - ListViewCell m_cells[k_maxNumberOfCells]; + MenuListCell m_cells[k_maxNumberOfCells]; SelectableTableView m_selectableTableView; const char ** m_messages; }; diff --git a/escher/Makefile b/escher/Makefile index 2d591a14a..dece7b5fe 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -9,8 +9,8 @@ objs += $(addprefix escher/src/,\ image_view.o\ invocation.o\ input_view_controller.o\ - list_view_cell.o\ list_view_data_source.o\ + menu_list_cell.o\ metric.o\ palette.o\ pointer_text_view.o\ @@ -23,7 +23,7 @@ objs += $(addprefix escher/src/,\ solid_color_view.o\ stack_view.o\ stack_view_controller.o\ - switch_list_view_cell.o\ + switch_menu_list_cell.o\ switch_view.o\ tab_view.o\ tab_view_cell.o\ @@ -32,7 +32,7 @@ objs += $(addprefix escher/src/,\ table_view_cell.o\ table_view_data_source.o\ text_field.o\ - text_list_view_cell.o\ + text_menu_list_cell.o\ text_view.o\ tiled_view.o\ view.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index 0de4bb944..d49ce437d 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -24,9 +24,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/escher/include/escher/list_view_cell.h b/escher/include/escher/menu_list_cell.h similarity index 79% rename from escher/include/escher/list_view_cell.h rename to escher/include/escher/menu_list_cell.h index 5fcda321b..e0df272c4 100644 --- a/escher/include/escher/list_view_cell.h +++ b/escher/include/escher/menu_list_cell.h @@ -1,5 +1,5 @@ -#ifndef ESCHER_LIST_VIEW_CELL_H -#define ESCHER_LIST_VIEW_CELL_H +#ifndef ESCHER_MENU_LIST_CELL_H +#define ESCHER_MENU_LIST_CELL_H #include #include @@ -7,9 +7,9 @@ #include #include -class ListViewCell : public TableViewCell { +class MenuListCell : public TableViewCell { public: - ListViewCell(char * label = nullptr); + MenuListCell(char * label = nullptr); PointerTextView * textView(); virtual View * contentView() const; void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/escher/include/escher/switch_list_view_cell.h b/escher/include/escher/switch_list_view_cell.h deleted file mode 100644 index 469aca959..000000000 --- a/escher/include/escher/switch_list_view_cell.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ESCHER_SWITCH_LIST_VIEW_CELL_H -#define ESCHER_SWITCH_LIST_VIEW_CELL_H - -#include -#include - -class SwitchListViewCell : public ListViewCell { -public: - SwitchListViewCell(char * label); - View * contentView() const override; -private: - SwitchView m_contentView; -}; - -#endif diff --git a/escher/include/escher/switch_menu_list_cell.h b/escher/include/escher/switch_menu_list_cell.h new file mode 100644 index 000000000..0db98555d --- /dev/null +++ b/escher/include/escher/switch_menu_list_cell.h @@ -0,0 +1,15 @@ +#ifndef ESCHER_SWITCH_MENU_LIST_CELL_H +#define ESCHER_SWITCH_MENU_LIST_CELL_H + +#include +#include + +class SwitchMenuListCell : public MenuListCell { +public: + SwitchMenuListCell(char * label); + View * contentView() const override; +private: + SwitchView m_contentView; +}; + +#endif diff --git a/escher/include/escher/text_list_view_cell.h b/escher/include/escher/text_menu_list_cell.h similarity index 59% rename from escher/include/escher/text_list_view_cell.h rename to escher/include/escher/text_menu_list_cell.h index 060e78799..68b465b60 100644 --- a/escher/include/escher/text_list_view_cell.h +++ b/escher/include/escher/text_menu_list_cell.h @@ -1,12 +1,12 @@ -#ifndef ESCHER_TEXT_LIST_VIEW_CELL_H -#define ESCHER_TEXT_LIST_VIEW_CELL_H +#ifndef ESCHER_TEXT_MENU_LIST_CELL_H +#define ESCHER_TEXT_MENU_LIST_CELL_H -#include +#include #include -class TextListViewCell : public ListViewCell { +class TextMenuListCell : public MenuListCell { public: - TextListViewCell(char * label); + TextMenuListCell(char * label); void reloadCell() override; View * contentView() const override; void setHighlighted(bool highlight); diff --git a/escher/src/list_view_cell.cpp b/escher/src/menu_list_cell.cpp similarity index 79% rename from escher/src/list_view_cell.cpp rename to escher/src/menu_list_cell.cpp index 372eb1178..e2b9c22ef 100644 --- a/escher/src/list_view_cell.cpp +++ b/escher/src/menu_list_cell.cpp @@ -1,22 +1,22 @@ -#include +#include #include -constexpr KDCoordinate ListViewCell::k_separatorThickness; +constexpr KDCoordinate MenuListCell::k_separatorThickness; -ListViewCell::ListViewCell(char * label) : +MenuListCell::MenuListCell(char * label) : TableViewCell(), m_pointerTextView(PointerTextView(label, 0, 0.5, KDColorBlack, Palette::CellBackgroundColor)) { } -int ListViewCell::numberOfSubviews() const { +int MenuListCell::numberOfSubviews() const { if (contentView() == nullptr) { return 1; } return 2; } -View * ListViewCell::subviewAtIndex(int index) { +View * MenuListCell::subviewAtIndex(int index) { if (index == 0) { return &m_pointerTextView; } @@ -24,7 +24,7 @@ View * ListViewCell::subviewAtIndex(int index) { return contentView(); } -void ListViewCell::layoutSubviews() { +void MenuListCell::layoutSubviews() { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); KDSize labelSize = m_pointerTextView.minimalSizeForOptimalDisplay(); @@ -35,21 +35,21 @@ void ListViewCell::layoutSubviews() { } } -void ListViewCell::reloadCell() { +void MenuListCell::reloadCell() { TableViewCell::reloadCell(); KDColor backgroundColor = isHighlighted()? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor; m_pointerTextView.setBackgroundColor(backgroundColor); } -PointerTextView * ListViewCell::textView() { +PointerTextView * MenuListCell::textView() { return &m_pointerTextView; } -View * ListViewCell::contentView() const { +View * MenuListCell::contentView() const { return nullptr; } -void ListViewCell::drawRect(KDContext * ctx, KDRect rect) const { +void MenuListCell::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); KDColor backgroundColor = isHighlighted() ? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor; diff --git a/escher/src/switch_list_view_cell.cpp b/escher/src/switch_list_view_cell.cpp deleted file mode 100644 index a31bd6b7a..000000000 --- a/escher/src/switch_list_view_cell.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -SwitchListViewCell::SwitchListViewCell(char * label) : - ListViewCell(label), - m_contentView(SwitchView()) -{ -} - -View * SwitchListViewCell::contentView() const { - return (View *)&m_contentView; -} diff --git a/escher/src/switch_menu_list_cell.cpp b/escher/src/switch_menu_list_cell.cpp new file mode 100644 index 000000000..ade6df3bf --- /dev/null +++ b/escher/src/switch_menu_list_cell.cpp @@ -0,0 +1,11 @@ +#include + +SwitchMenuListCell::SwitchMenuListCell(char * label) : + MenuListCell(label), + m_contentView(SwitchView()) +{ +} + +View * SwitchMenuListCell::contentView() const { + return (View *)&m_contentView; +} diff --git a/escher/src/text_list_view_cell.cpp b/escher/src/text_menu_list_cell.cpp similarity index 52% rename from escher/src/text_list_view_cell.cpp rename to escher/src/text_menu_list_cell.cpp index 1f2453040..dd740b7ec 100644 --- a/escher/src/text_list_view_cell.cpp +++ b/escher/src/text_menu_list_cell.cpp @@ -1,31 +1,31 @@ -#include +#include -TextListViewCell::TextListViewCell(char * label) : - ListViewCell(label), +TextMenuListCell::TextMenuListCell(char * label) : + MenuListCell(label), m_contentView(BufferTextView(1.0f, 0.5f)) { } -void TextListViewCell::setText(const char * textBody) { +void TextMenuListCell::setText(const char * textBody) { m_contentView.setText(textBody); } -const char * TextListViewCell::textContent() { +const char * TextMenuListCell::textContent() { return m_contentView.text(); } -View * TextListViewCell::contentView() const { +View * TextMenuListCell::contentView() const { return (View *)&m_contentView; } -void TextListViewCell::reloadCell() { - ListViewCell::reloadCell(); +void TextMenuListCell::reloadCell() { + MenuListCell::reloadCell(); KDColor backgroundColor = isHighlighted()? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor; m_contentView.setBackgroundColor(backgroundColor); } -void TextListViewCell::setHighlighted(bool highlight) { - ListViewCell::setHighlighted(highlight); +void TextMenuListCell::setHighlighted(bool highlight) { + MenuListCell::setHighlighted(highlight); KDColor backgroundColor = highlight? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor; m_contentView.setBackgroundColor(backgroundColor); } \ No newline at end of file