diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index be3ff1e7d0681de8322e13501c1762cc2bd8c46f..7e46efce6eb672e94fc91a195ff82bc2e9a5dc47 100644 (file)
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
#endif
+#include <set>
#include "debug/simple-event.h"
#include "debug/event-tracker.h"
@@ -109,12 +110,14 @@ static bool inkscape_init_config (Inkscape::XML::Document *doc, const gchar *con
struct Inkscape::Application {
GObject object;
Inkscape::XML::Document *menus;
+ std::multiset<SPDocument *> document_set;
GSList *documents;
GSList *desktops;
gchar *argv0;
gboolean dialogs_toggle;
gboolean use_gui; // may want to consider a virtual function
// for overriding things like the warning dlg's
+ guint mapalt;
};
struct Inkscape::ApplicationClass {
g_assert_not_reached ();
}
+ new (&inkscape->document_set) std::multiset<SPDocument *>();
+
inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL);
inkscape->documents = NULL;
inkscape->desktops = NULL;
inkscape->dialogs_toggle = TRUE;
-}
+ inkscape->mapalt=GDK_MOD1_MASK;
+}
static void
inkscape_dispose (GObject *object)
inkscape->menus = NULL;
}
+ inkscape->document_set.~multiset();
+
G_OBJECT_CLASS (parent_class)->dispose (object);
gtk_main_quit ();
g_object_unref (G_OBJECT (inkscape));
}
+/* returns the mask of the keyboard modifier to map to Alt, zero if no mapping */
+/* Needs to be a guint because gdktypes.h does not define a 'no-modifier' value */
+guint
+inkscape_mapalt() {
+ return inkscape->mapalt;
+}
+
+/* Sets the keyboard modifer to map to Alt. Zero switches off mapping, as does '1', which is the default */
+void inkscape_mapalt(guint maskvalue)
+{
+ if(maskvalue<2 || maskvalue> 5 ){ /* MOD5 is the highest defined in gdktypes.h */
+ inkscape->mapalt=0;
+ }else{
+ inkscape->mapalt=(GDK_MOD1_MASK << (maskvalue-1));
+ }
+}
static void
inkscape_activate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop)
Inkscape::UI::Dialogs::DebugDialog::getInstance()->captureLogMessages();
}
+ /* Check for global remapping of Alt key */
+ if(use_gui)
+ {
+ inkscape_mapalt(guint(prefs_get_int_attribute("options.mapalt","value",0)));
+ }
+
/* Initialize the extensions */
Inkscape::Extension::init();
Inkscape::XML::Node *
inkscape_get_repr (Inkscape::Application *inkscape, const gchar *key)
{
- if (key == NULL) {
+ if ( (key == NULL) || (inkscape == NULL) ) {
+ return NULL;
+ }
+
+ Inkscape::XML::Node *prefs = Inkscape::Preferences::get();
+ if ( !prefs ) {
return NULL;
}
- Inkscape::XML::Node *repr = Inkscape::Preferences::get()->root();
+ Inkscape::XML::Node *repr = prefs->root();
if (!repr) return NULL;
g_assert (!(strcmp (repr->name(), "inkscape")));
if (!Inkscape::NSApplication::Application::getNewGui())
{
- g_assert (!g_slist_find (inkscape->documents, document));
- inkscape->documents = g_slist_append (inkscape->documents, document);
+ if ( inkscape->document_set.find(document) != inkscape->document_set.end() ) {
+
+ inkscape->documents = g_slist_append (inkscape->documents, document);
+ }
+ inkscape->document_set.insert(document);
}
else
{
if (!Inkscape::NSApplication::Application::getNewGui())
{
- g_assert (g_slist_find (inkscape->documents, document));
- inkscape->documents = g_slist_remove (inkscape->documents, document);
+ inkscape->document_set.erase(document);
+ if ( inkscape->document_set.find(document) == inkscape->document_set.end() ) {
+ inkscape->documents = g_slist_remove (inkscape->documents, document);
+ }
}
else
{
@@ -1227,6 +1267,29 @@ inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, co
return false;
}
}
+
+ // Also create (empty for now) subdirectories for the user's stuff
+ {
+ gchar *temp_dn = profile_path("templates");
+ Inkscape::IO::mkdir_utf8name(temp_dn);
+ }
+ {
+ gchar *temp_dn = profile_path("keys");
+ Inkscape::IO::mkdir_utf8name(temp_dn);
+ }
+ {
+ gchar *temp_dn = profile_path("icons");
+ Inkscape::IO::mkdir_utf8name(temp_dn);
+ }
+ {
+ gchar *temp_dn = profile_path("extensions");
+ Inkscape::IO::mkdir_utf8name(temp_dn);
+ }
+ {
+ gchar *temp_dn = profile_path("palettes");
+ Inkscape::IO::mkdir_utf8name(temp_dn);
+ }
+
} else if (!Inkscape::IO::file_test(dn, G_FILE_TEST_IS_DIR)) {
if (use_gui) {
// Not a directory