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') 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') 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 fa90512487d3efef01c614cd4c7552fd984e46a4 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 25 May 2013 18:27:46 -0400 Subject: boolops. allow Division to create hole (Bug 499744) Fixed bugs: - https://launchpad.net/bugs/499744 (bzr r12342) --- src/livarot/ShapeMisc.cpp | 60 +++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index a7e5a6cdc..6fd40790f 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -374,6 +374,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in do { int dadContour=-1; + int childEdge = -1; + bool foundChild = false; int startBord = -1; { int fi = 0; @@ -389,6 +391,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in } else { dadContour = GPOINTER_TO_INT(swdData[askTo].misc); dadContour-=1; // pour compenser le decalage + childEdge = getPoint(fi).incidentEdge[FIRST]; } } lastPtUsed = fi + 1; @@ -407,6 +410,9 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in { // parcours en profondeur pour mettre les leF et riF a leurs valeurs swdData[startBord].misc = (void *)(intptr_t)(1 + nbNest); + if (startBord == childEdge) { + foundChild = true; + } //printf("part de %d\n",startBord); int curBord = startBord; bool back = false; @@ -444,22 +450,23 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in } else { - bool escapePath=false; - int tb=curBord; - while ( tb >= 0 && tb < numberOfEdges() ) { - if ( ebData[tb].pathID == wildPath ) { - escapePath=true; - break; - } - tb=swdData[tb].precParc; - } +// bool escapePath=false; +// int tb=curBord; +// while ( tb >= 0 && tb < numberOfEdges() ) { +// if ( ebData[tb].pathID == wildPath ) { +// escapePath=true; +// break; +// } +// tb=swdData[tb].precParc; +// } nesting=(int*)g_realloc(nesting,(nbNest+1)*sizeof(int)); contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); - if ( escapePath ) { - nesting[nbNest++]=-1; // contient des bouts de coupure -> a part - } else { + if (foundChild) { nesting[nbNest++]=dadContour; + foundChild = false; + } else { + nesting[nbNest++]=-1; // contient des bouts de coupure -> a part } swdData[curBord].suivParc = -1; AddContour (dest, nbP, orig, startBord, curBord,splitWhenForced); @@ -484,24 +491,24 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in if ( getEdge(curBord).en == curStartPt ) { //printf("contour %i ",curStartPt); - bool escapePath=false; - int tb=curBord; - while ( tb >= 0 && tb < numberOfEdges() ) { - if ( ebData[tb].pathID == wildPath ) { - escapePath=true; - break; - } - tb=swdData[tb].precParc; - } +// bool escapePath=false; +// int tb=curBord; +// while ( tb >= 0 && tb < numberOfEdges() ) { +// if ( ebData[tb].pathID == wildPath ) { +// escapePath=true; +// break; +// } +// tb=swdData[tb].precParc; +// } nesting=(int*)g_realloc(nesting,(nbNest+1)*sizeof(int)); contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); - if ( escapePath ) { - nesting[nbNest++]=-1; // contient des bouts de coupure -> a part - } else { + if (foundChild) { nesting[nbNest++]=dadContour; + foundChild = false; + } else { + nesting[nbNest++]=-1; // contient des bouts de coupure -> a part } - swdData[curBord].suivParc = -1; AddContour (dest, nbP, orig, startBord, curBord,splitWhenForced); startBord=nb; @@ -512,6 +519,9 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in swdData[nb].precParc = curBord; swdData[curBord].suivParc = nb; curBord = nb; + if (nb == childEdge) { + foundChild = true; + } //printf("suite %d\n",curBord); } } -- cgit v1.2.3 From 6ee24230324394a8dc26a4e46e0a679b2f29b0ec Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 26 May 2013 21:56:10 +0200 Subject: Prevent crash from middle marker when a path or polyline has only one point. (bzr r12343) --- src/sp-shape.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 4037b302c..be9f5388c 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -889,8 +889,8 @@ int SPShape::numberOfMarkers(int type) if (pathv.size() == 0) { return 0; } - switch(type) { + case SP_MARKER_LOC: { if ( this->_marker[SP_MARKER_LOC] ) { @@ -914,7 +914,9 @@ int SPShape::numberOfMarkers(int type) for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { n += path_it->size_default() + 1; } - return n - 2; // minus the start and end marker. + n = (n > 1) ? (n - 2) : 0; // Minus the start and end marker, but never negative. + // A path or polyline may have only one point. + return n; } else { return 0; } -- cgit v1.2.3