summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-05-12 00:26:49 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-05-12 00:26:49 +0000
commit3b42c3d705f97584d1cf614240aa1da7ce01a94b (patch)
tree4fa75458ce1e84e35a53d62b1fd32daada22423e /src
parentAdd Maren improvements prepare to merge (diff)
downloadinkscape-3b42c3d705f97584d1cf614240aa1da7ce01a94b.tar.gz
inkscape-3b42c3d705f97584d1cf614240aa1da7ce01a94b.zip
Fixes bugs: #1770760, #1770761, #1770763, #1770769 related to linked SVG
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/svg.cpp3
-rw-r--r--src/object/sp-image.cpp20
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/ui/contextmenu.cpp35
-rw-r--r--src/ui/contextmenu.h2
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp12
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
-rw-r--r--src/verbs.cpp4
8 files changed, 61 insertions, 17 deletions
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index 1043c0b09..c5ddb084c 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -225,8 +225,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri)
SPDocument * doc = SPDocument::createNewDoc (NULL, TRUE, TRUE);
- if (link) {
-
+ if (link && is_import) {
SPDocument * ret = SPDocument::createNewDoc(uri, TRUE);
SPNamedView *nv = sp_document_namedview(doc, NULL);
Glib::ustring display_unit = nv->display_units->abbr;
diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp
index 8d3a15f0b..6fd9e5c1e 100644
--- a/src/object/sp-image.cpp
+++ b/src/object/sp-image.cpp
@@ -509,6 +509,26 @@ gchar* SPImage::description() const {
this->pixbuf->width(),
this->pixbuf->height(),
href_desc) );
+
+ if (this->pixbuf == NULL &&
+ this->document)
+ {
+ Inkscape::Pixbuf * pb = NULL;
+ pb = sp_image_repr_read_image (
+ this->getRepr()->attribute("xlink:href"),
+ this->getRepr()->attribute("sodipodi:absref"),
+ this->document->getBase());
+
+ if (pb) {
+ ret = ( pb == NULL ? g_strdup_printf(_("[bad reference]: %s"), href_desc)
+ : g_strdup_printf(_("%d &#215; %d: %s"),
+ pb->width(),
+ pb->height(),
+ href_desc));
+ delete pb;
+ }
+ }
+
g_free(href_desc);
return ret;
}
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index 23040fcfd..620793dc5 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -280,6 +280,7 @@ static char const preferences_skeleton[] =
" <group id=\"autoscrolldistance\" value=\"-10\"/>\n"
" <group id=\"simplifythreshold\" value=\"0.002\"/>\n"
" <group id=\"bitmapeditor\" value=\"gimp\"/>\n"
+" <group id=\"svgeditor\" value=\"inkscape\"/>\n"
" <group id=\"bitmapautoreload\" value=\"1\"/>\n"
" <group id=\"dialogtype\" value=\"1\"/>\n"
#ifdef WIN32
diff --git a/src/ui/contextmenu.cpp b/src/ui/contextmenu.cpp
index 1a5691c3f..628b0b2fd 100644
--- a/src/ui/contextmenu.cpp
+++ b/src/ui/contextmenu.cpp
@@ -719,15 +719,25 @@ void ContextMenu::ImageProperties(void)
_desktop->_dlg_mgr->showDialog("ObjectAttributes");
}
-Glib::ustring ContextMenu::getImageEditorName() {
+Glib::ustring ContextMenu::getImageEditorName(bool is_svg) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring value;
- Glib::ustring choices = prefs->getString("/options/bitmapeditor/value");
- if (!choices.empty()) {
- value = choices;
- }
- else {
- value = "gimp";
+ if (!is_svg) {
+ Glib::ustring choices = prefs->getString("/options/bitmapeditor/value");
+ if (!choices.empty()) {
+ value = choices;
+ }
+ else {
+ value = "gimp";
+ }
+ } else {
+ Glib::ustring choices = prefs->getString("/options/svgeditor/value");
+ if (!choices.empty()) {
+ value = choices;
+ }
+ else {
+ value = "inkscape";
+ }
}
return value;
}
@@ -739,7 +749,8 @@ void ContextMenu::ImageEdit(void)
}
GError* errThing = 0;
- Glib::ustring cmdline = getImageEditorName();
+ Glib::ustring bmpeditor = getImageEditorName();
+ Glib::ustring cmdline = bmpeditor;
Glib::ustring name;
Glib::ustring fullname;
@@ -783,7 +794,13 @@ void ContextMenu::ImageEdit(void)
} else {
fullname = Glib::build_filename(Glib::get_current_dir(), name);
}
-
+ if (name.substr(name.find_last_of(".") + 1) == "SVG" ||
+ name.substr(name.find_last_of(".") + 1) == "svg" )
+ {
+ cmdline.erase(0, bmpeditor.length());
+ Glib::ustring svgeditor = getImageEditorName(true);
+ cmdline = svgeditor.append(cmdline);
+ }
cmdline.append(" '");
cmdline.append(fullname.c_str());
cmdline.append("'");
diff --git a/src/ui/contextmenu.h b/src/ui/contextmenu.h
index faae6358f..465767604 100644
--- a/src/ui/contextmenu.h
+++ b/src/ui/contextmenu.h
@@ -165,7 +165,7 @@ class ContextMenu : public Gtk::Menu
/**
* auxiliary function that loads the external image editor name from the settings.
*/
- Glib::ustring getImageEditorName();
+ Glib::ustring getImageEditorName(bool is_svg = false);
/**
* callback, is executed on clicking the "Embed Image" menu entry
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 18b38c68d..f0ac55736 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -1533,16 +1533,18 @@ void InkscapePreferences::initPageBitmaps()
{
/* Note: /options/bitmapoversample removed with Cairo renderer */
_page_bitmaps.add_group_header( _("Edit"));
- _misc_bitmap_autoreload.init(_("Automatically reload bitmaps"), "/options/bitmapautoreload/value", true);
+ _misc_bitmap_autoreload.init(_("Automatically reload images"), "/options/bitmapautoreload/value", true);
_page_bitmaps.add_line( false, "", _misc_bitmap_autoreload, "",
_("Automatically reload linked images when file is changed on disk"));
_misc_bitmap_editor.init("/options/bitmapeditor/value", true);
_page_bitmaps.add_line( false, _("_Bitmap editor:"), _misc_bitmap_editor, "", "", true);
+ _misc_svg_editor.init("/options/svgeditor/value", true);
+ _page_bitmaps.add_line( false, _("_SVG editor:"), _misc_svg_editor, "", "", true);
_page_bitmaps.add_group_header( _("Export"));
_importexport_export_res.init("/dialogs/export/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false);
_page_bitmaps.add_line( false, _("Default export _resolution:"), _importexport_export_res, _("dpi"),
- _("Default bitmap resolution (in dots per inch) in the Export dialog"), false);
+ _("Default image resolution (in dots per inch) in the Export dialog"), false);
_page_bitmaps.add_group_header( _("Create"));
_bitmap_copy_res.init("/options/createbitmap/resolution", 1.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false);
_page_bitmaps.add_line( false, _("Resolution for Create Bitmap _Copy:"), _bitmap_copy_res, _("dpi"),
@@ -1564,13 +1566,13 @@ void InkscapePreferences::initPageBitmaps()
Glib::ustring labels[] = {_("None (auto)"), _("Smooth (optimizeQuality)"), _("Blocky (optimizeSpeed)") };
Glib::ustring values[] = {"auto", "optimizeQuality", "optimizeSpeed"};
_bitmap_scale.init("/dialogs/import/scale", labels, values, G_N_ELEMENTS(values), "scale");
- _page_bitmaps.add_line( false, _("Bitmap scale (image-rendering):"), _bitmap_scale, "", "", false);
+ _page_bitmaps.add_line( false, _("Image scale (image-rendering):"), _bitmap_scale, "", "", false);
}
/* Note: /dialogs/import/quality removed use of in r12542 */
_importexport_import_res.init("/dialogs/import/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false);
_page_bitmaps.add_line( false, _("Default _import resolution:"), _importexport_import_res, _("dpi"),
- _("Default bitmap resolution (in dots per inch) for bitmap and SVG import"), false);
+ _("Default import resolution (in dots per inch) for bitmap and SVG import"), false);
_importexport_import_res_override.init(_("Override file resolution"), "/dialogs/import/forcexdpi", false);
_page_bitmaps.add_line( false, "", _importexport_import_res_override, "",
_("Use default bitmap resolution in favor of information from file"));
@@ -1580,7 +1582,7 @@ void InkscapePreferences::initPageBitmaps()
_rendering_image_outline.init( _("Images in Outline Mode"), "/options/rendering/imageinoutlinemode", false);
_page_bitmaps.add_line(false, "", _rendering_image_outline, "", _("When active will render images while in outline mode instead of a red box with an x. This is useful for manual tracing."));
- this->AddPage(_page_bitmaps, _("Bitmaps"), PREFS_PAGE_BITMAPS);
+ this->AddPage(_page_bitmaps, _("Imported Images"), PREFS_PAGE_BITMAPS);
}
void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui)
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 782e96a82..80df5ed65 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -375,6 +375,7 @@ protected:
// Bitmaps
UI::Widget::PrefCombo _misc_overs_bitmap;
UI::Widget::PrefEntryFileButtonHBox _misc_bitmap_editor;
+ UI::Widget::PrefEntryFileButtonHBox _misc_svg_editor;
UI::Widget::PrefCheckButton _misc_bitmap_autoreload;
UI::Widget::PrefSpinButton _bitmap_copy_res;
UI::Widget::PrefCheckButton _bitmap_ask;
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 4d86cf0ae..75830f290 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -894,7 +894,9 @@ void FileVerb::perform(SPAction *action, void *data)
prefs->setString("/options/openmethod/value", "done");
break;
case SP_VERB_FILE_REVERT:
+ prefs->setString("/options/openmethod/value", "revert");
sp_file_revert_dialog();
+ prefs->setString("/options/openmethod/value", "done");
break;
case SP_VERB_FILE_SAVE:
sp_file_save(*parent, NULL, NULL);
@@ -937,7 +939,9 @@ void FileVerb::perform(SPAction *action, void *data)
sp_ui_close_view(NULL);
break;
case SP_VERB_FILE_TEMPLATES:
+ prefs->setString("/options/openmethod/value", "template");
Inkscape::UI::NewFromTemplate::load_new_from_template();
+ prefs->setString("/options/openmethod/value", "done");
break;
default:
break;