1
#ifndef __OCAL_DIALOG_H__
2
#define __OCAL_DIALOG_H__
4
* Defines the FileExportToOCALDialog, FileImportFromOCALDialog and
5
* FileExportToOCALPasswordDialog and their supporting classes.
8
* Bruno Dilly <bruno.dilly@gmail.com>
11
* Copyright (C) 2007 Bruno Dilly <bruno.dilly@gmail.com>
13
* Released under GNU GPL, read the file 'COPYING' for more information
19
#include "filedialogimpl-gtkmm.h"
26
#include <libxml/parser.h>
27
#include <libxml/tree.h>
31
#include <glibmm/i18n.h>
32
#include <glib/gstdio.h>
35
//Remove this after the get_filter() calls in
36
//show() on both classes are fixed
37
#include <gtk/gtkfilechooser.h>
40
#include <gtk/gtkentry.h>
41
#include <gtk/gtkexpander.h>
43
#include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
44
#include<libgnomevfs/gnome-vfs.h>
48
#include "prefs-utils.h"
49
#include <extension/input.h>
50
#include <extension/output.h>
51
#include <extension/db.h>
53
#include "svg-view-widget.h"
57
#include "ui/widget/scalar-unit.h"
67
/*#########################################################################
68
### F I L E D I A L O G O C A L B A S E C L A S S
69
#########################################################################*/
72
* This class is the base implementation for export to OCAL.
74
class FileDialogOCALBase : public Gtk::Dialog
81
FileDialogOCALBase(const Glib::ustring &title, Gtk::Window& parent) : Gtk::Dialog(title, parent, true)
87
virtual ~FileDialogOCALBase()
91
void cleanup( bool showConfirmed );
94
* What type of 'open' are we? (open, import, place, etc)
96
FileDialogType dialogType;
102
//########################################################################
103
//# F I L E E X P O R T T O O C A L
104
//########################################################################
108
* Our implementation of the FileExportToOCALDialog interface.
110
class FileExportToOCALDialog : public FileDialogOCALBase
116
* @param fileTypes one of FileDialogTypes
117
* @param title the title of the dialog
118
* @param key a list of file types from which the user can select
120
FileExportToOCALDialog(Gtk::Window& parentWindow,
121
FileDialogType fileTypes,
122
const Glib::ustring &title);
126
* Perform any necessary cleanups.
128
~FileExportToOCALDialog();
131
* Show an SaveAs file selector.
132
* @return the selected path if user selected one, else NULL
136
Glib::ustring getFilename();
138
Glib::ustring myFilename;
141
* Change the window title.
143
void change_title(const Glib::ustring& title);
148
* Fix to allow the user to type the file name
150
Gtk::Entry *fileNameEntry;
153
* Data mirror of the combo box
155
std::vector<FileType> fileTypes;
163
* The extension to use to write this file
165
Inkscape::Extension::Extension *extension;
168
* Callback for user input into fileNameEntry
170
void fileNameEntryChangedCallback();
173
* List of known file extensions.
175
std::set<Glib::ustring> knownExtensions;
177
}; //FileExportToOCAL
180
//########################################################################
181
//# F I L E E X P O R T T O O C A L P A S S W O R D
182
//########################################################################
186
* Our implementation of the FileExportToOCALPasswordDialog interface.
188
class FileExportToOCALPasswordDialog : public FileDialogOCALBase
194
* @param title the title of the dialog
196
FileExportToOCALPasswordDialog(Gtk::Window& parentWindow,
197
const Glib::ustring &title);
201
* Perform any necessary cleanups.
203
~FileExportToOCALPasswordDialog();
207
* Show 2 entry to input username and password.
211
Glib::ustring getUsername();
212
Glib::ustring getPassword();
215
* Change the window title.
217
void change_title(const Glib::ustring& title);
219
Glib::ustring myUsername;
220
Glib::ustring myPassword;
225
* Fix to allow the user to type the file name
227
Gtk::Entry *usernameEntry;
228
Gtk::Entry *passwordEntry;
231
Gtk::VBox entriesBox;
235
}; //FileExportToOCALPassword
239
//#########################################################################
240
//### F I L E I M P O R T F R O M O C A L
241
//#########################################################################
244
* Our implementation class for filesListView
246
class FileListViewText : public Gtk::ListViewText
249
FileListViewText(guint columns_count, SVGPreview& filesPreview, Gtk::Label& description, Gtk::Button& okButton)
250
:ListViewText(columns_count)
252
myPreview = &filesPreview;
253
myLabel = &description;
254
myButton = &okButton;
256
Glib::ustring getFilename();
258
void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
259
void on_cursor_changed();
261
Glib::ustring myFilename;
262
SVGPreview *myPreview;
264
Gtk::Button *myButton;
268
* Our implementation class for the FileImportFromOCALDialog interface..
270
class FileImportFromOCALDialog : public FileDialogOCALBase
275
* @param path the directory where to start searching
276
* @param fileTypes one of FileDialogTypes
277
* @param title the title of the dialog
279
FileImportFromOCALDialog(Gtk::Window& parentWindow,
280
const Glib::ustring &dir,
281
FileDialogType fileTypes,
282
const Glib::ustring &title);
286
* Perform any necessary cleanups.
288
~FileImportFromOCALDialog();
291
* Show an OpenFile file selector.
292
* @return the selected path if user selected one, else NULL
297
* Return the 'key' (filetype) of the selection, if any
298
* @return a pointer to a string if successful (which must
299
* be later freed with g_free(), else NULL.
301
Inkscape::Extension::Extension *getSelectionType();
303
Glib::ustring getFilename();
308
* Allow the user to type the tag to be searched
310
Gtk::Entry *searchTagEntry;
311
FileListViewText *filesList;
312
SVGPreview *filesPreview;
313
Gtk::Label *notFoundLabel;
314
Gtk::Label *descriptionLabel;
315
Gtk::Button *searchButton;
316
Gtk::Button *okButton;
321
Gtk::HBox messageBox;
322
Gtk::HBox descriptionBox;
323
Gtk::ScrolledWindow listScrolledWindow;
324
Glib::RefPtr<Gtk::TreeSelection> selection;
327
* Callback for user input into searchTagEntry
329
void searchTagEntryChangedCallback();
333
* Prints the names of the all the xml elements
334
* that are siblings or children of a given xml node
336
void print_xml_element_names(xmlNode * a_node);
339
* The extension to use to write this file
341
Inkscape::Extension::Extension *extension;
343
}; //FileImportFromOCALDialog
348
} //namespace Inkscape
351
#endif /* __OCAL_DIALOG_H__ */
356
c-file-style:"stroustrup"
357
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
362
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :