From e65b07286d6f0352727b9fe5bc303a336d7ff1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 17 Feb 2017 15:55:31 +0100 Subject: [PATCH] [escher] [apps] Get rid of magic numbers Change-Id: Iad192d24324dda37b3d739830cc8ead7a032e22f --- apps/calculation/scrollable_expression_view.cpp | 4 ++-- apps/graph/graph/curve_parameter_controller.cpp | 4 ++-- .../graph/initialisation_parameter_controller.cpp | 4 ++-- apps/graph/values/abscissa_parameter_controller.cpp | 4 ++-- .../graph/values/derivative_parameter_controller.cpp | 4 ++-- apps/graph/values/function_parameter_controller.cpp | 4 ++-- apps/home/app_cell.cpp | 2 +- apps/home/app_cell.h | 1 + apps/home/controller.cpp | 3 ++- apps/home/controller.h | 3 +++ apps/probability/law_controller.cpp | 4 ++-- apps/probability/parameters_controller.cpp | 6 +++--- apps/regression/calculation_controller.cpp | 4 ++-- apps/regression/calculation_controller.h | 2 +- .../initialisation_parameter_controller.cpp | 4 ++-- apps/regression/prediction_parameter_controller.cpp | 4 ++-- apps/sequence/list/list_controller.cpp | 2 +- apps/sequence/list/list_parameter_controller.cpp | 4 ++-- apps/settings/main_controller.cpp | 4 ++-- apps/settings/sub_controller.cpp | 4 ++-- apps/shared/float_parameter_controller.cpp | 4 ++-- apps/shared/list_parameter_controller.cpp | 4 ++-- apps/shared/store_controller.cpp | 2 +- apps/shared/store_controller.h | 2 +- apps/shared/store_parameter_controller.cpp | 4 ++-- apps/statistics/calculation_controller.cpp | 2 +- apps/statistics/calculation_controller.h | 2 +- escher/Makefile | 1 - escher/include/escher/metric.h | 12 ++++++++---- escher/include/escher/tab_view_controller.h | 1 - escher/src/metric.cpp | 7 ------- escher/src/tab_view_controller.cpp | 7 ++++--- 32 files changed, 60 insertions(+), 59 deletions(-) delete mode 100644 escher/src/metric.cpp diff --git a/apps/calculation/scrollable_expression_view.cpp b/apps/calculation/scrollable_expression_view.cpp index d6725b9e3..c48d0f47a 100644 --- a/apps/calculation/scrollable_expression_view.cpp +++ b/apps/calculation/scrollable_expression_view.cpp @@ -42,14 +42,14 @@ bool ScrollableExpressionView::rightViewIsInvisible() { bool ScrollableExpressionView::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::Right && rightViewIsInvisible()) { KDCoordinate rightSpace = m_expressionView.bounds().width() - m_manualScrolling - bounds().width(); - KDCoordinate scrollAdd = rightSpace > 10 ? 10 : rightSpace; + KDCoordinate scrollAdd = rightSpace > Metric::ScrollStep ? Metric::ScrollStep : rightSpace; m_manualScrolling += scrollAdd; setContentOffset(KDPoint(m_manualScrolling, 0)); return true; } if (event == Ion::Events::Left && m_manualScrolling > 0) { KDCoordinate leftSpace = m_manualScrolling; - KDCoordinate scrollSubstract = leftSpace > 10 ? 10 : leftSpace; + KDCoordinate scrollSubstract = leftSpace > Metric::ScrollStep ? Metric::ScrollStep : leftSpace; m_manualScrolling -= scrollSubstract; setContentOffset(KDPoint(m_manualScrolling, 0)); return true; diff --git a/apps/graph/graph/curve_parameter_controller.cpp b/apps/graph/graph/curve_parameter_controller.cpp index 36c620bd3..2abdf672e 100644 --- a/apps/graph/graph/curve_parameter_controller.cpp +++ b/apps/graph/graph/curve_parameter_controller.cpp @@ -12,8 +12,8 @@ CurveParameterController::CurveParameterController(InteractiveCurveViewRange * g m_calculationCell(PointerTableCellWithChevron((char*)"Calculer")), m_goToCell(PointerTableCellWithChevron((char*)"Aller a")), m_derivativeCell(PointerTableCellWithSwitch((char*)"Nombre derivee")), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_goToParameterController(GoToParameterController(this, graphRange, cursor)) { } diff --git a/apps/graph/graph/initialisation_parameter_controller.cpp b/apps/graph/graph/initialisation_parameter_controller.cpp index 4aa4a9f50..ca681e2f0 100644 --- a/apps/graph/graph/initialisation_parameter_controller.cpp +++ b/apps/graph/graph/initialisation_parameter_controller.cpp @@ -9,8 +9,8 @@ namespace Graph { InitialisationParameterController::InitialisationParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_graphRange(graphRange) { } diff --git a/apps/graph/values/abscissa_parameter_controller.cpp b/apps/graph/values/abscissa_parameter_controller.cpp index 608e3ccf5..99b73e35f 100644 --- a/apps/graph/values/abscissa_parameter_controller.cpp +++ b/apps/graph/values/abscissa_parameter_controller.cpp @@ -8,8 +8,8 @@ AbscissaParameterController::AbscissaParameterController(Responder * parentRespo m_deleteColumn(PointerTableCell((char*)"Effacer la colonne")), m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")), m_setInterval(PointerTableCellWithChevron((char*)"Regler l'intervalle")), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_intervalParameterController(intervalParameterController) { } diff --git a/apps/graph/values/derivative_parameter_controller.cpp b/apps/graph/values/derivative_parameter_controller.cpp index 4d5fa68c7..9bfd630e1 100644 --- a/apps/graph/values/derivative_parameter_controller.cpp +++ b/apps/graph/values/derivative_parameter_controller.cpp @@ -9,8 +9,8 @@ DerivativeParameterController::DerivativeParameterController(ValuesController * m_pageTitle{"Colonne f'(x)"}, m_hideColumn(PointerTableCell((char*)"Masquer la colonne de la derivee")), m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_function(nullptr), m_valuesController(valuesController) { diff --git a/apps/graph/values/function_parameter_controller.cpp b/apps/graph/values/function_parameter_controller.cpp index 84cd07132..368d7e101 100644 --- a/apps/graph/values/function_parameter_controller.cpp +++ b/apps/graph/values/function_parameter_controller.cpp @@ -9,8 +9,8 @@ FunctionParameterController::FunctionParameterController(ValuesController * valu m_pageTitle{"Colonne f(x)"}, m_displayDerivativeColumn(PointerTableCellWithSwitch((char*)"Colonne de la fonction derivee")), m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_function(nullptr), m_valuesController(valuesController) { diff --git a/apps/home/app_cell.cpp b/apps/home/app_cell.cpp index cff8f2207..56dabde27 100644 --- a/apps/home/app_cell.cpp +++ b/apps/home/app_cell.cpp @@ -20,7 +20,7 @@ View * AppCell::subviewAtIndex(int index) { } void AppCell::layoutSubviews() { - m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, 18, k_iconWidth,k_iconHeight)); + m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, k_iconMargin, k_iconWidth,k_iconHeight)); KDSize nameSize = m_nameView.minimalSizeForOptimalDisplay(); m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin)); } diff --git a/apps/home/app_cell.h b/apps/home/app_cell.h index 1dfd65d2a..60322b6ba 100644 --- a/apps/home/app_cell.h +++ b/apps/home/app_cell.h @@ -17,6 +17,7 @@ public: void reloadCell() override; void setApp(::App * app); private: + static constexpr KDCoordinate k_iconMargin = 18; static constexpr KDCoordinate k_iconWidth = 55; static constexpr KDCoordinate k_iconHeight = 56; static constexpr KDCoordinate k_nameWidthMargin = 4; diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index 326d909ab..30ac9caaf 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -9,7 +9,8 @@ namespace Home { Controller::Controller(Responder * parentResponder, ::AppsContainer * container) : ViewController(parentResponder), m_container(container), - m_selectableTableView(SelectableTableView(this, this, 0, 4, 0, 4, this, true, true, KDColorWhite, 28, Palette::YellowDark, Palette::GreyMiddle, 116)) + m_selectableTableView(SelectableTableView(this, this, 0, k_sideMargin, 0, k_sideMargin, this, true, true, + KDColorWhite, k_indicatorThickness, Palette::YellowDark, Palette::GreyMiddle, k_indicatorMargin)) { } diff --git a/apps/home/controller.h b/apps/home/controller.h index cef9e77cb..5a379bfe6 100644 --- a/apps/home/controller.h +++ b/apps/home/controller.h @@ -29,6 +29,9 @@ private: int numberOfIcons(); AppsContainer * m_container; SelectableTableView m_selectableTableView; + static constexpr KDCoordinate k_sideMargin = 4; + static constexpr KDCoordinate k_indicatorThickness = 28; + static constexpr KDCoordinate k_indicatorMargin = 116; static constexpr int k_numberOfColumns = 4; static constexpr int k_numberOfApps = 10; static constexpr int k_maxNumberOfCells = 16; diff --git a/apps/probability/law_controller.cpp b/apps/probability/law_controller.cpp index f159a3be7..7f116d16d 100644 --- a/apps/probability/law_controller.cpp +++ b/apps/probability/law_controller.cpp @@ -53,8 +53,8 @@ static const char * sMessages[] = { LawController::LawController(Responder * parentResponder) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin-ContentView::k_titleMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin-ContentView::k_titleMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_contentView(&m_selectableTableView), m_law(nullptr), m_parametersController(ParametersController(nullptr)) diff --git a/apps/probability/parameters_controller.cpp b/apps/probability/parameters_controller.cpp index d15cdf745..ce5a48691 100644 --- a/apps/probability/parameters_controller.cpp +++ b/apps/probability/parameters_controller.cpp @@ -37,7 +37,7 @@ PointerTextView * ParametersController::ContentView::parameterDefinitionAtIndex( } void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { - int tableHeight = m_selectableTableView->size().height()+ Metric::TopMargin + Metric::BottomMargin; + int tableHeight = m_selectableTableView->size().height()+ Metric::CommonTopMargin + Metric::CommonBottomMargin; ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), Palette::WallScreen); } @@ -69,9 +69,9 @@ View * ParametersController::ContentView::subviewAtIndex(int index) { void ParametersController::ContentView::layoutSubviews() { KDCoordinate titleHeight = KDText::stringSize("", KDText::FontSize::Small).height()+k_titleMargin; m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight)); - KDCoordinate tableHeight = m_selectableTableView->size().height() + Metric::TopMargin + Metric::BottomMargin; + KDCoordinate tableHeight = m_selectableTableView->size().height() + Metric::CommonTopMargin + Metric::CommonBottomMargin; m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), tableHeight)); - m_nextButton.setFrame(KDRect(Metric::LeftMargin, titleHeight+tableHeight, bounds().width() - Metric::RightMargin - Metric::LeftMargin, k_buttonHeight)); + m_nextButton.setFrame(KDRect(Metric::CommonLeftMargin, titleHeight+tableHeight, bounds().width() - Metric::CommonRightMargin - Metric::CommonLeftMargin, k_buttonHeight)); KDCoordinate textHeight = KDText::stringSize("", KDText::FontSize::Small).height(); KDCoordinate defOrigin = (titleHeight+tableHeight+k_buttonHeight)/2+(bounds().height()-textHeight)/2; m_secondParameterDefinition.setFrame(KDRectZero); diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index 654fc6d66..8789eb043 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -15,8 +15,8 @@ CalculationController::CalculationController(Responder * parentResponder, Header EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small)}, m_columnTitleCell(EvenOddDoubleBufferTextCell(&m_selectableTableView)), m_calculationCells{EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small)}, - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin, this, true, true, Palette::WallScreenDark)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin, this, true, true, Palette::WallScreenDark)), m_store(store) { for (int k = 0; k < k_maxNumberOfDisplayableRows/2; k++) { diff --git a/apps/regression/calculation_controller.h b/apps/regression/calculation_controller.h index 39410402a..66840c37d 100644 --- a/apps/regression/calculation_controller.h +++ b/apps/regression/calculation_controller.h @@ -40,7 +40,7 @@ private: constexpr static int k_totalNumberOfColumns = 2; constexpr static int k_maxNumberOfDisplayableRows = 10; static constexpr KDCoordinate k_cellHeight = 25; - static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2; + static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; EvenOddPointerTextCell m_titleCells[k_maxNumberOfDisplayableRows]; EvenOddDoubleBufferTextCell m_columnTitleCell; EvenOddDoubleBufferTextCell m_doubleCalculationCells[k_maxNumberOfDisplayableRows/2]; diff --git a/apps/regression/initialisation_parameter_controller.cpp b/apps/regression/initialisation_parameter_controller.cpp index 6e7499bfa..bd10c7bd9 100644 --- a/apps/regression/initialisation_parameter_controller.cpp +++ b/apps/regression/initialisation_parameter_controller.cpp @@ -8,8 +8,8 @@ namespace Regression { InitialisationParameterController::InitialisationParameterController(Responder * parentResponder, Store * store) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_store(store) { } diff --git a/apps/regression/prediction_parameter_controller.cpp b/apps/regression/prediction_parameter_controller.cpp index 9c5623eb4..4117da1ec 100644 --- a/apps/regression/prediction_parameter_controller.cpp +++ b/apps/regression/prediction_parameter_controller.cpp @@ -7,8 +7,8 @@ namespace Regression { PredictionParameterController::PredictionParameterController(Responder * parentResponder, Store * store, CurveViewCursor * cursor) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_goToParameterController(GoToParameterController(this, store, cursor)) { } diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index 00c48ebda..ec431efed 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -223,7 +223,7 @@ int ListController::sequenceDefinitionForRow(int j) { } void ListController::addEmptyFunction() { - app()->displayModalViewController(&m_typeStackController, 0.f, 0.f, 32, 20, 20, 20); + app()->displayModalViewController(&m_typeStackController, 0.f, 0.f, Metric::TabHeight+Metric::ModalTopMargin, Metric::CommonRightMargin, Metric::ModalBottomMargin, Metric::CommonLeftMargin); } void ListController::editExpression(Shared::Function * function, Ion::Events::Event event) { diff --git a/apps/sequence/list/list_parameter_controller.cpp b/apps/sequence/list/list_parameter_controller.cpp index 3682bca30..1dd6a1b33 100644 --- a/apps/sequence/list/list_parameter_controller.cpp +++ b/apps/sequence/list/list_parameter_controller.cpp @@ -8,8 +8,8 @@ namespace Sequence { ListParameterController::ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore) : Shared::ListParameterController(parentResponder, sequenceStore), m_typeCell(PointerTableCellWithChevronAndExpression((char *)"Type de suite")), - m_typeParameterController(TypeParameterController(this, sequenceStore, TableCell::Layout::Horizontal, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)) + m_typeParameterController(TypeParameterController(this, sequenceStore, TableCell::Layout::Horizontal, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)) { } diff --git a/apps/settings/main_controller.cpp b/apps/settings/main_controller.cpp index 3e16b1771..9be1e6dba 100644 --- a/apps/settings/main_controller.cpp +++ b/apps/settings/main_controller.cpp @@ -22,8 +22,8 @@ MainController::MainController(Responder * parentResponder) : ViewController(parentResponder), m_cells{PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large)}, - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_nodeModel((Node *)&model), m_subController(this) { diff --git a/apps/settings/sub_controller.cpp b/apps/settings/sub_controller.cpp index 6f7926831..46ef4352c 100644 --- a/apps/settings/sub_controller.cpp +++ b/apps/settings/sub_controller.cpp @@ -11,8 +11,8 @@ SubController::SubController(Responder * parentResponder) : ViewController(parentResponder), m_cells{PointerTableCell(nullptr, KDText::FontSize::Large), PointerTableCell(nullptr, KDText::FontSize::Large), PointerTableCell(nullptr, KDText::FontSize::Large)}, - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_nodeModel(nullptr), m_preferenceIndex(0) { diff --git a/apps/shared/float_parameter_controller.cpp b/apps/shared/float_parameter_controller.cpp index 6fe5a066f..b26bc505c 100644 --- a/apps/shared/float_parameter_controller.cpp +++ b/apps/shared/float_parameter_controller.cpp @@ -10,8 +10,8 @@ namespace Shared { FloatParameterController::FloatParameterController(Responder * parentResponder) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin, this)) + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin, this)) { } diff --git a/apps/shared/list_parameter_controller.cpp b/apps/shared/list_parameter_controller.cpp index 44f8cca64..3a2aeb4b5 100644 --- a/apps/shared/list_parameter_controller.cpp +++ b/apps/shared/list_parameter_controller.cpp @@ -5,8 +5,8 @@ namespace Shared { ListParameterController::ListParameterController(Responder * parentResponder, FunctionStore * functionStore) : ViewController(parentResponder), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_functionStore(functionStore), m_colorCell(PointerTableCellWithChevron((char*)"Couleur de la fonction")), m_enableCell(PointerTableCellWithSwitch((char*)"Activer/Desactiver")), diff --git a/apps/shared/store_controller.cpp b/apps/shared/store_controller.cpp index 50620751e..174cad7e3 100644 --- a/apps/shared/store_controller.cpp +++ b/apps/shared/store_controller.cpp @@ -8,7 +8,7 @@ using namespace Poincare; namespace Shared { StoreController::StoreController(Responder * parentResponder, FloatPairStore * store, HeaderViewController * header) : - EditableCellTableViewController(parentResponder, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin), + EditableCellTableViewController(parentResponder, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin), HeaderViewDelegate(header), m_editableCells{EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), diff --git a/apps/shared/store_controller.h b/apps/shared/store_controller.h index 37b703f0e..0de65b91b 100644 --- a/apps/shared/store_controller.h +++ b/apps/shared/store_controller.h @@ -22,7 +22,7 @@ public: void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override; bool handleEvent(Ion::Events::Event event) override; protected: - static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2; + static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; constexpr static int k_maxNumberOfEditableCells = 22; constexpr static int k_numberOfTitleCells = 2; Responder * tabController() const; diff --git a/apps/shared/store_parameter_controller.cpp b/apps/shared/store_parameter_controller.cpp index a6e78594a..522d8a27a 100644 --- a/apps/shared/store_parameter_controller.cpp +++ b/apps/shared/store_parameter_controller.cpp @@ -8,8 +8,8 @@ StoreParameterController::StoreParameterController(Responder * parentResponder, m_deleteColumn(PointerTableCell((char*)"Effacer la colonne")), m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")), m_importList(PointerTableCellWithChevron((char*)"Importer une liste")), - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, - Metric::BottomMargin, Metric::LeftMargin)), + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, + Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_store(store), m_xColumnSelected(true) { diff --git a/apps/statistics/calculation_controller.cpp b/apps/statistics/calculation_controller.cpp index d55d81099..5d8f2d989 100644 --- a/apps/statistics/calculation_controller.cpp +++ b/apps/statistics/calculation_controller.cpp @@ -16,7 +16,7 @@ CalculationController::CalculationController(Responder * parentResponder, Header EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small)}, m_calculationCells{EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small)}, - m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin, + m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin, nullptr, true, true, Palette::WallScreenDark)), m_store(store) { diff --git a/apps/statistics/calculation_controller.h b/apps/statistics/calculation_controller.h index 80f879dd1..7004fc556 100644 --- a/apps/statistics/calculation_controller.h +++ b/apps/statistics/calculation_controller.h @@ -37,7 +37,7 @@ private: constexpr static int k_totalNumberOfRows = 13; constexpr static int k_maxNumberOfDisplayableRows = 11; static constexpr KDCoordinate k_cellHeight = 20; - static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2; + static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; EvenOddPointerTextCell m_titleCells[k_maxNumberOfDisplayableRows]; EvenOddBufferTextCell m_calculationCells[k_maxNumberOfDisplayableRows]; SelectableTableView m_selectableTableView; diff --git a/escher/Makefile b/escher/Makefile index 8348b3b16..b5eeffade 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -23,7 +23,6 @@ objs += $(addprefix escher/src/,\ invocation.o\ input_view_controller.o\ list_view_data_source.o\ - metric.o\ modal_view_controller.o\ palette.o\ pointer_table_cell.o\ diff --git a/escher/include/escher/metric.h b/escher/include/escher/metric.h index aed0c6d19..50d6e4836 100644 --- a/escher/include/escher/metric.h +++ b/escher/include/escher/metric.h @@ -5,11 +5,15 @@ class Metric { public: - constexpr static KDCoordinate LeftMargin = 20; - constexpr static KDCoordinate RightMargin = 20; - constexpr static KDCoordinate TopMargin = 15; - constexpr static KDCoordinate BottomMargin = 15; + constexpr static KDCoordinate CommonLeftMargin = 20; + constexpr static KDCoordinate CommonRightMargin = 20; + constexpr static KDCoordinate CommonTopMargin = 15; + constexpr static KDCoordinate CommonBottomMargin = 15; constexpr static KDCoordinate ParameterCellHeight = 35; + constexpr static KDCoordinate ModalTopMargin = 5; + constexpr static KDCoordinate ModalBottomMargin = 20; + constexpr static KDCoordinate TabHeight = 27; + constexpr static KDCoordinate ScrollStep = 10; }; #endif \ No newline at end of file diff --git a/escher/include/escher/tab_view_controller.h b/escher/include/escher/tab_view_controller.h index c8b917744..9a6022dcc 100644 --- a/escher/include/escher/tab_view_controller.h +++ b/escher/include/escher/tab_view_controller.h @@ -31,7 +31,6 @@ private: const char * className() const override; #endif private: - static constexpr KDCoordinate k_tabHeight = 27; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; void layoutSubviews() override; diff --git a/escher/src/metric.cpp b/escher/src/metric.cpp deleted file mode 100644 index 732b30746..000000000 --- a/escher/src/metric.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -constexpr KDCoordinate Metric::LeftMargin; -constexpr KDCoordinate Metric::RightMargin; -constexpr KDCoordinate Metric::TopMargin; -constexpr KDCoordinate Metric::BottomMargin; -constexpr KDCoordinate Metric::ParameterCellHeight; diff --git a/escher/src/tab_view_controller.cpp b/escher/src/tab_view_controller.cpp index 29098b39f..f90e5f2c1 100644 --- a/escher/src/tab_view_controller.cpp +++ b/escher/src/tab_view_controller.cpp @@ -2,6 +2,7 @@ extern "C" { #include } #include +#include #include TabViewController::ContentView::ContentView() : @@ -19,14 +20,14 @@ void TabViewController::ContentView::setActiveView(View * view) { void TabViewController::ContentView::layoutSubviews() { KDRect tabViewFrame = KDRect( 0, 0, - m_frame.width(), k_tabHeight + m_frame.width(), Metric::TabHeight ); m_tabView.setFrame(tabViewFrame); if (m_activeView) { KDRect activeViewFrame = KDRect( - 0, k_tabHeight, + 0, Metric::TabHeight, m_frame.width(), - m_frame.height() - k_tabHeight + m_frame.height() - Metric::TabHeight ); m_activeView->setFrame(activeViewFrame); }