diff --git a/apps/graph/list/function_expression_view.cpp b/apps/graph/list/function_expression_view.cpp index c6e8cb12a..b6f1cf707 100644 --- a/apps/graph/list/function_expression_view.cpp +++ b/apps/graph/list/function_expression_view.cpp @@ -12,5 +12,8 @@ void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const { // Select text color according to the state of the function bool active = m_function->isActive(); KDColor text = active ? KDColorBlack : FunctionCell::k_desactiveTextColor; - m_function->layout()->draw(ctx, KDPointZero, text, background); + //Position the origin of expression + KDSize expressionSize = m_function->layout()->size(); + KDPoint origin(0, 0.5f*(m_frame.height() - expressionSize.height())); + m_function->layout()->draw(ctx, origin, text, background); } diff --git a/apps/graph/list/function_name_view.cpp b/apps/graph/list/function_name_view.cpp index d207327da..73d89073b 100644 --- a/apps/graph/list/function_name_view.cpp +++ b/apps/graph/list/function_name_view.cpp @@ -1,4 +1,5 @@ #include "function_name_view.h" +#include "../function_store.h" FunctionNameView::FunctionNameView() : FunctionCell() @@ -20,7 +21,10 @@ void FunctionNameView::drawRect(KDContext * ctx, KDRect rect) const { // Position the name of the function const char * functionName = m_function->name(); KDCoordinate baseline = m_function->layout()->baseline(); - KDSize nameSize = KDText::stringSize(functionName); - ctx->drawString(functionName, KDPoint(k_colorIndicatorThickness, baseline-nameSize.height()), functionNameColor, background); - ctx->drawString("(x)", KDPoint(k_colorIndicatorThickness+nameSize.width(), baseline-nameSize.height()), textColor, background); + KDSize textSize = KDText::stringSize(functionName); + KDSize expressionSize = m_function->layout()->size(); + KDPoint origin(0.5f*(k_colorIndicatorThickness + m_frame.width() - 4*textSize.width()), + baseline-textSize.height()+0.5f*(m_frame.height() - expressionSize.height())); + ctx->drawString(functionName, origin, functionNameColor, background); + ctx->drawString(Graph::Function::Parameter, origin.translatedBy(KDPoint(textSize.width(), 0)), textColor, background); } diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index afb3a1de7..c9ef06375 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -36,7 +36,7 @@ int ListController::numberOfColumns() { KDCoordinate ListController::rowHeight(int j) { Graph::Function * function = m_functionStore->functionAtIndex(j); KDCoordinate functionSize = function->layout()->size().height(); - return functionSize > k_minimalfunctionHeight ? functionSize : k_minimalfunctionHeight; + return functionSize + k_verticalFunctionMargin; } KDCoordinate ListController::columnWidth(int i) { diff --git a/apps/graph/list/list_controller.h b/apps/graph/list/list_controller.h index c4aa56458..4da89bc9f 100644 --- a/apps/graph/list/list_controller.h +++ b/apps/graph/list/list_controller.h @@ -35,7 +35,7 @@ public: void editExpression(FunctionExpressionView * functionCell); private: - static constexpr KDCoordinate k_minimalfunctionHeight = 40; + static constexpr KDCoordinate k_verticalFunctionMargin = 20; static constexpr KDCoordinate k_functionNameWidth = 40; Responder * tabController() const; constexpr static int k_maxNumberOfRows = 6;