Code

Cleanup of device internal handling and API.
[inkscape.git] / src / ui / dialog / filedialogimpl-gtkmm.h
index e5058d0c207f6f2def2584381753bd7ff2b26c94..65bb389716abe5f383746ab8cfa70c9f3cc51d1b 100644 (file)
@@ -1,29 +1,29 @@
-#ifndef __FILE_DIALOGIMPL_H__
-#define __FILE_DIALOGIMPL_H__
-/**
- * Implementation of the file dialog interfaces defined in filedialogimpl.h
- *
- * Authors:
+/** @file
+ * @brief Implementation of the file dialog interfaces defined in filedialogimpl.h
+ */
+/* Authors:
  *   Bob Jamison
+ *   Johan Engelen <johan@shouraizou.nl>
  *   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) 2004-2008 Authors
  * Copyright (C) 2004-2007 The Inkscape Organization
- * Copyright (C) 2007 Joel Holdsworth
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
+
+#ifndef __FILE_DIALOGIMPL_H__
+#define __FILE_DIALOGIMPL_H__
+
 #include "filedialog.h"
+#include "extension/system.h"
+
 //General includes
 #include <unistd.h>
 #include <sys/stat.h>
 #include <errno.h>
-#include <set>
 #include <libxml/parser.h>
 #include <libxml/tree.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 "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
@@ -164,10 +159,10 @@ public:
      *
      */
     FileDialogBaseGtk(Gtk::Window& parentWindow, const Glib::ustring &title,
-               FileDialogType type, gchar const* preferenceBase) :
-        Gtk::FileChooserDialog(parentWindow, title),
+               Gtk::FileChooserAction dialogType, FileDialogType type, gchar const* preferenceBase) :
+        Gtk::FileChooserDialog(parentWindow, title, dialogType),
         preferenceBase(preferenceBase ? preferenceBase : "unknown"),
-        dialogType(type)
+        _dialogType(type)
     {
         internalSetup();
     }
@@ -175,11 +170,11 @@ public:
     /**
      *
      */
-    FileDialogBaseGtk(Gtk::Window& parentWindow, const Glib::ustring &title,
+    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)
+        _dialogType(type)
     {
         internalSetup();
     }
@@ -193,18 +188,20 @@ public:
 protected:
     void cleanup( bool showConfirmed );
 
-    Glib::ustring preferenceBase;
+    Glib::ustring const preferenceBase;
     /**
      * What type of 'open' are we? (open, import, place, etc)
      */
-    FileDialogType dialogType;
+    FileDialogType _dialogType;
 
     /**
      * Our svg preview widget
      */
     SVGPreview svgPreview;
 
-    //# Child widgets
+    /**
+        * Child widgets
+        */
     Gtk::CheckButton previewCheckbox;
 
 private:
@@ -248,7 +245,9 @@ public:
 
     Glib::ustring getFilename();
 
-    std::vector<Glib::ustring> getFilenames ();
+    std::vector<Glib::ustring> getFilenames();
+
+       Glib::ustring getCurrentDirectory();
 
 private:
 
@@ -267,11 +266,6 @@ private:
      */
     Inkscape::Extension::Extension *extension;
 
-    /**
-     * Filename that was given
-     */
-    Glib::ustring myFilename;
-
 };
 
 
@@ -287,11 +281,13 @@ 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);
+    FileSaveDialogImplGtk(Gtk::Window &parentWindow,
+                          const Glib::ustring &dir,
+                          FileDialogType fileTypes,
+                          const Glib::ustring &title,
+                          const Glib::ustring &default_key,
+                          const gchar* docTitle,
+                          const Inkscape::Extension::FileSaveMethod save_method);
 
     virtual ~FileSaveDialogImplGtk();
 
@@ -300,13 +296,18 @@ public:
     Inkscape::Extension::Extension *getSelectionType();
     virtual void setSelectionType( Inkscape::Extension::Extension * key );
 
-    Glib::ustring getFilename();
+       Glib::ustring getCurrentDirectory();
 
-    void change_title(const Glib::ustring& title);
+private:
+    //void change_title(const Glib::ustring& title);
     void change_path(const Glib::ustring& path);
     void updateNameAndExtension();
 
-private:
+    /**
+     * The file save method (essentially whether the dialog was invoked by "Save as ..." or "Save a
+     * copy ..."), which is used to determine file extensions and save paths.
+     */
+    Inkscape::Extension::FileSaveMethod save_method;
 
     /**
      * Fix to allow the user to type the file name
@@ -351,21 +352,13 @@ private:
      * Callback for user input into fileNameEntry
      */
     void fileNameEntryChangedCallback();
-
-    /**
-     * Filename that was given
-     */
-    Glib::ustring myFilename;
-
-    /**
-     * List of known file extensions.
-     */
-    std::set<Glib::ustring> knownExtensions;
 };
 
 
 
 
+#ifdef NEW_EXPORT_DIALOG
+
 //########################################################################
 //# F I L E     E X P O R T
 //########################################################################
@@ -394,10 +387,10 @@ public:
 
     /**
      * Return the scope of the export.  One of the enumerated types
-     * in ScopeType     
+     * in ScopeType
      */
     ScopeType getScope()
-        { 
+        {
         if (pageButton.get_active())
             return SCOPE_PAGE;
         else if (selectionButton.get_active())
@@ -408,25 +401,25 @@ public:
             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
      */
@@ -582,10 +575,11 @@ private:
     Glib::ustring myFilename;
 };
 
+#endif // NEW_EXPORT_DIALOG
 
-}
-}
-}
+} // namespace Dialog
+} // namespace UI
+} // namespace Inkscape
 
 #endif /*__FILE_DIALOGIMPL_H__*/
 
@@ -598,4 +592,4 @@ private:
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :