diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 6af2f7169eaf3c9eb34ed451470c0d9ee4fa0aa1..b01146d60a3797408a608e4f7f058e717e0aa9fc 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
#include "sp-rect.h"
#include "text-tag-attributes.h"
#include "text-chemistry.h"
-
+#include "text-editing.h"
#include "livarot/Shape.h"
static void sp_flowtext_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static void sp_flowtext_print(SPItem *item, SPPrintContext *ctx);
static gchar *sp_flowtext_description(SPItem *item);
+static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
static NRArenaItem *sp_flowtext_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags);
static void sp_flowtext_hide(SPItem *item, unsigned key);
item_class->bbox = sp_flowtext_bbox;
item_class->print = sp_flowtext_print;
item_class->description = sp_flowtext_description;
+ item_class->snappoints = sp_flowtext_snappoints;
item_class->show = sp_flowtext_show;
item_class->hide = sp_flowtext_hide;
}
{
Inkscape::Text::Layout const &layout = SP_FLOWTEXT(item)->layout;
int const nChars = layout.iteratorToCharIndex(layout.end());
- if (SP_FLOWTEXT(item)->has_internal_frame())
- return g_strdup_printf(ngettext("<b>Flowed text</b> (%d character)", "<b>Flowed text</b> (%d characters)", nChars), nChars);
- else
- return g_strdup_printf(ngettext("<b>Linked flowed text</b> (%d character)", "<b>Linked flowed text</b> (%d characters)", nChars), nChars);
+
+ char const *trunc = (layout.inputTruncated()) ? _(" [truncated]") : "";
+
+ if (SP_FLOWTEXT(item)->has_internal_frame()) {
+ return g_strdup_printf(ngettext("<b>Flowed text</b> (%d character%s)", "<b>Flowed text</b> (%d characters%s)", nChars), nChars, trunc);
+ } else {
+ return g_strdup_printf(ngettext("<b>Linked flowed text</b> (%d character%s)", "<b>Linked flowed text</b> (%d characters%s)", nChars), nChars, trunc);
+ }
+}
+
+static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const */*snapprefs*/)
+{
+ // Choose a point on the baseline for snapping from or to, with the horizontal position
+ // of this point depending on the text alignment (left vs. right)
+ Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
+ if (layout != NULL && layout->outputExists()) {
+ boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
+ if (pt) {
+ p.push_back(Inkscape::SnapCandidatePoint((*pt) * sp_item_i2d_affine(item), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE));
+ }
+ }
}
static NRArenaItem *