36 bool repeat_ =
false,
bool passEvent_ =
false,
bool msx_ =
false)
56 template<
typename XmlStream>
59 xml.begin(
"bindings");
61 for (
const auto& k : boundKeys) {
66 xml.attribute(
"repeat",
"true");
69 xml.attribute(
"event",
"true");
72 xml.attribute(
"msx",
"true");
74 xml.data(info.command);
78 for (
const auto& k : unboundKeys) {
90 LayerInfo(std::string l,
bool b)
91 : layer(
std::move(l)), blocking(b) {}
97 void initDefaultBindings();
98 void bind (HotKeyInfo&& info);
99 void unbind (
const Event& event);
100 void bindDefault (HotKeyInfo&& info);
101 void unbindDefault(
const Event& event);
102 void bindLayer (HotKeyInfo&& info,
const std::string& layer);
103 void unbindLayer (
const Event& event,
const std::string& layer);
104 void unbindFullLayer(
const std::string& layer);
105 void activateLayer (std::string layer,
bool blocking);
106 void deactivateLayer(std::string_view layer);
109 void executeBinding(
const Event& event,
const HotKeyInfo& info);
110 void startRepeat (
const Event& event);
116 void executeRT()
override;
119 class BindCmd final :
public Command {
121 BindCmd(CommandController& commandController, HotKey& hotKey,
123 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
124 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
127 const bool defaultCmd;
130 BindCmd bindDefaultCmd;
132 class UnbindCmd final :
public Command {
134 UnbindCmd(CommandController& commandController, HotKey& hotKey,
136 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
137 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
140 const bool defaultCmd;
143 UnbindCmd unbindDefaultCmd;
145 struct ActivateCmd final : Command {
146 explicit ActivateCmd(CommandController& commandController);
147 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
148 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
151 struct DeactivateCmd final : Command {
152 explicit DeactivateCmd(CommandController& commandController);
153 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
154 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
159 std::map<std::string, BindMap, std::less<>> layerMap;
160 std::vector<LayerInfo> activeLayers;
163 GlobalCommandController& commandController;
164 EventDistributor& eventDistributor;
165 std::optional<Event> lastEvent;
167 class Listener :
public EventListener {
171 bool signalEvent(
const Event& event)
override;
176 Listener listenerHigh;
177 Listener listenerLow;
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
ITER find_unguarded(ITER first, ITER last, const VAL &val, Proj proj={})
Faster alternative to 'find' when it's guaranteed that the value will be found (if not the behavior i...