inkscape.cpp revision ce95d2d6aaca3faca8fd0b56ca4ae855803f72fc
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico * Interface to main application
83aaf46c9feab529aeb9add871c05c3d1177afccaurium * Lauris Kaplinski <lauris@kaplinski.com>
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico * bulia byak <buliabyak@users.sf.net>
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico * Copyright (C) 1999-2005 authors
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico * g++ port Copyright (C) 2003 Nathan Hurst
83aaf46c9feab529aeb9add871c05c3d1177afccaurium * Released under GNU GPL, read the file 'COPYING' for more information
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico# define HAS_PROC_SELF_EXE //to get path of executable
16aa2c670becdbbc15bfcebe162d3306245bf111JazzyNico// For now to get at is_os_wide().
#define HAS_SHGetSpecialFolderLocation
#define HAS_GetModuleFileName
# include <shlobj.h>
#include <signal.h>
#include <string>
#include <cstring>
#include "helper/sp-marshal.h"
#include "dialogs/debugdialog.h"
#include "application/application.h"
#include "application/editor.h"
#include "preferences.h"
#include "document.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "selection.h"
#include "event-context.h"
#include "inkscape-private.h"
#include "prefs-utils.h"
#include "menus-skeleton.h"
static void inkscape_activate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop);
static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop);
static bool inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, const gchar *skeleton,
unsigned int skel_size,
void (* modify_selection) (Inkscape::Application * inkscape, Inkscape::Selection * selection, guint flags);
#ifdef WIN32
inkscape_get_type (void)
if (!type) {
return type;
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
if (!inkscape) {
gtk_main_quit ();
inkscape_ref (void)
if (inkscape)
inkscape_unref (void)
if (inkscape)
/* Needs to be a guint because gdktypes.h does not define a 'no-modifier' value */
inkscape_mapalt() {
/* Sets the keyboard modifer to map to Alt. Zero switches off mapping, as does '1', which is the default */
#ifndef WIN32
if (recursion) {
abort ();
if (docname) {
d = d0;
docname = n;
if (!file) {
if (!file) {
if (file) {
failednames = g_slist_prepend (failednames, (docname) ? g_strdup (docname) : g_strdup (_("Untitled document")));
count++;
if (savednames) {
if (failednames) {
fprintf (stderr, "with a detailed description of the steps leading to the crash, so we can fix it.\n");
char const *sstr = _("Automatic backups of unsaved documents were done to the following locations:\n");
if (savednames) {
if (failednames) {
GtkWidget *msgbox = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b);
g_free (b);
#ifndef WIN32
#ifdef WIN32
#define DEFAULT_LOG_REDIRECT true
#define DEFAULT_LOG_REDIRECT false
if(use_gui)
return inkscape;
inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton,
bool result;
return result;
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_notreg, safeFn, warn);
gtk_widget_destroy (w);
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_notxml, safeFn, warn);
gtk_widget_destroy (w);
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_notsp, safeFn, warn);
gtk_widget_destroy (w);
* a reasonable merge working with the menus.xml file */
if (INKSCAPE)
bool retval = false;
retval = true;
return retval;
return NULL;
if ( !prefs ) {
return NULL;
len = e++ - s;
return NULL;
return repr;
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_EVENTCONTEXT], 0, sp_desktop_event_context (desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_SELECTION], 0, sp_desktop_selection (desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[CHANGE_SELECTION], 0, sp_desktop_selection (desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_EVENTCONTEXT], 0, sp_desktop_event_context (new_desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_SELECTION], 0, sp_desktop_selection (new_desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[CHANGE_SELECTION], 0, sp_desktop_selection (new_desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_EVENTCONTEXT], 0, sp_desktop_event_context (desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[SET_SELECTION], 0, sp_desktop_selection (desktop));
g_signal_emit (G_OBJECT (inkscape), inkscape_signals[CHANGE_SELECTION], 0, sp_desktop_selection (desktop));
* Resends ACTIVATE_DESKTOP for current desktop; needed when a new desktop has got its window that dialogs will transientize to
return NULL;
unsigned int dkey = 0;
return dkey;
d = inkscape_find_desktop_by_dkey (i);
for (unsigned int i = 0; i <= inkscape_maximum_dkey(); i++) {
d = inkscape_find_desktop_by_dkey (i);
g_assert (d);
if (dkey_current > 0) {
d = inkscape_find_desktop_by_dkey (i);
g_assert (d);
inkscape_active_desktop (void)
return NULL;
inkscape_active_document (void)
if (SP_ACTIVE_DESKTOP) {
return NULL;
if (!document) {
if (SP_ACTIVE_DESKTOP) {
return NULL;
inkscape_init_config (Inkscape::XML::Document */*doc*/, const gchar *config_name, const gchar *skeleton,
unsigned int skel_size,
bool use_gui = (Inkscape::NSApplication::Application::getNewGui())? Inkscape::NSApplication::Application::getUseGui() : inkscape->use_gui;
if (use_gui) {
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_mkdir, safeDn, warn);
gtk_widget_destroy (w);
if (use_gui) {
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_notdir, safeDn, warn);
gtk_widget_destroy (w);
if (!fh) {
if (use_gui) {
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_ccf, safeFn, warn);
gtk_widget_destroy (w);
if (use_gui) {
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_cwf, safeFn, warn);
gtk_widget_destroy (w);
gtk_main_quit ();
gchar *
if (!homedir) {
if ( utf8Path )
if (!homedir) {
if ( utf8Path )
* Get, or guess, or decide the location where the preferences.xml
gchar *
if (!prefdir) {
if (!prefdir) {
if ( utf8Path ) {
g_warning( "SHGetPathFromIDList%c() resulted in invalid UTF-8", (PrintWin32::is_os_wide() ? 'W' : 'A') );
utf8Path = 0;
if (!prefdir) {