From 98b79d5d99f334780027d4e3206e29a4e3f2370f Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 12 Jul 2012 20:04:41 +0200 Subject: Translations. Fix for Bug #425202 (Script messages not translated). (bzr r11546) --- src/extension/implementation/script.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 432b25bb9..b5052d222 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -861,13 +861,7 @@ void Script::checkStderr (const Glib::ustring &data, textview->set_wrap_mode(Gtk::WRAP_WORD); textview->show(); - // Remove the last character - char *errormsg = (char*) data.c_str(); - while (*errormsg != '\0') errormsg++; - errormsg -= 1; - *errormsg = '\0'; - - textview->get_buffer()->set_text(_(data.c_str())); + textview->get_buffer()->set_text(data.c_str()); Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow(); scrollwindow->add(*textview); -- cgit v1.2.3 From 52f79787efcd2df27e6756994b95ba53f29c870e Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 31 Jul 2012 17:45:56 +0200 Subject: Extensions. Better fix for Bug #944077 (inkscape crashed with SIGSEGV in Inkscape::Extension::Implementation::Script::effect()). (bzr r11576) --- src/extension/implementation/script.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index b5052d222..d3aeace55 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -732,10 +732,9 @@ void Script::effect(Inkscape::Extension::Effect *module, copy_doc(doc->doc()->rroot, mydoc->rroot); doc->doc()->emitReconstructionFinish(); SPObject *layer = NULL; - SPObject *obj = mydoc->getObjectById("base"); // Getting the named view from the document generated by the extension - SPNamedView *nv = (SPNamedView *) obj; + SPNamedView *nv = sp_document_namedview(mydoc, NULL); //Check if it has a default layer set up if ( nv != NULL){ -- cgit v1.2.3 From 3441298ed44e1a00f2c71b73a582755d7bda7cd5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 15 Feb 2013 14:12:46 +0100 Subject: Better fix for Bug #911146 (Inkscape reads .eps files from /tmp instead of the current directory) by Michael Karcher. (bzr r12127) --- src/extension/implementation/script.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d3aeace55..4af778e04 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -956,7 +956,14 @@ int Script::execute (const std::list &in_command, // assemble the rest of argv std::copy(in_params.begin(), in_params.end(), std::back_inserter(argv)); if (!filein.empty()) { - argv.push_back(filein); + if(Glib::path_is_absolute(filein)) + argv.push_back(filein); + else { + std::vector buildargs; + buildargs.push_back(Glib::get_current_dir()); + buildargs.push_back(filein); + argv.push_back(Glib::build_filename(buildargs)); + } } int stdout_pipe, stderr_pipe; -- cgit v1.2.3 From ea952687e7b1ae64c4c30c8eb66bd875d75fec2d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 23 Feb 2013 13:57:26 +0000 Subject: Fix missing headers for Gtk+ 3 build Fixed bugs: - https://launchpad.net/bugs/1122816 (bzr r12145) --- src/extension/implementation/script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 4af778e04..fa46569e2 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include -- cgit v1.2.3 From 1d3f07d09370bf8fefa7968706375ae3669dbd1c Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 8 Mar 2013 01:44:43 +0000 Subject: Drop deprecated get_vbox method in Gtk::Dialog (bzr r12181) --- src/extension/implementation/script.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index fa46569e2..3ac1e06ab 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -854,7 +854,11 @@ void Script::checkStderr (const Glib::ustring &data, GtkWidget *dlg = GTK_WIDGET(warning.gobj()); sp_transientize(dlg); +#if WITH_GTKMM_3_0 + Gtk::Box * vbox = warning.get_content_area(); +#else Gtk::Box * vbox = warning.get_vbox(); +#endif /* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */ Gtk::TextView * textview = new Gtk::TextView(); -- cgit v1.2.3 From fa74436561b0b28b9fa967101d44b4e7d6530871 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 8 Apr 2013 08:10:27 +0200 Subject: NULL pointer checks (bzr r12271) --- src/extension/implementation/script.cpp | 81 +++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 33 deletions(-) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 3ac1e06ab..69ce982d0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -669,8 +669,13 @@ void Script::effect(Inkscape::Extension::Effect *module, printf("TOO BAD TO LIVE!!!"); exit(1); } + if (doc == NULL) + { + g_warning("Script::effect: View not defined"); + return; + } - SPDesktop *desktop = (SPDesktop *)doc; + SPDesktop *desktop = reinterpret_cast(doc); sp_namedview_document_from_window(desktop); std::list params; @@ -696,16 +701,14 @@ void Script::effect(Inkscape::Extension::Effect *module, return; } - if (desktop != NULL) { - Inkscape::Util::GSListConstIterator selected = - sp_desktop_selection(desktop)->itemList(); - while ( selected != NULL ) { - Glib::ustring selected_id; - selected_id += "--id="; - selected_id += (*selected)->getId(); - params.insert(params.begin(), selected_id); - ++selected; - } + Inkscape::Util::GSListConstIterator selected = + sp_desktop_selection(desktop)->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer + while ( selected != NULL ) { + Glib::ustring selected_id; + selected_id += "--id="; + selected_id += (*selected)->getId(); + params.insert(params.begin(), selected_id); + ++selected; } file_listener fileout; @@ -728,30 +731,37 @@ void Script::effect(Inkscape::Extension::Effect *module, g_unlink(tempfilename_out.c_str()); - /* Do something with mydoc.... */ if (mydoc) { - doc->doc()->emitReconstructionStart(); - copy_doc(doc->doc()->rroot, mydoc->rroot); - doc->doc()->emitReconstructionFinish(); - SPObject *layer = NULL; - - // Getting the named view from the document generated by the extension - SPNamedView *nv = sp_document_namedview(mydoc, NULL); - - //Check if it has a default layer set up - if ( nv != NULL){ - if( nv->default_layer_id != 0 ) { - SPDocument *document = desktop->doc(); - //If so, get that layer - layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); + SPDocument* vd=doc->doc(); + if (vd != NULL) + { + vd->emitReconstructionStart(); + copy_doc(vd->rroot, mydoc->rroot); + vd->emitReconstructionFinish(); + SPObject *layer = NULL; + + // Getting the named view from the document generated by the extension + SPNamedView *nv = sp_document_namedview(mydoc, NULL); + + //Check if it has a default layer set up + if ( nv != NULL) + { + if( nv->default_layer_id != 0 ) { + SPDocument *document = desktop->doc(); + //If so, get that layer + if (document != NULL) + { + layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); + } + } + } + + sp_namedview_update_layers_from_document(desktop); + //If that layer exists, + if (layer) { + //set the current layer + desktop->setCurrentLayer(layer); } - } - - sp_namedview_update_layers_from_document(desktop); - //If that layer exists, - if (layer) { - //set the current layer - desktop->setCurrentLayer(layer); } mydoc->release(); } @@ -778,6 +788,11 @@ void Script::effect(Inkscape::Extension::Effect *module, */ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newroot) { + if ((oldroot == NULL) ||(newroot == NULL)) + { + g_warning("Error on copy_doc: NULL pointer input."); + return; + } std::vector delete_list; Inkscape::XML::Node * oldroot_namedview = NULL; -- cgit v1.2.3 From 3c82e8251460b21c8046a418a9fefb700db0a164 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 4 Jun 2013 01:52:40 -0700 Subject: Correct to compile against recent gtkmm, including updated macports versions. Fixes bug #1179338. Fixed bugs: - https://launchpad.net/bugs/1179338 (bzr r12346.1.1) --- src/extension/implementation/script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 69ce982d0..ce18d2108 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -19,6 +19,8 @@ # include #endif +#include + #include #include #include -- cgit v1.2.3 From 72d8e897c6b67e46b2a613c4743ef9c13de25059 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 6 Jun 2013 06:44:11 -0700 Subject: Added configure/ifdef guards to only bring in the needed #include if glibmm has it. (bzr r12353) --- src/extension/implementation/script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/extension/implementation/script.cpp') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index ce18d2108..f0fd3711b 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -19,7 +19,9 @@ # include #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H #include +#endif #include #include -- cgit v1.2.3