From df0fdf362347495531bc3a5d19233220721d846b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 11 May 2021 13:45:26 -0400 Subject: Refactor most functionality around actions and settings This moves more code into general places, and completely eliminates dependencies on the Patchage "god object". --- src/Reactor.hpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/Reactor.hpp') diff --git a/src/Reactor.hpp b/src/Reactor.hpp index 9317b0a..17c20ce 100644 --- a/src/Reactor.hpp +++ b/src/Reactor.hpp @@ -20,16 +20,19 @@ #include "Action.hpp" #include "SignalDirection.hpp" +#include + namespace patchage { struct PortID; +class Canvas; class CanvasModule; class CanvasPort; class ClientID; +class Configuration; class Drivers; class ILog; -class Patchage; /// Reacts to actions from the user class Reactor @@ -37,7 +40,10 @@ class Reactor public: using result_type = void; ///< For boost::apply_visitor - explicit Reactor(Patchage& patchage); + explicit Reactor(Configuration& conf, + Drivers& drivers, + Canvas& canvas, + ILog& log); Reactor(const Reactor&) = delete; Reactor& operator=(const Reactor&) = delete; @@ -48,22 +54,33 @@ public: ~Reactor() = default; void operator()(const action::ConnectPorts& action); + void operator()(const action::DecreaseFontSize& action); void operator()(const action::DisconnectClient& action); void operator()(const action::DisconnectPort& action); void operator()(const action::DisconnectPorts& action); + void operator()(const action::IncreaseFontSize& action); void operator()(const action::MoveModule& action); + void operator()(const action::Refresh& action); + void operator()(const action::ResetFontSize& action); void operator()(const action::SplitModule& action); void operator()(const action::UnsplitModule& action); + void operator()(const action::ZoomFull& action); + void operator()(const action::ZoomIn& action); + void operator()(const action::ZoomNormal& action); + void operator()(const action::ZoomOut& action); void operator()(const Action& action); private: + std::string module_name(const ClientID& client); + CanvasModule* find_module(const ClientID& client, SignalDirection type); CanvasPort* find_port(const PortID& port); - Patchage& _patchage; - ILog& _log; - Drivers& _drivers; + Configuration& _conf; + Drivers& _drivers; + Canvas& _canvas; + ILog& _log; }; } // namespace patchage -- cgit v1.2.1