2#include <Process/Dataflow/Port.hpp>
3#include <Process/Dataflow/PortFactory.hpp>
4#include <Process/Dataflow/PortItem.hpp>
5#include <Process/Process.hpp>
6#include <Process/ProcessContext.hpp>
8#include <score/application/GUIApplicationContext.hpp>
10#include <ossia/network/value/value_conversion.hpp>
12#include <Process/Commands/SetControlValue.hpp>
14#include <score/command/Dispatchers/MultiOngoingCommandDispatcher.hpp>
16#include <QElapsedTimer>
17#include <QGraphicsItem>
18#include <QGraphicsSceneMouseEvent>
19#include <QGuiApplication>
23#include <Ui/Monitor/ModeSwitch.hpp>
38 if(index < p.inlets().size())
39 return qobject_cast<const Process::ControlInlet*>(p.inlets()[index]);
48 return static_cast<E
>(std::clamp(ossia::convert<int>(c->value()), 0,
int(last)));
53 return c ? ossia::convert<float>(c->value()) : fallback;
58 return c ? ossia::convert<bool>(c->value()) : fallback;
65 QGraphicsItem* parent, QObject* owner,
double y = 5.)
67 if(index >= p.inlets().size())
69 auto* inlet = p.inlets()[index];
71 if(
auto fact = factories.get(inlet->concreteKey()))
72 if(
auto port = fact->makePortItem(*inlet, doc, parent, owner))
77template <
typename Item,
typename... C>
83 c, &Process::ControlInlet::valueChanged, item, [item] { item->update(); });
96 bool operator()(
const QGraphicsSceneMouseEvent& ev)
98 if(ev.button() != Qt::LeftButton)
102 && m_last.elapsed() < QGuiApplication::styleHints()->mouseDoubleClickInterval()
103 && QLineF(ev.screenPos(), m_pos).length() < 6.;
110 m_pos = ev.screenPos();
115 QElapsedTimer m_last;
122 std::initializer_list<std::pair<const Process::ControlInlet*, ossia::value>> values)
126 for(
const auto& [c, v] : values)
The MultiOngoingCommandDispatcher class.
Definition MultiOngoingCommandDispatcher.hpp:37
Definition PortFactory.hpp:110
The Process class.
Definition score-lib-process/Process/Process.hpp:82
Definition SetControlValue.hpp:14
Several controls changed by one gesture: one undo step.
Definition SetControlValue.hpp:38
Definition LayerHelpers.hpp:94
A small abstraction layer over the score::CommandStack.
Definition CommandStackFacade.hpp:21
Definition BufferDecode.hpp:16
void repaintOn(Item *item, C *... controls)
Repaints item whenever one of the given controls changes in the model.
Definition LayerHelpers.hpp:78
const Process::ControlInlet * controlInlet(const Process::ProcessModel &p, std::size_t index) noexcept
Definition LayerHelpers.hpp:36
void showInlet(const Process::ProcessModel &p, std::size_t index, const Process::Context &doc, QGraphicsItem *parent, QObject *owner, double y=5.)
Definition LayerHelpers.hpp:63
void setControls(const score::CommandStackFacade &stack, std::initializer_list< std::pair< const Process::ControlInlet *, ossia::value > > values)
Sets several controls as one undoable edit.
Definition LayerHelpers.hpp:120
Definition ProcessContext.hpp:12
const T & interfaces() const
Access to a specific interface list.
Definition ApplicationContext.hpp:87