summaryrefslogtreecommitdiffstats
path: root/src/application
diff options
context:
space:
mode:
Diffstat (limited to 'src/application')
-rw-r--r--src/application/.cvsignore3
-rw-r--r--src/application/Makefile_insert14
-rw-r--r--src/application/app-prototype.cpp43
-rw-r--r--src/application/app-prototype.h53
-rw-r--r--src/application/application.cpp163
-rw-r--r--src/application/application.h65
-rw-r--r--src/application/editor.cpp416
-rw-r--r--src/application/editor.h139
-rw-r--r--src/application/makefile.in17
9 files changed, 913 insertions, 0 deletions
diff --git a/src/application/.cvsignore b/src/application/.cvsignore
new file mode 100644
index 000000000..38efca7bc
--- /dev/null
+++ b/src/application/.cvsignore
@@ -0,0 +1,3 @@
+.deps
+.dirstamp
+makefile
diff --git a/src/application/Makefile_insert b/src/application/Makefile_insert
new file mode 100644
index 000000000..9a5306ec7
--- /dev/null
+++ b/src/application/Makefile_insert
@@ -0,0 +1,14 @@
+## Makefile.am fragment sourced by src/Makefile.am.
+
+application/all: application/libinkapp.a
+
+application/clean:
+ rm -f application/libinkapp.a $(application_libinkapp_a_OBJECTS)
+
+application_libinkapp_a_SOURCES = \
+ application/editor.cpp \
+ application/editor.h \
+ application/application.cpp \
+ application/application.h \
+ application/app-prototype.cpp \
+ application/app-prototype.h
diff --git a/src/application/app-prototype.cpp b/src/application/app-prototype.cpp
new file mode 100644
index 000000000..b94f5ea05
--- /dev/null
+++ b/src/application/app-prototype.cpp
@@ -0,0 +1,43 @@
+/**
+ * \brief Base class for different application modes
+ *
+ * Author:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ *
+ * Copyright (C) 2005 Bryce Harrington
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#include "app-prototype.h"
+
+namespace Inkscape {
+namespace NSApplication {
+
+AppPrototype::AppPrototype()
+{
+}
+
+AppPrototype::AppPrototype(int argc, const char **argv)
+{
+}
+
+AppPrototype::~AppPrototype()
+{
+}
+
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/app-prototype.h b/src/application/app-prototype.h
new file mode 100644
index 000000000..a7c8ad86f
--- /dev/null
+++ b/src/application/app-prototype.h
@@ -0,0 +1,53 @@
+/**
+ * \brief Base class for different application modes
+ *
+ * Author:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ *
+ * Copyright (C) 2005 Bryce Harrington
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_APPLICATION_APP_PROTOTYPE_H
+#define INKSCAPE_APPLICATION_APP_PROTOTYPE_H
+
+namespace Gtk {
+class Window;
+}
+
+
+namespace Inkscape {
+namespace NSApplication {
+
+class AppPrototype
+{
+public:
+ AppPrototype();
+ AppPrototype(int argc, const char **argv);
+ virtual ~AppPrototype();
+
+ virtual void* getWindow() = 0;
+
+protected:
+ AppPrototype(AppPrototype const &);
+ AppPrototype& operator=(AppPrototype const &);
+
+};
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+
+#endif /* !INKSCAPE_APPLICATION_APP_PROTOTYPE_H */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/application.cpp b/src/application/application.cpp
new file mode 100644
index 000000000..4b1ea03df
--- /dev/null
+++ b/src/application/application.cpp
@@ -0,0 +1,163 @@
+/** \file
+ * \brief The top level class for managing the application.
+ *
+ * Authors:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * Copyright (C) 2005 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtkmm/main.h>
+
+#include "preferences.h"
+#include "application.h"
+#include "editor.h"
+
+int sp_main_gui(int argc, char const **argv);
+int sp_main_console(int argc, char const **argv);
+
+static Gtk::Main *_gtk_main;
+static bool _use_gui, _new_gui;
+
+namespace Inkscape {
+namespace NSApplication {
+
+Application::Application(int argc, char **argv, bool use_gui, bool new_gui)
+ : _argc(argc),
+ _argv(NULL),
+ _app_impl(NULL),
+ _path_home(NULL)
+{
+ _use_gui = use_gui;
+ _new_gui = new_gui;
+
+ if (argv != NULL) {
+ _argv = argv; // TODO: Is this correct?
+ }
+
+ Inkscape::Preferences::loadSkeleton();
+ if (new_gui) {
+ _gtk_main = new Gtk::Main(argc, argv, true);
+
+ // TODO: Determine class by arguments
+ g_warning("Creating new Editor");
+ _app_impl = (AppPrototype*) Editor::create(_argc, _argv);
+
+ } else if (use_gui) {
+ // No op - we'll use the old interface
+ } else {
+ _app_impl = NULL; // = Cmdline(_argc, _argv);
+ }
+
+ /// \todo Install segv handler here?
+
+// Inkscape::Extension::init();
+}
+
+Application::~Application()
+{
+ g_free(_path_home);
+}
+
+
+/** Returns the current home directory location */
+gchar const*
+Application::homedir() const
+{
+ if ( !_path_home ) {
+ _path_home = g_strdup(g_get_home_dir());
+ gchar* utf8Path = g_filename_to_utf8( _path_home, -1, NULL, NULL, NULL );
+ if ( utf8Path ) {
+ _path_home = utf8Path;
+ if ( !g_utf8_validate(_path_home, -1, NULL) ) {
+ g_warning( "Home directory is non-UTF-8" );
+ }
+ }
+ }
+ if ( !_path_home && _argv != NULL) {
+ gchar * path = g_path_get_dirname(_argv[0]);
+ gchar * utf8Path = g_filename_to_utf8( path, -1, NULL, NULL, NULL );
+ g_free(path);
+ if (utf8Path) {
+ _path_home = utf8Path;
+ if ( !g_utf8_validate(_path_home, -1, NULL) ) {
+ g_warning( "Application run directory is non-UTF-8" );
+ }
+ }
+ }
+ return _path_home;
+}
+
+gint
+Application::run()
+{
+ gint result = 0;
+
+ /* Note: This if loop should be replaced by calls to the
+ * various subclasses of I::A::AppPrototype.
+ */
+ if (_gtk_main != NULL) {
+ g_assert(_app_impl != NULL);
+
+ Inkscape::Preferences::load();
+ g_warning("Running main window");
+ Gtk::Window *win = static_cast<Gtk::Window*>(_app_impl->getWindow());
+ g_assert(win != NULL);
+ _gtk_main->run(*win);
+ result = 0;
+
+ } else if (_use_gui) {
+ result = sp_main_gui(_argc, (const char**)_argv);
+
+ } else {
+ result = sp_main_console(_argc, (const char**)_argv);
+ }
+
+ return result;
+}
+
+void
+Application::exit()
+{
+ Inkscape::Preferences::save();
+
+ if (_gtk_main != NULL) {
+ _gtk_main->quit();
+ }
+
+}
+
+bool
+Application::getUseGui()
+{
+ return _use_gui;
+}
+
+bool
+Application::getNewGui()
+{
+ return _new_gui;
+}
+
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/application.h b/src/application/application.h
new file mode 100644
index 000000000..212add9e8
--- /dev/null
+++ b/src/application/application.h
@@ -0,0 +1,65 @@
+/** \file
+ * \brief The top level class for managing the application.
+ *
+ * Authors:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * Copyright (C) 2005 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_APPLICATION_APPLICATION_H
+#define INKSCAPE_APPLICATION_APPLICATION_H
+
+#include <glib/gtypes.h>
+
+namespace Gtk {
+class Main;
+}
+
+namespace Inkscape {
+namespace NSApplication {
+class AppPrototype;
+
+class Application
+{
+public:
+ Application(int argc, char **argv, bool use_gui=true, bool new_gui=false);
+ virtual ~Application();
+
+ gchar const *homedir() const;
+
+ gint run();
+
+ static bool getUseGui();
+ static bool getNewGui();
+ static void exit();
+
+protected:
+ Application(Application const &);
+ Application& operator=(Application const &);
+
+ gint _argc;
+ char **_argv;
+ AppPrototype *_app_impl;
+
+ mutable gchar *_path_home;
+};
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+#endif /* !INKSCAPE_APPLICATION_APPLICATION_H */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/editor.cpp b/src/application/editor.cpp
new file mode 100644
index 000000000..6c3dbf896
--- /dev/null
+++ b/src/application/editor.cpp
@@ -0,0 +1,416 @@
+/** \file
+ * \brief Editor Implementation class declaration for Inkscape. This
+ * singleton class implements much of the functionality of the former
+ * 'inkscape' object and its services and signals.
+ *
+ * Authors:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ * Derek P. Moore <derekm@hackunix.org>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * Copyright (C) 2004-2005 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/*
+ TODO: Replace SPDocument with the new Inkscape::Document
+ TODO: Change 'desktop's to 'view*'s
+ TODO: Add derivation from Inkscape::Application::RunMode
+*/
+
+
+#include "path-prefix.h"
+#include "io/sys.h"
+#include "sp-object-repr.h"
+#include <desktop-handles.h>
+#include "document.h"
+#include "sp-namedview.h"
+#include "event-context.h"
+#include "sp-guide.h"
+#include "selection.h"
+#include "editor.h"
+#include "application/application.h"
+#include "preferences.h"
+#include "ui/view/edit-widget.h"
+
+namespace Inkscape {
+namespace NSApplication {
+
+static Editor *_instance = 0;
+static void *_window;
+
+Editor*
+Editor::create (gint argc, char **argv)
+{
+ if (_instance == 0)
+ {
+ _instance = new Editor (argc, argv);
+ _instance->init();
+ }
+ return _instance;
+}
+
+Editor::Editor (gint argc, char **argv)
+: _documents (0),
+ _desktops (0),
+ _argv0 (argv[0]),
+ _dialogs_toggle (true)
+
+{
+ sp_object_type_register ("sodipodi:namedview", SP_TYPE_NAMEDVIEW);
+ sp_object_type_register ("sodipodi:guide", SP_TYPE_GUIDE);
+
+ Inkscape::Preferences::load();
+}
+
+bool
+Editor::init()
+{
+ // Load non-local template until we have everything right
+ // This code formerly lived in file.cpp
+ //
+ gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL);
+ bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR);
+ SPDocument *doc = sp_document_new (have_default? tmpl:0, true, true);
+ g_return_val_if_fail (doc != 0, false);
+ Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc);
+ sp_document_unref (doc);
+ _window = ew->getWindow();
+ return ew != 0;
+}
+
+Editor::~Editor()
+{
+}
+
+/// Returns the Window representation of this application object
+void*
+Editor::getWindow()
+{
+ return _window;
+}
+
+/// Returns the active document
+SPDocument*
+Editor::getActiveDocument()
+{
+ if (getActiveDesktop()) {
+ return SP_DT_DOCUMENT (getActiveDesktop());
+ }
+
+ return NULL;
+}
+
+void
+Editor::addDocument (SPDocument *doc)
+{
+ g_assert (!g_slist_find (_instance->_documents, doc));
+ _instance->_documents = g_slist_append (_instance->_documents, doc);
+}
+
+void
+Editor::removeDocument (SPDocument *doc)
+{
+ g_assert (g_slist_find (_instance->_documents, doc));
+ _instance->_documents = g_slist_remove (_instance->_documents, doc);
+}
+
+SPDesktop*
+Editor::createDesktop (SPDocument* doc)
+{
+ g_assert (doc != 0);
+ (new Inkscape::UI::View::EditWidget (doc))->present();
+ sp_document_unref (doc);
+ SPDesktop *dt = getActiveDesktop();
+ reactivateDesktop (dt);
+ return dt;
+}
+
+/// Returns the currently active desktop
+SPDesktop*
+Editor::getActiveDesktop()
+{
+ if (_instance->_desktops == NULL) {
+ return NULL;
+ }
+
+ return (SPDesktop *) _instance->_desktops->data;
+}
+
+/// Add desktop to list of desktops
+void
+Editor::addDesktop (SPDesktop *dt)
+{
+ g_return_if_fail (dt != 0);
+ g_assert (!g_slist_find (_instance->_desktops, dt));
+
+ _instance->_desktops = g_slist_append (_instance->_desktops, dt);
+
+ if (isDesktopActive (dt)) {
+ _instance->_desktop_activated_signal.emit (dt);
+ _instance->_event_context_set_signal.emit (SP_DT_EVENTCONTEXT (dt));
+ _instance->_selection_set_signal.emit (SP_DT_SELECTION (dt));
+ _instance->_selection_changed_signal.emit (SP_DT_SELECTION (dt));
+ }
+}
+
+/// Remove desktop from list of desktops
+void
+Editor::removeDesktop (SPDesktop *dt)
+{
+ g_return_if_fail (dt != 0);
+ g_assert (g_slist_find (_instance->_desktops, dt));
+
+ if (dt == _instance->_desktops->data) { // is it the active desktop?
+ _instance->_desktop_deactivated_signal.emit (dt);
+ if (_instance->_desktops->next != 0) {
+ SPDesktop * new_desktop = (SPDesktop *) _instance->_desktops->next->data;
+ _instance->_desktops = g_slist_remove (_instance->_desktops, new_desktop);
+ _instance->_desktops = g_slist_prepend (_instance->_desktops, new_desktop);
+ _instance->_desktop_activated_signal.emit (new_desktop);
+ _instance->_event_context_set_signal.emit (SP_DT_EVENTCONTEXT (new_desktop));
+ _instance->_selection_set_signal.emit (SP_DT_SELECTION (new_desktop));
+ _instance->_selection_changed_signal.emit (SP_DT_SELECTION (new_desktop));
+ } else {
+ _instance->_event_context_set_signal.emit (0);
+ if (SP_DT_SELECTION(dt))
+ SP_DT_SELECTION(dt)->clear();
+ }
+ }
+
+ _instance->_desktops = g_slist_remove (_instance->_desktops, dt);
+
+ // if this was the last desktop, shut down the program
+ if (_instance->_desktops == NULL) {
+ _instance->_shutdown_signal.emit();
+ Inkscape::NSApplication::Application::exit();
+ }
+}
+
+void
+Editor::activateDesktop (SPDesktop* dt)
+{
+ g_assert (dt != 0);
+ if (isDesktopActive (dt))
+ return;
+
+ g_assert (g_slist_find (_instance->_desktops, dt));
+ SPDesktop *curr = (SPDesktop*)_instance->_desktops->data;
+ _instance->_desktop_deactivated_signal.emit (curr);
+
+ _instance->_desktops = g_slist_remove (_instance->_desktops, dt);
+ _instance->_desktops = g_slist_prepend (_instance->_desktops, dt);
+
+ _instance->_desktop_activated_signal.emit (dt);
+ _instance->_event_context_set_signal.emit (SP_DT_EVENTCONTEXT(dt));
+ _instance->_selection_set_signal.emit (SP_DT_SELECTION(dt));
+ _instance->_selection_changed_signal.emit (SP_DT_SELECTION(dt));
+}
+
+void
+Editor::reactivateDesktop (SPDesktop* dt)
+{
+ g_assert (dt != 0);
+ if (isDesktopActive(dt))
+ _instance->_desktop_activated_signal.emit (dt);
+}
+
+bool
+Editor::isDuplicatedView (SPDesktop* dt)
+{
+ SPDocument const* document = dt->doc();
+ if (!document) {
+ return false;
+ }
+ for ( GSList *iter = _instance->_desktops ; iter ; iter = iter->next ) {
+ SPDesktop *other_desktop=(SPDesktop *)iter->data;
+ SPDocument *other_document=other_desktop->doc();
+ if ( other_document == document && other_desktop != dt ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+ /// Returns the event context
+//SPEventContext*
+//Editor::getEventContext()
+//{
+// if (getActiveDesktop()) {
+// return SP_DT_EVENTCONTEXT (getActiveDesktop());
+// }
+//
+// return NULL;
+//}
+
+
+void
+Editor::selectionModified (Inkscape::Selection* sel, guint flags)
+{
+ g_return_if_fail (sel != NULL);
+ if (isDesktopActive (sel->desktop()))
+ _instance->_selection_modified_signal.emit (sel, flags);
+}
+
+void
+Editor::selectionChanged (Inkscape::Selection* sel)
+{
+ g_return_if_fail (sel != NULL);
+ if (isDesktopActive (sel->desktop()))
+ _instance->_selection_changed_signal.emit (sel);
+}
+
+void
+Editor::subSelectionChanged (SPDesktop* dt)
+{
+ g_return_if_fail (dt != NULL);
+ if (isDesktopActive (dt))
+ _instance->_subselection_changed_signal.emit (dt);
+}
+
+void
+Editor::selectionSet (Inkscape::Selection* sel)
+{
+ g_return_if_fail (sel != NULL);
+ if (isDesktopActive (sel->desktop())) {
+ _instance->_selection_set_signal.emit (sel);
+ _instance->_selection_changed_signal.emit (sel);
+ }
+}
+
+void
+Editor::eventContextSet (SPEventContext* ec)
+{
+ g_return_if_fail (ec != NULL);
+ g_return_if_fail (SP_IS_EVENT_CONTEXT (ec));
+ if (isDesktopActive (ec->desktop))
+ _instance->_event_context_set_signal.emit (ec);
+}
+
+void
+Editor::hideDialogs()
+{
+ _instance->_dialogs_hidden_signal.emit();
+ _instance->_dialogs_toggle = false;
+}
+
+void
+Editor::unhideDialogs()
+{
+ _instance->_dialogs_unhidden_signal.emit();
+ _instance->_dialogs_toggle = true;
+}
+
+void
+Editor::toggleDialogs()
+{
+ if (_dialogs_toggle) {
+ hideDialogs();
+ } else {
+ unhideDialogs();
+ }
+}
+
+void
+Editor::refreshDisplay()
+{
+ // TODO
+}
+
+void
+Editor::exit()
+{
+ //emit shutdown signal so that dialogs could remember layout
+ _shutdown_signal.emit();
+ Inkscape::Preferences::save();
+}
+
+//==================================================================
+
+sigc::connection
+Editor::connectSelectionModified
+(const sigc::slot<void, Inkscape::Selection*, guint> &slot)
+{
+ return _instance->_selection_modified_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectSelectionChanged
+(const sigc::slot<void, Inkscape::Selection*> &slot)
+{
+ return _instance->_selection_changed_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectSubselectionChanged (const sigc::slot<void, SPDesktop*> &slot)
+{
+ return _instance->_subselection_changed_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectSelectionSet (const sigc::slot<void, Inkscape::Selection*> &slot)
+{
+ return _instance->_selection_set_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectEventContextSet (const sigc::slot<void, SPEventContext*> &slot)
+{
+ return _instance->_event_context_set_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectDesktopActivated (const sigc::slot<void, SPDesktop*> &slot)
+{
+ return _instance->_desktop_activated_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectDesktopDeactivated (const sigc::slot<void, SPDesktop*> &slot)
+{
+ return _instance->_desktop_deactivated_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectShutdown (const sigc::slot<void> &slot)
+{
+ return _instance->_shutdown_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectDialogsHidden (const sigc::slot<void> &slot)
+{
+ return _instance->_dialogs_hidden_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectDialogsUnhidden (const sigc::slot<void> &slot)
+{
+ return _instance->_dialogs_unhidden_signal.connect (slot);
+}
+
+sigc::connection
+Editor::connectExternalChange (const sigc::slot<void> &slot)
+{
+ return _instance->_external_change_signal.connect (slot);
+}
+
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/editor.h b/src/application/editor.h
new file mode 100644
index 000000000..9d2ce493c
--- /dev/null
+++ b/src/application/editor.h
@@ -0,0 +1,139 @@
+/** \file
+ * \brief Class to manage an application used for editing SVG documents
+ * using GUI views
+ *
+ * \note This class is a Singleton
+ *
+ * Authors:
+ * Bryce W. Harrington <bryce@bryceharrington.org>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * Copyright (C) 2004 Bryce Harrington
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_APPLICATION_EDITOR_H
+#define INKSCAPE_APPLICATION_EDITOR_H
+
+#include <sigc++/sigc++.h>
+#include <glib/gslist.h>
+#include <glibmm/ustring.h>
+#include "app-prototype.h"
+
+class SPDesktop;
+class SPDocument;
+class SPEventContext;
+
+namespace Inkscape {
+ class Selection;
+ namespace XML {
+ class Document;
+ }
+ namespace UI {
+ namespace View {
+ class Edit;
+ }
+ }
+ namespace NSApplication {
+
+class Editor : public AppPrototype
+{
+public:
+ static Editor *create (int argc, char **argv);
+ virtual ~Editor();
+
+ void* getWindow();
+
+ void toggleDialogs();
+ void nextDesktop();
+ void prevDesktop();
+
+ void refreshDisplay();
+ void exit();
+
+ bool lastViewOfDocument(SPDocument* doc, SPDesktop* view) const;
+
+ bool addView(SPDesktop* view);
+ bool deleteView(SPDesktop* view);
+
+ static Inkscape::XML::Document *getPreferences();
+ static SPDesktop* getActiveDesktop();
+ static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; }
+ static SPDesktop* createDesktop (SPDocument* doc);
+ static void addDesktop (SPDesktop* dt);
+ static void removeDesktop (SPDesktop* dt);
+ static void activateDesktop (SPDesktop* dt);
+ static void reactivateDesktop (SPDesktop* dt);
+ static bool isDuplicatedView (SPDesktop* dt);
+
+ static SPDocument* getActiveDocument();
+ static void addDocument (SPDocument* doc);
+ static void removeDocument (SPDocument* doc);
+
+ static void selectionModified (Inkscape::Selection*, guint);
+ static void selectionChanged (Inkscape::Selection*);
+ static void subSelectionChanged (SPDesktop*);
+ static void selectionSet (Inkscape::Selection*);
+ static void eventContextSet (SPEventContext*);
+ static void hideDialogs();
+ static void unhideDialogs();
+
+ static sigc::connection connectSelectionModified (const sigc::slot<void, Inkscape::Selection*, guint> &slot);
+ static sigc::connection connectSelectionChanged (const sigc::slot<void, Inkscape::Selection*> &slot);
+ static sigc::connection connectSubselectionChanged (const sigc::slot<void, SPDesktop*> &slot);
+ static sigc::connection connectSelectionSet (const sigc::slot<void, Inkscape::Selection*> &slot);
+ static sigc::connection connectEventContextSet (const sigc::slot<void, SPEventContext*> &slot);
+ static sigc::connection connectDesktopActivated (const sigc::slot<void, SPDesktop*> &slot);
+ static sigc::connection connectDesktopDeactivated (const sigc::slot<void, SPDesktop*> &slot);
+ static sigc::connection connectShutdown (const sigc::slot<void> &slot);
+ static sigc::connection connectDialogsHidden (const sigc::slot<void> &slot);
+ static sigc::connection connectDialogsUnhidden (const sigc::slot<void> &slot);
+ static sigc::connection connectExternalChange (const sigc::slot<void> &slot);
+
+
+protected:
+ Editor(Editor const &);
+ Editor& operator=(Editor const &);
+
+ GSList *_documents;
+ GSList *_desktops;
+ gchar *_argv0;
+
+ bool _dialogs_toggle;
+
+ sigc::signal <void, Inkscape::Selection*, guint> _selection_modified_signal;
+ sigc::signal <void, Inkscape::Selection*> _selection_changed_signal;
+ sigc::signal <void, SPDesktop*> _subselection_changed_signal;
+ sigc::signal <void, Inkscape::Selection*> _selection_set_signal;
+ sigc::signal <void, SPEventContext*> _event_context_set_signal;
+ sigc::signal <void, SPDesktop*> _desktop_activated_signal;
+ sigc::signal <void, SPDesktop*> _desktop_deactivated_signal;
+ sigc::signal <void> _shutdown_signal;
+ sigc::signal <void> _dialogs_hidden_signal;
+ sigc::signal <void> _dialogs_unhidden_signal;
+ sigc::signal <void> _external_change_signal;
+
+private:
+ Editor(int argc, char **argv);
+ bool init();
+};
+
+#define ACTIVE_DESKTOP Inkscape::NSApplication::Editor::getActiveDesktop()
+
+} // namespace NSApplication
+} // namespace Inkscape
+
+
+#endif /* !INKSCAPE_APPLICATION_EDITOR_H */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/application/makefile.in b/src/application/makefile.in
new file mode 100644
index 000000000..d35d0b1f3
--- /dev/null
+++ b/src/application/makefile.in
@@ -0,0 +1,17 @@
+# Convenience stub makefile to call the real Makefile.
+
+@SET_MAKE@
+
+# Explicit so that it's the default rule.
+all:
+ cd .. && $(MAKE) application/all
+
+clean %.a %.o:
+ cd .. && $(MAKE) application/$@
+
+.PHONY: all clean
+
+OBJEXT = @OBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .a .$(OBJEXT)