[apps/graph] [apps/sequence] Implement copy paste

Change-Id: I7e33e24565b18e771ec530c74fb2a74ade5c3c85
This commit is contained in:
Émilie Feral
2017-04-25 15:19:40 +02:00
parent b4f0256ad4
commit e2bba16738
4 changed files with 28 additions and 1 deletions

View File

@@ -220,7 +220,7 @@ bool ListController::handleEvent(Ion::Events::Event event) {
}
return true;
}
if ((event.hasText() || event == Ion::Events::XNT)
if ((event.hasText() || event == Ion::Events::XNT || event == Ion::Events::Paste)
&& selectableTableView()->selectedColumn() == 1
&& (selectableTableView()->selectedRow() != numberOfRows() - 1
|| m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions())) {
@@ -228,6 +228,11 @@ bool ListController::handleEvent(Ion::Events::Event event) {
editExpression(function, event);
return true;
}
if (event == Ion::Events::Copy && selectableTableView()->selectedColumn() == 1 &&
(selectableTableView()->selectedRow() < numberOfRows() - 1 || m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions())) {
Clipboard::sharedClipboard()->store(textForRow(selectableTableView()->selectedRow()));
return true;
}
return false;
}
@@ -287,6 +292,11 @@ int ListController::functionIndexForRow(int j) {
return j;
}
const char * ListController::textForRow(int j) {
Shared::Function * function = m_functionStore->functionAtIndex(functionIndexForRow(j));
return function->text();
}
void ListController::addEmptyFunction() {
m_functionStore->addEmptyFunction();
selectableTableView()->reloadData();