diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index a40bb849a..752d4a9ea 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -230,13 +230,21 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int } KDCoordinate CalculationController::columnWidth(int i) { - return k_cellWidth; + return i == 0 ? k_calculationTitleCellWidth : k_calculationCellWidth; } KDCoordinate CalculationController::rowHeight(int j) { return k_cellHeight; } +KDCoordinate CalculationController::cumulatedHeightFromIndex(int j) { + return j*rowHeight(0); +} + +int CalculationController::indexFromCumulatedHeight(KDCoordinate offsetY) { + return (offsetY-1) / rowHeight(0); +} + HighlightCell * CalculationController::reusableCell(int index, int type) { if (type == k_standardCalculationTitleCellType) { assert(index >= 0 && index < k_maxNumberOfDisplayableRows); diff --git a/apps/regression/calculation_controller.h b/apps/regression/calculation_controller.h index 812be6c47..6c9b3a45c 100644 --- a/apps/regression/calculation_controller.h +++ b/apps/regression/calculation_controller.h @@ -8,13 +8,12 @@ #include "../shared/hideable_even_odd_cell.h" #include "../shared/margin_even_odd_message_text_cell.h" #include "../shared/tab_table_controller.h" -#include "../shared/regular_table_view_data_source.h" #include "../shared/separator_even_odd_buffer_text_cell.h" #include "../shared/store_cell.h" namespace Regression { -class CalculationController : public Shared::TabTableController, public Shared::RegularTableViewDataSource, public SelectableTableViewDelegate, public ButtonRowDelegate, public AlternateEmptyViewDelegate { +class CalculationController : public Shared::TabTableController, public TableViewDataSource, public SelectableTableViewDelegate, public ButtonRowDelegate, public AlternateEmptyViewDelegate { public: CalculationController(Responder * parentResponder, ButtonRowController * header, Store * store); @@ -23,20 +22,30 @@ public: CalculationController(CalculationController&& other) = delete; CalculationController& operator=(const CalculationController& other) = delete; CalculationController& operator=(CalculationController&& other) = delete; + + // View Controller const char * title() override; + + // Responder bool handleEvent(Ion::Events::Event event) override; void didBecomeFirstResponder() override; + + // SelectableTableViewDelegate void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) override; + // AlternateEmptyViewDelegate bool isEmpty() const override; I18n::Message emptyMessage() override; Responder * defaultController() override; + // TableViewDataSource int numberOfRows() override; int numberOfColumns() override; void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override; KDCoordinate columnWidth(int i) override; KDCoordinate rowHeight(int j) override; + KDCoordinate cumulatedHeightFromIndex(int j) override; + int indexFromCumulatedHeight(KDCoordinate offsetY) override; HighlightCell * reusableCell(int index, int type) override; int reusableCellCount(int type) override; int typeAtLocation(int i, int j) override; @@ -55,7 +64,8 @@ private: static constexpr int k_regressionCellIndex = 9; static constexpr KDCoordinate k_cellHeight = 25; - static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; + static constexpr KDCoordinate k_calculationTitleCellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; + static constexpr KDCoordinate k_calculationCellWidth = 195; static constexpr KDCoordinate k_margin = 8; static constexpr KDCoordinate k_r2CellMargin = 2; static constexpr KDCoordinate k_scrollBarMargin = Metric::CommonRightMargin;