MatejGolian / ReaHotkey

An AutoHotkey script for blind musicians and REAPER users
9 stars 2 forks source link

Change Hotkey Setting Mechanism #15

Closed MatejGolian closed 4 months ago

MatejGolian commented 4 months ago

@Timtam I remembered us discussing how setting custom hotkeys was a bit complicated at the moment, because one has to call 2 methods. We could modify Plugin.SetHotkey and Standalone.SetHotkey to handle the whole thing and thus avoid the need to call the SetHotkey methods of individual objects, although the caveat is that one would still have to supply the control in question to Plugin/Standalone.SetHotkey as a parameter. The new Plugin/Standalone SetHotkey methods would look like this: Static SetHotkey(PluginName, OverlayControl, KeyName, KeyLabel := "", Action := "", Options := "") Do you think this would make things more intuitive?

MatejGolian commented 4 months ago

I've started implementing my idea as an experiment, but than I looked at your code and now it seems to me that it wouldn't really simplify things in practice. So now it seems to me that all things considered, the current method is still the most logical one. But of course, say if you deem otherwise or if you have any other ideas. That being said, we could probably simplify things a little by not having to specify TriggerStandaloneHotkey or TriggerPluginHotkey.

MatejGolian commented 4 months ago

I created a test branch where TriggerPluginHotkey and TriggerStandaloneHotkey don't have to be specified, in fact they have been moved to the Plugin and Standalone classes respectively in the form of function objects. I have updated the Dubler2 file accordingly. Please, test if Dubler 2 still works as expected though. And of course, let me know your thoughts on this in general.

MatejGolian commented 4 months ago

I have merged this as it seems to work fine and I think that making overlay hotkey triggering actions the default in this case is reasonable. After all, we can always change things should the need arise...

MatejGolian commented 4 months ago

Just reopening this to notify about the latest updates. Now there are both instance and static methods for batch registering overlay hotkeys (called 'RegisterOverlayHotkeys'). You supply the accessibility overlay as a parameter and the methods will get all control hotkeys and subsequently enable them for the given plugin or standalone. And should you ever use one of the 'RegisterOverlay' methods, 'RegisterOverlayHotkeys' will get called automatically. This might still not be the ideal solution for your scenario where you're generating everything dynamically, but hopefully it's a step in the right direction.

MatejGolian commented 4 months ago

Closing once again, since the word is out... 🙂