[PD-dev] Why don't we implement zooming in Tcl?

Christof Ressi christof.ressi at gmx.at
Tue Aug 27 02:38:17 CEST 2019


> Maybe I'm missing something obvious?

Of course I did... We send raw Tcl commands from the core with the actual canvas coordinates and this complicates things because of how Tk's "scale" method works...

Maybe it's time to eventually refactor the GUI messaging and use abstract commands instead of actual Tcl code, with logical coordinates instead of actual coordinates... This would mean that zooming could be implemented easily on the GUI side.

But what's more important: people can replace the Tk GUI with other (better) GUIs. I think the libpd people would love that as well, because apps could easily integrate Pd's GUI into their GUI framework of choice. Also, people can offer alternative GUIs for Pd vanilla. Personally, I can imagine writing a Qt GUI. This would be similar to how Supercollider has alternative language clients which all talk to the Server via well-defined OSC messages.

<rant>

I appreciate Pd's minimalism but a simple GUI should also be a *fast* GUI. The Tk canvas implementation is actually pretty terrible performance-wise. Moving an object in a larger patch maxes out a whole core(!) on my Laptop. It appears that Tk simply redraws the whole canvas :-( Any decent GUI framework should use some kind of spatial partitioning to determine which part of the canvas actually needs to be redrawn. Qt's QGraphicsScene does this pretty well (I've written a level editor where the view can easily contain 10 thousands of tiles and editing/zooming is smooth!).

So I'm pretty frustated with Tk. A short-term solution could be to patch Tk's canvas code, but in the long run I think we need an abstract GUI interface, so that people can experiment with better GUI frameworks.

</rant>

Christof

> Gesendet: Dienstag, 27. August 2019 um 00:30 Uhr
> Von: "Christof Ressi" <christof.ressi at gmx.at>
> An: pd-dev at iem.at
> Betreff: [PD-dev] Why don't we implement zooming in Tcl?
>
> Hi, I've been wondering why the zooming is implemented on the Pd core? Tk's canvas has a scale method and people have been using to implement a zoom feature, e.g. https://www.tek-tips.com/viewthread.cfm?qid=239833
>
> Ideally, the core shouldn't have to know about the size of the GUI window at all and just work with "logical" coordinates. The GUI can scale the content to whatever size it wants and when communicating with the core it would transform the mouse coordinates between logical and screen coordinates. Some better GUI frameworks already do that for you (e.g. Qt's QGraphicsScene/QGraphicView), but it shouldn't be too hard to do it manually for Tk. This would also allow fractional zoom factors. Unfortunately, Tk doesn't allow fractional font sizes (or has this changed?), but we could have at least *some* steps between 100% and 200%. Also, it would make the Pd core code much easier because we wouldn't have to worry about zoom at all...
>
> This is just I've been wondering about when having a look at the zooming code and coming from my experience of developing GUI apps with Qt. Maybe I'm missing something obvious?
>
> Christof
>
>
>
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>





More information about the Pd-dev mailing list