export.cpp revision 081a843d20a46d9526f6be83a913635cf5717188
0N/A#ifdef HAVE_CONFIG_H
0N/A#ifdef WITH_GNOME_VFS
0N/A#include "helper/unit-menu.h"
0N/A#include "unit-constants.h"
0N/A#include "inkscape-private.h"
0N/A#include "document.h"
0N/A#include "desktop-handles.h"
0N/A#include "selection.h"
0N/A#include "sp-namedview.h"
0N/A#include "selection-chemistry.h"
0N/A#include "dialog-events.h"
243N/A#include "preferences.h"
0N/A#include "interface.h"
0N/A#include "helper/png-write.h"
0N/Astatic gint x = -1000, y = -1000, w = 0, h = 0; // impossible original values to make sure they are read from prefs
0N/Aenum selection_type {
0N/A sp_unit_selector_set_unit (SP_UNIT_SELECTOR(us->gobj()), sp_desktop_namedview(desktop)->doc_units);
0N/A for (int i = 0; i < SELECTION_NUMBER_OF; i++) {
0N/Asp_export_dialog (void)
0N/A if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)))
0N/A const bool homogeneous = false;
0N/A sp_export_spinbutton_new ( "ydpi", prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE),
0N/A Gtk::Label *flabel = new Gtk::Label(_("<big><b>_Filename</b></big>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true);
0N/A const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str();
0N/A oextension = dynamic_cast<Inkscape::Extension::Output *>(Inkscape::Extension::db.get(text_extension));
0N/A 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);
0N/A gtk_tooltips_set_tip(tt, he, _("In the exported image, hide all objects except those that are selected"), NULL);
0N/A gtk_tooltips_set_tip (tt, GTK_WIDGET(b->gobj()), _("Export the bitmap file with these settings"), NULL);
0N/A gtk_button_set_label (GTK_BUTTON(be), g_strdup_printf (ngettext("Batch export %d selected object","Batch export %d selected objects",num), num));
0N/A int i = SELECTION_NUMBER_OF;
0N/A for (i = 0; i < SELECTION_NUMBER_OF; i++) {
0N/A current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
0N/A current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
886N/A current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
0N/A switch (current_key) {
0N/A case SELECTION_DRAWING:
0N/A if ( SP_ACTIVE_DESKTOP ) {
0N/A case SELECTION_SELECTION:
1045N/A old_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
886N/A if ( SP_ACTIVE_DESKTOP )
886N/A case SELECTION_SELECTION:
886N/A case SELECTION_DRAWING:
1058N/A case SELECTION_PAGE:
1338N/A case SELECTION_CUSTOM:
1976N/A case SELECTION_PAGE:
1976N/A case SELECTION_DRAWING: {
1976N/A case SELECTION_SELECTION:
1976N/A sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), &filename, &xdpi, &ydpi);
1976N/A case SELECTION_CUSTOM:
0N/A if (!SP_ACTIVE_DESKTOP) return;
0N/A const gchar *dpi_hint = SP_OBJECT_REPR(item)->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
0N/A switch ((selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")))) {
0N/A case SELECTION_PAGE:
0N/A case SELECTION_DRAWING: {
0N/A case SELECTION_SELECTION: {
0N/A/// @todo refactor this code to use ui/dialogs/filedialog.cpp
0N/A#ifdef WITH_GNOME_VFS
0N/A if (gnome_vfs_initialized()) {
0N/A // code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp
0N/A WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL);
0N/A gchar *utf8string = g_utf16_to_utf8((const gunichar2*)opf.lpstrFile, _MAX_PATH, NULL, NULL, NULL);
0N/A// TODO: Move this to nr-rect-fns.h.
0N/A static const selection_type test_order[SELECTION_NUMBER_OF] = {SELECTION_SELECTION, SELECTION_DRAWING, SELECTION_PAGE, SELECTION_CUSTOM};
0N/A this_test[0] = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
0N/A for (int i = 0; i < SELECTION_NUMBER_OF; i++) {
0N/A case SELECTION_SELECTION:
0N/A case SELECTION_DRAWING: {
0N/A case SELECTION_PAGE: {
0N/A selection_type old = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
0N/A gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_object_get_data(base, selection_names[old])), FALSE);
0N/A gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_object_get_data(base, selection_names[key])), TRUE);
0N/A const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)gtk_object_get_data (base, "units") );
0N/A const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)gtk_object_get_data (base, "units"));