Code

(no commit message)
authorgouldtj <gouldtj@users.sourceforge.net>
Mon, 6 Feb 2006 05:38:08 +0000 (05:38 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Mon, 6 Feb 2006 05:38:08 +0000 (05:38 +0000)
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 4f83279310b88fae57fa0fcae7a8fb5644b81256..5e8c4a8377fd442fb813f8cc9885bf14eea60d99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,3 @@
-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 a23949ee8f5cb01910c651d7897d7379286ed6e4..c73d0dad0f76ea5129ae2f1971d68902f01ed711 100755 (executable)
@@ -16,54 +16,47 @@ 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, simplepath, cubicsuperpath
+import inkex, 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")\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")
+        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")
 
+               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 bdcc6cf3f099982e83a09967a86fbb8d5b531d4f..b6249248bc90775c4ec7ce154870a77f15f94e77 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 && (int) _glyphs[glyph_index].in_character < start) continue;
+        if (start != -1 && _glyphs[glyph_index].in_character < start) continue;
         if (length != -1) {
             if (start == -1)
                 start = 0;
-            if ((int) _glyphs[glyph_index].in_character > start + length) continue;
+            if (_glyphs[glyph_index].in_character > start + length) continue;
         }
         // this could be faster
         NRMatrix glyph_matrix;
index c8273376b9fa2aae0ee66ad5831b735cefe5ee5b..683d66da3425a8345d9c666cd0a63e2f4f48ee73 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_MAX:l->slack();
+               ?DBL_MIN:l->slack();
        double const sr = 
                r->left->block->timeStamp > r->timeStamp
                ||r->left->block==r->right->block
-               ?-DBL_MAX:r->slack();
+               ?DBL_MIN:r->slack();
        if(sl==sr) {
                // arbitrary choice based on id
                if(l->left->id==r->left->id) {
index a8bfe28e7eaa20ef6ce8b462a9587bdf91aa7067..efa4774499310d40ed752c09542611e7c021e661 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==eb->v->r) {
+       if(ea->v->r==ea->v->r) {
                // when comparing opening and closing from the same rect
                // open must come first
                if(ea->type==Open) return -1;
index 9f98d5811cf98c63edf41eac0aee00fcf1ebf8c5..34cedf48163ad2849fde0c4442e40dd510cd8934 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 f07783dbefe7db75ce65c4ac636f4d57d616c39d..6be42312516e2ec64c5fa4bb696040775091df7b 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;
 
-    // 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);
+    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));
 
     // Add stroke width
     SPStyle* style=SP_OBJECT_STYLE (item);
index e0a1dcc7d2bdaad8a62f85d9c88e61c3baae2c5c..5fe837fe75801530d92fcc598a70af382aebfd5d 100644 (file)
@@ -390,7 +390,6 @@ sp_style_new()
 
     style->cloned = false;
     style->hreffed = false;
-    style->listening = false;
 
     return style;
 }
index 333344ad9b2fd280b21d645cc1b8805d56022a38..ba1900bde8265103285729d3dcdaa61bdc4ef5bb 100644 (file)
@@ -323,8 +323,6 @@ 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 f0cb4bd9da12967f29a32a30863485bc1154a367..d5a53fc49c5b88482bc050af680a9ee1100094d7 100644 (file)
@@ -183,36 +183,23 @@ unsigned sp_text_get_length(SPObject const *item)
 }
 
 /** Recursively gets the length of all the SPStrings at or below the given
-\a item, before and not including \a upto. Also adds 1 for each line break encountered. */
+\a item. 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) && !SP_IS_TEXT(item)) {
-        if (item != SP_OBJECT_PARENT(item)->firstChild()) {
-            // add 1 for each newline
-            length++;
-        }
-    }
+    if (SP_IS_STRING(item)) return SP_STRING(item)->string.length();
+    if (is_line_break_object(item)) length++;
     for (SPObject const *child = item->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
-        if (upto && child == upto) {
-            // hit upto, return immediately
+        if (child == upto) 
             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 (upto && child->isAncestorOf(upto)) {
-                // upto is below us, recurse and break loop
-                length += sp_text_get_length_upto(child, upto);
+            if (child->isAncestorOf(upto)) {
+                length += sp_text_get_length(child);
                 return length;
             } else {
-                // recurse and go to the next sibling
-                length += sp_text_get_length_upto(child, upto);
+                length += sp_text_get_length(child);
             }
         }
     }