← Back to team overview

kicad-developers team mailing list archive

Re: Adding global mouse shortcuts in GAL tool framework


Hi John,

I am glad you like the idea. I agree it is better to wait until the
legacy canvas removal, it feels like we are quite close to reaching that


On 11/23/18 10:04 PM, John Beard wrote:
> Hi Orson,
> Thanks for the idea - seems like that could be a fairly flexible way
> to generalise action shortcuts.
> Perhaps such a refactor would be better after the hotkeys aren't
> synced with legacy, though.
> Cheers,
> John
> On Fri, Nov 23, 2018 at 8:58 AM Maciej Sumiński <maciej.suminski@xxxxxxx> wrote:
>> Hi John,
>> One possible way of solving the problem is to change the m_defaultHotkey
>> in TOOL_ACTION class to a TOOL_EVENT field which says what triggers the
>> action. Then ACTION_MANAGER instead of comparing hotkeys should run
>> TOOL_EVENT::Matches() to check whether a processed TOOL_EVENT is
>> supposed to fire an action.
>> Cheers,
>> Orson
>> On 11/21/18 11:15 AM, John Beard wrote:
>>> Hi,
>>> A little technical query provoked by someone else's question, which I
>>> was unable to answer.
>>> Say one wanted to add a global mouse shortcut, for example, double
>>> middle-click to do "zoom-to-fit" [1].
>>> The current mouse events are handled on a contextual basis in the
>>> event loops for each tool. Thus, each tool handles its own clicks,
>>> drags, etc, which generally makes sense for the basic left/right
>>> clicks as what that does is usually highly tool-dependent. Global key
>>> shortcuts for ACTIONs are handled at a higher level and and either
>>> trigger a transition set by setTransitions(), or translated to an
>>> event and caught by the current tool's event loop as their own event
>>> (checked with evt->IsAction())
>>> However, there appears to be no way to add a mouse click pattern to an
>>> ACTION, thus you can't have a global double-middle-click, unless you
>>> add an "if( evt->IsDblClick( BTN_MIDDLE))" to every event loop.
>>> What would be the right way (if any) to approach this? I'm ignoring
>>> for now the UI implications of presenting such a shortcut in the
>>> hotkey dialog, implementing the "set hotkey" action, and any problems
>>> that might arise in having it co-exist with legacy hotkeys.
>>> Cheers,
>>> John
>>> [1]: https://bugs.launchpad.net/kicad/+bug/1480868
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp

Attachment: signature.asc
Description: OpenPGP digital signature