diff options
| author | Ted Gould <ted@gould.cx> | 2006-02-06 05:38:08 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-02-06 05:38:08 +0000 |
| commit | 1d97567299259f4ceaea8ff51de359dc74b49578 (patch) | |
| tree | 5d4da9bec137ed8edc1e1e25faa068645a3c67a5 /src | |
| parent | DBL_MIN replaced by -DBL_MAX which is what I meant all along. (diff) | |
| download | inkscape-1d97567299259f4ceaea8ff51de359dc74b49578.tar.gz inkscape-1d97567299259f4ceaea8ff51de359dc74b49578.zip | |
(bzr r90)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/libnrtype/Layout-TNG-Output.cpp | 4 | ||||
| -rw-r--r-- | src/removeoverlap/constraint.h | 4 | ||||
| -rw-r--r-- | src/removeoverlap/generate-constraints.cpp | 2 | ||||
| -rwxr-xr-x | src/removeoverlap/remove_rectangle_overlap.cpp | 2 | ||||
| -rw-r--r-- | src/sp-tspan.cpp | 6 | ||||
| -rw-r--r-- | src/style.cpp | 1 | ||||
| -rw-r--r-- | src/style.h | 2 | ||||
| -rw-r--r-- | src/text-editing.cpp | 29 |
8 files changed, 17 insertions, 33 deletions
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index bdcc6cf3f..b6249248b 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 && (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; diff --git a/src/removeoverlap/constraint.h b/src/removeoverlap/constraint.h index c8273376b..683d66da3 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_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) { diff --git a/src/removeoverlap/generate-constraints.cpp b/src/removeoverlap/generate-constraints.cpp index a8bfe28e7..efa477449 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==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; diff --git a/src/removeoverlap/remove_rectangle_overlap.cpp b/src/removeoverlap/remove_rectangle_overlap.cpp index 9f98d5811..34cedf481 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 f07783dbe..6be423125 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; - // 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); diff --git a/src/style.cpp b/src/style.cpp index e0a1dcc7d..5fe837fe7 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -390,7 +390,6 @@ 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 333344ad9..ba1900bde 100644 --- a/src/style.h +++ b/src/style.h @@ -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(); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index f0cb4bd9d..d5a53fc49 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -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); } } } |
