diff options
| author | bulia byak <buliabyak@gmail.com> | 2009-02-16 00:23:40 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2009-02-16 00:23:40 +0000 |
| commit | 466bbb68dc798353d847ba60aaaf2ae8c2ba3254 (patch) | |
| tree | cd1ab2cb160d41dda0765b7400eff2ba1b2d2eb8 /src/text-editing.cpp | |
| parent | Fix build failure on reconfigure (diff) | |
| download | inkscape-466bbb68dc798353d847ba60aaaf2ae8c2ba3254.tar.gz inkscape-466bbb68dc798353d847ba60aaaf2ae8c2ba3254.zip | |
utilities for getting style at cursor, placing cursor at iterator or coordinates, getting cursor iterator; display char count when editing in text tool
(bzr r7299)
Diffstat (limited to 'src/text-editing.cpp')
| -rw-r--r-- | src/text-editing.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 2ccc91195..5b9db13d4 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -110,6 +110,14 @@ sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator co SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position) { + SPObject const *pos_obj = sp_te_object_at_position(text, position); + if (pos_obj) + return SP_OBJECT_STYLE(pos_obj); + return NULL; +} + +SPObject const * sp_te_object_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position) +{ Inkscape::Text::Layout const *layout = te_get_layout(text); if (layout == NULL) return NULL; @@ -119,8 +127,8 @@ SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layo pos_obj = SP_OBJECT(rawptr); if (pos_obj == 0) pos_obj = text; while (SP_OBJECT_STYLE(pos_obj) == NULL) - pos_obj = SP_OBJECT_PARENT(pos_obj); // SPStrings don't have style - return SP_OBJECT_STYLE(pos_obj); + pos_obj = SP_OBJECT_PARENT(pos_obj); // not interested in SPStrings + return pos_obj; } /* |
