From 608843c38bc77cffe831c1d397de9f166831e0ab Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 21 May 2013 13:17:25 +0200 Subject: Fix for bug #1022543 (Ctrl+C increments the documents count) by Maggio. Fixed bugs: - https://launchpad.net/bugs/1022543 (bzr r12340) --- src/document.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 706710cfc..2fc6d3bc6 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -84,6 +84,7 @@ static gint sp_document_rerouting_handler(gpointer data); gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer data); static gint doc_count = 0; +static gint doc_mem_count = 0; static unsigned long next_serial = 0; @@ -480,15 +481,16 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b base = NULL; name = g_strdup(uri); } + if (make_new) { + name = g_strdup_printf(_("New document %d"), ++doc_count); + } g_free(s); } else { - rdoc = sp_repr_document_new("svg:svg"); - } + if (make_new) { + name = g_strdup_printf(_("Memory document %d"), ++doc_mem_count); + } - if (make_new) { - base = NULL; - uri = NULL; - name = g_strdup_printf(_("New document %d"), ++doc_count); + rdoc = sp_repr_document_new("svg:svg"); } //# These should be set by now @@ -514,7 +516,7 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un // If xml file is not svg, return NULL without warning // TODO fixme: destroy document } else { - Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_count ); + Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); doc = createDoc(rdoc, NULL, NULL, name.c_str(), keepalive); } } -- cgit v1.2.3 From a2a5d1f2446214af5457693e3a06cfc7aa132942 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sat, 25 May 2013 08:38:34 +0200 Subject: Reverting fix for Bug #1022543. (bzr r12341) --- src/document.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 2fc6d3bc6..706710cfc 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -84,7 +84,6 @@ static gint sp_document_rerouting_handler(gpointer data); gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer data); static gint doc_count = 0; -static gint doc_mem_count = 0; static unsigned long next_serial = 0; @@ -481,18 +480,17 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b base = NULL; name = g_strdup(uri); } - if (make_new) { - name = g_strdup_printf(_("New document %d"), ++doc_count); - } g_free(s); } else { - if (make_new) { - name = g_strdup_printf(_("Memory document %d"), ++doc_mem_count); - } - rdoc = sp_repr_document_new("svg:svg"); } + if (make_new) { + base = NULL; + uri = NULL; + name = g_strdup_printf(_("New document %d"), ++doc_count); + } + //# These should be set by now g_assert(name); @@ -516,7 +514,7 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un // If xml file is not svg, return NULL without warning // TODO fixme: destroy document } else { - Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); + Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_count ); doc = createDoc(rdoc, NULL, NULL, name.c_str(), keepalive); } } -- cgit v1.2.3 From 4d232a223d1dcb7b2381615de1a64b20b2fb6165 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Tue, 9 Jul 2013 20:46:51 -0400 Subject: Small refactor of align and distribute to reduce complexity. (bzr r12411) --- src/document.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 706710cfc..0e9c43fe4 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -611,6 +611,11 @@ Geom::Point SPDocument::getDimensions() const return Geom::Point(getWidth(), getHeight()); } +Geom::OptRect SPDocument::preferredBounds() const +{ + return Geom::OptRect( Geom::Point(0, 0), getDimensions() ); +} + /** * Given a Geom::Rect that may, for example, correspond to the bbox of an object, * this function fits the canvas to that rect by resizing the canvas -- cgit v1.2.3