mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[apps/*/expression_model_list_controller] Refactor modelStore()
Its return type is covariant. Get the ExpressionModelStore from the App.
This commit is contained in:
committed by
LeaNumworks
parent
e80aaa649d
commit
413397652c
@@ -118,7 +118,7 @@ bool ListController::textFieldDidAbortEditing(TextField * textField) {
|
||||
// Put the name column back to normal size
|
||||
computeTitlesColumnWidth();
|
||||
selectableTableView()->reloadData();
|
||||
ExpiringPointer<Function> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(selectedRow()));
|
||||
ExpiringPointer<CartesianFunction> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(selectedRow()));
|
||||
setFunctionNameInTextField(function, textField);
|
||||
m_selectableTableView.selectedCell()->setHighlighted(true);
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
@@ -165,7 +165,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
titleCell->setBaseline(baseline(j));
|
||||
if (!titleCell->isEditing()) {
|
||||
// Set name and color if the name is not being edited
|
||||
ExpiringPointer<Function> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
ExpiringPointer<CartesianFunction> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
setFunctionNameInTextField(function, titleCell->textField());
|
||||
KDColor functionNameColor = function->isActive() ? function->color() : Palette::GreyDark;
|
||||
titleCell->setColor(functionNameColor);
|
||||
@@ -177,16 +177,20 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
|
||||
assert(j >= 0 && j < modelStore()->numberOfModels());
|
||||
Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j);
|
||||
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
|
||||
ExpiringPointer<Function> f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
ExpiringPointer<CartesianFunction> f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
KDColor textColor = f->isActive() ? KDColorBlack : Palette::GreyDark;
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
void ListController::setFunctionNameInTextField(ExpiringPointer<Function> function, TextField * textField) {
|
||||
void ListController::setFunctionNameInTextField(ExpiringPointer<CartesianFunction> function, TextField * textField) {
|
||||
assert(textField != nullptr);
|
||||
char bufferName[BufferTextView::k_maxNumberOfChar];
|
||||
function->nameWithArgument(bufferName, BufferTextView::k_maxNumberOfChar);
|
||||
textField->setText(bufferName);
|
||||
}
|
||||
|
||||
CartesianFunctionStore * ListController::modelStore() {
|
||||
return App::app()->functionStore();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user