index cd9523036cf4190bdb4ef8649f9e8ce25175062f..94067a921ea289659776da7fe91cd75c84454729 100644 (file)
-/**\r
- * Implementation of the file dialog interfaces defined in filedialogimpl.h\r
- *\r
- * Authors:\r
- * Bob Jamison\r
- * Joel Holdsworth\r
- * Other dudes from The Inkscape Organization\r
- *\r
- * Copyright (C) 2004-2007 Bob Jamison\r
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>\r
- * Copyright (C) 2004-2007 The Inkscape Organization\r
- * Copyright (C) 2007 Joel Holdsworth\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
- \r
-#include "filedialog.h"\r
- \r
-//General includes\r
-#include <unistd.h>\r
-#include <sys/stat.h>\r
-#include <errno.h>\r
-#include <set>\r
-\r
-//Gtk includes\r
-#include <glibmm/i18n.h>\r
-#include <glib/gstdio.h>\r
-\r
-//Temporary ugly hack\r
-//Remove this after the get_filter() calls in\r
-//show() on both classes are fixed\r
-#include <gtk/gtkfilechooser.h>\r
-\r
-//Another hack\r
-#include <gtk/gtkentry.h>\r
-#include <gtk/gtkexpander.h>\r
-#ifdef WITH_GNOME_VFS\r
-# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized\r
-#endif\r
-\r
-//Inkscape includes\r
-#include "prefs-utils.h"\r
-#include <extension/input.h>\r
-#include <extension/output.h>\r
-#include <extension/db.h>\r
-#include "inkscape.h"\r
-#include "svg-view-widget.h"\r
-#include "gc-core.h"\r
-\r
-//For export dialog\r
-#include "ui/widget/scalar-unit.h"\r
- \r
-namespace Inkscape\r
-{\r
-namespace UI\r
-{\r
-namespace Dialog\r
-{\r
-\r
-/*#########################################################################\r
-### SVG Preview Widget\r
-#########################################################################*/\r
-\r
-/**\r
- * Simple class for displaying an SVG file in the "preview widget."\r
- * Currently, this is just a wrapper of the sp_svg_view Gtk widget.\r
- * Hopefully we will eventually replace with a pure Gtkmm widget.\r
- */\r
-class SVGPreview : public Gtk::VBox\r
-{\r
-public:\r
-\r
- SVGPreview();\r
-\r
- ~SVGPreview();\r
-\r
- bool setDocument(SPDocument *doc);\r
-\r
- bool setFileName(Glib::ustring &fileName);\r
-\r
- bool setFromMem(char const *xmlBuffer);\r
-\r
- bool set(Glib::ustring &fileName, int dialogType);\r
-\r
- bool setURI(URI &uri);\r
-\r
- /**\r
- * Show image embedded in SVG\r
- */\r
- void showImage(Glib::ustring &fileName);\r
-\r
- /**\r
- * Show the "No preview" image\r
- */\r
- void showNoPreview();\r
-\r
- /**\r
- * Show the "Too large" image\r
- */\r
- void showTooLarge(long fileLength);\r
-\r
-private:\r
- /**\r
- * The svg document we are currently showing\r
- */\r
- SPDocument *document;\r
-\r
- /**\r
- * The sp_svg_view widget\r
- */\r
- GtkWidget *viewerGtk;\r
-\r
- /**\r
- * are we currently showing the "no preview" image?\r
- */\r
- bool showingNoPreview;\r
-\r
-};\r
-\r
-/*#########################################################################\r
-### F I L E D I A L O G B A S E C L A S S\r
-#########################################################################*/\r
-\r
-/**\r
- * This class is the base implementation for the others. This\r
- * reduces redundancies and bugs.\r
- */\r
-class FileDialogBaseGtk : public Gtk::FileChooserDialog\r
-{\r
-public:\r
-\r
- /**\r
- *\r
- */\r
- FileDialogBaseGtk(Gtk::Window& parentWindow, const Glib::ustring &title,\r
- FileDialogType type, gchar const* preferenceBase) :\r
- Gtk::FileChooserDialog(parentWindow, title),\r
- preferenceBase(preferenceBase ? preferenceBase : "unknown"),\r
- dialogType(type)\r
- {\r
- internalSetup();\r
- }\r
-\r
- /**\r
- *\r
- */\r
- FileDialogBaseGtk(Gtk::Window& parentWindow, const Glib::ustring &title,\r
- Gtk::FileChooserAction dialogType, FileDialogType type, gchar const* preferenceBase) :\r
- Gtk::FileChooserDialog(parentWindow, title, dialogType),\r
- preferenceBase(preferenceBase ? preferenceBase : "unknown"),\r
- dialogType(type)\r
- {\r
- internalSetup();\r
- }\r
-\r
- /**\r
- *\r
- */\r
- virtual ~FileDialogBaseGtk()\r
- {}\r
-\r
-protected:\r
- void cleanup( bool showConfirmed );\r
-\r
- Glib::ustring preferenceBase;\r
- /**\r
- * What type of 'open' are we? (open, import, place, etc)\r
- */\r
- FileDialogType dialogType;\r
-\r
- /**\r
- * Our svg preview widget\r
- */\r
- SVGPreview svgPreview;\r
-\r
- //# Child widgets\r
- Gtk::CheckButton previewCheckbox;\r
-\r
-private:\r
- void internalSetup();\r
-\r
- /**\r
- * Callback for user changing preview checkbox\r
- */\r
- void _previewEnabledCB();\r
-\r
- /**\r
- * Callback for seeing if the preview needs to be drawn\r
- */\r
- void _updatePreviewCallback();\r
-};\r
-\r
-\r
-\r
-\r
-/*#########################################################################\r
-### F I L E O P E N\r
-#########################################################################*/\r
-\r
-/**\r
- * Our implementation class for the FileOpenDialog interface..\r
- */\r
-class FileOpenDialogImplGtk : public FileOpenDialog, public FileDialogBaseGtk\r
-{\r
-public:\r
-\r
- FileOpenDialogImplGtk(Gtk::Window& parentWindow,\r
- const Glib::ustring &dir,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title);\r
-\r
- virtual ~FileOpenDialogImplGtk();\r
-\r
- bool show();\r
-\r
- Inkscape::Extension::Extension *getSelectionType();\r
-\r
- Glib::ustring getFilename();\r
-\r
- std::vector<Glib::ustring> getFilenames ();\r
-\r
-private:\r
-\r
- /**\r
- * Create a filter menu for this type of dialog\r
- */\r
- void createFilterMenu();\r
-\r
- /**\r
- * Filter name->extension lookup\r
- */\r
- std::map<Glib::ustring, Inkscape::Extension::Extension *> extensionMap;\r
-\r
- /**\r
- * The extension to use to write this file\r
- */\r
- Inkscape::Extension::Extension *extension;\r
-\r
- /**\r
- * Filename that was given\r
- */\r
- Glib::ustring myFilename;\r
-\r
-};\r
-\r
-\r
-class FileType\r
-{\r
- public:\r
- FileType() {}\r
- ~FileType() {}\r
- Glib::ustring name;\r
- Glib::ustring pattern;\r
- Inkscape::Extension::Extension *extension;\r
-};\r
-\r
-\r
-\r
-//########################################################################\r
-//# F I L E S A V E\r
-//########################################################################\r
-\r
-/**\r
- * Our implementation of the FileSaveDialog interface.\r
- */\r
-class FileSaveDialogImplGtk : public FileSaveDialog, public FileDialogBaseGtk\r
-{\r
-\r
-public:\r
- FileSaveDialogImplGtk(Gtk::Window &parentWindow, \r
- const Glib::ustring &dir,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title,\r
- const Glib::ustring &default_key);\r
-\r
- virtual ~FileSaveDialogImplGtk();\r
-\r
- bool show();\r
-\r
- Inkscape::Extension::Extension *getSelectionType();\r
- virtual void setSelectionType( Inkscape::Extension::Extension * key );\r
-\r
- Glib::ustring getFilename();\r
-\r
- void change_title(const Glib::ustring& title);\r
- void change_path(const Glib::ustring& path);\r
- void updateNameAndExtension();\r
-\r
-private:\r
-\r
- /**\r
- * Fix to allow the user to type the file name\r
- */\r
- Gtk::Entry *fileNameEntry;\r
-\r
-\r
- /**\r
- * Allow the specification of the output file type\r
- */\r
- Gtk::ComboBoxText fileTypeComboBox;\r
-\r
-\r
- /**\r
- * Data mirror of the combo box\r
- */\r
- std::vector<FileType> fileTypes;\r
-\r
- //# Child widgets\r
- Gtk::HBox childBox;\r
- Gtk::VBox checksBox;\r
-\r
- Gtk::CheckButton fileTypeCheckbox;\r
-\r
- /**\r
- * Callback for user input into fileNameEntry\r
- */\r
- void fileTypeChangedCallback();\r
-\r
- /**\r
- * Create a filter menu for this type of dialog\r
- */\r
- void createFileTypeMenu();\r
-\r
-\r
- /**\r
- * The extension to use to write this file\r
- */\r
- Inkscape::Extension::Extension *extension;\r
-\r
- /**\r
- * Callback for user input into fileNameEntry\r
- */\r
- void fileNameEntryChangedCallback();\r
-\r
- /**\r
- * Filename that was given\r
- */\r
- Glib::ustring myFilename;\r
-\r
- /**\r
- * List of known file extensions.\r
- */\r
- std::set<Glib::ustring> knownExtensions;\r
-};\r
-\r
-\r
-\r
-\r
-//########################################################################\r
-//# F I L E E X P O R T\r
-//########################################################################\r
-\r
-/**\r
- * Our implementation of the FileExportDialog interface.\r
- */\r
-class FileExportDialogImpl : public FileExportDialog, public FileDialogBaseGtk\r
-{\r
-\r
-public:\r
- FileExportDialogImpl(Gtk::Window& parentWindow, \r
- const Glib::ustring &dir,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title,\r
- const Glib::ustring &default_key);\r
-\r
- virtual ~FileExportDialogImpl();\r
-\r
- bool show();\r
-\r
- Inkscape::Extension::Extension *getSelectionType();\r
-\r
- Glib::ustring getFilename();\r
-\r
-\r
- /**\r
- * Return the scope of the export. One of the enumerated types\r
- * in ScopeType \r
- */\r
- ScopeType getScope()\r
- { \r
- if (pageButton.get_active())\r
- return SCOPE_PAGE;\r
- else if (selectionButton.get_active())\r
- return SCOPE_SELECTION;\r
- else if (customButton.get_active())\r
- return SCOPE_CUSTOM;\r
- else\r
- return SCOPE_DOCUMENT;\r
-\r
- }\r
- \r
- /**\r
- * Return left side of the exported region\r
- */\r
- double getSourceX()\r
- { return sourceX0Spinner.getValue(); }\r
- \r
- /**\r
- * Return the top of the exported region\r
- */\r
- double getSourceY()\r
- { return sourceY1Spinner.getValue(); }\r
- \r
- /**\r
- * Return the width of the exported region\r
- */\r
- double getSourceWidth()\r
- { return sourceWidthSpinner.getValue(); }\r
- \r
- /**\r
- * Return the height of the exported region\r
- */\r
- double getSourceHeight()\r
- { return sourceHeightSpinner.getValue(); }\r
-\r
- /**\r
- * Return the units of the coordinates of exported region\r
- */\r
- Glib::ustring getSourceUnits()\r
- { return sourceUnitsSpinner.getUnitAbbr(); }\r
-\r
- /**\r
- * Return the width of the destination document\r
- */\r
- double getDestinationWidth()\r
- { return destWidthSpinner.getValue(); }\r
-\r
- /**\r
- * Return the height of the destination document\r
- */\r
- double getDestinationHeight()\r
- { return destHeightSpinner.getValue(); }\r
-\r
- /**\r
- * Return the height of the exported region\r
- */\r
- Glib::ustring getDestinationUnits()\r
- { return destUnitsSpinner.getUnitAbbr(); }\r
-\r
- /**\r
- * Return the destination DPI image resulution, if bitmap\r
- */\r
- double getDestinationDPI()\r
- { return destDPISpinner.getValue(); }\r
-\r
- /**\r
- * Return whether we should use Cairo for rendering\r
- */\r
- bool getUseCairo()\r
- { return cairoButton.get_active(); }\r
-\r
- /**\r
- * Return whether we should use antialiasing\r
- */\r
- bool getUseAntialias()\r
- { return antiAliasButton.get_active(); }\r
-\r
- /**\r
- * Return the background color for exporting\r
- */\r
- unsigned long getBackground()\r
- { return backgroundButton.get_color().get_pixel(); }\r
-\r
-private:\r
-\r
- /**\r
- * Fix to allow the user to type the file name\r
- */\r
- Gtk::Entry *fileNameEntry;\r
-\r
- //##########################################\r
- //# EXTRA WIDGET -- SOURCE SIDE\r
- //##########################################\r
-\r
- Gtk::Frame sourceFrame;\r
- Gtk::VBox sourceBox;\r
-\r
- Gtk::HBox scopeBox;\r
- Gtk::RadioButtonGroup scopeGroup;\r
- Gtk::RadioButton documentButton;\r
- Gtk::RadioButton pageButton;\r
- Gtk::RadioButton selectionButton;\r
- Gtk::RadioButton customButton;\r
-\r
- Gtk::Table sourceTable;\r
- Inkscape::UI::Widget::Scalar sourceX0Spinner;\r
- Inkscape::UI::Widget::Scalar sourceY0Spinner;\r
- Inkscape::UI::Widget::Scalar sourceX1Spinner;\r
- Inkscape::UI::Widget::Scalar sourceY1Spinner;\r
- Inkscape::UI::Widget::Scalar sourceWidthSpinner;\r
- Inkscape::UI::Widget::Scalar sourceHeightSpinner;\r
- Inkscape::UI::Widget::UnitMenu sourceUnitsSpinner;\r
-\r
-\r
- //##########################################\r
- //# EXTRA WIDGET -- DESTINATION SIDE\r
- //##########################################\r
-\r
- Gtk::Frame destFrame;\r
- Gtk::VBox destBox;\r
-\r
- Gtk::Table destTable;\r
- Inkscape::UI::Widget::Scalar destWidthSpinner;\r
- Inkscape::UI::Widget::Scalar destHeightSpinner;\r
- Inkscape::UI::Widget::Scalar destDPISpinner;\r
- Inkscape::UI::Widget::UnitMenu destUnitsSpinner;\r
-\r
- Gtk::HBox otherOptionBox;\r
- Gtk::CheckButton cairoButton;\r
- Gtk::CheckButton antiAliasButton;\r
- Gtk::ColorButton backgroundButton;\r
-\r
-\r
- /**\r
- * 'Extra' widget that holds two boxes above\r
- */\r
- Gtk::HBox exportOptionsBox;\r
-\r
-\r
- //# Child widgets\r
- Gtk::CheckButton fileTypeCheckbox;\r
-\r
- /**\r
- * Allow the specification of the output file type\r
- */\r
- Gtk::ComboBoxText fileTypeComboBox;\r
-\r
-\r
- /**\r
- * Data mirror of the combo box\r
- */\r
- std::vector<FileType> fileTypes;\r
-\r
-\r
-\r
- /**\r
- * Callback for user input into fileNameEntry\r
- */\r
- void fileTypeChangedCallback();\r
-\r
- /**\r
- * Create a filter menu for this type of dialog\r
- */\r
- void createFileTypeMenu();\r
-\r
-\r
- bool append_extension;\r
-\r
- /**\r
- * The extension to use to write this file\r
- */\r
- Inkscape::Extension::Extension *extension;\r
-\r
- /**\r
- * Callback for user input into fileNameEntry\r
- */\r
- void fileNameEntryChangedCallback();\r
-\r
- /**\r
- * Filename that was given\r
- */\r
- Glib::ustring myFilename;\r
-};\r
-\r
-}\r
-}\r
-}\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#ifndef __FILE_DIALOGIMPL_H__
+#define __FILE_DIALOGIMPL_H__
+/**
+ * Implementation of the file dialog interfaces defined in filedialogimpl.h
+ *
+ * Authors:
+ * Bob Jamison
+ * Joel Holdsworth
+ * Bruno Dilly
+ * Other dudes from The Inkscape Organization
+ *
+ * Copyright (C) 2004-2007 Bob Jamison
+ * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2007-2008 Joel Holdsworth
+ * Copyright (C) 2004-2007 The Inkscape Organization
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "filedialog.h"
+
+//General includes
+#include <unistd.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+
+//Gtk includes
+#include <glibmm/i18n.h>
+#include <glib/gstdio.h>
+
+//Temporary ugly hack
+//Remove this after the get_filter() calls in
+//show() on both classes are fixed
+#include <gtk/gtkfilechooser.h>
+
+//Another hack
+#include <gtk/gtkentry.h>
+#include <gtk/gtkexpander.h>
+#ifdef WITH_GNOME_VFS
+# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
+#endif
+
+//Inkscape includes
+#include "prefs-utils.h"
+#include <extension/input.h>
+#include <extension/output.h>
+#include <extension/db.h>
+#include "inkscape.h"
+#include "svg-view-widget.h"
+#include "gc-core.h"
+
+//For export dialog
+#include "ui/widget/scalar-unit.h"
+
+namespace Inkscape
+{
+namespace UI
+{
+namespace Dialog
+{
+
+/*#########################################################################
+### Utility
+#########################################################################*/
+void
+fileDialogExtensionToPattern(Glib::ustring &pattern,
+ Glib::ustring &extension);
+
+void
+findEntryWidgets(Gtk::Container *parent,
+ std::vector<Gtk::Entry *> &result);
+
+void
+findExpanderWidgets(Gtk::Container *parent,
+ std::vector<Gtk::Expander *> &result);
+
+/*#########################################################################
+### SVG Preview Widget
+#########################################################################*/
+
+class FileType
+{
+ public:
+ FileType() {}
+ ~FileType() {}
+ Glib::ustring name;
+ Glib::ustring pattern;
+ Inkscape::Extension::Extension *extension;
+};
+
+/**
+ * Simple class for displaying an SVG file in the "preview widget."
+ * Currently, this is just a wrapper of the sp_svg_view Gtk widget.
+ * Hopefully we will eventually replace with a pure Gtkmm widget.
+ */
+class SVGPreview : public Gtk::VBox
+{
+public:
+
+ SVGPreview();
+
+ ~SVGPreview();
+
+ bool setDocument(SPDocument *doc);
+
+ bool setFileName(Glib::ustring &fileName);
+
+ bool setFromMem(char const *xmlBuffer);
+
+ bool set(Glib::ustring &fileName, int dialogType);
+
+ bool setURI(URI &uri);
+
+ /**
+ * Show image embedded in SVG
+ */
+ void showImage(Glib::ustring &fileName);
+
+ /**
+ * Show the "No preview" image
+ */
+ void showNoPreview();
+
+ /**
+ * Show the "Too large" image
+ */
+ void showTooLarge(long fileLength);
+
+private:
+ /**
+ * The svg document we are currently showing
+ */
+ SPDocument *document;
+
+ /**
+ * The sp_svg_view widget
+ */
+ GtkWidget *viewerGtk;
+
+ /**
+ * are we currently showing the "no preview" image?
+ */
+ bool showingNoPreview;
+
+};
+
+/*#########################################################################
+### F I L E D I A L O G B A S E C L A S S
+#########################################################################*/
+
+/**
+ * This class is the base implementation for the others. This
+ * reduces redundancies and bugs.
+ */
+class FileDialogBaseGtk : public Gtk::FileChooserDialog
+{
+public:
+
+ /**
+ *
+ */
+ FileDialogBaseGtk(Gtk::Window& parentWindow, const Glib::ustring &title,
+ Gtk::FileChooserAction dialogType, FileDialogType type, gchar const* preferenceBase) :
+ Gtk::FileChooserDialog(parentWindow, title, dialogType),
+ preferenceBase(preferenceBase ? preferenceBase : "unknown"),
+ _dialogType(type)
+ {
+ internalSetup();
+ }
+
+ /**
+ *
+ */
+ FileDialogBaseGtk(Gtk::Window& parentWindow, const char *title,
+ Gtk::FileChooserAction dialogType, FileDialogType type, gchar const* preferenceBase) :
+ Gtk::FileChooserDialog(parentWindow, title, dialogType),
+ preferenceBase(preferenceBase ? preferenceBase : "unknown"),
+ _dialogType(type)
+ {
+ internalSetup();
+ }
+
+ /**
+ *
+ */
+ virtual ~FileDialogBaseGtk()
+ {}
+
+protected:
+ void cleanup( bool showConfirmed );
+
+ Glib::ustring preferenceBase;
+ /**
+ * What type of 'open' are we? (open, import, place, etc)
+ */
+ FileDialogType _dialogType;
+
+ /**
+ * Our svg preview widget
+ */
+ SVGPreview svgPreview;
+
+ /**
+ * Child widgets
+ */
+ Gtk::CheckButton previewCheckbox;
+
+private:
+ void internalSetup();
+
+ /**
+ * Callback for user changing preview checkbox
+ */
+ void _previewEnabledCB();
+
+ /**
+ * Callback for seeing if the preview needs to be drawn
+ */
+ void _updatePreviewCallback();
+};
+
+
+
+
+/*#########################################################################
+### F I L E O P E N
+#########################################################################*/
+
+/**
+ * Our implementation class for the FileOpenDialog interface..
+ */
+class FileOpenDialogImplGtk : public FileOpenDialog, public FileDialogBaseGtk
+{
+public:
+
+ FileOpenDialogImplGtk(Gtk::Window& parentWindow,
+ const Glib::ustring &dir,
+ FileDialogType fileTypes,
+ const Glib::ustring &title);
+
+ virtual ~FileOpenDialogImplGtk();
+
+ bool show();
+
+ Inkscape::Extension::Extension *getSelectionType();
+
+ Glib::ustring getFilename();
+
+ std::vector<Glib::ustring> getFilenames();
+
+ Glib::ustring getCurrentDirectory();
+
+private:
+
+ /**
+ * Create a filter menu for this type of dialog
+ */
+ void createFilterMenu();
+
+ /**
+ * Filter name->extension lookup
+ */
+ std::map<Glib::ustring, Inkscape::Extension::Extension *> extensionMap;
+
+ /**
+ * The extension to use to write this file
+ */
+ Inkscape::Extension::Extension *extension;
+
+};
+
+
+
+//########################################################################
+//# F I L E S A V E
+//########################################################################
+
+/**
+ * Our implementation of the FileSaveDialog interface.
+ */
+class FileSaveDialogImplGtk : public FileSaveDialog, public FileDialogBaseGtk
+{
+
+public:
+ FileSaveDialogImplGtk(Gtk::Window &parentWindow,
+ const Glib::ustring &dir,
+ FileDialogType fileTypes,
+ const Glib::ustring &title,
+ const Glib::ustring &default_key);
+
+ virtual ~FileSaveDialogImplGtk();
+
+ bool show();
+
+ Inkscape::Extension::Extension *getSelectionType();
+ virtual void setSelectionType( Inkscape::Extension::Extension * key );
+
+ Glib::ustring getCurrentDirectory();
+
+private:
+ //void change_title(const Glib::ustring& title);
+ void change_path(const Glib::ustring& path);
+ void updateNameAndExtension();
+
+ /**
+ * Fix to allow the user to type the file name
+ */
+ Gtk::Entry *fileNameEntry;
+
+
+ /**
+ * Allow the specification of the output file type
+ */
+ Gtk::ComboBoxText fileTypeComboBox;
+
+
+ /**
+ * Data mirror of the combo box
+ */
+ std::vector<FileType> fileTypes;
+
+ //# Child widgets
+ Gtk::HBox childBox;
+ Gtk::VBox checksBox;
+
+ Gtk::CheckButton fileTypeCheckbox;
+
+ /**
+ * Callback for user input into fileNameEntry
+ */
+ void fileTypeChangedCallback();
+
+ /**
+ * Create a filter menu for this type of dialog
+ */
+ void createFileTypeMenu();
+
+
+ /**
+ * The extension to use to write this file
+ */
+ Inkscape::Extension::Extension *extension;
+
+ /**
+ * Callback for user input into fileNameEntry
+ */
+ void fileNameEntryChangedCallback();
+};
+
+
+
+
+//########################################################################
+//# F I L E E X P O R T
+//########################################################################
+
+/**
+ * Our implementation of the FileExportDialog interface.
+ */
+class FileExportDialogImpl : public FileExportDialog, public FileDialogBaseGtk
+{
+
+public:
+ FileExportDialogImpl(Gtk::Window& parentWindow,
+ const Glib::ustring &dir,
+ FileDialogType fileTypes,
+ const Glib::ustring &title,
+ const Glib::ustring &default_key);
+
+ virtual ~FileExportDialogImpl();
+
+ bool show();
+
+ Inkscape::Extension::Extension *getSelectionType();
+
+ Glib::ustring getFilename();
+
+
+ /**
+ * Return the scope of the export. One of the enumerated types
+ * in ScopeType
+ */
+ ScopeType getScope()
+ {
+ if (pageButton.get_active())
+ return SCOPE_PAGE;
+ else if (selectionButton.get_active())
+ return SCOPE_SELECTION;
+ else if (customButton.get_active())
+ return SCOPE_CUSTOM;
+ else
+ return SCOPE_DOCUMENT;
+
+ }
+
+ /**
+ * Return left side of the exported region
+ */
+ double getSourceX()
+ { return sourceX0Spinner.getValue(); }
+
+ /**
+ * Return the top of the exported region
+ */
+ double getSourceY()
+ { return sourceY1Spinner.getValue(); }
+
+ /**
+ * Return the width of the exported region
+ */
+ double getSourceWidth()
+ { return sourceWidthSpinner.getValue(); }
+
+ /**
+ * Return the height of the exported region
+ */
+ double getSourceHeight()
+ { return sourceHeightSpinner.getValue(); }
+
+ /**
+ * Return the units of the coordinates of exported region
+ */
+ Glib::ustring getSourceUnits()
+ { return sourceUnitsSpinner.getUnitAbbr(); }
+
+ /**
+ * Return the width of the destination document
+ */
+ double getDestinationWidth()
+ { return destWidthSpinner.getValue(); }
+
+ /**
+ * Return the height of the destination document
+ */
+ double getDestinationHeight()
+ { return destHeightSpinner.getValue(); }
+
+ /**
+ * Return the height of the exported region
+ */
+ Glib::ustring getDestinationUnits()
+ { return destUnitsSpinner.getUnitAbbr(); }
+
+ /**
+ * Return the destination DPI image resulution, if bitmap
+ */
+ double getDestinationDPI()
+ { return destDPISpinner.getValue(); }
+
+ /**
+ * Return whether we should use Cairo for rendering
+ */
+ bool getUseCairo()
+ { return cairoButton.get_active(); }
+
+ /**
+ * Return whether we should use antialiasing
+ */
+ bool getUseAntialias()
+ { return antiAliasButton.get_active(); }
+
+ /**
+ * Return the background color for exporting
+ */
+ unsigned long getBackground()
+ { return backgroundButton.get_color().get_pixel(); }
+
+private:
+
+ /**
+ * Fix to allow the user to type the file name
+ */
+ Gtk::Entry *fileNameEntry;
+
+ //##########################################
+ //# EXTRA WIDGET -- SOURCE SIDE
+ //##########################################
+
+ Gtk::Frame sourceFrame;
+ Gtk::VBox sourceBox;
+
+ Gtk::HBox scopeBox;
+ Gtk::RadioButtonGroup scopeGroup;
+ Gtk::RadioButton documentButton;
+ Gtk::RadioButton pageButton;
+ Gtk::RadioButton selectionButton;
+ Gtk::RadioButton customButton;
+
+ Gtk::Table sourceTable;
+ Inkscape::UI::Widget::Scalar sourceX0Spinner;
+ Inkscape::UI::Widget::Scalar sourceY0Spinner;
+ Inkscape::UI::Widget::Scalar sourceX1Spinner;
+ Inkscape::UI::Widget::Scalar sourceY1Spinner;
+ Inkscape::UI::Widget::Scalar sourceWidthSpinner;
+ Inkscape::UI::Widget::Scalar sourceHeightSpinner;
+ Inkscape::UI::Widget::UnitMenu sourceUnitsSpinner;
+
+
+ //##########################################
+ //# EXTRA WIDGET -- DESTINATION SIDE
+ //##########################################
+
+ Gtk::Frame destFrame;
+ Gtk::VBox destBox;
+
+ Gtk::Table destTable;
+ Inkscape::UI::Widget::Scalar destWidthSpinner;
+ Inkscape::UI::Widget::Scalar destHeightSpinner;
+ Inkscape::UI::Widget::Scalar destDPISpinner;
+ Inkscape::UI::Widget::UnitMenu destUnitsSpinner;
+
+ Gtk::HBox otherOptionBox;
+ Gtk::CheckButton cairoButton;
+ Gtk::CheckButton antiAliasButton;
+ Gtk::ColorButton backgroundButton;
+
+
+ /**
+ * 'Extra' widget that holds two boxes above
+ */
+ Gtk::HBox exportOptionsBox;
+
+
+ //# Child widgets
+ Gtk::CheckButton fileTypeCheckbox;
+
+ /**
+ * Allow the specification of the output file type
+ */
+ Gtk::ComboBoxText fileTypeComboBox;
+
+
+ /**
+ * Data mirror of the combo box
+ */
+ std::vector<FileType> fileTypes;
+
+
+
+ /**
+ * Callback for user input into fileNameEntry
+ */
+ void fileTypeChangedCallback();
+
+ /**
+ * Create a filter menu for this type of dialog
+ */
+ void createFileTypeMenu();
+
+
+ bool append_extension;
+
+ /**
+ * The extension to use to write this file
+ */
+ Inkscape::Extension::Extension *extension;
+
+ /**
+ * Callback for user input into fileNameEntry
+ */
+ void fileNameEntryChangedCallback();
+
+ /**
+ * Filename that was given
+ */
+ Glib::ustring myFilename;
+};
+
+
+}
+}
+}
+
+#endif /*__FILE_DIALOGIMPL_H__*/
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :