[apps/reg] Fix Stats column widths to fit the quartic regression formula

This commit is contained in:
Léa Saviot
2018-06-13 15:19:56 +02:00
committed by Émilie Feral
parent aed2632c9f
commit 42982cb078
2 changed files with 22 additions and 4 deletions

View File

@@ -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);

View File

@@ -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;