index 9892e897fc1e935e7e006390dae7a84d066645ed..a244e9abbbb30c32c55ebb68740077dffae28145 100644 (file)
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+/*
+TODO:
+FIXME:
+ After Inkscape makes a formal requirement for a GTK version above 2.11.4, please
+ replace all the instances of ink_ext_XXXXXX in this file that represent
+ svg files with ink_ext_XXXXXX.svg . Doing so will prevent errors in extensions
+ that call inkscape to manipulate the file.
+
+ "** (inkscape:5848): WARNING **: Format autodetect failed. The file is being opened as SVG."
+
+ references:
+ http://www.gtk.org/api/2.6/glib/glib-File-Utilities.html#g-mkstemp
+ http://ftp.gnome.org/pub/gnome/sources/glib/2.11/glib-2.11.4.changes
+ http://developer.gnome.org/doc/API/2.0/glib/glib-File-Utilities.html#g-mkstemp
+
+ --Aaron Spike
+*/
#define __INKSCAPE_EXTENSION_IMPLEMENTATION_SCRIPT_C__
#ifdef HAVE_CONFIG_H
#include "extension/output.h"
#include "extension/db.h"
#include "script.h"
+#include "dialogs/dialog-events.h"
#include "util/glib-list-iterators.h"
if (interpretstr != NULL) {
Glib::ustring interpString =
resolveInterpreterExecutable(interpretstr);
- interpString .append(" ");
+ interpString .append(" \"");
interpString .append(command_text);
+ interpString .append("\"");
command_text = interpString;
}
}
int data_read = execute(command, local_filename, tempfilename_out);
-
SPDocument *mydoc = NULL;
if (data_read > 10) {
if (helper_extension.size()==0) {
This function is a little bit trickier than the previous two. It
needs two temporary files to get it's work done. Both of these
files have random names created for them using the g_file_open_temp function
- with the sp_ext_ prefix in the temporary directory. Like the other
+ with the ink_ext_ prefix in the temporary directory. Like the other
functions, the temporary files are deleted at the end.
To save/load the two temporary documents (both are SVG) the internal
void
Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc)
{
- SPDocument * mydoc = NULL;
+ if (module->no_doc) {
+ // this is a no-doc extension, e.g. a Help menu command;
+ // just run the command without any files, ignoring errors
+ Glib::ustring local_command(command);
+ Glib::ustring paramString = *module->paramString();
+ local_command.append(paramString);
+
+ Glib::ustring empty;
+ execute(local_command, empty, empty);
+
+ return;
+ }
gchar *tmpname;
// FIXME: process the GError instead of passing NULL
@@ -769,6 +798,7 @@ Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *do
int data_read = execute(local_command, tempfilename_in, tempfilename_out);
+ SPDocument * mydoc = NULL;
if (data_read > 10)
mydoc = Inkscape::Extension::open(
Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG),
@@ -789,6 +819,7 @@ Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *do
copy_doc(doc->doc()->rroot, mydoc->rroot);
doc->doc()->emitReconstructionFinish();
mydoc->release();
+ sp_namedview_update_layers_from_document(desktop);
}
}
child = child->next()) {
if (!strcmp("sodipodi:namedview", child->name()))
continue;
- if (!strcmp("svg:defs", child->name()))
- continue;
delete_list.push_back(child);
}
for (unsigned int i = 0; i < delete_list.size(); i++)
child = child->next()) {
if (!strcmp("sodipodi:namedview", child->name()))
continue;
- if (!strcmp("svg:defs", child->name()))
- continue;
oldroot->appendChild(child->duplicate());
}
/**
- \return none
\brief This is the core of the extension file as it actually does
the execution of the extension.
\param in_command The command to be executed
g_free(tmpname);
Glib::ustring localCommand = in_command;
- localCommand .append(" \"");
- localCommand .append(filein);
- localCommand .append("\"");
+
+ if (!(filein.empty())) {
+ localCommand .append(" \"");
+ localCommand .append(filein);
+ localCommand .append("\"");
+ }
// std::cout << "Command to run: " << command << std::endl;
return 0;
}
+ if (fileout.empty()) { // no output file to create; just close everything and return 0
+ if (errorFile.size()>0) {
+ unlink(errorFile.c_str());
+ }
+ pipe.close();
+ return 0;
+ }
+
+ /* Copy pipe output to fileout (temporary file) */
Inkscape::IO::dump_fopen_call(fileout.c_str(), "J");
FILE *pfile = Inkscape::IO::fopen_utf8name(fileout.c_str(), "w");
return 0;
}
- /* Copy pipe output to a temporary file */
int amount_read = 0;
char buf[BUFSIZE];
int num_read;
Gtk::MessageDialog warning(message, false, type, Gtk::BUTTONS_OK, true);
warning.set_resizable(true);
+ GtkWidget *dlg = GTK_WIDGET(warning.gobj());
+ sp_transientize(dlg);
Gtk::VBox * vbox = warning.get_vbox();