[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: gschem: Using mouse wheels for scrolling
Hi,
[snip]
>I'd like to implement it. A hint on what parts of the code need to be
>changed would be great.
>I guess I've to set up a callback to react to the additional mouse
>buttons and call x_basic.nw:x_[hv]scrollbar_update in that callback. But
>where should I set it?
The place to add this will probably be in gschem/noweb/x_event.nw
in the functions: x_event_button_pressed() or x_event_button_released()
Also, if you take a look at a_pan_mouse() in
gschem/noweb/a_pan.nw, I think that function is all you will need as it
takes a difference in x and y directions (note, those differences are
in screen coordinates). Be sure to see how a_mouse_pan is called in
x_event.nw (though it is called in x_event_motion; you will want to call
it from the _pressed event handler). Also, what's nice about a_pan_mouse
is that it will handle all the redrawing and scrollbar updates you will
need (I think).
So, when the user moves one of the horizontal or vertical wheels
(though I only have a vertical mouse wheel), typically these
(vertical) things generate a button 4 or 5 event (which can be caught in
x_event_button_pressed), then you can then call a_mouse_pan. The trick
will probably be to figure out what value to pass in as the difference.
The best way to figure this out is to experiment with hardcoded values.
Hope this helps.
-Ales