[PD-dev] improved scrolling algorithm

Ivica Ico Bukvic ico at vt.edu
Wed May 19 21:04:33 CEST 2010


OK, here's a complete patch that fixes most (all?) issues with scrolling
algorithm listed below.

Please note the following applies to:
Linux/OSX/Windows
Pd 0.42.5 vanilla and extended
Tcl/Tk 8.4 & 8.5

In addition to the detailed description provided in the previous email,
here's a list of fixes:

*redesigned scrolling algorithm so that is no 0 0 centric but rather
viewport-centric (e.g. if everything can fit within the said window, it
should)

*100% accurate bbox creation including text which requires font resizing
workaround (known tcl/tk issue). Font resizing has to be done per-font
(Linux fix provided for three default fonts, currently other OSs use old
bbox style even though it is broken mainly because its fonts need to be
manually re-calibrated). Font resizing has been tested accurate up to
1000px-sized fonts but should work beyond as well. NB: this has been
mainly tested with 8.5 with antialiased fonts on Linux but should work
on other versions as well. The text also avoids calculating bbox for
text entries that are empty (something that existing version does making
its bbox incorrect and rendering GUI creation with tight window margins
impossible, e.g. a large number2 object with a window size matching
object's)

*scroll wheel scrolls only if the scrollbars are active (back-ported
from pd-extended)

*scrollbars update automatically and dynamically with
undo/redo/cut/paste/resize/typing text, as well as apply actions in
canvas and object properties where the change may require creation or
hiding of scrollbars (e.g. creating an atom and then in its properties
applying width of 1000 which then spills outside the visible window will
automatically update scrollbars).

*array and graph are spawned always on-screen regardless how big patch
is or how far it is currently located away from the 0 0 origin.

*array name is immediately displayed at creation-time rather than
requiring moving the object before it is properly displayed.

*properties windows spawn right next to the mouse which makes editing a
lot easier rather than hunting the widget across the random desktop
spawning locations.

Now I think this should pass all Hans's pd-gui-rewrite tests plus
provide a few more test cases none of the existing models account for.

Attached tarball consists of 15 separate patches (named after the file
they are meant to patch) and should patch cleanly against 0.42.5
pd-extended source. Changes should be also mostly self-explanatory or
are commented accordingly.

Cheers!

ico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bigkahuna_100519.tar.gz
Type: application/x-compressed-tar
Size: 7664 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20100519/cb3bac8e/attachment.bin>


More information about the Pd-dev mailing list