export.cpp revision f9ad29477e5b11b6a0af5ac0f0d4dab1a9c6ec1c
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * PNG export dialog.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Lauris Kaplinski <lauris@kaplinski.com>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * bulia byak <buliabyak@users.sf.net>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Jon A. Cruz <jon@joncruz.org>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Abhishek Sharma
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (C) 1999-2007 Authors
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (C) 2001-2002 Ximian, Inc.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Released under GNU GPL, read the file 'COPYING' for more information
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster// This has to be included prior to anything that includes setjmp.h, it croaks otherwise
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
static gint x = -1000, y = -1000, w = 0, h = 0; // impossible original values to make sure they are read from prefs
enum selection_type {
GtkWidget *t, int x, int y,
if (us) {
int pos = 0;
if (ll) {
if (lr) {
if (cb)
if (desktop)
for (int i = 0; i < SELECTION_NUMBER_OF; i++) {
dlg );
dlg );
dlg );
dlg );
dlg );
dlg );
return vb;
return filename;
sp_export_dialog (void)
if (!dlg) {
if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)))
const bool homogeneous = false;
dlg );
dlg );
dlg );
Gtk::Label *flabel = new Gtk::Label(_("<big><b>_Filename</b></big>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true);
const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str();
oextension = dynamic_cast<Inkscape::Extension::Output *>(Inkscape::Extension::db.get(text_extension));
gtk_widget_set_tooltip_text(be, _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)"));
gtk_widget_set_tooltip_text(he, _("In the exported image, hide all objects except those that are selected"));
gtk_widget_set_tooltip_text (GTK_WIDGET(b->gobj()), _("Export the bitmap file with these settings"));
gtk_button_set_label (GTK_BUTTON(be), g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num));
if (num > 0) {
int i = SELECTION_NUMBER_OF;
for (i = 0; i < SELECTION_NUMBER_OF; i++) {
current_key = (selection_type)(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(base), "selection-type")));
was_empty) {
TRUE );
current_key = (selection_type)(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(base), "selection-type")));
if (inkscape &&
selection &&
current_key = (selection_type)(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(base), "selection-type")));
switch (current_key) {
case SELECTION_DRAWING:
if ( SP_ACTIVE_DESKTOP ) {
if (bbox) {
case SELECTION_SELECTION:
FALSE );
if ( SP_ACTIVE_DESKTOP )
switch (key) {
case SELECTION_SELECTION:
case SELECTION_DRAWING:
if (bbox) {
case SELECTION_PAGE:
case SELECTION_CUSTOM:
switch (key) {
case SELECTION_PAGE:
case SELECTION_DRAWING: {
case SELECTION_SELECTION:
case SELECTION_CUSTOM:
static gint
return TRUE;
int evtcount;
return FALSE;
evtcount = 0;
return TRUE;
return dlg;
static gchar *
if ( !dot )
if (dirname) {
if (!path) {
return path;
if (!SP_ACTIVE_DESKTOP) return;
gint n = 0;
i != NULL;
i = i->next) {
if (!filename) {
const gchar *dpi_hint = item->getRepr()->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
if (dpi_hint) {
if (area) {
safeDir);
case SELECTION_PAGE:
case SELECTION_DRAWING: {
bool modified = false;
modified = true;
modified = true;
modified = true;
if (modified) {
case SELECTION_SELECTION: {
bool modified = false;
modified = true;
modified = true;
modified = true;
if (modified) {
/// @todo refactor this code to use ui/dialogs/filedialog.cpp
NULL );
#ifdef WITH_GNOME_VFS
if (gnome_vfs_initialized()) {
#ifdef WIN32
// code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp
WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL);
// TODO: Move this to nr-rect-fns.h.
static const selection_type test_order[SELECTION_NUMBER_OF] = {SELECTION_SELECTION, SELECTION_DRAWING, SELECTION_PAGE, SELECTION_CUSTOM};
this_test[0] = (selection_type)(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(base), "selection-type")));
for (int i = 0; i < SELECTION_NUMBER_OF; i++) {
switch (this_test[i]) {
case SELECTION_SELECTION:
case SELECTION_DRAWING: {
case SELECTION_PAGE: {
selection_type old = (selection_type)(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(base), "selection-type")));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(g_object_get_data(G_OBJECT(base), selection_names[old])), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(g_object_get_data(G_OBJECT(base), selection_names[key])), TRUE);
if (sp_unit_selector_update_test(reinterpret_cast<SPUnitSelector *>(g_object_get_data(G_OBJECT(base), "units")))) {
if (sp_unit_selector_update_test(reinterpret_cast<SPUnitSelector *>(g_object_get_data(G_OBJECT(base), "units")))) {
const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)g_object_get_data (G_OBJECT(base), "units") );
const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)g_object_get_data (G_OBJECT(base), "units"));