← Back to team overview

kicad-developers team mailing list archive

Re: Adding global mouse shortcuts in GAL tool framework

 

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

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References