From ec3d3965f0aa7444d42fc8765abbc9c3ed0916ce Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Wed, 3 Jul 2013 13:35:06 +0200 Subject: Templates menu item fixed (bzr r12379.2.6) --- src/file.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5b4110253..7f8bfc8bf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -66,6 +66,7 @@ #include "verbs.h" #include "event-log.h" #include "ui/dialog/font-substitution.h" +#include "ui/dialog/new-from-template.h" #include @@ -199,6 +200,13 @@ SPDesktop* sp_file_new_default() return desk; } +SPDesktop* sp_file_new_from_templatee() +{ + Inkscape::UI::NewFromTemplate dl; + dl.run(); + return sp_file_new_default(); +} + /*###################### ## D E L E T E ######################*/ -- cgit v1.2.3 From 09ce234c1fc367a2607936e6cf106cb24c60e94f Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Wed, 3 Jul 2013 20:06:11 +0100 Subject: Modified dbus interface so that it works in console mode (--dbus-listen) Modified action context setup so that in console mode, when a document is added to the main inkscape app instance, it gets a selection model and layer model automatically set up for it Made a couple more verbs work in console mode (bzr r12387.1.4) --- src/file.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5b4110253..5007cd901 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -68,6 +68,7 @@ #include "ui/dialog/font-substitution.h" #include +#include #include #include @@ -209,8 +210,13 @@ SPDesktop* sp_file_new_default() void sp_file_exit() { - sp_ui_close_all(); - // no need to call inkscape_exit here; last document being closed will take care of that + if (SP_ACTIVE_DESKTOP == NULL) { + // We must be in console mode + Gtk::Main::quit(); + } else { + sp_ui_close_all(); + // no need to call inkscape_exit here; last document being closed will take care of that + } } @@ -582,24 +588,25 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d /** * Remove unreferenced defs from the defs section of the document. */ -void sp_file_vacuum() +void sp_file_vacuum(SPDocument *doc) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; - unsigned int diff = doc->vacuumDocument(); DocumentUndo::done(doc, SP_VERB_FILE_VACUUM, _("Clean up document")); SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (diff > 0) { - dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, - ngettext("Removed %i unused definition in <defs>.", - "Removed %i unused definitions in <defs>.", - diff), - diff); - } else { - dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in <defs>.")); + if (dt != NULL) { + // Show status messages when in GUI mode + if (diff > 0) { + dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, + ngettext("Removed %i unused definition in <defs>.", + "Removed %i unused definitions in <defs>.", + diff), + diff); + } else { + dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in <defs>.")); + } } } -- cgit v1.2.3 From 46211dc227f62c2e71b3edfa1ffb508c9fe8e0ac Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Thu, 4 Jul 2013 16:19:38 +0200 Subject: Added loading templates into NewFromTemplate dialog. (bzr r12379.2.7) --- src/file.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 7f8bfc8bf..9d3c513ab 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -66,7 +66,6 @@ #include "verbs.h" #include "event-log.h" #include "ui/dialog/font-substitution.h" -#include "ui/dialog/new-from-template.h" #include @@ -200,12 +199,6 @@ SPDesktop* sp_file_new_default() return desk; } -SPDesktop* sp_file_new_from_templatee() -{ - Inkscape::UI::NewFromTemplate dl; - dl.run(); - return sp_file_new_default(); -} /*###################### ## D E L E T E -- cgit v1.2.3 From 3d59db609dcae34444b45348c57ac203886576b6 Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Sun, 4 Aug 2013 14:37:48 +0200 Subject: Removing template data from XML tree added (bzr r12379.2.18) --- src/file.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 9d3c513ab..ee205b035 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -227,7 +227,7 @@ sp_file_exit() */ bool sp_file_open(const Glib::ustring &uri, Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) + int flags) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { @@ -252,9 +252,19 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { + if (flags & IS_FROM_TEMPLATE){ + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + } + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; - if (existing && existing->virgin && replace_empty) { + if (existing && existing->virgin && (flags & REPLACE_EMPTY)) { // If the current desktop is empty, open the document there doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); @@ -268,14 +278,14 @@ bool sp_file_open(const Glib::ustring &uri, doc->virgin = FALSE; - // everyone who cares now has a reference, get rid of ours + // everyone who cares now has a reference, get rid of our`s doc->doUnref(); // resize the window to match the document properties sp_namedview_window_from_document(desktop); sp_namedview_update_layers_from_document(desktop); - if (add_to_recent) { + if (flags & ADD_TO_RECENT) { sp_file_add_recent( doc->getURI() ); } -- cgit v1.2.3 From 625d70be1e222b3cfbbf6527b2829b645f369cd2 Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Tue, 6 Aug 2013 22:48:28 +0200 Subject: Adapted sp_file_new for use with templates (bzr r12379.2.19) --- src/file.cpp | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index ee205b035..258628d32 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -127,21 +127,46 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) { SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); g_return_val_if_fail(doc != NULL, NULL); + + // Remove all the template info from xml tree + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + desktop->setWaitingCursor(); + } + + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + + if (existing && existing->virgin) { + // If the current desktop is empty, open the document there + doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. + desktop->change_document(doc); + doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); + } else { + // create a whole new desktop and window + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != NULL, NULL); + sp_create_window(dtw, TRUE); + desktop = static_cast(dtw->view); + } - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - g_return_val_if_fail(dtw != NULL, NULL); doc->doUnref(); - sp_create_window(dtw, TRUE); - SPDesktop *dt = static_cast(dtw->view); - sp_namedview_window_from_document(dt); - sp_namedview_update_layers_from_document(dt); + sp_namedview_window_from_document(desktop); + sp_namedview_update_layers_from_document(desktop); #ifdef WITH_DBUS Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); #endif - return dt; + return desktop; } Glib::ustring sp_file_default_template_uri() @@ -252,16 +277,7 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { - if (flags & IS_FROM_TEMPLATE){ - Inkscape::XML::Node *myRoot = doc->getReprRoot(); - Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); - if (nodeToRemove != NULL){ - sp_repr_unparent(nodeToRemove); - delete nodeToRemove; - DocumentUndo::clearUndo(doc); - } - } - + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && (flags & REPLACE_EMPTY)) { -- cgit v1.2.3 From 7f43184f78f3ab203d6c597639805bf65cd22387 Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 14 Aug 2013 20:52:42 +0200 Subject: fix build with dbusapi enabled Fixed bugs: - https://launchpad.net/bugs/1212355 (bzr r12477) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index eb917f169..68e229e62 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -164,7 +164,7 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) sp_namedview_update_layers_from_document(desktop); #ifdef WITH_DBUS - Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); + Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif return desktop; -- cgit v1.2.3