
On Fri, 2009-12-25 at 22:26 -0800, Jon Cruz wrote:
On Dec 25, 2009, at 4:28 AM, Alex Leone wrote:
- This eventually calls src/document.cpp:601: SPDocument::fitToRect(Geom::Rect const &rect)
My plan was to add marginTop, marginLeft, etc as parameters to SPDocument::fitToRect, and somehow pass these parameters through the void *data parameter in sp_action_perform. However, all the other calls to sp_action_perform in inkscape set the void *data parameter to NULL, and it looks like the action handler doesn't have any code to call free on the parameter after all the action listeners are serviced.
Am I trying to do this completely wrong?
Yes, this does sound a bit off.
the data parameter on sp_action_perform is really some C legacy approach for passing a pointer to some arbitrary blob of data.
Once we moved the C++ the 'proper' thing to do is set member values and operate on those.
The problem being that the action/verb system was never moved to C++ really -- so I think that this pattern is still appropriate. Now, whether the code should be migrated is a different story :)
--Ted