>> I've managed to get native scrollbars working with a horrible hack, but
>> that's really just due to my lack of understanding.
>> I need help with the following (additions/corrections):
>> [...]
> [...]
> The best reference for most of the variables named above are the two
> functions window_to_user() and user_to_window() in functions.c, which
> translate coordinates between the xcircuit coordinate system and X11.
>
> For an X11 coordinate (x, y) to xcircuit coordinate (a, b):
>
> a = x / vscale + pcorner.x
> b = (height - y) / vscale + pcorner.y
> [...]
Ok, this has helped -- good explaining on your part!
I now have scrollbars that don't rely on any hacks. The scrollbar redraw is not
hooked
into anymore. Instead, scrollbar limits and default value are re-set in
functions.c:
redraw(), as they should be. The panning code is relatively simple, too:
void panhbar(xcWidget, void*, void* value_)
{
const int value = (int)value_;
if (eventmode == SELAREA_MODE) return;
areawin->pcorner.x = value/areawin->vscale + topobject->bbox.lowerleft.x;
areawin->area->update();
}
The value is sent by the scrollbar; I've set scrollbar's mapping such that it
operates
in X11 units. E.g.: horizontal scrollbar's width is areawin->width, and its
overall length is topobject->box.width
scaled into X11 units. This makes it easy to deal with.
I will now try and get the drawing area to be a QAbstractScrollArea -- this way
the scrollbars will appear
on-demand, and all the mouse wheel / two-finger-swipe (on Apple input devices)
magic will happen "by itself".
Cheers, Kuba
_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev