summaryrefslogtreecommitdiffstats
path: root/src/text-editing.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2010-05-14 20:13:53 +0000
committertavmjong-free <tavmjong@free.fr>2010-05-14 20:13:53 +0000
commitf1b28615cb0ce50d3e0d9ba841d700a2905fdbec (patch)
tree9f79944a2155574686f05d1dd59042cf1b42e35b /src/text-editing.cpp
parentTranslations. Belarusian translation by Hleb Valoshka. (diff)
downloadinkscape-f1b28615cb0ce50d3e0d9ba841d700a2905fdbec.tar.gz
inkscape-f1b28615cb0ce50d3e0d9ba841d700a2905fdbec.zip
Add dx (kerning), dy (vertical shifting), and rotate widgets to
text toolbar along with routines needed by them. (bzr r9417)
Diffstat (limited to 'src/text-editing.cpp')
-rw-r--r--src/text-editing.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index e93ebdffa..372f5026d 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -928,7 +928,7 @@ sp_te_set_repr_text_multiline(SPItem *text, gchar const *str)
/** Returns the attributes block and the character index within that block
which represents the iterator \a position. */
-static TextTagAttributes*
+TextTagAttributes*
text_tag_attributes_at_position(SPItem *item, Inkscape::Text::Layout::iterator const &position, unsigned *char_index)
{
if (item == NULL || char_index == NULL || !SP_IS_TEXT(item))
@@ -973,6 +973,36 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons
}
void
+sp_te_adjust_dx (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta)
+{
+ unsigned char_index;
+ TextTagAttributes *attributes = text_tag_attributes_at_position(item, std::min(start, end), &char_index);
+ if (attributes) attributes->addToDx(char_index, delta);
+ if (start != end) {
+ attributes = text_tag_attributes_at_position(item, std::max(start, end), &char_index);
+ if (attributes) attributes->addToDx(char_index, -delta);
+ }
+
+ item->updateRepr();
+ item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+}
+
+void
+sp_te_adjust_dy (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta)
+{
+ unsigned char_index;
+ TextTagAttributes *attributes = text_tag_attributes_at_position(item, std::min(start, end), &char_index);
+ if (attributes) attributes->addToDy(char_index, delta);
+ if (start != end) {
+ attributes = text_tag_attributes_at_position(item, std::max(start, end), &char_index);
+ if (attributes) attributes->addToDy(char_index, -delta);
+ }
+
+ item->updateRepr();
+ item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+}
+
+void
sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble pixels)
{
// divide increment by zoom
@@ -1012,6 +1042,25 @@ sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &star
}
void
+sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop */*desktop*/, gdouble degrees)
+{
+ unsigned char_index;
+ TextTagAttributes *attributes = text_tag_attributes_at_position(text, std::min(start, end), &char_index);
+ if (attributes == NULL) return;
+
+ if (start != end) {
+ for (Inkscape::Text::Layout::iterator it = std::min(start, end) ; it != std::max(start, end) ; it.nextCharacter()) {
+ attributes = text_tag_attributes_at_position(text, it, &char_index);
+ if (attributes) attributes->setRotate(char_index, degrees);
+ }
+ } else
+ attributes->setRotate(char_index, degrees);
+
+ text->updateRepr();
+ text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+}
+
+void
sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble by)
{
g_return_if_fail (text != NULL);