Am 6. November 2024 17:56:32 MEZ schrieb Alexandre Torres Porres porres@gmail.com:
In order to know that Pd is in edit mode I do what I consider an ugly hack, which is listening to all canvas messages and filter the 'edit' message. I think it looks bad in the code and I wonder if there is a simpler way. Or if the way comment works is just something not exposed for externals. And I have the same inquiry for the cursor thing, if I can learn and apply the same mechanism for externals.
Getting the edit mode, should be easy enough: https://github.com/pure-data/pure-data/blob/c2d65103e5c068fa466260480b012ef03aed58a2/src/g_editor.c#L2254
But iirc, there's no proper way for an arbitrary object to receive mouse events while in edit mode. Everything you mentioned is hardcoded in Pd's editor itself.
And the "widgetbehaviour" API is really a prime example of bad design (with respect to extendibility), so it's not easy to change it to make more objects do something class-specific in edit mode, without cluttering rather unrelated code (g_editor), or - possibly - resorting to even uglier hacks
mfg.sfg.jfd IOhannes