First working implementation of Inputs Mapping

Management of inputs in Control, Management of callbacks creator per input in Source, Saving and Loading in Session, Unified renaming of SourceCallbacks, User interface window for creating and editing input mapping from Keyboard and Numerical keypad, with appropriate Settings.
This commit is contained in:
Bruno Herbelin
2022-02-06 00:36:05 +01:00
parent 8404e0f670
commit ab040f5268
23 changed files with 1054 additions and 291 deletions

View File

@@ -580,16 +580,19 @@ void SessionVisitor::visit (Source& s)
s.mixingGroup()->accept(*this);
}
std::vector<int> keys = s.callbackKeys();
if (!keys.empty()) {
std::list<uint> inputs = s.callbackInputs();
if (!inputs.empty()) {
// list of callbacks
XMLElement *callbackselement = xmlDoc_->NewElement( "Callbacks" );
sourceNode->InsertEndChild(callbackselement);
for (auto k = keys.begin(); k != keys.end(); ++k) {
xmlCurrent_ = xmlDoc_->NewElement( "Callback" );
xmlCurrent_->SetAttribute("key", *k);
s.keyCallback(*k)->accept(*this);
callbackselement->InsertEndChild(xmlCurrent_);
for (auto i = inputs.begin(); i != inputs.end(); ++i) {
std::list<SourceCallback *> callbacks = s.inputCallbacks(*i);
for (auto c = callbacks.begin(); c != callbacks.end(); ++c) {
xmlCurrent_ = xmlDoc_->NewElement( "Callback" );
xmlCurrent_->SetAttribute("input", *i);
(*c)->accept(*this);
callbackselement->InsertEndChild(xmlCurrent_);
}
}
}
@@ -756,6 +759,49 @@ void SessionVisitor::visit (SrtReceiverSource& s)
xmlCurrent_->InsertEndChild(port);
}
void SessionVisitor::visit (SourceCallback &c)
{
xmlCurrent_->SetAttribute("type", (uint) c.type());
}
void SessionVisitor::visit (SetAlpha &c)
{
xmlCurrent_->SetAttribute("alpha", c.value());
}
void SessionVisitor::visit (SetDepth &c)
{
xmlCurrent_->SetAttribute("depth", c.value());
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Loom &c)
{
xmlCurrent_->SetAttribute("delta", c.value());
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Grab &c)
{
xmlCurrent_->SetAttribute("delta.x", c.value().x);
xmlCurrent_->SetAttribute("delta.y", c.value().y);
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Resize &c)
{
xmlCurrent_->SetAttribute("delta.x", c.value().x);
xmlCurrent_->SetAttribute("delta.y", c.value().y);
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Turn &c)
{
xmlCurrent_->SetAttribute("delta", c.value());
xmlCurrent_->SetAttribute("duration", c.duration());
}
std::string SessionVisitor::getClipboard(const SourceList &list)
{
std::string x = "";
@@ -843,47 +889,4 @@ std::string SessionVisitor::getClipboard(ImageProcessingShader * const s)
return x;
}
void SessionVisitor::visit (SourceCallback &c)
{
xmlCurrent_->SetAttribute("type", (uint) c.type());
}
void SessionVisitor::visit (GotoAlpha &c)
{
xmlCurrent_->SetAttribute("alpha", c.alpha());
}
void SessionVisitor::visit (GotoDepth &c)
{
xmlCurrent_->SetAttribute("depth", c.depth());
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Loom &c)
{
xmlCurrent_->SetAttribute("delta", c.delta());
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Grab &c)
{
xmlCurrent_->SetAttribute("delta.x", c.delta().x);
xmlCurrent_->SetAttribute("delta.y", c.delta().y);
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Resize &c)
{
xmlCurrent_->SetAttribute("delta.x", c.delta().x);
xmlCurrent_->SetAttribute("delta.y", c.delta().y);
xmlCurrent_->SetAttribute("duration", c.duration());
}
void SessionVisitor::visit (Turn &c)
{
xmlCurrent_->SetAttribute("delta", c.delta());
xmlCurrent_->SetAttribute("duration", c.duration());
}