summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 94a7b78)
raw | patch | inline | side by side (parent: 94a7b78)
author | joelholdsworth <joelholdsworth@users.sourceforge.net> | |
Sun, 19 Aug 2007 00:29:36 +0000 (00:29 +0000) | ||
committer | joelholdsworth <joelholdsworth@users.sourceforge.net> | |
Sun, 19 Aug 2007 00:29:36 +0000 (00:29 +0000) |
src/ui/dialog/Makefile_insert | patch | blob | history | |
src/ui/dialog/filedialog.cpp | patch | blob | history | |
src/ui/dialog/filedialog.h | patch | blob | history | |
src/ui/dialog/filedialogimpl-gtkmm.cpp | patch | blob | history | |
src/ui/dialog/filedialogimpl-gtkmm.h | patch | blob | history | |
src/ui/dialog/ocaldialogs.cpp | [new file with mode: 0644] | patch | blob |
src/ui/dialog/ocaldialogs.h | [new file with mode: 0644] | patch | blob |
index 11011d0c5eaeb003b575d15a3aba94467ca7121d..d3bb8b62c1fecbe67e97607d78c24ce85002c57e 100644 (file)
$(inkboard_dialogs) \
ui/dialog/xml-editor.cpp \
ui/dialog/xml-editor.h \
- ui/dialog/aboutbox.cpp \
- ui/dialog/aboutbox.h
+ ui/dialog/aboutbox.cpp \
+ ui/dialog/aboutbox.h \
+ ui/dialog/ocaldialogs.cpp \
+ ui/dialog/ocaldialogs.h
ui/dialog/aboutbox.$(OBJEXT): inkscape_version.h
index 88ba32679e24502d4ecadee6d721180b1de7ead6..c3ca49c992de5178430774de6971eb3a92665989 100644 (file)
}
-//########################################################################
-//# F I L E E X P O R T T O O C A L
-//########################################################################
-
-
-/**
- * Public factory method. Used in file.cpp
- */
-
- FileExportToOCALDialog *FileExportToOCALDialog::create(Gtk::Window& parentWindow,
- FileDialogType fileTypes,
- const Glib::ustring &title,
- const Glib::ustring &default_key)
-{
- FileExportToOCALDialog *dialog = new FileExportToOCALDialogImpl(parentWindow, fileTypes, title, default_key);
- return dialog;
-}
-
-//#########################################################################
-//### F I L E I M P O R T F R O M O C A L
-//#########################################################################
-
-/**
- * Public factory. Called by file.cpp.
- */
-FileImportFromOCALDialog *FileImportFromOCALDialog::create(Gtk::Window &parentWindow,
- const Glib::ustring &path,
- FileDialogType fileTypes,
- const Glib::ustring &title)
-{
- FileImportFromOCALDialog *dialog = new FileImportFromOCALDialogImplGtk(parentWindow, path, fileTypes, title);
- return dialog;
-}
-
-
} //namespace Dialog
} //namespace UI
} //namespace Inkscape
index d98c37a28199cb6be7227644498173e4a0d7647f..75c6f008073c4517a4dd1c17fd88c6c6f4eb129c 100644 (file)
*/
typedef struct FileOpenNativeData_def FileOpenNativeData;
-
/**
* This class provides an implementation-independent API for
* file "Open" dialogs. Using a standard interface obviates the need
}; //FileExportDialog
-/**
- * This class provides an implementation-independent API for
- * file "ExportToOCAL" dialogs.
- */
-class FileExportToOCALDialog
-{
-public:
-
- /**
- * Constructor. Do not call directly . Use the factory.
- * @param fileTypes one of FileDialogTypes
- * @param title the title of the dialog
- * @param key a list of file types from which the user can select
- */
- FileExportToOCALDialog ()
- {};
-
- /**
- * Factory.
- * @param fileTypes one of FileDialogTypes
- * @param title the title of the dialog
- * @param key a list of file types from which the user can select
- */
- static FileExportToOCALDialog *create(Gtk::Window& parentWindow,
- FileDialogType fileTypes,
- const Glib::ustring &title,
- const Glib::ustring &default_key);
-
-
- /**
- * Destructor.
- * Perform any necessary cleanups.
- */
- virtual ~FileExportToOCALDialog() {};
-
-
- /**
- * Show an SaveAs file selector.
- * @return the selected path if user selected one, else NULL
- */
- virtual bool show() =0;
-
- /**
- * Return the 'key' (filetype) of the selection, if any
- * @return a pointer to a string if successful (which must
- * be later freed with g_free(), else NULL.
- */
- virtual Inkscape::Extension::Extension * getSelectionType() = 0;
-
- virtual void setSelectionType( Inkscape::Extension::Extension * key ) = 0;
-
- virtual Glib::ustring getFilename () =0;
-
- /**
- * Change the window title.
- */
- virtual void change_title(const Glib::ustring& title) =0;
-
-
-}; //FileExportToOCAL
-
-
-/**
- * This class provides an implementation-independent API for
- * file "ImportFromOCAL" dialogs.
- */
-class FileImportFromOCALDialog
-{
-public:
-
-
- /**
- * Constructor .. do not call directly
- * @param path the directory where to start searching
- * @param fileTypes one of FileDialogTypes
- * @param title the title of the dialog
- */
- FileImportFromOCALDialog()
- {};
-
- /**
- * Factory.
- * @param path the directory where to start searching
- * @param fileTypes one of FileDialogTypes
- * @param title the title of the dialog
- */
- static FileImportFromOCALDialog *create(Gtk::Window& parentWindow,
- const Glib::ustring &path,
- FileDialogType fileTypes,
- const Glib::ustring &title);
-
-
- /**
- * Destructor.
- * Perform any necessary cleanups.
- */
- virtual ~FileImportFromOCALDialog() {};
-
- /**
- * Show an OpenFile file selector.
- * @return the selected path if user selected one, else NULL
- */
- virtual bool show() =0;
-
- /**
- * Return the 'key' (filetype) of the selection, if any
- * @return a pointer to a string if successful (which must
- * be later freed with g_free(), else NULL.
- */
- virtual Inkscape::Extension::Extension * getSelectionType() = 0;
-
- virtual Glib::ustring getFilename () =0;
-
-}; //FileImportFromOCALDialog
-
-
} //namespace Dialog
} //namespace UI
} //namespace Inkscape
index db6914354e85782505b7170d90e3695d02f57736..d3016e0f3513abbf15f5444f54e90a9541655b95 100644 (file)
//### U T I L I T Y\r
//########################################################################\r
\r
-/**\r
- \brief A quick function to turn a standard extension into a searchable\r
- pattern for the file dialogs\r
- \param pattern The patter that the extension should be written to\r
- \param in_file_extension The C string that represents the extension\r
-\r
- This function just goes through the string, and takes all characters\r
- and puts a [<upper><lower>] so that both are searched and shown in\r
- the file dialog. This function edits the pattern string to make\r
- this happen.\r
-*/\r
-static void\r
+void\r
fileDialogExtensionToPattern(Glib::ustring &pattern,\r
Glib::ustring &extension)\r
{\r
}\r
}\r
\r
-\r
-/**\r
- * Hack: Find all entry widgets in a container\r
- */\r
-static void\r
+\rvoid\r
findEntryWidgets(Gtk::Container *parent,\r
std::vector<Gtk::Entry *> &result)\r
{\r
\r
}\r
\r
-\r
-\r
-\r
-/**\r
- * Hack: Find all expander widgets in a container\r
- */\r
-static void\r
+void\r
findExpanderWidgets(Gtk::Container *parent,\r
std::vector<Gtk::Expander *> &result)\r
{\r
{\r
return myFilename;\r
}\r
-\r
-\r
-\r
-\r
-//########################################################################\r
-//# F I L E E X P O R T T O O C A L\r
-//########################################################################\r
-\r
-\r
-\r
-/**\r
- * Callback for fileNameEntry widget\r
- */\r
-void FileExportToOCALDialogImpl::fileNameEntryChangedCallback()\r
-{\r
- if (!fileNameEntry)\r
- return;\r
-\r
- Glib::ustring fileName = fileNameEntry->get_text();\r
- if (!Glib::get_charset()) //If we are not utf8\r
- fileName = Glib::filename_to_utf8(fileName);\r
-\r
- myFilename = fileName;\r
- response(Gtk::RESPONSE_OK);\r
-}\r
-\r
-\r
-\r
-/**\r
- * Callback for fileNameEntry widget\r
- */\r
-void FileExportToOCALDialogImpl::fileTypeChangedCallback()\r
-{\r
- int sel = fileTypeComboBox.get_active_row_number();\r
- if (sel<0 || sel >= (int)fileTypes.size())\r
- return;\r
- FileType type = fileTypes[sel];\r
-\r
- extension = type.extension;\r
- updateNameAndExtension();\r
-}\r
-\r
-\r
-\r
-void FileExportToOCALDialogImpl::createFileTypeMenu()\r
-{\r
- Inkscape::Extension::DB::OutputList extension_list;\r
- Inkscape::Extension::db.get_output_list(extension_list);\r
- knownExtensions.clear();\r
-\r
- for (Inkscape::Extension::DB::OutputList::iterator current_item = extension_list.begin();\r
- current_item != extension_list.end(); current_item++)\r
- {\r
- Inkscape::Extension::Output * omod = *current_item;\r
-\r
- // FIXME: would be nice to grey them out instead of not listing them\r
- if (omod->deactivated()) continue;\r
-\r
- FileType type;\r
- type.name = (_(omod->get_filetypename()));\r
- type.pattern = "*";\r
- Glib::ustring extension = omod->get_extension();\r
- knownExtensions.insert( extension.casefold() );\r
- fileDialogExtensionToPattern (type.pattern, extension);\r
- type.extension= omod;\r
- fileTypeComboBox.append_text(type.name);\r
- fileTypes.push_back(type);\r
- }\r
-\r
- //#Let user choose\r
- FileType guessType;\r
- guessType.name = _("Guess from extension");\r
- guessType.pattern = "*";\r
- guessType.extension = NULL;\r
- fileTypeComboBox.append_text(guessType.name);\r
- fileTypes.push_back(guessType);\r
-\r
-\r
- fileTypeComboBox.set_active(0);\r
- fileTypeChangedCallback(); //call at least once to set the filter\r
-}\r
-\r
-\r
-\r
-/**\r
- * Constructor\r
- */\r
-FileExportToOCALDialogImpl::FileExportToOCALDialogImpl(Gtk::Window &parentWindow,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title,\r
- const Glib::ustring &default_key) :\r
- FileDialogOCALBase(title)\r
-{\r
- /*\r
- * Start Taking the vertical Box and putting a Label\r
- * and a Entry to take the filename\r
- * Later put the extension selection and checkbox (?)\r
- */\r
- /* Initalize to Autodetect */\r
- extension = NULL;\r
- /* No filename to start out with */\r
- myFilename = "";\r
-\r
- /* Set our dialog type (save, export, etc...)*/\r
- dialogType = fileTypes;\r
- Gtk::VBox *vbox = get_vbox();\r
-\r
- Gtk::Label *fileLabel = new Gtk::Label(_("File"));\r
-\r
- fileNameEntry = new Gtk::Entry();\r
- fileNameEntry->set_text(myFilename);\r
- fileNameEntry->set_max_length(252); // I am giving the extension approach.\r
- fileBox.pack_start(*fileLabel);\r
- fileBox.pack_start(*fileNameEntry, Gtk::PACK_EXPAND_WIDGET, 3);\r
- vbox->pack_start(fileBox);\r
-\r
- //###### Do we want the .xxx extension automatically added?\r
- fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically")));\r
- fileTypeCheckbox.set_active( (bool)prefs_get_int_attribute("dialogs.export",\r
- "append_extension", 1) );\r
-\r
- createFileTypeMenu();\r
-\r
- fileTypeComboBox.set_size_request(200,40);\r
- fileTypeComboBox.signal_changed().connect(\r
- sigc::mem_fun(*this, &FileExportToOCALDialogImpl::fileTypeChangedCallback) );\r
-\r
- checksBox.pack_start( fileTypeCheckbox );\r
- vbox->pack_start( checksBox );\r
-\r
- vbox->pack_end( fileTypeComboBox );\r
-\r
- //Let's do some customization\r
- fileNameEntry = NULL;\r
- Gtk::Container *cont = get_toplevel();\r
- std::vector<Gtk::Entry *> entries;\r
- findEntryWidgets(cont, entries);\r
- //g_message("Found %d entry widgets\n", entries.size());\r
- if (entries.size() >=1 )\r
- {\r
- //Catch when user hits [return] on the text field\r
- fileNameEntry = entries[0];\r
- fileNameEntry->signal_activate().connect(\r
- sigc::mem_fun(*this, &FileExportToOCALDialogImpl::fileNameEntryChangedCallback) );\r
- }\r
-\r
- //Let's do more customization\r
- std::vector<Gtk::Expander *> expanders;\r
- findExpanderWidgets(cont, expanders);\r
- //g_message("Found %d expander widgets\n", expanders.size());\r
- if (expanders.size() >=1 )\r
- {\r
- //Always show the file list\r
- Gtk::Expander *expander = expanders[0];\r
- expander->set_expanded(true);\r
- }\r
-\r
-\r
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);\r
- set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK));\r
-\r
- show_all_children();\r
-}\r
-\r
-\r
-\r
-/**\r
- * Destructor\r
- */\r
-FileExportToOCALDialogImpl::~FileExportToOCALDialogImpl()\r
-{\r
-}\r
-\r
-\r
-\r
-/**\r
- * Show this dialog modally. Return true if user hits [OK]\r
- */\r
-bool\r
-FileExportToOCALDialogImpl::show()\r
-{\r
- set_modal (TRUE); //Window\r
- sp_transientize((GtkWidget *)gobj()); //Make transient\r
- gint b = run(); //Dialog\r
- hide();\r
-\r
- if (b == Gtk::RESPONSE_OK)\r
- {\r
- updateNameAndExtension();\r
-\r
- return TRUE;\r
- }\r
- else\r
- {\r
- return FALSE;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * Get the file extension type that was selected by the user. Valid after an [OK]\r
- */\r
-Inkscape::Extension::Extension *\r
-FileExportToOCALDialogImpl::getSelectionType()\r
-{\r
- return extension;\r
-}\r
-\r
-void FileExportToOCALDialogImpl::setSelectionType( Inkscape::Extension::Extension * key )\r
-{\r
- // If no pointer to extension is passed in, look up based on filename extension.\r
- if ( !key ) {\r
- // Not quite UTF-8 here.\r
- gchar *filenameLower = g_ascii_strdown(myFilename.c_str(), -1);\r
- for ( int i = 0; !key && (i < (int)fileTypes.size()); i++ ) {\r
- Inkscape::Extension::Output *ext = dynamic_cast<Inkscape::Extension::Output*>(fileTypes[i].extension);\r
- if ( ext && ext->get_extension() ) {\r
- gchar *extensionLower = g_ascii_strdown( ext->get_extension(), -1 );\r
- if ( g_str_has_suffix(filenameLower, extensionLower) ) {\r
- key = fileTypes[i].extension;\r
- }\r
- g_free(extensionLower);\r
- }\r
- }\r
- g_free(filenameLower);\r
- }\r
-\r
- // Ensure the proper entry in the combo box is selected.\r
- if ( key ) {\r
- extension = key;\r
- gchar const * extensionID = extension->get_id();\r
- if ( extensionID ) {\r
- for ( int i = 0; i < (int)fileTypes.size(); i++ ) {\r
- Inkscape::Extension::Extension *ext = fileTypes[i].extension;\r
- if ( ext ) {\r
- gchar const * id = ext->get_id();\r
- if ( id && ( strcmp(extensionID, id) == 0) ) {\r
- int oldSel = fileTypeComboBox.get_active_row_number();\r
- if ( i != oldSel ) {\r
- fileTypeComboBox.set_active(i);\r
- }\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * Get the file name chosen by the user. Valid after an [OK]\r
- */\r
-Glib::ustring\r
-FileExportToOCALDialogImpl::getFilename()\r
-{\r
- myFilename = fileNameEntry->get_text();\r
- updateNameAndExtension();\r
- return myFilename;\r
-}\r
-\r
-\r
-void\r
-FileExportToOCALDialogImpl::change_title(const Glib::ustring& title)\r
-{\r
- this->set_title(title);\r
-}\r
-\r
-void FileExportToOCALDialogImpl::updateNameAndExtension()\r
-{\r
- // Pick up any changes the user has typed in.\r
- Glib::ustring tmp = myFilename; // get_filename();\r
-\r
- Inkscape::Extension::Output* newOut = extension ? dynamic_cast<Inkscape::Extension::Output*>(extension) : 0;\r
- if ( fileTypeCheckbox.get_active() && newOut ) {\r
- try {\r
- bool appendExtension = true;\r
- Glib::ustring utf8Name = Glib::filename_to_utf8( myFilename );\r
- Glib::ustring::size_type pos = utf8Name.rfind('.');\r
- if ( pos != Glib::ustring::npos ) {\r
- Glib::ustring trail = utf8Name.substr( pos );\r
- Glib::ustring foldedTrail = trail.casefold();\r
- if ( (trail == ".")\r
- | (foldedTrail != Glib::ustring( newOut->get_extension() ).casefold()\r
- && ( knownExtensions.find(foldedTrail) != knownExtensions.end() ) ) ) {\r
- utf8Name = utf8Name.erase( pos );\r
- } else {\r
- appendExtension = false;\r
- }\r
- }\r
-\r
- if (appendExtension) {\r
- utf8Name = utf8Name + newOut->get_extension();\r
- myFilename = Glib::filename_from_utf8( utf8Name );\r
-\r
- }\r
- } catch ( Glib::ConvertError& e ) {\r
- // ignore\r
- }\r
- }\r
-}\r
-\r
-//#########################################################################\r
-//### F I L E I M P O R T F R O M O C A L\r
-//#########################################################################\r
-\r
-/*\r
- * Callback for row activated\r
- */\r
-void FileListViewText::on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column)\r
-{\r
- // create file path\r
- myFilename = Glib::get_tmp_dir();\r
- myFilename.append(G_DIR_SEPARATOR_S);\r
- std::vector<int> posArray(1);\r
- posArray = path.get_indices();\r
- myFilename.append(get_text(posArray[0], 2));\r
- \r
-#ifdef WITH_GNOME_VFS\r
- gnome_vfs_init();\r
- GnomeVFSHandle *from_handle = NULL;\r
- GnomeVFSHandle *to_handle = NULL;\r
- GnomeVFSFileSize bytes_read;\r
- GnomeVFSFileSize bytes_written;\r
- GnomeVFSResult result;\r
- guint8 buffer[8192];\r
-\r
- //get file url\r
- Glib::ustring fileUrl = get_text(posArray[0], 1); //http url\r
-\r
- //Glib::ustring fileUrl = "dav://"; //dav url\r
- //fileUrl.append(prefs_get_string_attribute("options.ocalurl", "str"));\r
- //fileUrl.append("/dav/");\r
- //fileUrl.append(get_text(posArray[0], 3)); //author dir\r
- //fileUrl.append("/");\r
- //fileUrl.append(get_text(posArray[0], 2)); //filename\r
-\r
- if (!Glib::get_charset()) //If we are not utf8\r
- fileUrl = Glib::filename_to_utf8(fileUrl);\r
-\r
- // verifies if the file wasn't previously downloaded\r
- if(gnome_vfs_open(&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_READ) == GNOME_VFS_ERROR_NOT_FOUND)\r
- {\r
- // open the temp file to receive\r
- result = gnome_vfs_open (&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_WRITE);\r
- if (result == GNOME_VFS_ERROR_NOT_FOUND){\r
- result = gnome_vfs_create (&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);\r
- }\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("Error creating temp file: %s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
- result = gnome_vfs_open (&from_handle, fileUrl.c_str(), GNOME_VFS_OPEN_READ);\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("Could not find the file in Open Clip Art Library.");\r
- return;\r
- }\r
- // copy the file\r
- while (1) {\r
- result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read);\r
- if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){\r
- result = gnome_vfs_close (from_handle);\r
- result = gnome_vfs_close (to_handle);\r
- break;\r
- }\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("%s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
- result = gnome_vfs_write (to_handle, buffer, bytes_read, &bytes_written);\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("%s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
- if (bytes_read != bytes_written){\r
- g_warning("Bytes read not equal to bytes written");\r
- return;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- gnome_vfs_close(to_handle);\r
- }\r
- myPreview->showImage(myFilename);\r
-#endif\r
-}\r
-\r
-\r
-/*\r
- * Returns the selected filename\r
- */\r
-Glib::ustring FileListViewText::getFilename()\r
-{\r
- return myFilename;\r
-}\r
-\r
-/**\r
- * Callback for user input into searchTagEntry\r
- */\r
-void FileImportFromOCALDialogImplGtk::searchTagEntryChangedCallback()\r
-{\r
- if (!searchTagEntry)\r
- return;\r
-\r
- notFoundLabel->hide();\r
-\r
- Glib::ustring searchTag = searchTagEntry->get_text();\r
- // create the ocal uri to get rss feed\r
- Glib::ustring uri = "http://www.";\r
- uri.append(prefs_get_string_attribute("options.ocalurl", "str"));\r
- uri.append("/media/feed/rss/");\r
- uri.append(searchTag);\r
- if (!Glib::get_charset()) //If we are not utf8\r
- uri = Glib::filename_to_utf8(uri);\r
-\r
-#ifdef WITH_GNOME_VFS\r
-\r
- // get the rss feed\r
- gnome_vfs_init();\r
- GnomeVFSHandle *from_handle = NULL;\r
- GnomeVFSHandle *to_handle = NULL;\r
- GnomeVFSFileSize bytes_read;\r
- GnomeVFSFileSize bytes_written;\r
- GnomeVFSResult result;\r
- guint8 buffer[8192];\r
-\r
- // create the temp file name\r
- Glib::ustring fileName = Glib::get_tmp_dir ();\r
- fileName.append(G_DIR_SEPARATOR_S);\r
- fileName.append("ocalfeed.xml");\r
-\r
- // open the temp file to receive\r
- result = gnome_vfs_open (&to_handle, fileName.c_str(), GNOME_VFS_OPEN_WRITE);\r
- if (result == GNOME_VFS_ERROR_NOT_FOUND){\r
- result = gnome_vfs_create (&to_handle, fileName.c_str(), GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);\r
- }\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("Error creating temp file: %s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
-\r
- // open the rss feed\r
- result = gnome_vfs_open (&from_handle, uri.c_str(), GNOME_VFS_OPEN_READ);\r
- if (result != GNOME_VFS_OK) {\r
- sp_ui_error_dialog(_("Failed to receive the Open Clip Art Library RSS feed. Verify if the URL is correct in Configuration->Misc (e.g.: openclipart.org)"));\r
- //g_warning("Could not find the Open Clip Art Library rss feed. Verify if the OCAL url is correct in Configuration");\r
- return;\r
- }\r
-\r
- // copy the file\r
- while (1) {\r
-\r
- result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read);\r
-\r
- if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){\r
- result = gnome_vfs_close (from_handle);\r
- result = gnome_vfs_close (to_handle);\r
- break;\r
- }\r
-\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("%s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
- result = gnome_vfs_write (to_handle, buffer, bytes_read, &bytes_written);\r
- if (result != GNOME_VFS_OK) {\r
- g_warning("%s", gnome_vfs_result_to_string(result));\r
- return;\r
- }\r
-\r
- if (bytes_read != bytes_written){\r
- g_warning("Bytes read not equal to bytes written");\r
- return;\r
- }\r
-\r
- }\r
-\r
- // create the resulting xml document tree\r
- // this initialize the library and test mistakes between compiled and shared library used\r
- LIBXML_TEST_VERSION \r
- xmlDoc *doc = NULL;\r
- xmlNode *root_element = NULL;\r
- doc = xmlReadFile(fileName.c_str(), NULL, 0);\r
- if (doc == NULL) {\r
- g_warning("Failed to parse %s\n", fileName.c_str());\r
- return;\r
- }\r
- \r
- // get the root element node\r
- root_element = xmlDocGetRootElement(doc);\r
-\r
- // clear the fileslist\r
- filesList->clear_items();\r
- filesList->set_sensitive(false);\r
-\r
- // print all xml the element names\r
- print_xml_element_names(root_element);\r
-\r
- if (filesList->size() == 0)\r
- {\r
- notFoundLabel->show();\r
- filesList->set_sensitive(false);\r
- }\r
- else\r
- filesList->set_sensitive(true);\r
-\r
- // free the document\r
- xmlFreeDoc(doc);\r
- // free the global variables that may have been allocated by the parser\r
- xmlCleanupParser();\r
- return;\r
-#endif \r
-}\r
-\r
-/**\r
- * Prints the names of the all the xml elements \r
- * that are siblings or children of a given xml node\r
- */\r
-void FileImportFromOCALDialogImplGtk::print_xml_element_names(xmlNode * a_node)\r
-{\r
- xmlNode *cur_node = NULL;\r
- guint row_num = 0;\r
- for (cur_node = a_node; cur_node; cur_node = cur_node->next) {\r
- // get itens information\r
- if (strcmp((const char*)cur_node->name, "rss")) //avoid the root\r
- if (cur_node->type == XML_ELEMENT_NODE && !strcmp((const char*)cur_node->parent->name, "item"))\r
- {\r
- if (!strcmp((const char*)cur_node->name, "title"))\r
- {\r
- xmlChar *title = xmlNodeGetContent(cur_node);\r
- row_num = filesList->append_text((const char*)title);\r
- xmlFree(title);\r
- }\r
-#ifdef WITH_GNOME_VFS\r
- else if (!strcmp((const char*)cur_node->name, "enclosure"))\r
- {\r
- xmlChar *urlattribute = xmlGetProp(cur_node, (xmlChar*)"url");\r
- filesList->set_text(row_num, 1, (const char*)urlattribute);\r
- gchar *tmp_file;\r
- tmp_file = gnome_vfs_uri_extract_short_path_name(gnome_vfs_uri_new((const char*)urlattribute));\r
- filesList->set_text(row_num, 2, (const char*)tmp_file);\r
- xmlFree(urlattribute);\r
- }\r
- else if (!strcmp((const char*)cur_node->name, "creator"))\r
- {\r
- filesList->set_text(row_num, 3, (const char*)xmlNodeGetContent(cur_node));\r
- }\r
-#endif\r
- }\r
- print_xml_element_names(cur_node->children);\r
- }\r
-}\r
-\r
-/**\r
- * Constructor. Not called directly. Use the factory.\r
- */\r
-FileImportFromOCALDialogImplGtk::FileImportFromOCALDialogImplGtk(Gtk::Window& parentWindow, \r
- const Glib::ustring &dir,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title) :\r
- FileDialogOCALBase(title)\r
-{\r
-\r
- // Initalize to Autodetect\r
- extension = NULL;\r
- // No filename to start out with\r
- Glib::ustring searchTag = "";\r
-\r
- dialogType = fileTypes;\r
- Gtk::VBox *vbox = get_vbox();\r
- Gtk::Label *tagLabel = new Gtk::Label(_("Search Tag"));\r
- notFoundLabel = new Gtk::Label(_("No files matched your search"));\r
- messageBox.pack_start(*notFoundLabel);\r
- searchTagEntry = new Gtk::Entry();\r
- searchTagEntry->set_text(searchTag);\r
- searchTagEntry->set_max_length(252); // I am giving the extension approach.\r
- tagBox.pack_start(*tagLabel);\r
- tagBox.pack_start(*searchTagEntry, Gtk::PACK_EXPAND_WIDGET, 3);\r
- filesPreview = new SVGPreview();\r
- filesPreview->showNoPreview();\r
- filesList = new FileListViewText(4, *filesPreview);\r
- filesList->set_sensitive(false);\r
- // add the listview inside a ScrolledWindow\r
- listScrolledWindow.add(*filesList);\r
- // only show the scrollbars when they are necessary:\r
- listScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);\r
- filesList->set_column_title(0, _("Files Found"));\r
- listScrolledWindow.set_size_request(200, 180);\r
- filesList->get_column(1)->set_visible(false); // file url\r
- filesList->get_column(2)->set_visible(false); // tmp file path\r
- filesList->get_column(3)->set_visible(false); // author dir\r
- filesBox.pack_start(listScrolledWindow);\r
- filesBox.pack_start(*filesPreview);\r
- vbox->pack_start(tagBox);\r
- vbox->pack_start(messageBox);\r
- vbox->pack_start(filesBox);\r
-\r
- //Let's do some customization\r
- searchTagEntry = NULL;\r
- Gtk::Container *cont = get_toplevel();\r
- std::vector<Gtk::Entry *> entries;\r
- findEntryWidgets(cont, entries);\r
- if (entries.size() >=1 )\r
- {\r
- //Catch when user hits [return] on the text field\r
- searchTagEntry = entries[0];\r
- searchTagEntry->signal_activate().connect(\r
- sigc::mem_fun(*this, &FileImportFromOCALDialogImplGtk::searchTagEntryChangedCallback));\r
- }\r
-\r
- add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);\r
- set_default(*add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK));\r
-\r
- show_all_children();\r
- notFoundLabel->hide();\r
-}\r
-\r
-/**\r
- * Destructor\r
- */\r
-FileImportFromOCALDialogImplGtk::~FileImportFromOCALDialogImplGtk()\r
-{\r
-\r
-}\r
-\r
-/**\r
- * Show this dialog modally. Return true if user hits [OK]\r
- */\r
-bool\r
-FileImportFromOCALDialogImplGtk::show()\r
-{\r
- set_modal (TRUE); //Window\r
- sp_transientize((GtkWidget *)gobj()); //Make transient\r
- gint b = run(); //Dialog\r
- hide();\r
-\r
- if (b == Gtk::RESPONSE_OK)\r
- {\r
- return TRUE;\r
- }\r
- else\r
- {\r
- return FALSE;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * Get the file extension type that was selected by the user. Valid after an [OK]\r
- */\r
-Inkscape::Extension::Extension *\r
-FileImportFromOCALDialogImplGtk::getSelectionType()\r
-{\r
- return extension;\r
-}\r
-\r
-\r
-/**\r
- * Get the file name chosen by the user. Valid after an [OK]\r
- */\r
-Glib::ustring\r
-FileImportFromOCALDialogImplGtk::getFilename (void)\r
-{\r
- return filesList->getFilename();\r
-}\r
-\r
+\r\r
} //namespace Dialog\r
} //namespace UI\r
} //namespace Inkscape\r
index 375ec23adbf893caff726c099597fabdb3f6c9d0..eb441b7099d1ddab2a7a271a725c7c6537b49956 100644 (file)
namespace UI\r
{\r
namespace Dialog\r
-{\r
+{
+
+/*#########################################################################\r
+### Utility\r
+#########################################################################*/
+void\r
+fileDialogExtensionToPattern(Glib::ustring &pattern,\r
+ Glib::ustring &extension);
+\r
+void\r
+findEntryWidgets(Gtk::Container *parent,\r
+ std::vector<Gtk::Entry *> &result);
+
+void\r
+findExpanderWidgets(Gtk::Container *parent,\r
+ std::vector<Gtk::Expander *> &result);\r
\r
/*#########################################################################\r
### SVG Preview Widget\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
* Simple class for displaying an SVG file in the "preview widget."\r
public:\r
\r
FileOpenDialogImplGtk(Gtk::Window& parentWindow,\r
- const Glib::ustring &dir,\r
+ const Glib::ustring &dir,\r
FileDialogType fileTypes,\r
const Glib::ustring &title);\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
@@ -361,11 +375,11 @@ class FileExportDialogImpl : public FileExportDialog, public FileDialogBaseGtk
{\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
+ 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
};\r
\r
\r
-\r
-/*#########################################################################\r
-### F I L E D I A L O G O C A L B A S E C L A S S\r
-#########################################################################*/\r
-\r
-/**\r
- * This class is the base implementation for export to OCAL.\r
- */\r
-class FileDialogOCALBase : public Gtk::Dialog\r
-{\r
-public:\r
-\r
- /**\r
- *\r
- */\r
- FileDialogOCALBase(const Glib::ustring &title) : Gtk::Dialog(title,true)\r
- {}\r
- /*\r
- *\r
- */\r
- virtual ~FileDialogOCALBase()\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
-\r
-\r
-\r
-//########################################################################\r
-//# F I L E E X P O R T T O O C A L\r
-//########################################################################\r
-\r
-\r
-\r
-/**\r
- * Our implementation of the FileExportToOCALDialog interface.\r
- */\r
-class FileExportToOCALDialogImpl : public FileExportToOCALDialog, public FileDialogOCALBase\r
-{\r
-\r
-public:\r
- FileExportToOCALDialogImpl(Gtk::Window& parentWindow, \r
- FileDialogType fileTypes,\r
- const Glib::ustring &title,\r
- const Glib::ustring &default_key);\r
- \r
- virtual ~FileExportToOCALDialogImpl();\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
- Glib::ustring myFilename;\r
-\r
- void change_title(const Glib::ustring& title);\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
- Gtk::HBox fileBox;\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
- * List of known file extensions.\r
- */\r
- std::set<Glib::ustring> knownExtensions;\r
-};\r
-\r
-\r
-//#########################################################################\r
-//### F I L E I M P O R T F R O M O C A L\r
-//#########################################################################\r
-\r
-/**\r
- * Our implementation class for filesListView\r
- */\r
-class FileListViewText : public Gtk::ListViewText\r
-{\r
-public:\r
- FileListViewText(guint columns_count, SVGPreview& filesPreview):ListViewText(columns_count)\r
- {\r
- myPreview = &filesPreview;\r
- }\r
- Glib::ustring getFilename();\r
-protected:\r
- void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);\r
-private:\r
- Glib::ustring myFilename;\r
- SVGPreview *myPreview;\r
-};\r
-\r
-/**\r
- * Our implementation class for the FileImportFromOCALDialog interface..\r
- */\r
-class FileImportFromOCALDialogImplGtk : public FileImportFromOCALDialog, public FileDialogOCALBase\r
-{\r
-public:\r
-\r
- FileImportFromOCALDialogImplGtk(Gtk::Window& parentWindow,\r
- const Glib::ustring &dir,\r
- FileDialogType fileTypes,\r
- const Glib::ustring &title);\r
-\r
- virtual ~FileImportFromOCALDialogImplGtk();\r
-\r
- bool show();\r
-\r
- Inkscape::Extension::Extension *getSelectionType();\r
-\r
- Glib::ustring getFilename();\r
-\r
-private:\r
-\r
- /**\r
- * Allow the user to type the tag to be searched\r
- */\r
- Gtk::Entry *searchTagEntry;\r
- FileListViewText *filesList;\r
- SVGPreview *filesPreview;\r
- Gtk::Label *notFoundLabel;\r
-\r
- // Child widgets\r
- Gtk::HBox tagBox;\r
- Gtk::HBox filesBox;\r
- Gtk::HBox messageBox;\r
- Gtk::ScrolledWindow listScrolledWindow;\r
- Glib::RefPtr<Gtk::TreeSelection> selection;\r
-\r
- /**\r
- * Callback for user input into searchTagEntry\r
- */\r
- void searchTagEntryChangedCallback();\r
-\r
-\r
- /**\r
- * Prints the names of the all the xml elements \r
- * that are siblings or children of a given xml node\r
- */\r
- void print_xml_element_names(xmlNode * a_node);\r
-\r
- /**\r
- * The extension to use to write this file\r
- */\r
- Inkscape::Extension::Extension *extension;\r
-};\r
-\r
+\r\r
}\r
}\r
}\r
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
--- /dev/null
@@ -0,0 +1,704 @@
+/**\r
+ * Implementation of the OCAL import/export dialogs\r
+ *\r
+ * Authors:\r
+ * Joel Holdsworth\r
+ * Bruno Dilly\r
+ * Other dudes from The Inkscape Organization\r
+ *\r
+ * Copyright (C) 2007 Bruno Dilly\r
+ *\r
+ * Released under GNU GPL, read the file 'COPYING' for more information\r
+ */\r
+\r
+#ifdef HAVE_CONFIG_H\r
+# include <config.h>\r
+#endif\r
+\r
+#include "ocaldialogs.h"\r
+#include "dialogs/dialog-events.h"\r
+#include "interface.h"\r
+\r
+#ifdef WITH_GNOME_VFS\r
+# include <libgnomevfs/gnome-vfs.h>\r
+#endif\r
+\r
+namespace Inkscape\r
+{\r
+namespace UI\r
+{\r
+namespace Dialog\r
+{
+
+//########################################################################\r
+//# F I L E E X P O R T T O O C A L\r
+//########################################################################\r
+\r
+\r
+\r
+/**\r
+ * Callback for fileNameEntry widget\r
+ */\r
+void FileExportToOCALDialog::fileNameEntryChangedCallback()\r
+{\r
+ if (!fileNameEntry)\r
+ return;\r
+\r
+ Glib::ustring fileName = fileNameEntry->get_text();\r
+ if (!Glib::get_charset()) //If we are not utf8\r
+ fileName = Glib::filename_to_utf8(fileName);\r
+\r
+ myFilename = fileName;\r
+ response(Gtk::RESPONSE_OK);\r
+}\r
+\r
+\r
+\r
+/**\r
+ * Callback for fileNameEntry widget\r
+ */\r
+void FileExportToOCALDialog::fileTypeChangedCallback()\r
+{\r
+ int sel = fileTypeComboBox.get_active_row_number();\r
+ if (sel<0 || sel >= (int)fileTypes.size())\r
+ return;\r
+ FileType type = fileTypes[sel];\r
+\r
+ extension = type.extension;\r
+ updateNameAndExtension();\r
+}\r
+\r
+\r
+\r
+void FileExportToOCALDialog::createFileTypeMenu()\r
+{\r
+ Inkscape::Extension::DB::OutputList extension_list;\r
+ Inkscape::Extension::db.get_output_list(extension_list);\r
+ knownExtensions.clear();\r
+\r
+ for (Inkscape::Extension::DB::OutputList::iterator current_item = extension_list.begin();\r
+ current_item != extension_list.end(); current_item++)\r
+ {\r
+ Inkscape::Extension::Output * omod = *current_item;\r
+\r
+ // FIXME: would be nice to grey them out instead of not listing them\r
+ if (omod->deactivated()) continue;\r
+\r
+ FileType type;\r
+ type.name = (_(omod->get_filetypename()));\r
+ type.pattern = "*";\r
+ Glib::ustring extension = omod->get_extension();\r
+ knownExtensions.insert( extension.casefold() );\r
+ fileDialogExtensionToPattern (type.pattern, extension);\r
+ type.extension= omod;\r
+ fileTypeComboBox.append_text(type.name);\r
+ fileTypes.push_back(type);\r
+ }\r
+\r
+ //#Let user choose\r
+ FileType guessType;\r
+ guessType.name = _("Guess from extension");\r
+ guessType.pattern = "*";\r
+ guessType.extension = NULL;\r
+ fileTypeComboBox.append_text(guessType.name);\r
+ fileTypes.push_back(guessType);\r
+\r
+\r
+ fileTypeComboBox.set_active(0);\r
+ fileTypeChangedCallback(); //call at least once to set the filter\r
+}\r
+\r
+\r
+\r
+/**\r
+ * Constructor\r
+ */\r
+FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,\r
+ const Glib::ustring &title,\r
+ const Glib::ustring &default_key) :\r
+ FileDialogOCALBase(title)\r
+{\r
+ /*\r
+ * Start Taking the vertical Box and putting a Label\r
+ * and a Entry to take the filename\r
+ * Later put the extension selection and checkbox (?)\r
+ */\r
+ /* Initalize to Autodetect */\r
+ extension = NULL;\r
+ /* No filename to start out with */\r
+ myFilename = "";\r
+\r
+ Gtk::VBox *vbox = get_vbox();\r
+\r
+ Gtk::Label *fileLabel = new Gtk::Label(_("File"));\r
+\r
+ fileNameEntry = new Gtk::Entry();\r
+ fileNameEntry->set_text(myFilename);\r
+ fileNameEntry->set_max_length(252); // I am giving the extension approach.\r
+ fileBox.pack_start(*fileLabel);\r
+ fileBox.pack_start(*fileNameEntry, Gtk::PACK_EXPAND_WIDGET, 3);\r
+ vbox->pack_start(fileBox);\r
+\r
+ //###### Do we want the .xxx extension automatically added?\r
+ fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically")));\r
+ fileTypeCheckbox.set_active( (bool)prefs_get_int_attribute("dialogs.export",\r
+ "append_extension", 1) );\r
+\r
+ createFileTypeMenu();\r
+\r
+ fileTypeComboBox.set_size_request(200,40);\r
+ fileTypeComboBox.signal_changed().connect(\r
+ sigc::mem_fun(*this, &FileExportToOCALDialog::fileTypeChangedCallback) );\r
+\r
+ checksBox.pack_start( fileTypeCheckbox );\r
+ vbox->pack_start( checksBox );\r
+\r
+ vbox->pack_end( fileTypeComboBox );\r
+\r
+ //Let's do some customization\r
+ fileNameEntry = NULL;\r
+ Gtk::Container *cont = get_toplevel();\r
+ std::vector<Gtk::Entry *> entries;\r
+ findEntryWidgets(cont, entries);\r
+ //g_message("Found %d entry widgets\n", entries.size());\r
+ if (entries.size() >=1 )\r
+ {\r
+ //Catch when user hits [return] on the text field\r
+ fileNameEntry = entries[0];\r
+ fileNameEntry->signal_activate().connect(\r
+ sigc::mem_fun(*this, &FileExportToOCALDialog::fileNameEntryChangedCallback) );\r
+ }\r
+\r
+ //Let's do more customization\r
+ std::vector<Gtk::Expander *> expanders;\r
+ findExpanderWidgets(cont, expanders);\r
+ //g_message("Found %d expander widgets\n", expanders.size());\r
+ if (expanders.size() >=1 )\r
+ {\r
+ //Always show the file list\r
+ Gtk::Expander *expander = expanders[0];\r
+ expander->set_expanded(true);\r
+ }\r
+\r
+\r
+ add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);\r
+ set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK));\r
+\r
+ show_all_children();\r
+}\r
+\r
+\r
+\r
+/**\r
+ * Destructor\r
+ */\r
+FileExportToOCALDialog::~FileExportToOCALDialog()\r
+{\r
+}\r
+\r
+\r
+\r
+/**\r
+ * Show this dialog modally. Return true if user hits [OK]\r
+ */\r
+bool\r
+FileExportToOCALDialog::show()\r
+{\r
+ set_modal (TRUE); //Window\r
+ sp_transientize((GtkWidget *)gobj()); //Make transient\r
+ gint b = run(); //Dialog\r
+ hide();\r
+\r
+ if (b == Gtk::RESPONSE_OK)\r
+ {\r
+ updateNameAndExtension();\r
+\r
+ return TRUE;\r
+ }\r
+ else\r
+ {\r
+ return FALSE;\r
+ }\r
+}\r
+\r
+\r
+/**\r
+ * Get the file extension type that was selected by the user. Valid after an [OK]\r
+ */\r
+Inkscape::Extension::Extension *\r
+FileExportToOCALDialog::getSelectionType()\r
+{\r
+ return extension;\r
+}\r
+\r
+void FileExportToOCALDialog::setSelectionType( Inkscape::Extension::Extension * key )\r
+{\r
+ // If no pointer to extension is passed in, look up based on filename extension.\r
+ if ( !key ) {\r
+ // Not quite UTF-8 here.\r
+ gchar *filenameLower = g_ascii_strdown(myFilename.c_str(), -1);\r
+ for ( int i = 0; !key && (i < (int)fileTypes.size()); i++ ) {\r
+ Inkscape::Extension::Output *ext = dynamic_cast<Inkscape::Extension::Output*>(fileTypes[i].extension);\r
+ if ( ext && ext->get_extension() ) {\r
+ gchar *extensionLower = g_ascii_strdown( ext->get_extension(), -1 );\r
+ if ( g_str_has_suffix(filenameLower, extensionLower) ) {\r
+ key = fileTypes[i].extension;\r
+ }\r
+ g_free(extensionLower);\r
+ }\r
+ }\r
+ g_free(filenameLower);\r
+ }\r
+\r
+ // Ensure the proper entry in the combo box is selected.\r
+ if ( key ) {\r
+ extension = key;\r
+ gchar const * extensionID = extension->get_id();\r
+ if ( extensionID ) {\r
+ for ( int i = 0; i < (int)fileTypes.size(); i++ ) {\r
+ Inkscape::Extension::Extension *ext = fileTypes[i].extension;\r
+ if ( ext ) {\r
+ gchar const * id = ext->get_id();\r
+ if ( id && ( strcmp(extensionID, id) == 0) ) {\r
+ int oldSel = fileTypeComboBox.get_active_row_number();\r
+ if ( i != oldSel ) {\r
+ fileTypeComboBox.set_active(i);\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+\r
+/**\r
+ * Get the file name chosen by the user. Valid after an [OK]\r
+ */\r
+Glib::ustring\r
+FileExportToOCALDialog::getFilename()\r
+{\r
+ myFilename = fileNameEntry->get_text();\r
+ updateNameAndExtension();\r
+ return myFilename;\r
+}\r
+\r
+\r
+void\r
+FileExportToOCALDialog::change_title(const Glib::ustring& title)\r
+{\r
+ this->set_title(title);\r
+}\r
+\r
+void FileExportToOCALDialog::updateNameAndExtension()\r
+{\r
+ // Pick up any changes the user has typed in.\r
+ Glib::ustring tmp = myFilename; // get_filename();\r
+\r
+ Inkscape::Extension::Output* newOut = extension ? dynamic_cast<Inkscape::Extension::Output*>(extension) : 0;\r
+ if ( fileTypeCheckbox.get_active() && newOut ) {\r
+ try {\r
+ bool appendExtension = true;\r
+ Glib::ustring utf8Name = Glib::filename_to_utf8( myFilename );\r
+ Glib::ustring::size_type pos = utf8Name.rfind('.');\r
+ if ( pos != Glib::ustring::npos ) {\r
+ Glib::ustring trail = utf8Name.substr( pos );\r
+ Glib::ustring foldedTrail = trail.casefold();\r
+ if ( (trail == ".")\r
+ | (foldedTrail != Glib::ustring( newOut->get_extension() ).casefold()\r
+ && ( knownExtensions.find(foldedTrail) != knownExtensions.end() ) ) ) {\r
+ utf8Name = utf8Name.erase( pos );\r
+ } else {\r
+ appendExtension = false;\r
+ }\r
+ }\r
+\r
+ if (appendExtension) {\r
+ utf8Name = utf8Name + newOut->get_extension();\r
+ myFilename = Glib::filename_from_utf8( utf8Name );\r
+\r
+ }\r
+ } catch ( Glib::ConvertError& e ) {\r
+ // ignore\r
+ }\r
+ }\r
+}\r
+\r
+//#########################################################################\r
+//### F I L E I M P O R T F R O M O C A L\r
+//#########################################################################\r
+\r
+/*\r
+ * Callback for row activated\r
+ */\r
+void FileListViewText::on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column)\r
+{\r
+ // create file path\r
+ myFilename = Glib::get_tmp_dir();\r
+ myFilename.append(G_DIR_SEPARATOR_S);\r
+ std::vector<int> posArray(1);\r
+ posArray = path.get_indices();\r
+ myFilename.append(get_text(posArray[0], 2));\r
+ \r
+#ifdef WITH_GNOME_VFS\r
+ gnome_vfs_init();\r
+ GnomeVFSHandle *from_handle = NULL;\r
+ GnomeVFSHandle *to_handle = NULL;\r
+ GnomeVFSFileSize bytes_read;\r
+ GnomeVFSFileSize bytes_written;\r
+ GnomeVFSResult result;\r
+ guint8 buffer[8192];\r
+\r
+ //get file url\r
+ Glib::ustring fileUrl = get_text(posArray[0], 1); //http url\r
+\r
+ //Glib::ustring fileUrl = "dav://"; //dav url\r
+ //fileUrl.append(prefs_get_string_attribute("options.ocalurl", "str"));\r
+ //fileUrl.append("/dav/");\r
+ //fileUrl.append(get_text(posArray[0], 3)); //author dir\r
+ //fileUrl.append("/");\r
+ //fileUrl.append(get_text(posArray[0], 2)); //filename\r
+\r
+ if (!Glib::get_charset()) //If we are not utf8\r
+ fileUrl = Glib::filename_to_utf8(fileUrl);\r
+\r
+ // verifies if the file wasn't previously downloaded\r
+ if(gnome_vfs_open(&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_READ) == GNOME_VFS_ERROR_NOT_FOUND)\r
+ {\r
+ // open the temp file to receive\r
+ result = gnome_vfs_open (&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_WRITE);\r
+ if (result == GNOME_VFS_ERROR_NOT_FOUND){\r
+ result = gnome_vfs_create (&to_handle, myFilename.c_str(), GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);\r
+ }\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("Error creating temp file: %s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+ result = gnome_vfs_open (&from_handle, fileUrl.c_str(), GNOME_VFS_OPEN_READ);\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("Could not find the file in Open Clip Art Library.");\r
+ return;\r
+ }\r
+ // copy the file\r
+ while (1) {\r
+ result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read);\r
+ if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){\r
+ result = gnome_vfs_close (from_handle);\r
+ result = gnome_vfs_close (to_handle);\r
+ break;\r
+ }\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("%s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+ result = gnome_vfs_write (to_handle, buffer, bytes_read, &bytes_written);\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("%s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+ if (bytes_read != bytes_written){\r
+ g_warning("Bytes read not equal to bytes written");\r
+ return;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ gnome_vfs_close(to_handle);\r
+ }\r
+ myPreview->showImage(myFilename);\r
+#endif\r
+}\r
+\r
+\r
+/*\r
+ * Returns the selected filename\r
+ */\r
+Glib::ustring FileListViewText::getFilename()\r
+{\r
+ return myFilename;\r
+}\r
+\r
+/**\r
+ * Callback for user input into searchTagEntry\r
+ */\r
+void FileImportFromOCALDialog::searchTagEntryChangedCallback()\r
+{\r
+ if (!searchTagEntry)\r
+ return;\r
+\r
+ notFoundLabel->hide();\r
+\r
+ Glib::ustring searchTag = searchTagEntry->get_text();\r
+ // create the ocal uri to get rss feed\r
+ Glib::ustring uri = "http://www.";\r
+ uri.append(prefs_get_string_attribute("options.ocalurl", "str"));\r
+ uri.append("/media/feed/rss/");\r
+ uri.append(searchTag);\r
+ if (!Glib::get_charset()) //If we are not utf8\r
+ uri = Glib::filename_to_utf8(uri);\r
+\r
+#ifdef WITH_GNOME_VFS\r
+\r
+ // get the rss feed\r
+ gnome_vfs_init();\r
+ GnomeVFSHandle *from_handle = NULL;\r
+ GnomeVFSHandle *to_handle = NULL;\r
+ GnomeVFSFileSize bytes_read;\r
+ GnomeVFSFileSize bytes_written;\r
+ GnomeVFSResult result;\r
+ guint8 buffer[8192];\r
+\r
+ // create the temp file name\r
+ Glib::ustring fileName = Glib::get_tmp_dir ();\r
+ fileName.append(G_DIR_SEPARATOR_S);\r
+ fileName.append("ocalfeed.xml");\r
+\r
+ // open the temp file to receive\r
+ result = gnome_vfs_open (&to_handle, fileName.c_str(), GNOME_VFS_OPEN_WRITE);\r
+ if (result == GNOME_VFS_ERROR_NOT_FOUND){\r
+ result = gnome_vfs_create (&to_handle, fileName.c_str(), GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);\r
+ }\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("Error creating temp file: %s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+\r
+ // open the rss feed\r
+ result = gnome_vfs_open (&from_handle, uri.c_str(), GNOME_VFS_OPEN_READ);\r
+ if (result != GNOME_VFS_OK) {\r
+ sp_ui_error_dialog(_("Failed to receive the Open Clip Art Library RSS feed. Verify if the URL is correct in Configuration->Misc (e.g.: openclipart.org)"));\r
+ //g_warning("Could not find the Open Clip Art Library rss feed. Verify if the OCAL url is correct in Configuration");\r
+ return;\r
+ }\r
+\r
+ // copy the file\r
+ while (1) {\r
+\r
+ result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read);\r
+\r
+ if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){\r
+ result = gnome_vfs_close (from_handle);\r
+ result = gnome_vfs_close (to_handle);\r
+ break;\r
+ }\r
+\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("%s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+ result = gnome_vfs_write (to_handle, buffer, bytes_read, &bytes_written);\r
+ if (result != GNOME_VFS_OK) {\r
+ g_warning("%s", gnome_vfs_result_to_string(result));\r
+ return;\r
+ }\r
+\r
+ if (bytes_read != bytes_written){\r
+ g_warning("Bytes read not equal to bytes written");\r
+ return;\r
+ }\r
+\r
+ }\r
+\r
+ // create the resulting xml document tree\r
+ // this initialize the library and test mistakes between compiled and shared library used\r
+ LIBXML_TEST_VERSION \r
+ xmlDoc *doc = NULL;\r
+ xmlNode *root_element = NULL;\r
+ doc = xmlReadFile(fileName.c_str(), NULL, 0);\r
+ if (doc == NULL) {\r
+ g_warning("Failed to parse %s\n", fileName.c_str());\r
+ return;\r
+ }\r
+ \r
+ // get the root element node\r
+ root_element = xmlDocGetRootElement(doc);\r
+\r
+ // clear the fileslist\r
+ filesList->clear_items();\r
+ filesList->set_sensitive(false);\r
+\r
+ // print all xml the element names\r
+ print_xml_element_names(root_element);\r
+\r
+ if (filesList->size() == 0)\r
+ {\r
+ notFoundLabel->show();\r
+ filesList->set_sensitive(false);\r
+ }\r
+ else\r
+ filesList->set_sensitive(true);\r
+\r
+ // free the document\r
+ xmlFreeDoc(doc);\r
+ // free the global variables that may have been allocated by the parser\r
+ xmlCleanupParser();\r
+ return;\r
+#endif \r
+}\r
+\r
+/**\r
+ * Prints the names of the all the xml elements \r
+ * that are siblings or children of a given xml node\r
+ */\r
+void FileImportFromOCALDialog::print_xml_element_names(xmlNode * a_node)\r
+{\r
+ xmlNode *cur_node = NULL;\r
+ guint row_num = 0;\r
+ for (cur_node = a_node; cur_node; cur_node = cur_node->next) {\r
+ // get itens information\r
+ if (strcmp((const char*)cur_node->name, "rss")) //avoid the root\r
+ if (cur_node->type == XML_ELEMENT_NODE && !strcmp((const char*)cur_node->parent->name, "item"))\r
+ {\r
+ if (!strcmp((const char*)cur_node->name, "title"))\r
+ {\r
+ xmlChar *title = xmlNodeGetContent(cur_node);\r
+ row_num = filesList->append_text((const char*)title);\r
+ xmlFree(title);\r
+ }\r
+#ifdef WITH_GNOME_VFS\r
+ else if (!strcmp((const char*)cur_node->name, "enclosure"))\r
+ {\r
+ xmlChar *urlattribute = xmlGetProp(cur_node, (xmlChar*)"url");\r
+ filesList->set_text(row_num, 1, (const char*)urlattribute);\r
+ gchar *tmp_file;\r
+ tmp_file = gnome_vfs_uri_extract_short_path_name(gnome_vfs_uri_new((const char*)urlattribute));\r
+ filesList->set_text(row_num, 2, (const char*)tmp_file);\r
+ xmlFree(urlattribute);\r
+ }\r
+ else if (!strcmp((const char*)cur_node->name, "creator"))\r
+ {\r
+ filesList->set_text(row_num, 3, (const char*)xmlNodeGetContent(cur_node));\r
+ }\r
+#endif\r
+ }\r
+ print_xml_element_names(cur_node->children);\r
+ }\r
+}\r
+\r
+/**\r
+ * Constructor. Not called directly. Use the factory.\r
+ */\r
+FileImportFromOCALDialog::FileImportFromOCALDialog(Gtk::Window& parentWindow, \r
+ const Glib::ustring &dir,\r
+ const Glib::ustring &title) :\r
+ FileDialogOCALBase(title)\r
+{\r
+\r
+ // Initalize to Autodetect\r
+ extension = NULL;\r
+ // No filename to start out with\r
+ Glib::ustring searchTag = "";\r
+\r
+ Gtk::VBox *vbox = get_vbox();\r
+ Gtk::Label *tagLabel = new Gtk::Label(_("Search Tag"));\r
+ notFoundLabel = new Gtk::Label(_("No files matched your search"));\r
+ messageBox.pack_start(*notFoundLabel);\r
+ searchTagEntry = new Gtk::Entry();\r
+ searchTagEntry->set_text(searchTag);\r
+ searchTagEntry->set_max_length(252); // I am giving the extension approach.\r
+ tagBox.pack_start(*tagLabel);\r
+ tagBox.pack_start(*searchTagEntry, Gtk::PACK_EXPAND_WIDGET, 3);\r
+ filesPreview = new SVGPreview();\r
+ filesPreview->showNoPreview();\r
+ filesList = new FileListViewText(4, *filesPreview);\r
+ filesList->set_sensitive(false);\r
+ // add the listview inside a ScrolledWindow\r
+ listScrolledWindow.add(*filesList);\r
+ // only show the scrollbars when they are necessary:\r
+ listScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);\r
+ filesList->set_column_title(0, _("Files Found"));\r
+ listScrolledWindow.set_size_request(200, 180);\r
+ filesList->get_column(1)->set_visible(false); // file url\r
+ filesList->get_column(2)->set_visible(false); // tmp file path\r
+ filesList->get_column(3)->set_visible(false); // author dir\r
+ filesBox.pack_start(listScrolledWindow);\r
+ filesBox.pack_start(*filesPreview);\r
+ vbox->pack_start(tagBox);\r
+ vbox->pack_start(messageBox);\r
+ vbox->pack_start(filesBox);\r
+\r
+ //Let's do some customization\r
+ searchTagEntry = NULL;\r
+ Gtk::Container *cont = get_toplevel();\r
+ std::vector<Gtk::Entry *> entries;\r
+ findEntryWidgets(cont, entries);\r
+ if (entries.size() >=1 )\r
+ {\r
+ //Catch when user hits [return] on the text field\r
+ searchTagEntry = entries[0];\r
+ searchTagEntry->signal_activate().connect(\r
+ sigc::mem_fun(*this, &FileImportFromOCALDialog::searchTagEntryChangedCallback));\r
+ }\r
+\r
+ add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);\r
+ set_default(*add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK));\r
+\r
+ show_all_children();\r
+ notFoundLabel->hide();\r
+}\r
+\r
+/**\r
+ * Destructor\r
+ */\r
+FileImportFromOCALDialog::~FileImportFromOCALDialog()\r
+{\r
+\r
+}\r
+\r
+/**\r
+ * Show this dialog modally. Return true if user hits [OK]\r
+ */\r
+bool\r
+FileImportFromOCALDialog::show()\r
+{\r
+ set_modal (TRUE); //Window\r
+ sp_transientize((GtkWidget *)gobj()); //Make transient\r
+ gint b = run(); //Dialog\r
+ hide();\r
+\r
+ if (b == Gtk::RESPONSE_OK)\r
+ {\r
+ return TRUE;\r
+ }\r
+ else\r
+ {\r
+ return FALSE;\r
+ }\r
+}\r
+\r
+\r
+/**\r
+ * Get the file extension type that was selected by the user. Valid after an [OK]\r
+ */\r
+Inkscape::Extension::Extension *\r
+FileImportFromOCALDialog::getSelectionType()\r
+{\r
+ return extension;\r
+}\r
+\r
+\r
+/**\r
+ * Get the file name chosen by the user. Valid after an [OK]\r
+ */\r
+Glib::ustring\r
+FileImportFromOCALDialog::getFilename (void)\r
+{\r
+ return filesList->getFilename();\r
+}\r
+\r
+} //namespace Dialog\r
+} //namespace UI\r
+} //namespace Inkscape\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 :
diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h
--- /dev/null
@@ -0,0 +1,251 @@
+/**\r
+ * Implementation of the OCAL import/export dialogs\r
+ *\r
+ * Authors:\r
+ * Joel Holdsworth\r
+ * Bruno Dilly\r
+ * Other dudes from The Inkscape Organization\r
+ *\r
+ * Copyright (C) 2007 Bruno Dilly\r
+ *\r
+ * Released under GNU GPL, read the file 'COPYING' for more information\r
+ */
+
+#include "filedialogimpl-gtkmm.h"\r
+\r
+namespace Inkscape\r
+{\r
+namespace UI\r
+{\r
+namespace Dialog\r
+{
+
+/*#########################################################################\r
+### F I L E D I A L O G O C A L B A S E C L A S S\r
+#########################################################################*/\r
+\r
+/**\r
+ * This class is the base implementation for export to OCAL.\r
+ */\r
+class FileDialogOCALBase : public Gtk::Dialog\r
+{\r
+public:\r
+\r
+ /**\r
+ *\r
+ */\r
+ FileDialogOCALBase(const Glib::ustring &title) : Gtk::Dialog(title,true)\r
+ {}\r
+ /*\r
+ *\r
+ */\r
+ virtual ~FileDialogOCALBase()\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
+//# F I L E E X P O R T T O O C A L\r
+//########################################################################\r
+\r
+/**\r
+ * Our implementation of the FileExportToOCALDialog interface.\r
+ */\r
+class FileExportToOCALDialog : public FileDialogOCALBase\r
+{\r
+\r
+public:\r
+ FileExportToOCALDialog(Gtk::Window& parentWindow, \r
+ const Glib::ustring &title,\r
+ const Glib::ustring &default_key);\r
+
+ /**
+ * Destructor.
+ * Perform any necessary cleanups.
+ */\r
+ virtual ~FileExportToOCALDialog();\r
+\r
+ bool show();\r
+
+ /**
+ * Return the 'key' (filetype) of the selection, if any
+ * @return a pointer to a string if successful (which must
+ * be later freed with g_free(), else NULL.
+ */\r
+ Inkscape::Extension::Extension *getSelectionType();
+\r
+ virtual void setSelectionType( Inkscape::Extension::Extension * key );\r
+\r
+ Glib::ustring getFilename();\r
+\r
+ Glib::ustring myFilename;\r
+\r
+ void change_title(const Glib::ustring& title);\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
+ Gtk::HBox fileBox;\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
+ * List of known file extensions.\r
+ */\r
+ std::set<Glib::ustring> knownExtensions;\r
+};\r
+\r
+\r
+//#########################################################################\r
+//### F I L E I M P O R T F R O M O C A L\r
+//#########################################################################\r
+\r
+/**\r
+ * Our implementation class for filesListView\r
+ */\r
+class FileListViewText : public Gtk::ListViewText\r
+{\r
+public:\r
+ FileListViewText(guint columns_count, SVGPreview& filesPreview):ListViewText(columns_count)\r
+ {\r
+ myPreview = &filesPreview;\r
+ }\r
+ Glib::ustring getFilename();\r
+protected:\r
+ void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);\r
+private:\r
+ Glib::ustring myFilename;\r
+ SVGPreview *myPreview;\r
+};\r
+\r
+/**\r
+ * Our implementation class for the FileImportFromOCALDialog\r
+ */\r
+class FileImportFromOCALDialog : public FileDialogOCALBase\r
+{\r
+public:\r
+\r
+ FileImportFromOCALDialog(Gtk::Window& parentWindow,\r
+ const Glib::ustring &dir,\r
+ const Glib::ustring &title);\r
+
+ /**
+ * Destructor.
+ * Perform any necessary cleanups.
+ */\r
+ virtual ~FileImportFromOCALDialog();\r
+
+ /**
+ * Show an OpenFile file selector.
+ * @return the selected path if user selected one, else NULL
+ */\r
+ bool show();\r
+
+ /**
+ * Return the 'key' (filetype) of the selection, if any
+ * @return a pointer to a string if successful (which must
+ * be later freed with g_free(), else NULL.
+ */\r
+ Inkscape::Extension::Extension *getSelectionType();\r
+\r
+ Glib::ustring getFilename();\r
+\r
+private:\r
+\r
+ /**\r
+ * Allow the user to type the tag to be searched\r
+ */\r
+ Gtk::Entry *searchTagEntry;\r
+ FileListViewText *filesList;\r
+ SVGPreview *filesPreview;\r
+ Gtk::Label *notFoundLabel;\r
+\r
+ // Child widgets\r
+ Gtk::HBox tagBox;\r
+ Gtk::HBox filesBox;\r
+ Gtk::HBox messageBox;\r
+ Gtk::ScrolledWindow listScrolledWindow;\r
+ Glib::RefPtr<Gtk::TreeSelection> selection;\r
+\r
+ /**\r
+ * Callback for user input into searchTagEntry\r
+ */\r
+ void searchTagEntryChangedCallback();\r
+\r
+\r
+ /**\r
+ * Prints the names of the all the xml elements \r
+ * that are siblings or children of a given xml node\r
+ */\r
+ void print_xml_element_names(xmlNode * a_node);\r
+\r
+ /**\r
+ * The extension to use to write this file\r
+ */\r
+ Inkscape::Extension::Extension *extension;\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 :