diff --git a/apps/graph/Makefile b/apps/graph/Makefile index be3d1f1a8..46f7f3634 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -24,6 +24,7 @@ app_graph_src = $(addprefix apps/graph/,\ list/text_field_function_title_cell.cpp \ list/type_helper.cpp \ list/type_parameter_controller.cpp \ + values/abscissa_title_cell.cpp \ values/derivative_parameter_controller.cpp \ values/function_parameter_controller.cpp \ values/interval_parameter_selector_controller.cpp \ diff --git a/apps/graph/values/abscissa_title_cell.cpp b/apps/graph/values/abscissa_title_cell.cpp new file mode 100644 index 000000000..7dbd4c54b --- /dev/null +++ b/apps/graph/values/abscissa_title_cell.cpp @@ -0,0 +1,26 @@ +#include "abscissa_title_cell.h" +#include +#include "escher/metric.h" + +namespace Graph { + +void AbscissaTitleCell::setSeparatorLeft(bool separator) { + if (m_separatorLeft != separator) { + m_separatorLeft = separator; + reloadCell(); + } +} + +void AbscissaTitleCell::drawRect(KDContext * ctx, KDRect rect) const { + EvenOddMessageTextCell::drawRect(ctx, rect); + // Draw the separator + KDRect separatorRect(0, 0, Metric::TableSeparatorThickness, bounds().height()); + ctx->fillRect(separatorRect, m_separatorLeft ? Shared::HideableEvenOddEditableTextCell::hideColor() : backgroundColor()); +} + +void AbscissaTitleCell::layoutSubviews() { + KDRect rect = bounds(); + m_messageTextView.setFrame(KDRect(rect.left() + (m_separatorLeft ? Metric::TableSeparatorThickness : 0), rect.top(), rect.width() - (m_separatorLeft ? Metric::TableSeparatorThickness : 0), rect.height())); +} + +} diff --git a/apps/graph/values/abscissa_title_cell.h b/apps/graph/values/abscissa_title_cell.h new file mode 100644 index 000000000..37c5fba1e --- /dev/null +++ b/apps/graph/values/abscissa_title_cell.h @@ -0,0 +1,25 @@ +#ifndef GRAPH_ABSCISSA_TITLE_CELL_H +#define GRAPH_ABSCISSA_TITLE_CELL_H + +#include + +namespace Graph { + +// TODO LEA copied from Shared::StoreTitleCell -> refactor? + +class AbscissaTitleCell : public EvenOddMessageTextCell { +public: + AbscissaTitleCell() : + EvenOddMessageTextCell(), + m_separatorLeft(false) + {} + void setSeparatorLeft(bool separator); + void drawRect(KDContext * ctx, KDRect rect) const override; + void layoutSubviews() override; +private: + bool m_separatorLeft; +}; + +} + +#endif diff --git a/apps/graph/values/values_controller.cpp b/apps/graph/values/values_controller.cpp index 916bd48ca..0ffc94f11 100644 --- a/apps/graph/values/values_controller.cpp +++ b/apps/graph/values/values_controller.cpp @@ -12,6 +12,8 @@ ValuesController::ValuesController(Responder * parentResponder, InputEventHandle Shared::ValuesController(parentResponder, header, interval), m_functionTitleCells{}, m_floatCells{}, + m_abscissaTitleCells{}, + m_abscissaCells{}, m_functionParameterController(this), m_intervalParameterController(this, inputEventHandlerDelegate, m_interval), m_derivativeParameterController(this), @@ -33,10 +35,11 @@ void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, in Shared::ValuesController::willDisplayCellAtLocation(cell, i, j); int typeAtLoc = typeAtLocation(i,j); if (typeAtLoc == k_abscissaTitleCellType) { - EvenOddMessageTextCell * mytitleCell = (EvenOddMessageTextCell *)cell; + AbscissaTitleCell * myTitleCell = (AbscissaTitleCell *)cell; Ion::Storage::Record record = recordAtColumn(i+1); Shared::ExpiringPointer function = functionStore()->modelForRecord(record); - mytitleCell->setMessage(function->parameterMessageName()); + myTitleCell->setMessage(function->parameterMessageName()); + myTitleCell->setSeparatorLeft(i > 0); return; } if (typeAtLoc == k_functionTitleCellType) { diff --git a/apps/graph/values/values_controller.h b/apps/graph/values/values_controller.h index a84f62e3f..2face72e3 100644 --- a/apps/graph/values/values_controller.h +++ b/apps/graph/values/values_controller.h @@ -6,6 +6,7 @@ #include "../../shared/values_controller.h" #include "../../shared/interval_parameter_controller.h" #include "../../shared/store_cell.h" +#include "abscissa_title_cell.h" #include "interval_parameter_selector_controller.h" #include "derivative_parameter_controller.h" #include "function_parameter_controller.h" @@ -45,14 +46,14 @@ private: int abscissaCellsCount() const override { return k_maxNumberOfAbscissaCells; } EvenOddEditableTextCell * abscissaCells(int j) override { assert (j >= 0 && j < k_maxNumberOfAbscissaCells); return &m_abscissaCells[j]; } int abscissaTitleCellsCount() const override { return Shared::CartesianFunction::k_numberOfPlotTypes; } - EvenOddMessageTextCell * abscissaTitleCells(int j) override { assert (j >= 0 && j < abscissaTitleCellsCount()); return &m_abscissaTitleCell[j]; } + EvenOddMessageTextCell * abscissaTitleCells(int j) override { assert (j >= 0 && j < abscissaTitleCellsCount()); return &m_abscissaTitleCells[j]; } ViewController * functionParameterController() override; I18n::Message valuesParameterControllerPageTitle() const override; int m_numberOfColumnsForType[Shared::CartesianFunction::k_numberOfPlotTypes]; Shared::BufferFunctionTitleCell m_functionTitleCells[k_maxNumberOfFunctions]; EvenOddBufferTextCell m_floatCells[k_maxNumberOfCells]; - EvenOddMessageTextCell m_abscissaTitleCell[Shared::CartesianFunction::k_numberOfPlotTypes]; + AbscissaTitleCell m_abscissaTitleCells[Shared::CartesianFunction::k_numberOfPlotTypes]; Shared::StoreCell m_abscissaCells[k_maxNumberOfAbscissaCells]; FunctionParameterController m_functionParameterController; Shared::IntervalParameterController m_intervalParameterController;