From: joncruz Date: Sun, 18 May 2008 08:20:21 +0000 (+0000) Subject: Added preferences for controlling external image editing and reload. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7827e4e4b270302f7a06ecfb3bfbded295b974ce;p=inkscape.git Added preferences for controlling external image editing and reload. Fixes bug #171824. --- diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 939be9a82..3ac8b0bb8 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -226,6 +226,8 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" +" \n" " \n" " attribute("xlink:href"); GError* errThing = 0; - gchar const* args[] = {EDIT_APP, href, 0}; + gchar* editorBin = getImageEditorName(); + gchar const* args[] = {editorBin, href, 0}; g_spawn_async(0, // working dir const_cast(args), 0, //envp @@ -339,6 +358,7 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor) g_error_free(errThing); errThing = 0; } + g_free(editorBin); } /* SPShape */ diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index effbeb328..f8e7b8e08 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -901,12 +901,13 @@ void InkscapePreferences::initPageMisc() _page_misc.add_line( false, _("Simplification threshold:"), _misc_simpl, "", _("How strong is the Simplify command by default. If you invoke this command several times in quick succession, it will act more and more aggressively; invoking it again after a pause restores the default threshold."), false); - int const num_items = 5; - Glib::ustring labels[num_items] = {_("None"), _("2x2"), _("4x4"), _("8x8"), _("16x16")}; - int values[num_items] = {0, 1, 2, 3, 4}; - _misc_overs_bitmap.set_size_request(_sb_width); - _misc_overs_bitmap.init("options.bitmapoversample", "value", labels, values, num_items, 1); - _page_misc.add_line( false, _("Oversample bitmaps:"), _misc_overs_bitmap, "", "", false); + { + Glib::ustring labels[] = {_("None"), _("2x2"), _("4x4"), _("8x8"), _("16x16")}; + int values[] = {0, 1, 2, 3, 4}; + _misc_overs_bitmap.set_size_request(_sb_width); + _misc_overs_bitmap.init("options.bitmapoversample", "value", labels, values, G_N_ELEMENTS(values), 1); + _page_misc.add_line( false, _("Oversample bitmaps:"), _misc_overs_bitmap, "", "", false); + } // consider moving this to an UI tab: @@ -931,6 +932,30 @@ void InkscapePreferences::initPageMisc() _("The maximum length of the Open Recent list in the File menu"), false); _misc_simpl.init("options.simplifythreshold", "value", 0.0001, 1.0, 0.0001, 0.0010, 0.0010, false, false); + + // ----------- + + _misc_bitmap_autoreload.init(_("Automatically reload bitmaps"), "options.bitmapautoreload", "value", true); + _page_misc.add_line( false, "", _misc_bitmap_autoreload, "", + _("Enbles automatic reload of linked images when changed on disk.")); + gchar const *choices = prefs_get_string_attribute("options.bitmapeditor", "choices"); + if ( choices && choices[0] ) { + gchar** splits = g_strsplit(choices, ",", 0); + gint numIems = g_strv_length(splits); + + Glib::ustring labels[numIems]; + int values[numIems]; + for ( gint i = 0; i < numIems; i++) { + values[i] = i; + labels[i] = splits[i]; + } + _misc_bitmap_editor.init("options.bitmapeditor", "value", labels, values, numIems, 0); + _page_misc.add_line( false, _("Bitmap editor:"), _misc_bitmap_editor, "", "", false); + + g_strfreev(splits); + } + + this->AddPage(_page_misc, _("Misc"), PREFS_PAGE_MISC); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index a1a577b95..5202e09d3 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -166,6 +166,8 @@ protected: PrefCombo _misc_small_secondary; PrefCombo _misc_small_tools; PrefCombo _misc_overs_bitmap; + PrefCombo _misc_bitmap_editor; + PrefCheckButton _misc_bitmap_autoreload; Gtk::ComboBoxText _cms_display_profile; PrefCheckButton _cms_from_display; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 3fd0e529e..c6e36aa8e 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1439,7 +1439,8 @@ sp_desktop_widget_adjustment_value_changed (GtkAdjustment */*adj*/, SPDesktopWid /* we make the desktop window with focus active, signal is connected in interface.c */ bool SPDesktopWidget::onFocusInEvent(GdkEventFocus*) { - { + + if (prefs_get_int_attribute_limited("options.bitmapautoreload", "value", 1, 0, 1)) { GSList const *imageList = sp_document_get_resource_list(desktop->doc(), "image"); for (GSList const *p = imageList; p; p = p->next) { SPImage* image = SP_IMAGE(p->data);