diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index c10581a9161e683a7cf052b0b68b43df7fe41965..4309775675cd95924f7bb72ee6b2affc72059513 100644 (file)
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
#include <gtkmm/messagedialog.h>
#include <signal.h>
#include <string>
-#include "application/application.h"
-#include "application/editor.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "device-manager.h"
# FORWARD DECLARATIONS
################################*/
-gboolean inkscape_app_use_gui( Inkscape::Application const * app );
-
static void inkscape_class_init (Inkscape::ApplicationClass *klass);
static void inkscape_init (SPObject *object);
static void inkscape_dispose (GObject *object);
++docnum;
- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
- // g_debug("Document %d: \"%s\" %s", docnum, doc ? doc->name : "(null)", doc ? (doc->isModifiedSinceSave() ? "(dirty)" : "(clean)") : "(null)");
+ Inkscape::XML::Node *repr = doc->getReprRoot();
+ // g_debug("Document %d: \"%s\" %s", docnum, doc ? doc->getName() : "(null)", doc ? (doc->isModifiedSinceSave() ? "(dirty)" : "(clean)") : "(null)");
if (doc->isModifiedSinceSave()) {
gchar *oldest_autosave = 0;
void inkscape_trackalt(guint trackvalue)
{
- inkscape->trackalt = trackvalue;
+ inkscape->trackalt = trackvalue;
}
@@ -557,6 +553,13 @@ inkscape_deactivate_desktop_private (Inkscape::Application */*inkscape*/, SPDesk
#define SP_INDENT 8
+static bool crashIsHappening = false;
+
+bool inkscapeIsCrashing()
+{
+ return crashIsHappening;
+}
+
static void
inkscape_crash_handler (int /*signum*/)
{
}
recursion = TRUE;
+ crashIsHappening = true;
+
EventTracker<SimpleEvent<Inkscape::Debug::Event::CORE> > tracker("crash");
tracker.set<SimpleEvent<> >("emergency-save");
++iter) {
SPDocument *doc = iter->first;
Inkscape::XML::Node *repr;
- repr = sp_document_repr_root (doc);
+ repr = doc->getReprRoot();
if (doc->isModifiedSinceSave()) {
const gchar *docname;
/* originally, the document name was retrieved from
* the sodipod:docname attribute */
- docname = doc->name;
+ docname = doc->getName();
if (docname) {
/* Removes an emergency save suffix if present: /(.*)\.[0-9_]*\.[0-9_]*\.[~\.]*$/\1/ */
const char* d0 = strrchr ((char*)docname, '.');
// Find a location
const char* locations[] = {
- doc->base,
+ doc->getBase(),
g_get_home_dir(),
g_get_tmp_dir(),
curdir,
savednames = g_slist_prepend (savednames, g_strdup (c));
fclose (file);
} else {
- failednames = g_slist_prepend (failednames, (doc->name) ? g_strdup (doc->name) : g_strdup (_("Untitled document")));
+ failednames = g_slist_prepend (failednames, (doc->getName()) ? g_strdup(doc->getName()) : g_strdup (_("Untitled document")));
}
count++;
}
}
*(b + pos) = '\0';
- if ( inkscape_get_instance() && inkscape_app_use_gui( inkscape_get_instance() ) ) {
+ if ( inkscape_get_instance() && inkscape_use_gui() ) {
GtkWidget *msgbox = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b);
gtk_dialog_run (GTK_DIALOG (msgbox));
gtk_widget_destroy (msgbox);
return inkscape;
}
-gboolean inkscape_app_use_gui( Inkscape::Application const * app )
+gboolean inkscape_use_gui()
{
- return app->use_gui;
+ return inkscape_get_instance()->use_gui;
}
/**
void
inkscape_selection_modified (Inkscape::Selection *selection, guint flags)
{
- if (Inkscape::NSApplication::Application::getNewGui()) {
- Inkscape::NSApplication::Editor::selectionModified (selection, flags);
- return;
- }
g_return_if_fail (selection != NULL);
if (DESKTOP_IS_ACTIVE (selection->desktop())) {
void
inkscape_selection_changed (Inkscape::Selection * selection)
{
- if (Inkscape::NSApplication::Application::getNewGui()) {
- Inkscape::NSApplication::Editor::selectionChanged (selection);
- return;
- }
g_return_if_fail (selection != NULL);
if (DESKTOP_IS_ACTIVE (selection->desktop())) {
void
inkscape_subselection_changed (SPDesktop *desktop)
{
- if (Inkscape::NSApplication::Application::getNewGui()) {
- Inkscape::NSApplication::Editor::subSelectionChanged (desktop);
- return;
- }
g_return_if_fail (desktop != NULL);
if (DESKTOP_IS_ACTIVE (desktop)) {
void
inkscape_selection_set (Inkscape::Selection * selection)
{
- if (Inkscape::NSApplication::Application::getNewGui()) {
- Inkscape::NSApplication::Editor::selectionSet (selection);
- return;
- }
g_return_if_fail (selection != NULL);
if (DESKTOP_IS_ACTIVE (selection->desktop())) {
void
inkscape_eventcontext_set (SPEventContext * eventcontext)
{
- if (Inkscape::NSApplication::Application::getNewGui()) {
- Inkscape::NSApplication::Editor::eventContextSet (eventcontext);
- return;
- }
g_return_if_fail (eventcontext != NULL);
g_return_if_fail (SP_IS_EVENT_CONTEXT (eventcontext));
inkscape_add_desktop (SPDesktop * desktop)
{
g_return_if_fail (desktop != NULL);
-
- if (Inkscape::NSApplication::Application::getNewGui())
- {
- Inkscape::NSApplication::Editor::addDesktop (desktop);
- return;
- }
g_return_if_fail (inkscape != NULL);
g_assert (!g_slist_find (inkscape->desktops, desktop));
inkscape_remove_desktop (SPDesktop * desktop)
{
g_return_if_fail (desktop != NULL);
- if (Inkscape::NSApplication::Application::getNewGui())
- {
- Inkscape::NSApplication::Editor::removeDesktop (desktop);
- return;
- }
g_return_if_fail (inkscape != NULL);
g_assert (g_slist_find (inkscape->desktops, desktop));
inkscape_activate_desktop (SPDesktop * desktop)
{
g_return_if_fail (desktop != NULL);
- if (Inkscape::NSApplication::Application::getNewGui())
- {
- Inkscape::NSApplication::Editor::activateDesktop (desktop);
- return;
- }
g_return_if_fail (inkscape != NULL);
if (DESKTOP_IS_ACTIVE (desktop)) {
inkscape_reactivate_desktop (SPDesktop * desktop)
{
g_return_if_fail (desktop != NULL);
- if (Inkscape::NSApplication::Application::getNewGui())
- {
- Inkscape::NSApplication::Editor::reactivateDesktop (desktop);
- return;
- }
g_return_if_fail (inkscape != NULL);
if (DESKTOP_IS_ACTIVE (desktop))
void
inkscape_dialogs_hide ()
{
- if (Inkscape::NSApplication::Application::getNewGui())
- Inkscape::NSApplication::Editor::hideDialogs();
- else
- {
- g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_HIDE], 0);
- inkscape->dialogs_toggle = FALSE;
- }
+ g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_HIDE], 0);
+ inkscape->dialogs_toggle = FALSE;
}
void
inkscape_dialogs_unhide ()
{
- if (Inkscape::NSApplication::Application::getNewGui())
- Inkscape::NSApplication::Editor::unhideDialogs();
- else
- {
- g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_UNHIDE], 0);
- inkscape->dialogs_toggle = TRUE;
- }
+ g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_UNHIDE], 0);
+ inkscape->dialogs_toggle = TRUE;
}
{
g_return_if_fail (document != NULL);
- if (!Inkscape::NSApplication::Application::getNewGui())
- {
- // try to insert the pair into the list
- if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) {
- //insert failed, this key (document) is already in the list
- for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin();
- iter != inkscape->document_set.end();
- ++iter) {
- if (iter->first == document) {
- // found this document in list, increase its count
- iter->second ++;
- }
- }
- }
- }
- else
- {
- Inkscape::NSApplication::Editor::addDocument (document);
+ // try to insert the pair into the list
+ if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) {
+ //insert failed, this key (document) is already in the list
+ for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin();
+ iter != inkscape->document_set.end();
+ ++iter) {
+ if (iter->first == document) {
+ // found this document in list, increase its count
+ iter->second ++;
+ }
+ }
}
}
{
g_return_val_if_fail (document != NULL, false);
- if (!Inkscape::NSApplication::Application::getNewGui())
- {
- for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin();
- iter != inkscape->document_set.end();
- ++iter) {
- if (iter->first == document) {
- // found this document in list, decrease its count
- iter->second --;
- if (iter->second < 1) {
- // this was the last one, remove the pair from list
- inkscape->document_set.erase (iter);
- return true;
- } else {
- return false;
- }
+ for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin();
+ iter != inkscape->document_set.end();
+ ++iter) {
+ if (iter->first == document) {
+ // found this document in list, decrease its count
+ iter->second --;
+ if (iter->second < 1) {
+ // this was the last one, remove the pair from list
+ inkscape->document_set.erase (iter);
+ return true;
+ } else {
+ return false;
}
}
}
- else
- {
- Inkscape::NSApplication::Editor::removeDocument (document);
- }
return false;
}
SPDesktop *
inkscape_active_desktop (void)
{
- if (Inkscape::NSApplication::Application::getNewGui())
- return Inkscape::NSApplication::Editor::getActiveDesktop();
-
if (inkscape->desktops == NULL) {
return NULL;
}
SPDocument *
inkscape_active_document (void)
{
- if (Inkscape::NSApplication::Application::getNewGui())
- return Inkscape::NSApplication::Editor::getActiveDocument();
-
if (SP_ACTIVE_DESKTOP) {
return sp_desktop_document (SP_ACTIVE_DESKTOP);
}