Hi all, "SP_ACTIVE_DOCUMENT" or equivalently "inkscape_active_document" uses the current active desktop to find out which document is active. So SP_ACTIVE_DOCUMENT will not work if there is no GUI (cmdline Inkscape), and will return NULL. To allow one to call SP_ACTIVE_DOCUMENT to obtain the SPDocument, I am proposing to 'fall back' to take the first listed document in the Inkscape instance if desktop==NULL.
In inkscape.cpp:
SPDocument * inkscape_active_document (void) { if (SP_ACTIVE_DESKTOP) { return sp_desktop_document (SP_ACTIVE_DESKTOP); } else if (!inkscape->document_set.empty()) { return document_set.begin()->first; }
return NULL; }
I know we should move away from SP_ACTIVE_DOCUMENT and friends, but let's do the proposed change for sake of getting functionality now instead of over 5 years. ;-) It is related to fixing r11804 [1] to work from the cmdline.
Cheers, Johan
[1] http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/11804#src/...