Index: src/dialogs/export.cpp =================================================================== --- src/dialogs/export.cpp (revision 22775) +++ src/dialogs/export.cpp (working copy) @@ -635,8 +635,20 @@ gtk_tooltips_set_tip(tt, he, _("In the exported image, hide all objects except those that are selected"), NULL); hide_box->show_all(); vb->pack_start(*hide_box); + } + + { + Gtk::HBox* mutual_hide_box = new Gtk::HBox(FALSE, 5); + GtkWidget *mhe = gtk_check_button_new_with_label(_("Mutually hide selected")); + gtk_widget_set_sensitive(GTK_WIDGET(mhe), TRUE); + gtk_object_set_data(GTK_OBJECT(dlg), "mutual_hide_checkbox", mhe); + mutual_hide_box->pack_start(*Glib::wrap(mhe), false, false); + gtk_tooltips_set_tip(tt, mhe, _("When exporting batch images, even hides selected images other than the currently exported"), NULL); + mutual_hide_box->show_all(); + vb->pack_start(*mutual_hide_box); } + /* Buttons */ Gtk::HButtonBox* bb = new Gtk::HButtonBox(Gtk::BUTTONBOX_END); bb->set_border_width(3); @@ -677,6 +689,8 @@ gint num = g_slist_length((GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()); GtkWidget *be = (GtkWidget *)gtk_object_get_data(base, "batch_checkbox"); GtkWidget *he = (GtkWidget *)gtk_object_get_data(base, "hide_checkbox"); + GtkWidget *mhe = (GtkWidget *)gtk_object_get_data(base, "mutual_hide_checkbox"); + if (num >= 2) { gtk_widget_set_sensitive (be, true); gtk_button_set_label (GTK_BUTTON(be), g_strdup_printf (ngettext("Batch export %d selected object","Batch export %d selected objects",num), num)); @@ -684,11 +698,9 @@ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(be), FALSE); gtk_widget_set_sensitive (be, FALSE); } - if (num > 0) { - gtk_widget_set_sensitive (he, true); - } else { - gtk_widget_set_sensitive (he, false); - } + + gtk_widget_set_sensitive (mhe, num >= 2); + gtk_widget_set_sensitive (he, num > 0); } static inline void @@ -1092,6 +1104,12 @@ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (be))) { // Batch export of selected objects + GtkWidget *mhe = static_cast( + gtk_object_get_data(base, "mutual_hide_checkbox") ); + + bool batch_mutual_hide = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mhe)); + gint num = g_slist_length((GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()); gint n = 0; @@ -1134,11 +1152,24 @@ if (width > 1 && height > 1) { /* Do export */ + + GSList *items_to_show = NULL; + if (hide || batch_mutual_hide) { + items_to_show = batch_mutual_hide ? + // only the exact current item is shown + g_slist_append( + items_to_show, static_cast(item) ) : + + // all the selected items are shown + const_cast( + sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() ); + } + if (!sp_export_png_file (doc, path, *area, width, height, dpi, dpi, nv->pagecolor, NULL, NULL, TRUE, // overwrite without asking - hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL + items_to_show )) { gchar * error; gchar * safeFile = Inkscape::IO::sanitizeString(path); @@ -1147,6 +1178,11 @@ g_free(safeFile); g_free(error); } + + if (batch_mutual_hide) { + // free the previously created list + g_slist_free(items_to_show); + } } } n++;