summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea7ff7f)
raw | patch | inline | side by side (parent: ea7ff7f)
author | bdilly <bdilly@users.sourceforge.net> | |
Mon, 20 Aug 2007 04:09:10 +0000 (04:09 +0000) | ||
committer | bdilly <bdilly@users.sourceforge.net> | |
Mon, 20 Aug 2007 04:09:10 +0000 (04:09 +0000) |
src/file.cpp | patch | blob | history | |
src/ui/dialog/ocaldialogs.cpp | patch | blob | history | |
src/ui/dialog/ocaldialogs.h | patch | blob | history |
diff --git a/src/file.cpp b/src/file.cpp
index e8e9af9d350d4c7582d7199a27ce9d6ed26d06f0..0e8a084e33439c504e59f171a5ccd1965e3687b1 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
// Show the Export To OCAL dialog
if (!exportDialogInstance)
- exportDialogInstance = Inkscape::UI::Dialog::FileExportToOCALDialog::create(
+ exportDialogInstance = new Inkscape::UI::Dialog::FileExportToOCALDialog(
parentWindow,
Inkscape::UI::Dialog::EXPORT_TYPES,
(char const *) _("Select file to export to")
if(!gotSuccess)
{
if (!exportPasswordDialogInstance)
- exportPasswordDialogInstance = Inkscape::UI::Dialog::FileExportToOCALPasswordDialog::create(
+ exportPasswordDialogInstance = new Inkscape::UI::Dialog::FileExportToOCALPasswordDialog(
parentWindow,
(char const *) _("Open Clip Art Login"));
success = exportPasswordDialogInstance->show();
static Inkscape::UI::Dialog::FileImportFromOCALDialog *importDialogInstance = NULL;
if (!importDialogInstance) {
- importDialogInstance =
- Inkscape::UI::Dialog::FileImportFromOCALDialog::create(
+ importDialogInstance = new
+ Inkscape::UI::Dialog::FileImportFromOCALDialog(
parentWindow,
import_path,
Inkscape::UI::Dialog::IMPORT_TYPES,
index ae2dbd315043299c5f2e152cdfe333ca25369cc0..7f1d72c70f3cfa5b08221c75cd0bc36f91f9d65a 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)
-{
- FileExportToOCALDialog *dialog = new FileExportToOCALDialogImpl(parentWindow, fileTypes, title);
- return dialog;
-}
-
-//########################################################################
-//# F I L E E X P O R T T O O C A L P A S S W O R D
-//########################################################################
-
-
-/**
- * Public factory method. Used in file.cpp
- */
-
-FileExportToOCALPasswordDialog *FileExportToOCALPasswordDialog::create(Gtk::Window& parentWindow,
- const Glib::ustring &title)
-{
- FileExportToOCALPasswordDialog *dialog = new FileExportToOCALPasswordDialogImpl(parentWindow, title);
- 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;
-}
-
-
-//########################################################################
-//# F I L E E X P O R T T O O C A L
-//########################################################################
-
-
-
/**
* Callback for fileNameEntry widget
*/
-void FileExportToOCALDialogImpl::fileNameEntryChangedCallback()
+void FileExportToOCALDialog::fileNameEntryChangedCallback()
{
if (!fileNameEntry)
return;
response(Gtk::RESPONSE_OK);
}
-
-
-
/**
* Constructor
*/
-FileExportToOCALDialogImpl::FileExportToOCALDialogImpl(Gtk::Window &parentWindow,
+FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,
FileDialogType fileTypes,
const Glib::ustring &title) :
- FileDialogOCALBase(title)
+ FileDialogOCALBase(title, parentWindow)
{
/*
* Start Taking the vertical Box and putting a Label
@@ -120,11 +64,10 @@ FileExportToOCALDialogImpl::FileExportToOCALDialogImpl(Gtk::Window &parentWindow
extension = NULL;
/* No filename to start out with */
myFilename = "";
-
/* Set our dialog type (save, export, etc...)*/
dialogType = fileTypes;
Gtk::VBox *vbox = get_vbox();
-
+
Gtk::Label *fileLabel = new Gtk::Label(_("File"));
fileNameEntry = new Gtk::Entry();
//Catch when user hits [return] on the text field
fileNameEntry = entries[0];
fileNameEntry->signal_activate().connect(
- sigc::mem_fun(*this, &FileExportToOCALDialogImpl::fileNameEntryChangedCallback) );
+ sigc::mem_fun(*this, &FileExportToOCALDialog::fileNameEntryChangedCallback) );
}
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
@@ -153,12 +96,10 @@ FileExportToOCALDialogImpl::FileExportToOCALDialogImpl(Gtk::Window &parentWindow
show_all_children();
}
-
-
/**
* Destructor
*/
-FileExportToOCALDialogImpl::~FileExportToOCALDialogImpl()
+FileExportToOCALDialog::~FileExportToOCALDialog()
{
}
* Show this dialog modally. Return true if user hits [OK]
*/
bool
-FileExportToOCALDialogImpl::show()
+FileExportToOCALDialog::show()
{
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
* Get the file name chosen by the user. Valid after an [OK]
*/
Glib::ustring
-FileExportToOCALDialogImpl::getFilename()
+FileExportToOCALDialog::getFilename()
{
myFilename = fileNameEntry->get_text();
if (!Glib::get_charset()) //If we are not utf8
void
-FileExportToOCALDialogImpl::change_title(const Glib::ustring& title)
+FileExportToOCALDialog::change_title(const Glib::ustring& title)
{
this->set_title(title);
}
/**
* Constructor
*/
-FileExportToOCALPasswordDialogImpl::FileExportToOCALPasswordDialogImpl(Gtk::Window &parentWindow,
- const Glib::ustring &title) : FileDialogOCALBase(title)
+FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &parentWindow,
+ const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow)
{
/*
* Start Taking the vertical Box and putting 2 Labels
@@ -257,7 +198,7 @@ FileExportToOCALPasswordDialogImpl::FileExportToOCALPasswordDialogImpl(Gtk::Wind
/**
* Destructor
*/
-FileExportToOCALPasswordDialogImpl::~FileExportToOCALPasswordDialogImpl()
+FileExportToOCALPasswordDialog::~FileExportToOCALPasswordDialog()
{
}
* Show this dialog modally. Return true if user hits [OK]
*/
bool
-FileExportToOCALPasswordDialogImpl::show()
+FileExportToOCALPasswordDialog::show()
{
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
* Get the username. Valid after an [OK]
*/
Glib::ustring
-FileExportToOCALPasswordDialogImpl::getUsername()
+FileExportToOCALPasswordDialog::getUsername()
{
myUsername = usernameEntry->get_text();
return myUsername;
* Get the password. Valid after an [OK]
*/
Glib::ustring
-FileExportToOCALPasswordDialogImpl::getPassword()
+FileExportToOCALPasswordDialog::getPassword()
{
myPassword = passwordEntry->get_text();
return myPassword;
}
void
-FileExportToOCALPasswordDialogImpl::change_title(const Glib::ustring& title)
+FileExportToOCALPasswordDialog::change_title(const Glib::ustring& title)
{
this->set_title(title);
}
/**
* Callback for user input into searchTagEntry
*/
-void FileImportFromOCALDialogImplGtk::searchTagEntryChangedCallback()
+void FileImportFromOCALDialog::searchTagEntryChangedCallback()
{
if (!searchTagEntry)
return;
* Prints the names of the all the xml elements
* that are siblings or children of a given xml node
*/
-void FileImportFromOCALDialogImplGtk::print_xml_element_names(xmlNode * a_node)
+void FileImportFromOCALDialog::print_xml_element_names(xmlNode * a_node)
{
xmlNode *cur_node = NULL;
guint row_num = 0;
@@ -581,11 +522,11 @@ void FileImportFromOCALDialogImplGtk::print_xml_element_names(xmlNode * a_node)
/**
* Constructor. Not called directly. Use the factory.
*/
-FileImportFromOCALDialogImplGtk::FileImportFromOCALDialogImplGtk(Gtk::Window& parentWindow,
+FileImportFromOCALDialog::FileImportFromOCALDialog(Gtk::Window& parentWindow,
const Glib::ustring &dir,
FileDialogType fileTypes,
const Glib::ustring &title) :
- FileDialogOCALBase(title)
+ FileDialogOCALBase(title, parentWindow)
{
// Initalize to Autodetect
extension = NULL;
@@ -644,11 +585,11 @@ FileImportFromOCALDialogImplGtk::FileImportFromOCALDialogImplGtk(Gtk::Window& pa
//Catch when user hits [return] on the text field
searchTagEntry = entries[0];
searchTagEntry->signal_activate().connect(
- sigc::mem_fun(*this, &FileImportFromOCALDialogImplGtk::searchTagEntryChangedCallback));
+ sigc::mem_fun(*this, &FileImportFromOCALDialog::searchTagEntryChangedCallback));
}
searchButton->signal_clicked().connect(
- sigc::mem_fun(*this, &FileImportFromOCALDialogImplGtk::searchTagEntryChangedCallback));
+ sigc::mem_fun(*this, &FileImportFromOCALDialog::searchTagEntryChangedCallback));
show_all_children();
notFoundLabel->hide();
@@ -657,7 +598,7 @@ FileImportFromOCALDialogImplGtk::FileImportFromOCALDialogImplGtk(Gtk::Window& pa
/**
* Destructor
*/
-FileImportFromOCALDialogImplGtk::~FileImportFromOCALDialogImplGtk()
+FileImportFromOCALDialog::~FileImportFromOCALDialog()
{
}
* Show this dialog modally. Return true if user hits [OK]
*/
bool
-FileImportFromOCALDialogImplGtk::show()
+FileImportFromOCALDialog::show()
{
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
* Get the file extension type that was selected by the user. Valid after an [OK]
*/
Inkscape::Extension::Extension *
-FileImportFromOCALDialogImplGtk::getSelectionType()
+FileImportFromOCALDialog::getSelectionType()
{
return extension;
}
* Get the file name chosen by the user. Valid after an [OK]
*/
Glib::ustring
-FileImportFromOCALDialogImplGtk::getFilename (void)
+FileImportFromOCALDialog::getFilename (void)
{
return filesList->getFilename();
}
index c7c8009de6c34f518cc07620bd7e8ab36bab73bc..0953e76bc98136772c4585a08e9570836bea4e6e 100644 (file)
namespace Dialog
{
-
-/**
- * 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);
-
-
- /**
- * 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;
-
- 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 "ExportToOCALPassword" dialogs.
- */
-class FileExportToOCALPasswordDialog
-{
-public:
-
- /**
- * Constructor. Do not call directly . Use the factory.
- * @param title the title of the dialog
- */
- FileExportToOCALPasswordDialog ()
- {};
-
- /**
- * Factory.
- * @param title the title of the dialog
- */
- static FileExportToOCALPasswordDialog *create(Gtk::Window& parentWindow,
- const Glib::ustring &title);
-
-
- /**
- * Destructor.
- * Perform any necessary cleanups.
- */
- virtual ~FileExportToOCALPasswordDialog() {};
-
-
- /**
- * Show 2 entry to input username and password.
- */
- virtual bool show() =0;
-
- virtual Glib::ustring getUsername () =0;
- virtual Glib::ustring getPassword () =0;
-
- /**
- * Change the window title.
- */
- virtual void change_title(const Glib::ustring& title) =0;
-
-
-}; //FileExportToOCALPassword
-
-
-
-/**
- * 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
-
-
/*#########################################################################
### F I L E D I A L O G O C A L B A S E C L A S S
#########################################################################*/
public:
/**
- *
+ * Constructor
*/
- FileDialogOCALBase(const Glib::ustring &title) : Gtk::Dialog(title,true)
+ FileDialogOCALBase(const Glib::ustring &title, Gtk::Window& parent) : Gtk::Dialog(title, parent, true)
{}
+
/*
- *
+ * Destructor
*/
virtual ~FileDialogOCALBase()
{}
protected:
void cleanup( bool showConfirmed );
- //Glib::ustring preferenceBase;
/**
* What type of 'open' are we? (open, import, place, etc)
*/
//########################################################################
-
/**
* Our implementation of the FileExportToOCALDialog interface.
*/
-class FileExportToOCALDialogImpl : public FileExportToOCALDialog, public FileDialogOCALBase
+class FileExportToOCALDialog : public FileDialogOCALBase
{
public:
- FileExportToOCALDialogImpl(Gtk::Window& parentWindow,
+ /**
+ * Constructor
+ * @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(Gtk::Window& parentWindow,
FileDialogType fileTypes,
const Glib::ustring &title);
- virtual ~FileExportToOCALDialogImpl();
+ /**
+ * Destructor.
+ * Perform any necessary cleanups.
+ */
+ ~FileExportToOCALDialog();
+ /**
+ * Show an SaveAs file selector.
+ * @return the selected path if user selected one, else NULL
+ */
bool show();
Glib::ustring getFilename();
Glib::ustring myFilename;
+ /**
+ * Change the window title.
+ */
void change_title(const Glib::ustring& title);
-
+
private:
/**
* List of known file extensions.
*/
std::set<Glib::ustring> knownExtensions;
-};
+
+}; //FileExportToOCAL
//########################################################################
/**
* Our implementation of the FileExportToOCALPasswordDialog interface.
*/
-class FileExportToOCALPasswordDialogImpl : public FileExportToOCALPasswordDialog, public FileDialogOCALBase
+class FileExportToOCALPasswordDialog : public FileDialogOCALBase
{
public:
- FileExportToOCALPasswordDialogImpl(Gtk::Window& parentWindow,
+ /**
+ * Constructor
+ * @param title the title of the dialog
+ */
+ FileExportToOCALPasswordDialog(Gtk::Window& parentWindow,
const Glib::ustring &title);
- virtual ~FileExportToOCALPasswordDialogImpl();
+ /**
+ * Destructor.
+ * Perform any necessary cleanups.
+ */
+ ~FileExportToOCALPasswordDialog();
+
+ /**
+ * Show 2 entry to input username and password.
+ */
bool show();
Glib::ustring getUsername();
Glib::ustring getPassword();
+ /**
+ * Change the window title.
+ */
+ void change_title(const Glib::ustring& title);
+
Glib::ustring myUsername;
Glib::ustring myPassword;
- void change_title(const Glib::ustring& title);
-
private:
/**
Gtk::HBox userBox;
Gtk::HBox passBox;
-};
-
+}; //FileExportToOCALPassword
/**
* Our implementation class for the FileImportFromOCALDialog interface..
*/
-class FileImportFromOCALDialogImplGtk : public FileImportFromOCALDialog, public FileDialogOCALBase
+class FileImportFromOCALDialog : public FileDialogOCALBase
{
public:
-
- FileImportFromOCALDialogImplGtk(Gtk::Window& parentWindow,
+ /**
+ * Constructor
+ * @param path the directory where to start searching
+ * @param fileTypes one of FileDialogTypes
+ * @param title the title of the dialog
+ */
+ FileImportFromOCALDialog(Gtk::Window& parentWindow,
const Glib::ustring &dir,
FileDialogType fileTypes,
const Glib::ustring &title);
- virtual ~FileImportFromOCALDialogImplGtk();
+ /**
+ * Destructor.
+ * Perform any necessary cleanups.
+ */
+ ~FileImportFromOCALDialog();
+ /**
+ * Show an OpenFile file selector.
+ * @return the selected path if user selected one, else NULL
+ */
bool show();
+ /**
+ * 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.
+ */
Inkscape::Extension::Extension *getSelectionType();
Glib::ustring getFilename();
* The extension to use to write this file
*/
Inkscape::Extension::Extension *extension;
-};
-
+}; //FileImportFromOCALDialog
} //namespace Dialog