62
70
#define EXPORT_COORD_PRECISION 3
72
#define MIN_ONSCREEN_DISTANCE 50
64
74
static void sp_export_area_toggled ( GtkToggleButton *tb, GtkObject *base );
65
75
static void sp_export_export_clicked ( GtkButton *button, GtkObject *base );
66
76
static void sp_export_browse_clicked ( GtkButton *button, gpointer userdata );
68
static void sp_export_area_x_value_changed ( GtkAdjustment *adj,
71
static void sp_export_area_y_value_changed ( GtkAdjustment *adj,
74
static void sp_export_area_width_value_changed ( GtkAdjustment *adj,
77
static void sp_export_area_height_value_changed ( GtkAdjustment *adj,
80
static void sp_export_bitmap_width_value_changed ( GtkAdjustment *adj,
83
static void sp_export_bitmap_height_value_changed ( GtkAdjustment *adj,
86
static void sp_export_xdpi_value_changed ( GtkAdjustment *adj,
89
static void sp_export_selection_changed ( Inkscape::Application *inkscape,
90
Inkscape::Selection *selection,
78
static void sp_export_area_x_value_changed ( GtkAdjustment *adj,
81
static void sp_export_area_y_value_changed ( GtkAdjustment *adj,
84
static void sp_export_area_width_value_changed ( GtkAdjustment *adj,
87
static void sp_export_area_height_value_changed ( GtkAdjustment *adj,
90
static void sp_export_bitmap_width_value_changed ( GtkAdjustment *adj,
93
static void sp_export_bitmap_height_value_changed ( GtkAdjustment *adj,
96
static void sp_export_xdpi_value_changed ( GtkAdjustment *adj,
99
static void sp_export_selection_changed ( Inkscape::Application *inkscape,
100
Inkscape::Selection *selection,
92
static void sp_export_selection_modified ( Inkscape::Application *inkscape,
93
Inkscape::Selection *selection,
102
static void sp_export_selection_modified ( Inkscape::Application *inkscape,
103
Inkscape::Selection *selection,
95
105
GtkObject *base );
280
290
b->set_data("key", GINT_TO_POINTER(i));
281
291
gtk_object_set_data (GTK_OBJECT (dlg), selection_names[i], b->gobj());
282
292
togglebox->pack_start(*b, false, true, 0);
283
gtk_signal_connect ( GTK_OBJECT (b->gobj()), "clicked",
293
gtk_signal_connect ( GTK_OBJECT (b->gobj()), "clicked",
284
294
GTK_SIGNAL_FUNC (sp_export_area_toggled), dlg );
287
g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection",
297
g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection",
288
298
G_CALLBACK (sp_export_selection_changed), dlg );
289
g_signal_connect ( G_OBJECT (INKSCAPE), "modify_selection",
299
g_signal_connect ( G_OBJECT (INKSCAPE), "modify_selection",
290
300
G_CALLBACK (sp_export_selection_modified), dlg );
291
g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop",
301
g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop",
292
302
G_CALLBACK (sp_export_selection_changed), dlg );
294
304
Gtk::Table* t = new Gtk::Table(2, 6, FALSE);
295
305
t->set_row_spacings (4);
296
306
t->set_col_spacings (4);
298
sp_export_spinbutton_new ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
308
sp_export_spinbutton_new ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
299
309
GTK_WIDGET(t->gobj()), 0, 0, _("_x0:"), NULL, EXPORT_COORD_PRECISION, 1,
300
G_CALLBACK ( sp_export_area_x_value_changed),
310
G_CALLBACK ( sp_export_area_x_value_changed),
303
sp_export_spinbutton_new ( "x1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
313
sp_export_spinbutton_new ( "x1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
304
314
GTK_WIDGET(t->gobj()), 2, 0, _("x_1:"), NULL, EXPORT_COORD_PRECISION, 1,
305
G_CALLBACK (sp_export_area_x_value_changed),
315
G_CALLBACK (sp_export_area_x_value_changed),
308
sp_export_spinbutton_new ( "width", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
318
sp_export_spinbutton_new ( "width", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
309
319
us->gobj(), GTK_WIDGET(t->gobj()), 4, 0, _("Width:"), NULL, EXPORT_COORD_PRECISION, 1,
311
(sp_export_area_width_value_changed),
321
(sp_export_area_width_value_changed),
314
sp_export_spinbutton_new ( "y0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
324
sp_export_spinbutton_new ( "y0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
315
325
GTK_WIDGET(t->gobj()), 0, 1, _("_y0:"), NULL, EXPORT_COORD_PRECISION, 1,
316
G_CALLBACK (sp_export_area_y_value_changed),
326
G_CALLBACK (sp_export_area_y_value_changed),
319
sp_export_spinbutton_new ( "y1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
329
sp_export_spinbutton_new ( "y1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, us->gobj(),
320
330
GTK_WIDGET(t->gobj()), 2, 1, _("y_1:"), NULL, EXPORT_COORD_PRECISION, 1,
321
G_CALLBACK (sp_export_area_y_value_changed),
331
G_CALLBACK (sp_export_area_y_value_changed),
324
sp_export_spinbutton_new ( "height", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
334
sp_export_spinbutton_new ( "height", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
325
335
us->gobj(), GTK_WIDGET(t->gobj()), 4, 1, _("Height:"), NULL, EXPORT_COORD_PRECISION, 1,
326
G_CALLBACK (sp_export_area_height_value_changed),
336
G_CALLBACK (sp_export_area_height_value_changed),
329
339
vb->pack_start(*togglebox, false, false, 3);
334
344
} // end of sp_export_dialog_area_box
347
gchar* create_filepath_from_id (const gchar *id, const gchar *file_entry_text) {
349
if (id == NULL) /* This should never happen */
352
gchar * directory = NULL;
354
if (directory == NULL && file_entry_text != NULL && file_entry_text[0] != '\0') {
355
// std::cout << "Directory from dialog" << std::endl;
356
directory = g_dirname(file_entry_text);
359
if (directory == NULL) {
360
/* Grab document directory */
361
if (SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT)) {
362
// std::cout << "Directory from document" << std::endl;
363
directory = g_dirname(SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT));
367
if (directory == NULL) {
368
// std::cout << "Home Directory" << std::endl;
369
directory = homedir_path(NULL);
372
gchar * id_ext = g_strconcat(id, ".png", NULL);
373
gchar *filename = g_build_filename(directory, id_ext, NULL);
380
batch_export_clicked (GtkWidget *widget, GtkObject *base)
382
Gtk::Widget *vb_singleexport = (Gtk::Widget *)gtk_object_get_data(base, "vb_singleexport");
383
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget))) {
384
vb_singleexport->set_sensitive(false);
386
vb_singleexport->set_sensitive(true);
338
391
sp_export_dialog (void)
344
395
gchar title[500];
345
396
sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_FILE_EXPORT), title);
422
474
t->set_col_spacings (4);
423
475
size_box->pack_start(*t);
425
sp_export_spinbutton_new ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0,
477
sp_export_spinbutton_new ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0,
426
478
NULL, GTK_WIDGET(t->gobj()), 0, 0,
427
479
_("_Width:"), _("pixels at"), 0, 1,
429
(sp_export_bitmap_width_value_changed),
481
(sp_export_bitmap_width_value_changed),
432
sp_export_spinbutton_new ( "xdpi",
433
prefs_get_double_attribute
434
( "dialogs.export.defaultxdpi",
484
sp_export_spinbutton_new ( "xdpi",
485
prefs_get_double_attribute
486
( "dialogs.export.defaultxdpi",
436
488
0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 0,
437
489
NULL, _("dp_i"), 2, 1,
438
G_CALLBACK (sp_export_xdpi_value_changed),
490
G_CALLBACK (sp_export_xdpi_value_changed),
441
sp_export_spinbutton_new ( "bmheight", 16.0, 1.0, 1000000.0, 1.0, 10.0,
442
NULL, GTK_WIDGET(t->gobj()), 0, 1,
443
_("Height:"), _("pixels at"), 0, 1,
493
sp_export_spinbutton_new ( "bmheight", 16.0, 1.0, 1000000.0, 1.0, 10.0,
494
NULL, GTK_WIDGET(t->gobj()), 0, 1,
495
_("Height:"), _("pixels at"), 0, 1,
445
(sp_export_bitmap_height_value_changed),
497
(sp_export_bitmap_height_value_changed),
449
* Needs fixing: there's no way to set ydpi currently, so we use
501
* Needs fixing: there's no way to set ydpi currently, so we use
450
502
* the defaultxdpi value here, too...
452
sp_export_spinbutton_new ( "ydpi", prefs_get_double_attribute
453
( "dialogs.export.defaultxdpi",
504
sp_export_spinbutton_new ( "ydpi", prefs_get_double_attribute
505
( "dialogs.export.defaultxdpi",
455
507
0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 1,
456
508
NULL, _("dpi"), 2, 0, NULL, dlg );
458
vb->pack_start(*size_box);
510
vb_singleexport->pack_start(*size_box);
559
611
// mnemonic in frame label moves focus to filename:
560
612
flabel->set_mnemonic_widget(*fe);
562
vb->pack_start(*file_box);
614
vb_singleexport->pack_start(*file_box);
618
Gtk::HBox* batch_box = new Gtk::HBox(FALSE, 5);
619
GtkWidget *be = gtk_check_button_new_with_label(_("Batch export all selected objects"));
620
gtk_widget_set_sensitive(GTK_WIDGET(be), TRUE);
621
gtk_object_set_data(GTK_OBJECT(dlg), "batch_checkbox", be);
622
batch_box->pack_start(*Glib::wrap(be), false, false);
623
gtk_tooltips_set_tip(tt, be, _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)"), NULL);
624
batch_box->show_all();
625
g_signal_connect(G_OBJECT(be), "toggled", GTK_SIGNAL_FUNC(batch_export_clicked), dlg);
626
vb->pack_start(*batch_box);
630
Gtk::HBox* hide_box = new Gtk::HBox(FALSE, 5);
631
GtkWidget *he = gtk_check_button_new_with_label(_("Hide all except selected"));
632
gtk_widget_set_sensitive(GTK_WIDGET(he), TRUE);
633
gtk_object_set_data(GTK_OBJECT(dlg), "hide_checkbox", he);
634
hide_box->pack_start(*Glib::wrap(he), false, false);
635
gtk_tooltips_set_tip(tt, he, _("In the exported image, hide all objects except those that are selected"), NULL);
636
hide_box->show_all();
637
vb->pack_start(*hide_box);
845
921
case SELECTION_SELECTION:
846
922
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
847
const GSList * reprlst;
848
bool filename_search = TRUE;
849
bool xdpi_search = TRUE;
850
bool ydpi_search = TRUE;
852
reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
853
for(; reprlst != NULL &&
857
reprlst = reprlst->next) {
858
const gchar * dpi_string;
859
Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data;
861
if (filename_search) {
862
filename = repr->attribute("inkscape:export-filename");
863
if (filename != NULL)
864
filename_search = FALSE;
869
dpi_string = repr->attribute("inkscape:export-xdpi");
870
if (dpi_string != NULL) {
871
xdpi = atof(dpi_string);
878
dpi_string = repr->attribute("inkscape:export-ydpi");
879
if (dpi_string != NULL) {
880
ydpi = atof(dpi_string);
924
sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), &filename, &xdpi, &ydpi);
886
926
/* If we still don't have a filename -- let's build
887
927
one that's nice */
888
928
if (filename == NULL) {
889
929
const gchar * id = NULL;
890
reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
930
const GSList * reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
891
931
for(; reprlst != NULL; reprlst = reprlst->next) {
892
932
Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data;
893
933
if (repr->attribute("id")) {
994
1007
} // end of sp_export_progress_callback()
1010
create_progress_dialog (GtkObject *base, gchar *progress_text) {
1011
GtkWidget *dlg, *prg, *btn; /* progressbar-stuff */
1013
dlg = gtk_dialog_new ();
1014
gtk_window_set_title (GTK_WINDOW (dlg), _("Export in progress"));
1015
prg = gtk_progress_bar_new ();
1016
sp_transientize (dlg);
1017
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
1018
g_object_set_data ((GObject *) base, "progress", prg);
1020
gtk_progress_bar_set_text ((GtkProgressBar *) prg, progress_text);
1022
gtk_progress_bar_set_orientation ( (GtkProgressBar *) prg,
1023
GTK_PROGRESS_LEFT_TO_RIGHT);
1024
gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dlg)->vbox,
1025
prg, FALSE, FALSE, 4 );
1026
btn = gtk_dialog_add_button ( GTK_DIALOG (dlg),
1028
GTK_RESPONSE_CANCEL );
1030
g_signal_connect ( (GObject *) dlg, "delete_event",
1031
(GCallback) sp_export_progress_delete, base);
1032
g_signal_connect ( (GObject *) btn, "clicked",
1033
(GCallback) sp_export_progress_cancel, base);
1034
gtk_window_set_modal ((GtkWindow *) dlg, TRUE);
1035
gtk_widget_show_all (dlg);
1040
// FIXME: Some lib function should be available to do this ...
1042
filename_add_extension (const gchar *filename, const gchar *extension)
1046
dot = strrchr (filename, '.');
1048
return g_strconcat (filename, ".", extension, NULL);
1051
return g_strconcat (filename, extension, NULL);
1054
if (g_strcasecmp (dot + 1, extension) == 0)
1055
return g_strdup (filename);
1058
return g_strconcat (filename, ".", extension, NULL);
996
1064
/// Called when export button is clicked
998
sp_export_export_clicked (GtkButton *button, GtkObject *base)
1066
sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
1000
1068
if (!SP_ACTIVE_DESKTOP) return;
1070
SPNamedView *nv = sp_desktop_namedview(SP_ACTIVE_DESKTOP);
1072
GtkWidget *be = (GtkWidget *)gtk_object_get_data(base, "batch_checkbox");
1073
GtkWidget *he = (GtkWidget *)gtk_object_get_data(base, "hide_checkbox");
1074
bool hide = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (he));
1075
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (be))) {
1076
// Batch export of selected objects
1078
gint num = g_slist_length((GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList());
1084
gchar *progress_text = g_strdup_printf (_("Exporting %d files"), num);
1085
GtkWidget *prog_dlg = create_progress_dialog (base, progress_text);
1086
g_free (progress_text);
1088
for (GSList *i = (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList();
1091
SPItem *item = (SPItem *) i->data;
1092
// retrieve export filename hint
1093
const gchar *fn = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename");
1095
fn = create_filepath_from_id (SP_OBJECT_ID(item), NULL);
1098
// retrieve export dpi hints
1099
const gchar *dpi_hint = SP_OBJECT_REPR(item)->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
1102
dpi = atof(dpi_hint);
1109
sp_item_invoke_bbox(item, &area, sp_item_i2r_affine((SPItem *) item), TRUE);
1111
gint width = (gint) ((area.x1 - area.x0) * dpi / PX_PER_IN + 0.5);
1112
gint height = (gint) ((area.y1 - area.y0) * dpi / PX_PER_IN + 0.5);
1114
if (width > 1 && height > 1) {
1116
if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), fn,
1117
area.x0, area.y0, area.x1, area.y1, width, height, dpi, dpi,
1119
NULL, NULL, TRUE, // overwrite without asking
1120
hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL
1123
gchar * safeFile = Inkscape::IO::sanitizeString(fn);
1124
error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
1125
sp_ui_error_dialog(error);
1131
sp_export_progress_callback((float)n/num, base);
1134
gtk_widget_destroy (prog_dlg);
1135
g_object_set_data (G_OBJECT (base), "cancel", (gpointer) 0);
1002
1139
GtkWidget *fe = (GtkWidget *)gtk_object_get_data(base, "filename");
1003
1140
gchar const *filename = gtk_entry_get_text(GTK_ENTRY(fe));
1037
1174
g_free(dirname);
1039
SPNamedView *nv = sp_desktop_namedview(SP_ACTIVE_DESKTOP);
1040
GtkWidget *dlg, *prg, *btn; /* progressbar-stuff */
1044
dlg = gtk_dialog_new ();
1045
gtk_window_set_title (GTK_WINDOW (dlg), _("Export in progress"));
1046
prg = gtk_progress_bar_new ();
1047
sp_transientize (dlg);
1048
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
1049
g_object_set_data ((GObject *) base, "progress", prg);
1050
fn = g_path_get_basename (filename);
1051
text = g_strdup_printf ( _("Exporting %s (%d x %d)"),
1176
// make sure that .png is the extension of the file:
1177
gchar * filename_ext = filename_add_extension(filename, "png");
1178
gtk_entry_set_text(GTK_ENTRY(fe), filename_ext);
1180
gchar *fn = g_path_get_basename (filename_ext);
1182
gchar *progress_text = g_strdup_printf (_("Exporting %s (%lu x %lu)"), fn, width, height);
1054
gtk_progress_bar_set_text ((GtkProgressBar *) prg, text);
1056
gtk_progress_bar_set_orientation ( (GtkProgressBar *) prg,
1057
GTK_PROGRESS_LEFT_TO_RIGHT);
1058
gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dlg)->vbox,
1059
prg, FALSE, FALSE, 4 );
1060
btn = gtk_dialog_add_button ( GTK_DIALOG (dlg),
1062
GTK_RESPONSE_CANCEL );
1064
g_signal_connect ( (GObject *) dlg, "delete_event",
1065
(GCallback) sp_export_progress_delete, base);
1066
g_signal_connect ( (GObject *) btn, "clicked",
1067
(GCallback) sp_export_progress_cancel, base);
1068
gtk_window_set_modal ((GtkWindow *) dlg, TRUE);
1069
gtk_widget_show_all (dlg);
1184
GtkWidget *prog_dlg = create_progress_dialog (base, progress_text);
1185
g_free (progress_text);
1071
1187
/* Do export */
1072
if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), filename,
1073
x0, y0, x1, y1, width, height, xdpi, ydpi,
1075
sp_export_progress_callback, base)) {
1188
if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), filename_ext,
1189
x0, y0, x1, y1, width, height, xdpi, ydpi,
1191
sp_export_progress_callback, base, FALSE,
1192
hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL
1077
1195
gchar * safeFile = Inkscape::IO::sanitizeString(filename);
1078
1196
error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
1096
1214
case SELECTION_DRAWING: {
1097
1215
SPDocument * doc = SP_ACTIVE_DOCUMENT;
1098
1216
Inkscape::XML::Node * repr = sp_document_repr_root(doc);
1099
bool modified = FALSE;
1217
bool modified = false;
1100
1218
const gchar * temp_string;
1102
1220
bool saved = sp_document_get_undo_sensitive(doc);
1103
sp_document_set_undo_sensitive(doc, FALSE);
1221
sp_document_set_undo_sensitive(doc, false);
1105
1223
temp_string = repr->attribute("inkscape:export-filename");
1106
if (temp_string == NULL || strcmp(temp_string, filename)) {
1107
repr->setAttribute("inkscape:export-filename", filename);
1224
if (temp_string == NULL || strcmp(temp_string, filename_ext)) {
1225
repr->setAttribute("inkscape:export-filename", filename_ext);
1110
1228
temp_string = repr->attribute("inkscape:export-xdpi");
1111
1229
if (temp_string == NULL || xdpi != atof(temp_string)) {
1112
1230
sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
1115
1233
temp_string = repr->attribute("inkscape:export-ydpi");
1116
1234
if (temp_string == NULL || xdpi != atof(temp_string)) {
1117
1235
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
1238
sp_document_set_undo_sensitive(doc, saved);
1122
repr->setAttribute("sodipodi:modified", "TRUE");
1123
sp_document_set_undo_sensitive(doc, saved);
1241
doc->setModifiedSinceSave();
1126
1245
case SELECTION_SELECTION: {
1127
1246
const GSList * reprlst;
1128
1247
SPDocument * doc = SP_ACTIVE_DOCUMENT;
1129
bool modified = FALSE;
1248
bool modified = false;
1131
1250
bool saved = sp_document_get_undo_sensitive(doc);
1132
sp_document_set_undo_sensitive(doc, FALSE);
1251
sp_document_set_undo_sensitive(doc, false);
1133
1252
reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
1135
1254
for(; reprlst != NULL; reprlst = reprlst->next) {
1137
1256
const gchar * temp_string;
1139
1258
if (repr->attribute("id") == NULL ||
1140
!(g_strrstr(filename, repr->attribute("id")) != NULL &&
1259
!(g_strrstr(filename_ext, repr->attribute("id")) != NULL &&
1141
1260
(!SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT) ||
1142
1261
strcmp(g_dirname(filename), g_dirname(SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT))) == 0))) {
1143
1262
temp_string = repr->attribute("inkscape:export-filename");
1144
if (temp_string == NULL || strcmp(temp_string, filename)) {
1145
repr->setAttribute("inkscape:export-filename", filename);
1263
if (temp_string == NULL || strcmp(temp_string, filename_ext)) {
1264
repr->setAttribute("inkscape:export-filename", filename_ext);
1149
1268
temp_string = repr->attribute("inkscape:export-xdpi");
1150
1269
if (temp_string == NULL || xdpi != atof(temp_string)) {
1151
1270
sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
1154
1273
temp_string = repr->attribute("inkscape:export-ydpi");
1155
1274
if (temp_string == NULL || xdpi != atof(temp_string)) {
1156
1275
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
1279
sp_document_set_undo_sensitive(doc, saved);
1161
1281
if (modified) {
1162
Inkscape::XML::Node * repr = sp_document_repr_root(doc);
1163
repr->setAttribute("sodipodi:modified", "TRUE");
1282
doc->setModifiedSinceSave();
1166
sp_document_set_undo_sensitive(doc, saved);
1290
g_free (filename_ext);
1175
1294
} // end of sp_export_export_clicked()
1177
1296
/// Called when Browse button is clicked
1179
sp_export_browse_clicked (GtkButton *button, gpointer userdata)
1298
sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/)
1181
1300
GtkWidget *fs, *fe;
1182
1301
const gchar *filename;
1184
1303
fs = gtk_file_chooser_dialog_new (_("Select a filename for exporting"),
1186
1305
GTK_FILE_CHOOSER_ACTION_SAVE,
1187
1306
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1188
1307
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
1310
#ifdef WITH_GNOME_VFS
1311
if (gnome_vfs_initialized()) {
1312
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fs), false);
1191
1316
fe = (GtkWidget *)g_object_get_data (G_OBJECT (dlg), "filename");
1193
1318
sp_transientize (fs);