Added UI actions to change key of source callbacks and copy-paste

Drag&drop input button keys to change key associated to a list of source callbacks (i.e. move). Copy Paste in context popup menu to remember the input model to copy at another input.
This commit is contained in:
Bruno Herbelin
2022-02-10 00:24:38 +01:00
parent 6200e78e93
commit 74eca2e527
3 changed files with 125 additions and 18 deletions

View File

@@ -684,6 +684,22 @@ void Source::addInputCallback(uint input, SourceCallback *callback)
added->second.model_ = callback;
}
void Source::swapInputCallback(uint from, uint to)
{
std::multimap<uint, InputCallback> swapped_callbacks_;
for (auto k = input_callbacks_.begin(); k != input_callbacks_.end(); ++k)
{
if ( k->first == from )
swapped_callbacks_.emplace( to, k->second);
else
swapped_callbacks_.emplace( k->first, k->second);
}
input_callbacks_.swap(swapped_callbacks_);
}
void Source::removeInputCallback(SourceCallback *callback)
{
for (auto k = input_callbacks_.begin(); k != input_callbacks_.end(); ++k)