summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-02-06 07:17:33 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-02-06 07:17:33 +0000
commit53e1c1a77a66d307715a796cb164d7f87ae9eba5 (patch)
tree514aa9c110787f3c9abc480a223a254959199286
parentHad to include fstream for overloaded def of << (diff)
downloadinkscape-53e1c1a77a66d307715a796cb164d7f87ae9eba5.tar.gz
inkscape-53e1c1a77a66d307715a796cb164d7f87ae9eba5.zip
r10887@tres: ted | 2006-02-05 23:16:41 -0800
Okay, I'm basically undoing the last commit that SVK screwed up. All this work is not mine, it was done by other people. Sorry to mess things up. (bzr r92)
-rw-r--r--ChangeLog24
-rwxr-xr-xshare/extensions/dxf_outlines.py83
-rwxr-xr-xsrc/libnrtype/Layout-TNG-Output.cpp4
-rw-r--r--src/removeoverlap/constraint.h4
-rw-r--r--src/removeoverlap/generate-constraints.cpp2
-rwxr-xr-xsrc/removeoverlap/remove_rectangle_overlap.cpp2
-rw-r--r--src/sp-tspan.cpp6
-rw-r--r--src/style.cpp1
-rw-r--r--src/style.h2
-rw-r--r--src/text-editing.cpp29
10 files changed, 102 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e8c4a837..4f8327931 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2006-02-05 MenTaLguY <mental@rydia.net>
+
+ * src/debug/event.h, src/debug/gc-heap.h, src/debug/heap.h,
+ src/debug/logger.cpp, src/debug/simple-event.h, src/debug/sysv-heap.h,
+ src/jabber_whiteboard/deserializer.cpp,
+ src/jabber_whiteboard/message-utilities.cpp,
+ src/jabber_whiteboard/message-utilities.h,
+ src/jabber_whiteboard/node-tracker-observer.h,
+ src/jabber_whiteboard/node-utilities.cpp,
+ src/jabber_whiteboard/serializer.cpp,
+ src/jabber_whiteboard/serializer.h,
+ src/sp-object.cpp, src/util/Makefile_insert, src/util/share.cpp,
+ src/util/shared-c-string-ptr.cpp, src/util/shared-c-string-ptr.h,
+ src/util/share.h, src/xml/attribute-record.h, src/xml/comment-node.h,
+ src/xml/composite-node-observer.cpp, src/xml/composite-node-observer.h,
+ src/xml/event.cpp, src/xml/event.h, src/xml/log-builder.cpp,
+ src/xml/log-builder.h, src/xml/node-observer.h, src/xml/repr.cpp,
+ src/xml/repr-io.cpp, src/xml/simple-node.cpp, src/xml/simple-node.h,
+ src/xml/simple-session.cpp, src/xml/simple-session.h,
+ src/xml/text-node.h:
+
+ replace Util::SharedCStringPtr with the nicer and more general
+ Util::shared_ptr<>
+
2006-02-03 Jon Phillips <jon@rejon.org>
* src/verbs.cpp: Added "..." to "Trace Bitmap" text. Yes, what a
diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py
index c73d0dad0..a23949ee8 100755
--- a/share/extensions/dxf_outlines.py
+++ b/share/extensions/dxf_outlines.py
@@ -16,47 +16,54 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkex, cubicsuperpath
+import inkex, simplepath, cubicsuperpath
class MyEffect(inkex.Effect):
- def __init__(self):
- inkex.Effect.__init__(self)
- self.dxf = ''
- def output(self):
- print self.dxf
- def dxf_add(self, str):
- self.dxf += str
- def dxf_line(self,csp):
- line = "\n0\nLINE\n8\n2\n62\n4\n10\n%f\n20\n%f\n30\n0\n11\n%f\n21\n%f\n31\n0" % (csp[0][0],csp[0][1],csp[1][0],csp[1][1])
- self.dxf_add(line)
- def dxf_spline(self,csp):
- knots = 8
- ctrls = 4
- self.dxf_add("\n 0\nSPLINE\n 5\n43\n 8\n0\n 62\n256\n370\n-1\n 6\nByLayer")
- self.dxf_add("\n100\nAcDbEntity\n100\nAcDbSpline\n 70\n8\n 71\n3\n 72\n%d\n 73\n%d\n 74\n0" % (knots, ctrls))
- for i in range(2):
- for j in range(4):
- self.dxf_add("\n 40\n%d" % i)
- for i in csp:
- self.dxf_add("\n 10\n%f\n 20\n%f\n 30\n0" % (i[0],i[1]))
- def effect(self):
- #References: Minimum Requirements for Creating a DXF File of a 3D Model By Paul Bourke
- # NURB Curves: A Guide for the Uninitiated By Philip J. Schneider
- self.dxf_add("999\nDXF created by Inkscape\n0\nSECTION\n2\nENTITIES")
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.dxf = ''
+ def output(self):
+ print self.dxf
+ def dxf_add(self, str):
+ self.dxf += str
+ def dxf_line(self,csp):
+ line = "\n0\nLINE\n8\n2\n62\n4\n10\n%f\n20\n%f\n30\n0\n11\n%f\n21\n%f\n31\n0" % (csp[0][0],csp[0][1],csp[1][0],csp[1][1])
+ self.dxf_add(line)
+ def dxf_spline(self,csp):
+ knots = 8
+ ctrls = 4
+ self.dxf_add("\n 0\nSPLINE\n 5\n43\n 8\n0\n 62\n256\n370\n-1\n 6\nByLayer")
+ self.dxf_add("\n100\nAcDbEntity\n100\nAcDbSpline\n 70\n8\n 71\n3\n 72\n%d\n 73\n%d\n 74\n0" % (knots, ctrls))
+ for i in range(2):
+ for j in range(4):
+ self.dxf_add("\n 40\n%d" % i)
+ for i in csp:
+ self.dxf_add("\n 10\n%f\n 20\n%f\n 30\n0" % (i[0],i[1]))
+ def effect(self):
+ #References: Minimum Requirements for Creating a DXF File of a 3D Model By Paul Bourke
+ # NURB Curves: A Guide for the Uninitiated By Philip J. Schneider
+ self.dxf_add("999\nDXF created by Inkscape\n0\nSECTION\n2\nENTITIES")
+
+ scale = 5.0/18.0
+ h = float(inkex.xml.xpath.Evaluate('/svg/@height',self.document)[0].value)
+
+ path = '//path'
+ for node in inkex.xml.xpath.Evaluate(path,self.document):
+ d = node.attributes.getNamedItem('d').value
+ sim = simplepath.parsePath(d)
+ simplepath.scalePath(sim,scale,-scale)
+ simplepath.translatePath(sim,0,h*scale)
+ p = cubicsuperpath.CubicSuperPath(sim)
+ for sub in p:
+ for i in range(len(sub)-1):
+ s = sub[i]
+ e = sub[i+1]
+ if s[1] == s[2] and e[0] == e[1]:
+ self.dxf_line([s[1],e[1]])
+ else:
+ self.dxf_spline([s[1],s[2],e[0],e[1]])
+ self.dxf_add("\n0\nENDSEC\n0\nEOF\n")
- path = '//path'
- for node in inkex.xml.xpath.Evaluate(path,self.document):
- p = cubicsuperpath.parsePath(node.attributes.getNamedItem('d').value)
- for sub in p:
- for i in range(len(sub)-1):
- s = sub[i]
- e = sub[i+1]
- if s[1] == s[2] and e[0] == e[1]:
- self.dxf_line([s[1],e[1]])
- else:
- self.dxf_spline([s[1],s[2],e[0],e[1]])
- self.dxf_add("\n0\nENDSEC\n0\nEOF\n")
-
e = MyEffect()
e.affect()
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index b6249248b..bdcc6cf3f 100755
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -87,11 +87,11 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i
{
for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; glyph_index++) {
if (_characters[_glyphs[glyph_index].in_character].in_glyph == -1) continue;
- if (start != -1 && _glyphs[glyph_index].in_character < start) continue;
+ if (start != -1 && (int) _glyphs[glyph_index].in_character < start) continue;
if (length != -1) {
if (start == -1)
start = 0;
- if (_glyphs[glyph_index].in_character > start + length) continue;
+ if ((int) _glyphs[glyph_index].in_character > start + length) continue;
}
// this could be faster
NRMatrix glyph_matrix;
diff --git a/src/removeoverlap/constraint.h b/src/removeoverlap/constraint.h
index 683d66da3..c8273376b 100644
--- a/src/removeoverlap/constraint.h
+++ b/src/removeoverlap/constraint.h
@@ -37,11 +37,11 @@ static inline bool compareConstraints(Constraint *const &l, Constraint *const &r
double const sl =
l->left->block->timeStamp > l->timeStamp
||l->left->block==l->right->block
- ?DBL_MIN:l->slack();
+ ?-DBL_MAX:l->slack();
double const sr =
r->left->block->timeStamp > r->timeStamp
||r->left->block==r->right->block
- ?DBL_MIN:r->slack();
+ ?-DBL_MAX:r->slack();
if(sl==sr) {
// arbitrary choice based on id
if(l->left->id==r->left->id) {
diff --git a/src/removeoverlap/generate-constraints.cpp b/src/removeoverlap/generate-constraints.cpp
index efa477449..a8bfe28e7 100644
--- a/src/removeoverlap/generate-constraints.cpp
+++ b/src/removeoverlap/generate-constraints.cpp
@@ -140,7 +140,7 @@ Event **events;
int compare_events(const void *a, const void *b) {
Event *ea=*(Event**)a;
Event *eb=*(Event**)b;
- if(ea->v->r==ea->v->r) {
+ if(ea->v->r==eb->v->r) {
// when comparing opening and closing from the same rect
// open must come first
if(ea->type==Open) return -1;
diff --git a/src/removeoverlap/remove_rectangle_overlap.cpp b/src/removeoverlap/remove_rectangle_overlap.cpp
index 34cedf481..9f98d5811 100755
--- a/src/removeoverlap/remove_rectangle_overlap.cpp
+++ b/src/removeoverlap/remove_rectangle_overlap.cpp
@@ -6,7 +6,7 @@
#include "constraint.h"
#ifdef RECTANGLE_OVERLAP_LOGGING
#include <fstream>
-#include <blocks.h>
+#include "blocks.h"
using std::ios;
using std::ofstream;
using std::endl;
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 6be423125..f07783dbe 100644
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
@@ -198,13 +198,13 @@ sp_tspan_modified(SPObject *object, unsigned flags)
static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags)
{
+ // find out the ancestor text which holds our layout
SPObject *parent_text = SP_OBJECT(item);
for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text));
if (parent_text == NULL) return;
- Inkscape::Text::Layout layout = SP_TEXT(parent_text)->layout;
-
- SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item) - 1, sp_text_get_length(item));
+ // get the bbox of our portion of the layout
+ SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item), sp_text_get_length_upto(item, NULL) - 1);
// Add stroke width
SPStyle* style=SP_OBJECT_STYLE (item);
diff --git a/src/style.cpp b/src/style.cpp
index 5fe837fe7..e0a1dcc7d 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -390,6 +390,7 @@ sp_style_new()
style->cloned = false;
style->hreffed = false;
+ style->listening = false;
return style;
}
diff --git a/src/style.h b/src/style.h
index ba1900bde..333344ad9 100644
--- a/src/style.h
+++ b/src/style.h
@@ -323,6 +323,8 @@ struct SPStyle {
bool cloned;
/// style has hreffed its paintservers, needs to release
bool hreffed;
+ /// style is listening to changes in paintservers, need to disconnect
+ bool listening;
};
SPStyle *sp_style_new();
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index d5a53fc49..f0cb4bd9d 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -183,23 +183,36 @@ unsigned sp_text_get_length(SPObject const *item)
}
/** Recursively gets the length of all the SPStrings at or below the given
-\a item. Also adds 1 for each line break encountered. */
+\a item, before and not including \a upto. Also adds 1 for each line break encountered. */
unsigned sp_text_get_length_upto(SPObject const *item, SPObject const *upto)
{
unsigned length = 0;
- if (SP_IS_STRING(item)) return SP_STRING(item)->string.length();
- if (is_line_break_object(item)) length++;
+ if (SP_IS_STRING(item)) {
+ return SP_STRING(item)->string.length();
+ }
+ if (is_line_break_object(item) && !SP_IS_TEXT(item)) {
+ if (item != SP_OBJECT_PARENT(item)->firstChild()) {
+ // add 1 for each newline
+ length++;
+ }
+ }
for (SPObject const *child = item->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
- if (child == upto)
+ if (upto && child == upto) {
+ // hit upto, return immediately
return length;
- if (SP_IS_STRING(child)) length += SP_STRING(child)->string.length();
+ }
+ if (SP_IS_STRING(child)) {
+ length += SP_STRING(child)->string.length();
+ }
else {
- if (child->isAncestorOf(upto)) {
- length += sp_text_get_length(child);
+ if (upto && child->isAncestorOf(upto)) {
+ // upto is below us, recurse and break loop
+ length += sp_text_get_length_upto(child, upto);
return length;
} else {
- length += sp_text_get_length(child);
+ // recurse and go to the next sibling
+ length += sp_text_get_length_upto(child, upto);
}
}
}