Slightly different answers than Jon.
On Sun, 2009-02-08 at 19:39 -0800, Krzysztof Kosiński wrote:
- What are the differences between SPAction and Gtk::Action? I read the
code and the only difference seems to be that SPActions derive from NRActiveObject, but this doesn't seem to matter much.
Historical reasons.
- Why do we need verbs at all? Why SPActions are bound to a document when
we can just perform them on SP_ACTIVE_DESKTOP when they are activated? Those are GUI actions, so I think it's impossible to perform an action on an inactive document.
This kinda ties into your next post, it basically comes down to knowing the active document is in many cases a little unreliable. For instance with sloppy focus, or multiple mouse pointers or with floating toolbars. If we can define this relationship explicitly we can be sure that it is accurate. It's part of making Inkscape rock-solid versus mostly-right.
- Why do we have one class per several verbs and a switch in perform()
instead of one class per verb?
When I converted the Verbs to be C++ I tried to make sure that the diff was small and readable to introduce less bugs in a fairly critical part of Inkscape code. This was the way that it was done before, and it remained. I would say that in general most of them could migrate to be classes themselves, but I personally haven't taken the time to do so. Some might be better as case statements as they have common code, but I don't believe that to be the majority case.
--Ted