Code

r10887@tres: ted | 2006-02-05 23:16:41 -0800
authorgouldtj <gouldtj@users.sourceforge.net>
Mon, 6 Feb 2006 07:17:33 +0000 (07:17 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Mon, 6 Feb 2006 07:17:33 +0000 (07:17 +0000)
 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.

ChangeLog
share/extensions/dxf_outlines.py
src/libnrtype/Layout-TNG-Output.cpp
src/removeoverlap/constraint.h
src/removeoverlap/generate-constraints.cpp
src/removeoverlap/remove_rectangle_overlap.cpp
src/sp-tspan.cpp
src/style.cpp
src/style.h
src/text-editing.cpp

index 5e8c4a8377fd442fb813f8cc9885bf14eea60d99..4f83279310b88fae57fa0fcae7a8fb5644b81256 100644 (file)
--- 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
index c73d0dad0f76ea5129ae2f1971d68902f01ed711..a23949ee8f5cb01910c651d7897d7379286ed6e4 100755 (executable)
@@ -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")\r
+        \r
+        scale = 5.0/18.0
+        h = float(inkex.xml.xpath.Evaluate('/svg/@height',self.document)[0].value)\r
+
+        path = '//path'
+        for node in inkex.xml.xpath.Evaluate(path,self.document):\r
+            d = node.attributes.getNamedItem('d').value\r
+            sim = simplepath.parsePath(d)\r
+            simplepath.scalePath(sim,scale,-scale)\r
+            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()
index b6249248bc90775c4ec7ce154870a77f15f94e77..bdcc6cf3f099982e83a09967a86fbb8d5b531d4f 100755 (executable)
@@ -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;
index 683d66da3425a8345d9c666cd0a63e2f4f48ee73..c8273376b9fa2aae0ee66ad5831b735cefe5ee5b 100644 (file)
@@ -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) {
index efa4774499310d40ed752c09542611e7c021e661..a8bfe28e7eaa20ef6ce8b462a9587bdf91aa7067 100644 (file)
@@ -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;
index 34cedf48163ad2849fde0c4442e40dd510cd8934..9f98d5811cf98c63edf41eac0aee00fcf1ebf8c5 100755 (executable)
@@ -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;
index 6be42312516e2ec64c5fa4bb696040775091df7b..f07783dbefe7db75ce65c4ac636f4d57d616c39d 100644 (file)
@@ -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);
index 5fe837fe75801530d92fcc598a70af382aebfd5d..e0a1dcc7d2bdaad8a62f85d9c88e61c3baae2c5c 100644 (file)
@@ -390,6 +390,7 @@ sp_style_new()
 
     style->cloned = false;
     style->hreffed = false;
+    style->listening = false;
 
     return style;
 }
index ba1900bde8265103285729d3dcdaa61bdc4ef5bb..333344ad9b2fd280b21d645cc1b8805d56022a38 100644 (file)
@@ -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();
index d5a53fc49c5b88482bc050af680a9ee1100094d7..f0cb4bd9da12967f29a32a30863485bc1154a367 100644 (file)
@@ -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);
             }
         }
     }