mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 14:20:39 +01:00
[apps/graph] ValuesController: column width are different for parametric
functions
This commit is contained in:
committed by
LeaNumworks
parent
bf23e0f8da
commit
00bb1b7ac1
@@ -42,6 +42,22 @@ ValuesController::ValuesController(Responder * parentResponder, InputEventHandle
|
||||
m_selectableTableView.setDelegate(this);
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::columnWidth(int i) {
|
||||
ContinuousFunction::PlotType plotType = plotTypeAtColumn(&i);
|
||||
if (i > 0 && plotType == ContinuousFunction::PlotType::Parametric) {
|
||||
return 2*k_cellWidth;
|
||||
}
|
||||
return k_cellWidth;
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::cumulatedWidthFromIndex(int i) {
|
||||
return TableViewDataSource::cumulatedWidthFromIndex(i);
|
||||
}
|
||||
|
||||
int ValuesController::indexFromCumulatedWidth(KDCoordinate offsetX) {
|
||||
return TableViewDataSource::indexFromCumulatedWidth(offsetX);
|
||||
}
|
||||
|
||||
Shared::Hideable * ValuesController::hideableCellFromType(HighlightCell * cell, int type) {
|
||||
if (type == k_notEditableValueCellType) {
|
||||
Shared::HideableEvenOddBufferTextCell * myCell = static_cast<Shared::HideableEvenOddBufferTextCell *>(cell);
|
||||
|
||||
@@ -20,6 +20,9 @@ public:
|
||||
Button * buttonAtIndex(int index, ButtonRowController::Position position) const override {
|
||||
return const_cast<Button *>(&m_setIntervalButton);
|
||||
}
|
||||
KDCoordinate columnWidth(int i) override;
|
||||
KDCoordinate cumulatedWidthFromIndex(int i) override;
|
||||
int indexFromCumulatedWidth(KDCoordinate offsetX) override;
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
int typeAtLocation(int i, int j) override;
|
||||
I18n::Message emptyMessage() override;
|
||||
@@ -31,6 +34,7 @@ public:
|
||||
}
|
||||
void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY, bool withinTemporarySelection = false) override;
|
||||
private:
|
||||
static constexpr KDCoordinate k_cellWidth = 100;
|
||||
constexpr static int k_maxNumberOfFunctions = 5;
|
||||
constexpr static int k_maxNumberOfAbscissaCells = Shared::ContinuousFunction::k_numberOfPlotTypes * k_maxNumberOfRows;
|
||||
constexpr static int k_maxNumberOfCells = k_maxNumberOfFunctions * k_maxNumberOfRows;
|
||||
|
||||
@@ -31,6 +31,30 @@ ValuesController::ValuesController(Responder * parentResponder, InputEventHandle
|
||||
setupAbscissaCellsAndTitleCells(inputEventHandlerDelegate);
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::columnWidth(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return k_abscissaCellWidth;
|
||||
default:
|
||||
return k_ordinateCellWidth;
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::cumulatedWidthFromIndex(int i) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return k_abscissaCellWidth + (i-1)*k_ordinateCellWidth;
|
||||
}
|
||||
}
|
||||
|
||||
int ValuesController::indexFromCumulatedWidth(KDCoordinate offsetX) {
|
||||
if (offsetX <= k_abscissaCellWidth) {
|
||||
return 0;
|
||||
}
|
||||
return (offsetX - k_abscissaCellWidth)/k_ordinateCellWidth+1;
|
||||
}
|
||||
|
||||
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
Shared::ValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
if (typeAtLocation(i,j) == k_abscissaTitleCellType) {
|
||||
|
||||
@@ -14,12 +14,17 @@ public:
|
||||
Button * buttonAtIndex(int index, ButtonRowController::Position position) const override {
|
||||
return const_cast<Button *>(&m_setIntervalButton);
|
||||
}
|
||||
KDCoordinate columnWidth(int i) override;
|
||||
KDCoordinate cumulatedWidthFromIndex(int i) override;
|
||||
int indexFromCumulatedWidth(KDCoordinate offsetX) override;
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
I18n::Message emptyMessage() override;
|
||||
IntervalParameterController * intervalParameterController() override {
|
||||
return &m_intervalParameterController;
|
||||
}
|
||||
private:
|
||||
static constexpr KDCoordinate k_abscissaCellWidth = 100;
|
||||
static constexpr KDCoordinate k_ordinateCellWidth = 100;
|
||||
void setStartEndMessages(Shared::IntervalParameterController * controller, int column) override;
|
||||
bool setDataAtLocation(double floatBody, int columnIndex, int rowIndex) override;
|
||||
void printEvaluationOfAbscissaAtColumn(double abscissa, int columnIndex, char * buffer, const int bufferSize) override;
|
||||
|
||||
@@ -136,30 +136,6 @@ void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, in
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::columnWidth(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return k_abscissaCellWidth;
|
||||
default:
|
||||
return k_ordinateCellWidth;
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate ValuesController::cumulatedWidthFromIndex(int i) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return k_abscissaCellWidth + (i-1)*k_ordinateCellWidth;
|
||||
}
|
||||
}
|
||||
|
||||
int ValuesController::indexFromCumulatedWidth(KDCoordinate offsetX) {
|
||||
if (offsetX <= k_abscissaCellWidth) {
|
||||
return 0;
|
||||
}
|
||||
return (offsetX - k_abscissaCellWidth)/k_ordinateCellWidth+1;
|
||||
}
|
||||
|
||||
HighlightCell * ValuesController::reusableCell(int index, int type) {
|
||||
assert(0 <= index && index < reusableCellCount(type));
|
||||
switch (type) {
|
||||
|
||||
@@ -24,9 +24,6 @@ public:
|
||||
virtual IntervalParameterController * intervalParameterController() = 0;
|
||||
int numberOfButtons(ButtonRowController::Position) const override;
|
||||
virtual void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
KDCoordinate columnWidth(int i) override;
|
||||
KDCoordinate cumulatedWidthFromIndex(int i) override;
|
||||
int indexFromCumulatedWidth(KDCoordinate offsetX) override;
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
int reusableCellCount(int type) override;
|
||||
int typeAtLocation(int i, int j) override;
|
||||
@@ -34,8 +31,6 @@ public:
|
||||
Responder * defaultController() override;
|
||||
void viewWillAppear() override;
|
||||
void viewDidDisappear() override;
|
||||
static constexpr KDCoordinate k_abscissaCellWidth = 108;
|
||||
static constexpr KDCoordinate k_ordinateCellWidth = 108;
|
||||
|
||||
protected:
|
||||
static constexpr int k_abscissaTitleCellType = 0;
|
||||
|
||||
Reference in New Issue
Block a user