Hi,
I have added some lines of code to the ThumbWheel widget to support wheel
events which are mapped to Button 4 & 5. It's kind of static in this sense
but it's a first shot and just nice :-). Anyone interested ?
patch inventor/libSoXt/src/viewers/Sgm/ThumbWheel.c thumbwheel.patch
340a341,342
> <Btn4Down>: PageUp() \n\
> <Btn5Down>: PageDown() \n\
363a366,367
> {"Btn4Down", PageUp},
> {"Btn5Down", PageDown},
467a472
>
957a963
>
1250c1256,1279
< /* fprintf(stderr, "PageUp\n");*/
---
> SgThumbWheelWidget thumb = (SgThumbWheelWidget) wid;
> XMotionEvent *xmotion = (XMotionEvent *)event;
> int old_value = thumb->thumbWheel.value;
> int new_value;
> int decrement = 10;
>
> thumb->thumbWheel.user_pixels -= decrement;
> new_value = ConvertPixelsToUserUnits(thumb, thumb->thumbWheel.user_pixels);
> thumb->thumbWheel.value = new_value;
>
> /*
> * Change the current pixmap to reflect "spinning" the wheel.
> */
> if( new_value != old_value) {
> SetCurrentPixmap(thumb, (new_value > old_value));
> Redisplay((Widget)thumb, NULL, NULL);
> }
>
> /*
> * Issue the dragCallback with the new value, if changed.
> */
> if (new_value != old_value) {
> IssueCallback(thumb, XmCR_DRAG, thumb->thumbWheel.value, event);
> }
1260c1289,1312
< /* fprintf(stderr, "PageDown\n");*/
---
> SgThumbWheelWidget thumb = (SgThumbWheelWidget) wid;
> XMotionEvent *xmotion = (XMotionEvent *)event;
> int old_value = thumb->thumbWheel.value;
> int new_value;
> int increment = 10;
>
> thumb->thumbWheel.user_pixels += increment;
> new_value = ConvertPixelsToUserUnits(thumb, thumb->thumbWheel.user_pixels);
> thumb->thumbWheel.value = new_value;
>
> /*
> * Change the current pixmap to reflect "spinning" the wheel.
> */
> if( new_value != old_value) {
> SetCurrentPixmap(thumb, (new_value > old_value));
> Redisplay((Widget)thumb, NULL, NULL);
> }
>
> /*
> * Issue the dragCallback with the new value, if changed.
> */
> if (new_value != old_value) {
> IssueCallback(thumb, XmCR_DRAG, thumb->thumbWheel.value, event);
> }
--
Nico Schmidt IPK/IWF eMail : nico.schmidt@xxxxxxxxxx
Sekr. PTZ 4, Pascalstr. 8-9 Phone : +49-30-39006342
D-10587 Berlin
|