summaryrefslogtreecommitdiffstats
path: root/src/Reactor.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-11 13:45:26 -0400
committerDavid Robillard <d@drobilla.net>2021-05-11 13:45:26 -0400
commitdf0fdf362347495531bc3a5d19233220721d846b (patch)
treee3631d08630d4d6651eb24aa53c9fc49157778ab /src/Reactor.hpp
parentc6ae340c6222240dc45e9bba714c722cebece186 (diff)
downloadpatchage-df0fdf362347495531bc3a5d19233220721d846b.tar.gz
patchage-df0fdf362347495531bc3a5d19233220721d846b.tar.bz2
patchage-df0fdf362347495531bc3a5d19233220721d846b.zip
Refactor most functionality around actions and settings
This moves more code into general places, and completely eliminates dependencies on the Patchage "god object".
Diffstat (limited to 'src/Reactor.hpp')
-rw-r--r--src/Reactor.hpp27
1 files changed, 22 insertions, 5 deletions
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 <string>
+
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