2
* @brief Open Clip Art Library integration dialogs
5
* Bruno Dilly <bruno.dilly@gmail.com>
8
* Copyright (C) 2007 Bruno Dilly <bruno.dilly@gmail.com>
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#ifndef __OCAL_DIALOG_H__
13
#define __OCAL_DIALOG_H__
18
#include "filedialogimpl-gtkmm.h"
25
#include <libxml/parser.h>
26
#include <libxml/tree.h>
30
#include <glibmm/i18n.h>
31
#include <glib/gstdio.h>
34
//Remove this after the get_filter() calls in
35
//show() on both classes are fixed
36
#include <gtk/gtkfilechooser.h>
39
#include <gtk/gtkentry.h>
40
#include <gtk/gtkexpander.h>
42
#include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
43
#include<libgnomevfs/gnome-vfs.h>
47
#include <extension/input.h>
48
#include <extension/output.h>
49
#include <extension/db.h>
51
#include "svg-view-widget.h"
55
#include "ui/widget/scalar-unit.h"
65
/*#########################################################################
66
### F I L E D I A L O G O C A L B A S E C L A S S
67
#########################################################################*/
70
* This class is the base implementation for export to OCAL.
72
class FileDialogOCALBase : public Gtk::Dialog
79
FileDialogOCALBase(const Glib::ustring &title, Gtk::Window& parent) : Gtk::Dialog(title, parent, true)
85
virtual ~FileDialogOCALBase()
89
void cleanup( bool showConfirmed );
92
* What type of 'open' are we? (open, import, place, etc)
94
FileDialogType dialogType;
100
//########################################################################
101
//# F I L E E X P O R T T O O C A L
102
//########################################################################
106
* Our implementation of the FileExportToOCALDialog interface.
108
class FileExportToOCALDialog : public FileDialogOCALBase
114
* @param fileTypes one of FileDialogTypes
115
* @param title the title of the dialog
116
* @param key a list of file types from which the user can select
118
FileExportToOCALDialog(Gtk::Window& parentWindow,
119
FileDialogType fileTypes,
120
const Glib::ustring &title);
124
* Perform any necessary cleanups.
126
~FileExportToOCALDialog();
129
* Show an SaveAs file selector.
130
* @return the selected path if user selected one, else NULL
134
Glib::ustring getFilename();
136
Glib::ustring myFilename;
139
* Change the window title.
141
void change_title(const Glib::ustring& title);
146
* Fix to allow the user to type the file name
148
Gtk::Entry *fileNameEntry;
151
* Data mirror of the combo box
153
std::vector<FileType> fileTypes;
161
* The extension to use to write this file
163
Inkscape::Extension::Extension *extension;
166
* Callback for user input into fileNameEntry
168
void fileNameEntryChangedCallback();
171
* List of known file extensions.
173
std::set<Glib::ustring> knownExtensions;
175
}; //FileExportToOCAL
178
//########################################################################
179
//# F I L E E X P O R T T O O C A L P A S S W O R D
180
//########################################################################
184
* Our implementation of the FileExportToOCALPasswordDialog interface.
186
class FileExportToOCALPasswordDialog : public FileDialogOCALBase
192
* @param title the title of the dialog
194
FileExportToOCALPasswordDialog(Gtk::Window& parentWindow,
195
const Glib::ustring &title);
199
* Perform any necessary cleanups.
201
~FileExportToOCALPasswordDialog();
205
* Show 2 entry to input username and password.
209
Glib::ustring getUsername();
210
Glib::ustring getPassword();
213
* Change the window title.
215
void change_title(const Glib::ustring& title);
217
Glib::ustring myUsername;
218
Glib::ustring myPassword;
223
* Fix to allow the user to type the file name
225
Gtk::Entry *usernameEntry;
226
Gtk::Entry *passwordEntry;
229
Gtk::VBox entriesBox;
233
}; //FileExportToOCALPassword
237
//#########################################################################
238
//### F I L E I M P O R T F R O M O C A L
239
//#########################################################################
242
* Our implementation class for filesListView
244
class FileListViewText : public Gtk::ListViewText
247
FileListViewText(guint columns_count, SVGPreview& filesPreview, Gtk::Label& description, Gtk::Button& okButton)
248
:ListViewText(columns_count)
250
myPreview = &filesPreview;
251
myLabel = &description;
252
myButton = &okButton;
254
Glib::ustring getFilename();
256
void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
257
void on_cursor_changed();
259
Glib::ustring myFilename;
260
SVGPreview *myPreview;
262
Gtk::Button *myButton;
266
* Our implementation class for the FileImportFromOCALDialog interface..
268
class FileImportFromOCALDialog : public FileDialogOCALBase
273
* @param path the directory where to start searching
274
* @param fileTypes one of FileDialogTypes
275
* @param title the title of the dialog
277
FileImportFromOCALDialog(Gtk::Window& parentWindow,
278
const Glib::ustring &dir,
279
FileDialogType fileTypes,
280
const Glib::ustring &title);
284
* Perform any necessary cleanups.
286
~FileImportFromOCALDialog();
289
* Show an OpenFile file selector.
290
* @return the selected path if user selected one, else NULL
295
* Return the 'key' (filetype) of the selection, if any
296
* @return a pointer to a string if successful (which must
297
* be later freed with g_free(), else NULL.
299
Inkscape::Extension::Extension *getSelectionType();
301
Glib::ustring getFilename();
306
* Allow the user to type the tag to be searched
308
Gtk::Entry *searchTagEntry;
309
FileListViewText *filesList;
310
SVGPreview *filesPreview;
311
Gtk::Label *notFoundLabel;
312
Gtk::Label *descriptionLabel;
313
Gtk::Button *searchButton;
314
Gtk::Button *okButton;
319
Gtk::HBox messageBox;
320
Gtk::HBox descriptionBox;
321
Gtk::ScrolledWindow listScrolledWindow;
322
Glib::RefPtr<Gtk::TreeSelection> selection;
325
* Callback for user input into searchTagEntry
327
void searchTagEntryChangedCallback();
331
* Prints the names of the all the xml elements
332
* that are siblings or children of a given xml node
334
void print_xml_element_names(xmlNode * a_node);
337
* The extension to use to write this file
339
Inkscape::Extension::Extension *extension;
341
}; //FileImportFromOCALDialog
346
} //namespace Inkscape
349
#endif /* __OCAL_DIALOG_H__ */
354
c-file-style:"stroustrup"
355
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
360
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :