mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[shared] Clean class names containing storage
This commit is contained in:
77
apps/graph/values/function_parameter_controller.cpp
Normal file
77
apps/graph/values/function_parameter_controller.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "function_parameter_controller.h"
|
||||
#include "values_controller.h"
|
||||
#include "../app.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
FunctionParameterController::FunctionParameterController(ValuesController * valuesController) :
|
||||
ValuesFunctionParameterController(CartesianFunction::Symbol()),
|
||||
m_displayDerivativeColumn(I18n::Message::DerivativeFunctionColumn),
|
||||
m_valuesController(valuesController)
|
||||
{
|
||||
}
|
||||
|
||||
bool FunctionParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
switch (selectedRow()) {
|
||||
case 0:
|
||||
{
|
||||
bool isDisplayingDerivative = function()->displayDerivative();
|
||||
function()->setDisplayDerivative(!isDisplayingDerivative);
|
||||
m_valuesController->selectCellAtLocation(isDisplayingDerivative ? m_selectedFunctionColumn : m_selectedFunctionColumn + 1, m_valuesController->selectedRow());
|
||||
m_selectableTableView.reloadData();
|
||||
return true;
|
||||
}
|
||||
#if COPY_COLUMN
|
||||
case 1:
|
||||
/* TODO: implement function copy column */
|
||||
return true;
|
||||
#endif
|
||||
default:
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int FunctionParameterController::numberOfRows() {
|
||||
return k_totalNumberOfCell;
|
||||
};
|
||||
|
||||
HighlightCell * FunctionParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_totalNumberOfCell);
|
||||
#if COPY_COLUMN
|
||||
HighlightCell * cells[] = {&m_displayDerivativeColumn, &m_copyColumn};
|
||||
#else
|
||||
HighlightCell * cells[] = {&m_displayDerivativeColumn};
|
||||
#endif
|
||||
return cells[index];
|
||||
}
|
||||
|
||||
int FunctionParameterController::reusableCellCount() {
|
||||
return k_totalNumberOfCell;
|
||||
}
|
||||
|
||||
void FunctionParameterController::viewWillAppear() {
|
||||
ValuesFunctionParameterController::viewWillAppear();
|
||||
m_selectedFunctionColumn = m_valuesController->selectedColumn();
|
||||
}
|
||||
|
||||
void FunctionParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
if (cell == &m_displayDerivativeColumn) {
|
||||
SwitchView * switchView = (SwitchView *)m_displayDerivativeColumn.accessoryView();
|
||||
switchView->setState(function()->displayDerivative());
|
||||
}
|
||||
}
|
||||
|
||||
ExpiringPointer<CartesianFunction> FunctionParameterController::function() {
|
||||
App * a = static_cast<App *>(app());
|
||||
return a->functionStore()->modelForRecord(m_record);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user