← Back to team overview

kicad-developers team mailing list archive

Re: Kicad Tool Framework


On 08/13/2013 03:30 PM, Dick Hollenbeck wrote:
On 08/13/2013 08:03 AM, Dick Hollenbeck wrote:
On 08/13/2013 07:09 AM, Dick Hollenbeck wrote:

I find track laying impossible without mouse warping... there is an
option to disable it. But how could you *emulate* it, if there is no way
to physically move the pointer?

The OS+native windowing system will move the mouse coordinates in the next mouse move event.

Your tool, if pushed onto the wxEvtHandler stack, I am thinking should have first access
to ALL events, (~captured mouse) so as long as you retain state information the next call
to ProcessEvent(), possibly routed to TOOL::OnMouseMove(), you can/could in there redraw
the mouse cursor at the new desired location, or not.

See wxEventLoopBase in http://docs.wxwidgets.org/trunk/classwx_event_loop_base.html

This class sucks events out of the os queue, and gets first dibs on any events, it is the
first recipient of any OS events when it is alive, and dispatching happens from here.

If simply residing topmost on the wxEvtHandler stack does not give you enough control,
then there is the option to create another wxEventLoopBase temporarily.

Here are some nice graphics and explanation of PushEventHandler:


It is my thinking that putting this in the wxFrame, by calling its PushEventHandler will
give you first dibs on all events.

With more or less acrobatics one could probably cast everything into wx event system. I don't see however why it would be simpler than a small, self-contained internal one. Having an example of both is a good idea.

Ours is in tools/selection_tool.cpp.

Why programs like Mozilla, Gimp, Blender, Webkit and EDA tools (proprietary, such as Altium & free, like gEDA) have custom event systems? Maybe this is one of the reasons.

I was going to explain the concept of coroutines in tools, but Lorenzo was faster (thanks for nice examples!).

I need more time to think about wx vs internal events. wxEvtHandler may be a good way to go if someone solves all wx platform-dependent quirks transparently to the tools.

In the meanwhile it will be better if I focus on the P&S. The router, fortunately isn't and will never be wx-dependent :).


Follow ups